Add casts in gzwrite.c for pointer differences.

This commit is contained in:
Mark Adler 2013-04-13 18:04:06 -07:00
parent 9b703f2000
commit 70252daf89
2 changed files with 4 additions and 3 deletions

View File

@ -142,7 +142,8 @@
# define DEF_MEM_LEVEL MAX_MEM_LEVEL # define DEF_MEM_LEVEL MAX_MEM_LEVEL
#endif #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 #define GZBUFSIZE 8192
/* gzip modes, also provide a little integrity check on the passed structure */ /* gzip modes, also provide a little integrity check on the passed structure */

View File

@ -211,7 +211,7 @@ int ZEXPORT gzwrite(file, buf, len)
if (strm->avail_in == 0) if (strm->avail_in == 0)
strm->next_in = state->in; 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; copy = state->size - have;
if (copy > len) if (copy > len)
copy = len; copy = len;
@ -273,7 +273,7 @@ int ZEXPORT gzputc(file, c)
if (state->size) { if (state->size) {
if (strm->avail_in == 0) if (strm->avail_in == 0)
strm->next_in = state->in; 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) { if (have < state->size) {
state->in[have] = c; state->in[have] = c;
strm->avail_in++; strm->avail_in++;