From: Nathan Moinvaziri Date: Fri, 2 Oct 2020 05:53:50 +0000 (-0700) Subject: Fixed conversion warning when calling zng_tr_tally_dist. Signature for dist and len... X-Git-Tag: v2.0.0-RC1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=778d65f3b31509cf92d86458dda2eee83c4bf19e;p=thirdparty%2Fzlib-ng.git Fixed conversion warning when calling zng_tr_tally_dist. Signature for dist and len now match zng_emit_dist. deflate.c(1575,67): warning C4244: 'function': conversion from 'uint32_t' to 'unsigned char', possible loss of data deflate_fast.c(60,94): warning C4244: 'function': conversion from 'uint32_t' to 'unsigned char', possible loss of data deflate_medium.c(39,102): warning C4244: 'function': conversion from 'int' to 'unsigned char', possible loss of data deflate_slow.c(75,101): warning C4244: 'function': conversion from 'unsigned int' to 'unsigned char', possible loss of data --- diff --git a/deflate_p.h b/deflate_p.h index 4c400035..9cec34dc 100644 --- a/deflate_p.h +++ b/deflate_p.h @@ -37,12 +37,12 @@ static inline int zng_tr_tally_lit(deflate_state *s, unsigned char c) { return (s->sym_next == s->sym_end); } -static inline int zng_tr_tally_dist(deflate_state *s, unsigned dist, unsigned char len) { +static inline int zng_tr_tally_dist(deflate_state *s, uint32_t dist, uint32_t len) { /* dist: distance of matched string */ /* len: match length-MIN_MATCH */ s->sym_buf[s->sym_next++] = (uint8_t)(dist); s->sym_buf[s->sym_next++] = (uint8_t)(dist >> 8); - s->sym_buf[s->sym_next++] = len; + s->sym_buf[s->sym_next++] = (uint8_t)len; s->matches++; dist--; Assert((uint16_t)dist < (uint16_t)MAX_DIST(s) &&