From: Mark Adler Date: Sun, 14 Apr 2013 01:04:06 +0000 (-0700) Subject: Add casts in gzwrite.c for pointer differences. X-Git-Tag: v1.2.7.2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70252daf893a5e181d8b6eb7da6cec9fab044ecc;p=thirdparty%2Fzlib-ng.git Add casts in gzwrite.c for pointer differences. --- diff --git a/gzguts.h b/gzguts.h index c22814df7..d87659d03 100644 --- a/gzguts.h +++ b/gzguts.h @@ -142,7 +142,8 @@ # 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 */ diff --git a/gzwrite.c b/gzwrite.c index 3729a29cc..aa767fbf6 100644 --- 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++;