aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2012-05-19 13:27:43 +0000
committerJakub Zawadzki <darkjames-ws@darkjames.pl>2012-05-19 13:27:43 +0000
commit63d6b6bf2a47e9e9f09374d45240a6803e339af4 (patch)
treea285daf5cf67ce190da1328dd4152dc43e594792
parent7bbbb880689c0749ae3c1e46441ce3fc79584d55 (diff)
Z_BLOCK was added in zlib-1.2.0.5
Pass Z_NO_FLUSH to inflate() when Z_BLOCK is not defined, just in case also disable fast seeking when it's not defined. References: http://www.wireshark.org/lists/wireshark-dev/201205/msg00145.html svn path=/trunk/; revision=42714
-rw-r--r--wiretap/file_wrappers.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c
index 0de09143d2..94840f01bf 100644
--- a/wiretap/file_wrappers.c
+++ b/wiretap/file_wrappers.c
@@ -462,8 +462,11 @@ zlib_read(FILE_T state, unsigned char *buf, unsigned int count)
strm->avail_in = state->avail_in;
strm->next_in = state->next_in;
/* decompress and handle errors */
- /* ret = inflate(strm, Z_NO_FLUSH); */
+#ifdef Z_BLOCK
ret = inflate(strm, Z_BLOCK);
+#else
+ ret = inflate(strm, Z_NO_FLUSH);
+#endif
state->avail_in = strm->avail_in;
state->next_in = strm->next_in;
if (ret == Z_STREAM_ERROR) {
@@ -492,6 +495,7 @@ zlib_read(FILE_T state, unsigned char *buf, unsigned int count)
*/
strm->adler = crc32(strm->adler, buf2, count2 - strm->avail_out);
+#ifdef Z_BLOCK
if (state->fast_seek_cur) {
struct zlib_cur_seek_point *cur = (struct zlib_cur_seek_point *) state->fast_seek_cur;
unsigned int ready = count2 - strm->avail_out;
@@ -524,6 +528,7 @@ zlib_read(FILE_T state, unsigned char *buf, unsigned int count)
if (cur->have >= ZLIB_WINSIZE && ret != Z_STREAM_END && (strm->data_type & 128) && !(strm->data_type & 64))
zlib_fast_seek_add(state, cur, (strm->data_type & 7), state->raw_pos - strm->avail_in, state->pos + (count - strm->avail_out));
}
+#endif
buf2 = (buf2 + count2 - strm->avail_out);
count2 = strm->avail_out;
@@ -646,7 +651,7 @@ gz_head(FILE_T state)
inflateReset(&(state->strm));
state->strm.adler = crc32(0L, Z_NULL, 0);
state->compression = ZLIB;
-
+#ifdef Z_BLOCK
if (state->fast_seek) {
struct zlib_cur_seek_point *cur = g_malloc(sizeof(struct zlib_cur_seek_point));
@@ -655,6 +660,7 @@ gz_head(FILE_T state)
state->fast_seek_cur = cur;
fast_seek_header(state, state->raw_pos - state->avail_in, state->pos, GZIP_AFTER_HEADER);
}
+#endif
return 0;
}
else {