"open_cap_file()" in Ethereal and Tethereal don't use the FILE_T they
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 5 Jul 2001 00:34:42 +0000 (00:34 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 5 Jul 2001 00:34:42 +0000 (00:34 +0000)
get from calling "wtap_file()", so get rid of the call and the
(otherwise unused) variable to which its result gets assigned.

That lets us get rid of "wtap_file()" in Wiretap.

It also lets us get rid of the include of "zlib.h" in "file.h"; the
#defines of "file_open()", "filed_open()", and "file_close()" are also
unnecessary, so we get rid of those as well.

However, that means we need to include <zlib.h> in "gtk/main.c" and
"tethereal.c", so that the version number of libz is defined and can
show up in the version string.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@3652 f5534014-38df-0310-8fa8-9805f1628bb7

file.c
file.h
gtk/main.c
tethereal.c
wiretap/wtap.c
wiretap/wtap.h

diff --git a/file.c b/file.c
index 0bdaa4f8be3f712a164e5d13d99ef9b798281f15..b576c1a511968e45233f2a3eed5201deef7e2b13 100644 (file)
--- a/file.c
+++ b/file.c
@@ -1,7 +1,7 @@
 /* file.c
  * File I/O routines
  *
- * $Id: file.c,v 1.241 2001/06/19 23:08:55 guy Exp $
+ * $Id: file.c,v 1.242 2001/07/05 00:34:38 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -123,7 +123,6 @@ open_cap_file(char *fname, gboolean is_tempfile, capture_file *cf)
 {
   wtap       *wth;
   int         err;
-  FILE_T      fh;
   int         fd;
   struct stat cf_stat;
 
@@ -132,7 +131,6 @@ open_cap_file(char *fname, gboolean is_tempfile, capture_file *cf)
     goto fail;
 
   /* Find the size of the file. */
-  fh = wtap_file(wth);
   fd = wtap_fd(wth);
   if (fstat(fd, &cf_stat) < 0) {
     err = errno;
diff --git a/file.h b/file.h
index ea3e1bd0f1a9788dca5eed009792f109055eddcf..2c359ea98c803b013289db12ccd0fa223ea0770b 100644 (file)
--- a/file.h
+++ b/file.h
@@ -1,7 +1,7 @@
 /* file.h
  * Definitions for file structures and routines
  *
- * $Id: file.h,v 1.83 2001/06/05 07:38:33 guy Exp $
+ * $Id: file.h,v 1.84 2001/07/05 00:34:39 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 #include <errno.h>
 #include <epan.h>
 
-#ifdef HAVE_LIBZ
-#include "zlib.h"
-#define FILE_T gzFile
-#define file_open gzopen
-#define filed_open gzdopen
-#define file_close gzclose
-#else /* No zLib */
-#define FILE_T FILE *
-#define file_open fopen
-#define filed_open fdopen
-#define file_close fclose
-#endif /* HAVE_LIBZ */
-
 /* Current state of file. */
 typedef enum {
        FILE_CLOSED,            /* No file open */
index c2419222469dfa23bfece0639f9711b77a3a8a40..3e82dcd7e89db2b15a7a2154b326e4a51b3e4ee6 100644 (file)
@@ -1,6 +1,6 @@
 /* main.c
  *
- * $Id: main.c,v 1.202 2001/06/27 08:36:08 guy Exp $
+ * $Id: main.c,v 1.203 2001/07/05 00:34:40 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 #include <pcap.h>
 #endif
 
+#ifdef HAVE_LIBZ
+#include <zlib.h>      /* to get the libz version number */
+#endif
+
 #ifdef NEED_SNPRINTF_H
 # include "snprintf.h"
 #endif
index ff6722c75f6a53c9d4425630ac57fb44a6a1b638..4469900372dd604476e5e6075631939c8ba7968c 100644 (file)
@@ -1,6 +1,6 @@
 /* tethereal.c
  *
- * $Id: tethereal.c,v 1.86 2001/06/08 08:50:49 guy Exp $
+ * $Id: tethereal.c,v 1.87 2001/07/05 00:34:39 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 #include <pcap.h>
 #endif
 
+#ifdef HAVE_LIBZ
+#include <zlib.h>      /* to get the libz version number */
+#endif
+
 #ifdef NEED_SNPRINTF_H
 # include "snprintf.h"
 #endif
@@ -1482,7 +1486,6 @@ open_cap_file(char *fname, gboolean is_tempfile, capture_file *cf)
 {
   wtap       *wth;
   int         err;
-  FILE_T      fh;
   int         fd;
   struct stat cf_stat;
   char        err_msg[2048+1];
@@ -1492,7 +1495,6 @@ open_cap_file(char *fname, gboolean is_tempfile, capture_file *cf)
     goto fail;
 
   /* Find the size of the file. */
-  fh = wtap_file(wth);
   fd = wtap_fd(wth);
   if (fstat(fd, &cf_stat) < 0) {
     err = errno;
index 200d6420a3523a5869be11a0fce0984f4c02cd00..63475d73b065812783aa2dcaaeb50b8ff41fb6a4 100644 (file)
@@ -1,6 +1,6 @@
 /* wtap.c
  *
- * $Id: wtap.c,v 1.52 2001/03/15 09:11:03 guy Exp $
+ * $Id: wtap.c,v 1.53 2001/07/05 00:34:42 guy Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
 #include "file_wrappers.h"
 #include "buffer.h"
 
-FILE*
-wtap_file(wtap *wth)
-{
-       return wth->fh;
-}
-
 int
 wtap_fd(wtap *wth)
 {
index fe4f302e77c9ec4233ae359aee073b112aa4cf1e..c2201dedc32a41838093d44938c24e08343eec10 100644 (file)
@@ -1,6 +1,6 @@
 /* wtap.h
  *
- * $Id: wtap.h,v 1.86 2001/03/15 09:11:03 guy Exp $
+ * $Id: wtap.h,v 1.87 2001/07/05 00:34:42 guy Exp $
  *
  * Wiretap Library
  * Copyright (c) 1998 by Gilbert Ramirez <gram@xiexie.org>
@@ -302,7 +302,6 @@ struct wtap_pkthdr *wtap_phdr(wtap *wth);
 union wtap_pseudo_header *wtap_pseudoheader(wtap *wth);
 guint8 *wtap_buf_ptr(wtap *wth);
 
-FILE* wtap_file(wtap *wth);
 int wtap_fd(wtap *wth);
 int wtap_snapshot_length(wtap *wth); /* per file */
 int wtap_file_type(wtap *wth);