]> git.lizzy.rs Git - zlib.git/commitdiff
Add casts in gzwrite.c for pointer differences.
authorMark Adler <madler@alumni.caltech.edu>
Sun, 14 Apr 2013 01:04:06 +0000 (18:04 -0700)
committerMark Adler <madler@alumni.caltech.edu>
Sun, 14 Apr 2013 01:04:06 +0000 (18:04 -0700)
gzguts.h
gzwrite.c

index c22814df7b808c4818cdd553df7ca4538aad6bf0..d87659d0319fa36db9f59ea62124bd28207ef9ae 100644 (file)
--- a/gzguts.h
+++ b/gzguts.h
 #  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
 #endif
 
-/* default i/o buffer size -- double this for output when reading */
+/* default i/o buffer size -- double this for output when reading (this and
+   twice this must be able to fit in an unsigned type) */
 #define GZBUFSIZE 8192
 
 /* gzip modes, also provide a little integrity check on the passed structure */
index 3729a29cc086f1131bd08f51490d22735f3642b3..aa767fbf63ec7ddd2f5863d05c03f647303a101f 100644 (file)
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -211,7 +211,7 @@ int ZEXPORT gzwrite(file, buf, len)
 
             if (strm->avail_in == 0)
                 strm->next_in = state->in;
-            have = strm->next_in + strm->avail_in - state->in;
+            have = (unsigned)((strm->next_in + strm->avail_in) - state->in);
             copy = state->size - have;
             if (copy > len)
                 copy = len;
@@ -273,7 +273,7 @@ int ZEXPORT gzputc(file, c)
     if (state->size) {
         if (strm->avail_in == 0)
             strm->next_in = state->in;
-        have = strm->next_in + strm->avail_in - state->in;
+        have = (unsigned)((strm->next_in + strm->avail_in) - state->in);
         if (have < state->size) {
             state->in[have] = c;
             strm->avail_in++;