From: Mika Lindqvist Date: Mon, 21 Jun 2021 06:07:59 +0000 (+0300) Subject: Cast calculation of safe length to unsigned int to avoid compiler warnings. X-Git-Tag: 2.1.0-beta1~555 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21050e06c511a67f3239d1bca444616be6853bfe;p=thirdparty%2Fzlib-ng.git Cast calculation of safe length to unsigned int to avoid compiler warnings. --- diff --git a/chunkset_tpl.h b/chunkset_tpl.h index 256475a64..ff760fcf6 100644 --- a/chunkset_tpl.h +++ b/chunkset_tpl.h @@ -38,7 +38,8 @@ Z_INTERNAL uint8_t* CHUNKCOPY(uint8_t *out, uint8_t const *from, unsigned len) { /* Behave like chunkcopy, but avoid writing beyond of legal output. */ Z_INTERNAL uint8_t* CHUNKCOPY_SAFE(uint8_t *out, uint8_t const *from, unsigned len, uint8_t *safe) { - len = MIN(len, safe - out + 1); + unsigned safelen = (unsigned)((safe - out) + 1); + len = MIN(len, safelen); #if CHUNK_SIZE >= 32 while (len >= 32) { memcpy(out, from, 32); diff --git a/inffast.c b/inffast.c index c431e50fc..136b98d5a 100644 --- a/inffast.c +++ b/inffast.c @@ -270,7 +270,7 @@ void Z_INTERNAL zng_inflate_fast(PREFIX3(stream) *strm, unsigned long start) { if (dist >= len || dist >= state->chunksize) out = functable.chunkcopy_safe(out, out - dist, len, safe); else - out = functable.chunkmemset_safe(out, dist, len, safe - out + 1); + out = functable.chunkmemset_safe(out, dist, len, (unsigned)((safe - out) + 1)); } else { /* Whole reference is in range of current output. No range checks are necessary because we start with room for at least 258 bytes of output, diff --git a/win32/Makefile.msc b/win32/Makefile.msc index ee6f857d7..b7166616b 100644 --- a/win32/Makefile.msc +++ b/win32/Makefile.msc @@ -114,7 +114,7 @@ $(IMPLIB): $(SHAREDLIB) $(SHAREDLIB): zconf $(TOP)/win32/$(DEFFILE) $(OBJS) $(RESFILE) $(LD) $(LDFLAGS) -def:$(TOP)/win32/$(DEFFILE) -dll -implib:$(IMPLIB) \ - -out:$@ -base:0x5A4C0000 $(OBJS) $(RESFILE) + -out:$@ $(OBJS) $(RESFILE) if exist $@.manifest \ mt -nologo -manifest $@.manifest -outputresource:$@;2