From: Nathan Moinvaziri Date: Fri, 2 Oct 2020 05:57:38 +0000 (-0700) Subject: Fixed casting warnings when comparing MAX_DIST. X-Git-Tag: v2.0.0-RC1~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a659d7f071bcb05117cf01148def547cbfd21b9c;p=thirdparty%2Fzlib-ng.git Fixed casting warnings when comparing MAX_DIST. deflate_medium.c(127,76): warning C4244: '=': conversion from 'unsigned int' to 'Pos', possible loss of data --- diff --git a/deflate_medium.c b/deflate_medium.c index 8335942a..dad550cd 100644 --- a/deflate_medium.c +++ b/deflate_medium.c @@ -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; diff --git a/deflate_p.h b/deflate_p.h index 9cec34dc..102a4de0 100644 --- a/deflate_p.h +++ b/deflate_p.h @@ -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++;