From a659d7f071bcb05117cf01148def547cbfd21b9c Mon Sep 17 00:00:00 2001 From: Nathan Moinvaziri Date: Thu, 1 Oct 2020 22:57:38 -0700 Subject: [PATCH] Fixed casting warnings when comparing MAX_DIST. deflate_medium.c(127,76): warning C4244: '=': conversion from 'unsigned int' to 'Pos', possible loss of data --- deflate_medium.c | 2 +- deflate_p.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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++; -- 2.47.3