]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Cast calculation of safe length to unsigned int to avoid compiler warnings.
authorMika Lindqvist <postmaster@raasu.org>
Mon, 21 Jun 2021 06:07:59 +0000 (09:07 +0300)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 21 Jun 2021 15:45:45 +0000 (17:45 +0200)
chunkset_tpl.h
inffast.c
win32/Makefile.msc

index 256475a641a29fa010eb08131e940ae09ca59a65..ff760fcf691ff2fde855003c5ef03ba9b58f5b50 100644 (file)
@@ -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);
index c431e50fc157efcdedbf9f0c3afeccd03678c73b..136b98d5a660c627dd341f04dc8903c984cb2767 100644 (file)
--- 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,
index ee6f857d76e2fc279310ae189ee0cab7f678f536..b7166616b3b1b1eb29404f92e4ce3090d06a631e 100644 (file)
@@ -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