Hi,

On Tue, Apr 12, 2011 at 08:06:19AM +0200, Anders Broman wrote:
> The problem is that inflatePrime is missing from zlib.def, we should 
> probably build with zlib 1.2.5

Or test if we have inflatePrime in zlib,
patch for configure.in, don't know how to the same for Windows.
diff --git configure.in configure.in
index 1da5ce6..0dbcc03 100644
--- configure.in
+++ configure.in
@@ -1199,9 +1199,9 @@ else
 fi
 
 if test "x$want_zlib" != "xno" ; then
-       AC_CHECK_LIB(z, gzclearerr,
+       AC_CHECK_LIB(z, inflatePrime,
        [
-               AC_DEFINE(HAVE_GZCLEARERR, 1, [Define if we have gzclearerr])
+               AC_DEFINE(HAVE_INFLATEPRIME, 1, [Define if we have 
inflatePrime])
        ])
 fi
 
diff --git wiretap/file_wrappers.c wiretap/file_wrappers.c
index 633204a..b319192 100644
--- wiretap/file_wrappers.c
+++ wiretap/file_wrappers.c
@@ -155,7 +155,9 @@ struct fast_seek_point {
        int compression;
        union {
                struct {
+#ifdef HAVE_INFLATEPRIME
                        int bits;               /* number of bits (1-7) from 
byte at in - 1, or 0 */
+#endif
                        unsigned char window[ZLIB_WINSIZE];     /* preceding 
32K of uncompressed data */
 
                        /* be gentle with Z_STREAM_END, 8 bytes more... Another 
solution would be to comment checks out */
@@ -260,6 +262,11 @@ zlib_fast_seek_add(FILE_T file, struct zlib_cur_seek_point 
*point, int bits, gin
        /* it's for sure after gzip header, so file->fast_seek->len != 0 */
        struct fast_seek_point *item = 
file->fast_seek->pdata[file->fast_seek->len - 1];;
 
+#ifndef HAVE_INFLATEPRIME
+       if (bits)
+               return;
+#endif
+
        /* Glib has got Balanced Binary Trees (GTree) but I couldn't find a way 
to do quick search for nearest (and smaller) value to seek (It's what 
fast_seek_find() do)
         *      Inserting value in middle of sorted array is expensive, so we 
want to add only in the end.
         *      It's not big deal, cause first-read don't usually invoke seeking
@@ -269,8 +276,9 @@ zlib_fast_seek_add(FILE_T file, struct zlib_cur_seek_point 
*point, int bits, gin
                val->in = in_pos;
                val->out = out_pos;
                val->compression = ZLIB;
-
+#ifdef HAVE_INFLATEPRIME
                val->data.zlib.bits = bits;
+#endif
                if (point->pos != 0) {
                        unsigned int left = ZLIB_WINSIZE - point->pos;
 
@@ -688,7 +696,11 @@ file_seek(FILE_T file, gint64 offset, int whence, int *err)
 
 #ifdef HAVE_LIBZ
                if (here->compression == ZLIB) {
+#ifdef HAVE_INFLATEPRIME
                        off = here->in - (here->data.zlib.bits ? 1 : 0);
+#else
+                       off = here->in;
+#endif
                        off2 = here->out;
                } else if (here->compression == GZIP_AFTER_HEADER) {
                        off = here->in;
@@ -716,21 +728,22 @@ file_seek(FILE_T file, gint64 offset, int whence, int 
*err)
 #ifdef HAVE_LIBZ
                if (here->compression == ZLIB) {
                        z_stream *strm = &file->strm;
-                       FILE_T state = file;
 
                        inflateReset(strm);
                        strm->adler = here->data.zlib.adler;
                        strm->total_out = here->data.zlib.total_out;
+#ifdef HAVE_INFLATEPRIME
                        if (here->data.zlib.bits) {
+                               FILE_T state = file;
                                int ret = NEXT();
 
                                if (ret == -1) {
                                        /* *err = ???; */
                                        return -1;
                                }
-
                                (void)inflatePrime(strm, here->data.zlib.bits, 
ret >> (8 - here->data.zlib.bits));
                        }
+#endif
                        (void)inflateSetDictionary(strm, 
here->data.zlib.window, ZLIB_WINSIZE);
                        file->compression = ZLIB;
                } else if (here->compression == GZIP_AFTER_HEADER) {
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe

Reply via email to