]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed conversion warning when calling zng_tr_tally_dist. Signature for dist and len...
authorNathan Moinvaziri <nathan@nathanm.com>
Fri, 2 Oct 2020 05:53:50 +0000 (22:53 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 2 Nov 2020 16:01:58 +0000 (17:01 +0100)
  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

deflate_p.h

index 4c4000355899731e36c3a3d9f21b66e4d5770db0..9cec34dc3d3b9afe7e648b88e9bf7f10efb0574b 100644 (file)
@@ -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) &&