Skip to content

Commit

Permalink
Add casts in gzwrite.c for pointer differences.
Browse files Browse the repository at this point in the history
  • Loading branch information
madler committed Apr 14, 2013
1 parent 9b703f2 commit 70252da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion gzguts.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions gzwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++;
Expand Down

0 comments on commit 70252da

Please sign in to comment.