diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-12-16 08:59:01 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-12-16 08:59:07 +0000 |
commit | 6d60c4d4684c2c03a43f1b8720497348cf17d357 (patch) | |
tree | 31c4eeb27100d4d42d942b85a8178cb167cf91d8 /wiretap/file_wrappers.c | |
parent | bfe73e3ad7162830c222a5b0d73433a72324baa5 (diff) |
Revert "Make zlib API constness-aware"
This reverts commit fb0246c6fd7cd34b820558f75eb48bba6326b768. That commit assumes that if you define Z_CONST, z_const will be defined; that is *not* the case with older versions of zlib, which don't define z_const under any circumstances.
Change-Id: I6f9b7ea18922799b1aaf94dc2c63120128f2550a
Reviewed-on: https://code.wireshark.org/review/12671
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/file_wrappers.c')
-rw-r--r-- | wiretap/file_wrappers.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c index 07daad1d6d..5918a55f6f 100644 --- a/wiretap/file_wrappers.c +++ b/wiretap/file_wrappers.c @@ -48,7 +48,6 @@ #include <wsutil/file_util.h> #ifdef HAVE_LIBZ -#define ZLIB_CONST #include <zlib.h> #endif /* HAVE_LIBZ */ @@ -129,7 +128,7 @@ struct wtap_reader { const char *err_info; /* additional error information string for some errors */ guint avail_in; /* number of bytes available at next_in */ - const guint8 *next_in; /* next input byte */ + unsigned char *next_in; /* next input byte */ #ifdef HAVE_LIBZ /* zlib inflate stream */ z_stream strm; /* stream structure in-place (not a pointer) */ @@ -1673,7 +1672,7 @@ gzwfile_write(GZWFILE_T state, const void *buf, guint len) n = state->size - strm->avail_in; if (n > len) n = len; - memcpy((Bytef *)strm->next_in + strm->avail_in, buf, n); + memcpy(strm->next_in + strm->avail_in, buf, n); strm->avail_in += n; state->pos += n; buf = (const char *)buf + n; @@ -1689,7 +1688,11 @@ gzwfile_write(GZWFILE_T state, const void *buf, guint len) /* directly compress user buffer to file */ strm->avail_in = len; +#if ZLIB_CONST strm->next_in = (z_const Bytef *)buf; +#else + strm->next_in = (Bytef *)buf; +#endif state->pos += len; if (gz_comp(state, Z_NO_FLUSH) == -1) return 0; |