]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed casting warnings when comparing MAX_DIST.
authorNathan Moinvaziri <nathan@nathanm.com>
Fri, 2 Oct 2020 05:57:38 +0000 (22:57 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 2 Nov 2020 16:01:58 +0000 (17:01 +0100)
  deflate_medium.c(127,76): warning C4244: '=': conversion from 'unsigned int' to 'Pos', possible loss of data

deflate_medium.c
deflate_p.h

index 8335942a3dedac30d921754ef16d1723167e84ec..dad550cd10a598e11c59eb2a4452f4034ce69fd2 100644 (file)
@@ -124,7 +124,7 @@ static void fizzle_matches(deflate_state *s, struct match *current, struct match
     n = *next;
 
     /* step one: try to move the "next" match to the left as much as possible */
-    limit = next->strstart > MAX_DIST(s) ? next->strstart - MAX_DIST(s) : 0;
+    limit = next->strstart > MAX_DIST(s) ? next->strstart - (Pos)MAX_DIST(s) : 0;
 
     match = s->window + n.match_start - 1;
     orig = s->window + n.strstart - 1;
index 9cec34dc3d3b9afe7e648b88e9bf7f10efb0574b..102a4de0665e6af40102fe5b3db42f5919af7adc 100644 (file)
@@ -45,8 +45,8 @@ static inline int zng_tr_tally_dist(deflate_state *s, uint32_t dist, uint32_t le
     s->sym_buf[s->sym_next++] = (uint8_t)len;
     s->matches++;
     dist--;
-    Assert((uint16_t)dist < (uint16_t)MAX_DIST(s) &&
-           (uint16_t)d_code(dist) < (uint16_t)D_CODES,  "zng_tr_tally: bad match");
+    Assert(dist < MAX_DIST(s) && (uint16_t)d_code(dist) < (uint16_t)D_CODES, 
+        "zng_tr_tally: bad match");
 
     s->dyn_ltree[zng_length_code[len]+LITERALS+1].Freq++;
     s->dyn_dtree[d_code(dist)].Freq++;