aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2002-02-06 09:58:30 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2002-02-06 09:58:30 +0000
commitf11409eb84e6a900527f22cc7d6c0a364e119421 (patch)
tree1507cee556dbf1f1c1e7a4113e29b81e530e49d8
parent873f9822a82be51c9124f84ee0e1f71e39bad032 (diff)
zlib 1.0.8 - the version that comes with X11 - does have "gzseek()",
even if it doesn't have "gzgets()", so one might think we could use it by using our own replacement for "gzgets()". One would be wrong to think so, however, as the "gzseek()" it has doesn't actually work when reading uncompressed files. zlib 1.0.9 has "gzgets()", and fixes that bug, so we rever to checking for "gzgets()" rather than "gzseek()", so that we don't accept pre-1.0.9 versions of zlib, and we get rid of our "gzgets()" replacement. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4702 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--acinclude.m439
-rw-r--r--wiretap/acinclude.m425
-rw-r--r--wiretap/configure.in4
-rw-r--r--wiretap/file_wrappers.c26
-rw-r--r--wiretap/file_wrappers.h8
5 files changed, 51 insertions, 51 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 42d7063b21..a150529277 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -2,7 +2,7 @@ dnl Macros that test for specific features.
dnl This file is part of the Autoconf packaging for Ethereal.
dnl Copyright (C) 1998-2000 by Gerald Combs.
dnl
-dnl $Id: acinclude.m4,v 1.41 2002/02/02 21:07:40 guy Exp $
+dnl $Id: acinclude.m4,v 1.42 2002/02/06 09:58:29 guy Exp $
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@@ -367,26 +367,37 @@ AC_DEFUN(AC_ETHEREAL_ZLIB_CHECK,
#
# Well, we at least have the zlib header file.
#
- # Check for "gzseek()" in zlib, because we need it, but
+ # Check for "gzgets()" in zlib, because we need it, but
# some older versions of zlib don't have it. It appears
# from the zlib ChangeLog that any released version of zlib
- # with "gzseek()" should have the other routines we
- # depend on, such as "gztell()", and "zError()".
- # (I think they may also get "gzgets()", in which case
- # we can get rid of our own private "gzgets()"
- # implementation, as any zlib that's adequate for our
- # purposes will have "gzgets()".)
+ # with "gzgets()" should have the other routines we
+ # depend on, such as "gzseek()", "gztell()", and "zError()".
#
- AC_CHECK_LIB(z, gzseek,,enable_zlib=no)
+ # Another reason why we require "gzgets()" is that
+ # some versions of zlib that didn't have it, such
+ # as 1.0.8, had a bug in "gzseek()" that meant that it
+ # doesn't work correctly on uncompressed files; this
+ # means we cannot use version 1.0.8. (Unfortunately,
+ # that's the version that comes with recent X11 source,
+ # and many people who install XFree86 on their Slackware
+ # boxes don't realize that they should configure it to
+ # use the native zlib rather than building and installing
+ # the crappy old version that comes with XFree86.)
+ #
+ # I.e., we can't just avoid using "gzgets()", as
+ # versions of zlib without "gzgets()" are likely to have
+ # a broken "gzseek()".
+ #
+ AC_CHECK_LIB(z, gzgets,,enable_zlib=no)
fi
if test x$enable_zlib != xno
then
#
# Well, we at least have the zlib header file and a zlib
- # with "gzseek()".
+ # with "gzgets()".
#
- # Now check for "gzseek()" in zlib when linking with the
+ # Now check for "gzgets()" in zlib when linking with the
# linker flags for GTK+ applications; people often grab
# XFree86 source and build and install it on their systems,
# and they appear sometimes to misconfigure XFree86 so that,
@@ -395,15 +406,15 @@ AC_DEFUN(AC_ETHEREAL_ZLIB_CHECK,
# own zlib in the X11 library directory.
#
# The XFree86 zlib is an older version that lacks
- # "gzseek()", and that's the zlib with which Ethereal
+ # "gzgets()", and that's the zlib with which Ethereal
# gets linked, so the build of Ethereal fails.
#
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$GTK_LIBS -lz $LIBS"
- AC_MSG_CHECKING([for gzseek missing when linking with X11])
- AC_TRY_LINK_FUNC(gzseek, AC_MSG_RESULT(no),
+ AC_MSG_CHECKING([for gzgets missing when linking with X11])
+ AC_TRY_LINK_FUNC(gzgets, AC_MSG_RESULT(no),
[
AC_MSG_RESULT(yes)
AC_MSG_ERROR(old zlib found when linking with X11 - get rid of old zlib.)
diff --git a/wiretap/acinclude.m4 b/wiretap/acinclude.m4
index 3f094e2aab..d30874b19e 100644
--- a/wiretap/acinclude.m4
+++ b/wiretap/acinclude.m4
@@ -2,7 +2,7 @@ dnl Macros that test for specific features.
dnl This file is part of the Autoconf packaging for Ethereal.
dnl Copyright (C) 1998-2000 by Gerald Combs.
dnl
-dnl $Id: acinclude.m4,v 1.12 2001/09/28 05:41:45 guy Exp $
+dnl $Id: acinclude.m4,v 1.13 2002/02/06 09:58:30 guy Exp $
dnl
#
@@ -71,12 +71,27 @@ AC_DEFUN(AC_WIRETAP_ZLIB_CHECK,
#
# Well, we at least have the zlib header file.
#
- # Check for "gzseek()" in zlib, because we need it, but
+ # Check for "gzgets()" in zlib, because we need it, but
# some older versions of zlib don't have it. It appears
# from the zlib ChangeLog that any released version of zlib
- # with "gzseek()" should have the other routines we
- # depend on, such as "gztell()" and "zError()".
+ # with "gzgets()" should have the other routines we
+ # depend on, such as "gzseek()", "gztell()", and "zError()".
#
- AC_CHECK_LIB(z, gzseek,,enable_zlib=no)
+ # Another reason why we require "gzgets()" is that
+ # some versions of zlib that didn't have it, such
+ # as 1.0.8, had a bug in "gzseek()" that meant that it
+ # doesn't work correctly on uncompressed files; this
+ # means we cannot use version 1.0.8. (Unfortunately,
+ # that's the version that comes with recent X11 source,
+ # and many people who install XFree86 on their Slackware
+ # boxes don't realize that they should configure it to
+ # use the native zlib rather than building and installing
+ # the crappy old version that comes with XFree86.)
+ #
+ # I.e., we can't just avoid using "gzgets()", as
+ # versions of zlib without "gzgets()" are likely to have
+ # a broken "gzseek()".
+ #
+ AC_CHECK_LIB(z, gzgets,,enable_zlib=no)
fi
])
diff --git a/wiretap/configure.in b/wiretap/configure.in
index b4e0fe59ab..8b64c969cb 100644
--- a/wiretap/configure.in
+++ b/wiretap/configure.in
@@ -1,4 +1,4 @@
-# $Id: configure.in,v 1.34 2002/01/30 23:48:53 guy Exp $
+# $Id: configure.in,v 1.35 2002/02/06 09:58:30 guy Exp $
dnl
dnl Process this file with autoconf 2.13 or later to produce a
dnl configure script; 2.12 doesn't generate a "configure" script that
@@ -116,7 +116,7 @@ if test "x$enable_usr_local" = "xyes" ; then
#
# Arrange that we search for libraries in "/usr/local/lib", as we'll
- # be testing whether zlib has gzseek, and we need to be able to find
+ # be testing whether zlib has gzgets, and we need to be able to find
# zlib even if it's in "/usr/local/lib".
#
# We do this after checking for GLib; see above.
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c
index b4df695dc6..c69a00daac 100644
--- a/wiretap/file_wrappers.c
+++ b/wiretap/file_wrappers.c
@@ -1,6 +1,6 @@
/* file_wrappers.c
*
- * $Id: file_wrappers.c,v 1.9 2001/11/13 23:55:43 gram Exp $
+ * $Id: file_wrappers.c,v 1.10 2002/02/06 09:58:30 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -153,27 +153,3 @@ file_error(FILE *fh)
return 0;
}
#endif /* HAVE_LIBZ */
-
-#ifdef HAVE_LIBZ
-/*
- * On some platforms, an older version of zlib is compiled into X. This causes
- * gzgets() to be unavailable. So here is an implementation of gzgets()
- */
-
-char *
-internal_gzgets(gzFile file, char *buf, int len)
-{
- char *b = buf;
- if (buf == NULL || len <= 0)
- return NULL;
- while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ;
- *buf = '\0';
- return b == buf && len > 0 ? NULL : b;
-}
-
-int internal_gzgetc(gzFile file)
-{
- unsigned char c;
- return gzread(file, &c, 1) == 1 ? c : -1;
-}
-#endif
diff --git a/wiretap/file_wrappers.h b/wiretap/file_wrappers.h
index 56641569b1..97566e0ce4 100644
--- a/wiretap/file_wrappers.h
+++ b/wiretap/file_wrappers.h
@@ -1,6 +1,6 @@
/* file_wrappers.h
*
- * $Id: file_wrappers.h,v 1.6 2001/11/13 23:55:43 gram Exp $
+ * $Id: file_wrappers.h,v 1.7 2002/02/06 09:58:30 guy Exp $
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
@@ -32,10 +32,8 @@ extern long file_seek(void *stream, long offset, int whence);
#define file_write(buf, bsize, count, file) gzwrite((file),(buf),((count)*(bsize)))
#define file_close gzclose
extern long file_tell(void *stream);
-char * internal_gzgets(gzFile file, char *buf, int len);
-int internal_gzgetc(gzFile file);
-#define file_getc internal_gzgetc
-#define file_gets(buf, len, file) internal_gzgets((file), (buf), (len))
+#define file_getc gzgetc
+#define file_gets(buf, len, file) gzgets((file), (buf), (len))
extern int file_error(void *fh);
#else /* No zLib */