"open_cap_file()" in Ethereal and Tethereal don't use the FILE_T they

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.

svn path=/trunk/; revision=3652
This commit is contained in:
Guy Harris 2001-07-05 00:34:42 +00:00
parent af5c567978
commit 537d308abe
6 changed files with 14 additions and 30 deletions

4
file.c
View File

@ -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;

15
file.h
View File

@ -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>
@ -35,19 +35,6 @@
#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 */

View 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>
@ -79,6 +79,10 @@
#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

View 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>
@ -58,6 +58,10 @@
#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;

View 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>
@ -30,12 +30,6 @@
#include "file_wrappers.h"
#include "buffer.h"
FILE*
wtap_file(wtap *wth)
{
return wth->fh;
}
int
wtap_fd(wtap *wth)
{

View 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);