From 70252daf893a5e181d8b6eb7da6cec9fab044ecc Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Sat, 13 Apr 2013 18:04:06 -0700 Subject: [PATCH] Add casts in gzwrite.c for pointer differences. --- gzguts.h | 3 ++- gzwrite.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gzguts.h b/gzguts.h index c22814d..d87659d 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 3729a29..aa767fb 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++;