Constify a bunch of arguments and variables, to squelch compiler

warnings.

Include "wiretap/libpcap.h" in "capture_loop.h", to get its declarations
of data structures for headers in libpcap files.  This lets us remove
the includes of "wiretap/libpcap.h from files including
"capture_loop.h".

Make "log_func_ignore()" in "tethereal.c" static, and declare some of
its arguments unused.  Also get rid of an unused variable.

Include <pcap.h> before including "wiretap/wtap-capture.h", to declare
"struct pcap_pkthdr".

svn path=/trunk/; revision=16791
This commit is contained in:
Guy Harris 2005-12-14 07:29:38 +00:00
parent 1f5bf52d6b
commit eaee2b68c5
9 changed files with 24 additions and 18 deletions

View File

@ -61,7 +61,7 @@
* rest-of-the-universe libpcap.
*/
int
get_pcap_linktype(pcap_t *pch, char *devname
get_pcap_linktype(pcap_t *pch, const char *devname
#ifndef _AIX
_U_
#endif
@ -69,7 +69,7 @@ get_pcap_linktype(pcap_t *pch, char *devname
{
int linktype;
#ifdef _AIX
char *ifacename;
const char *ifacename;
#endif
linktype = pcap_datalink(pch);
@ -348,7 +348,7 @@ create_data_link_info(int dlt)
}
GList *
get_pcap_linktype_list(char *devname, char *err_buf)
get_pcap_linktype_list(const char *devname, char *err_buf)
{
GList *linktype_list = NULL;
pcap_t *pch;

View File

@ -91,8 +91,8 @@ typedef struct {
char *description;
} data_link_info_t;
int get_pcap_linktype(pcap_t *pch, char *devname);
GList *get_pcap_linktype_list(char *devname, char *err_buf);
int get_pcap_linktype(pcap_t *pch, const char *devname);
GList *get_pcap_linktype_list(const char *devname, char *err_buf);
void free_pcap_linktype_list(GList *linktype_list);
const char *set_pcap_linktype(pcap_t *pch, char *devname, int dlt);

View File

@ -66,12 +66,11 @@
#include <glib.h>
#include <pcap.h>
#include "wiretap/wtap.h"
#include "wiretap/wtap-capture.h"
#include "wiretap/libpcap.h"
#include <pcap.h>
#include "capture-pcap-util.h"
#include "capture.h"

View File

@ -32,6 +32,14 @@
#ifndef __CAPTURE_LOOP_H__
#define __CAPTURE_LOOP_H__
#ifndef _WIN32
/*
* Get information about libpcap format from "wiretap/libpcap.h".
* XXX - can we just use pcap_open_offline() to read the pipe?
*/
#include "wiretap/libpcap.h"
#endif
/** Do the low-level work of a capture.
* Returns TRUE if it succeeds, FALSE otherwise. */
extern int capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct pcap_stat *stats);

View File

@ -269,10 +269,10 @@ free_capture_combo_list(GList *combo_list)
* Given text that contains an interface name possibly prefixed by an
* interface description, extract the interface name.
*/
char *
const char *
get_if_name(const char *if_text)
{
char *if_name;
const char *if_name;
#ifdef _WIN32
/*

View File

@ -65,7 +65,7 @@ void free_capture_combo_list(GList *combo_list);
*
* @return The raw interface name, without description (must NOT be g_free'd later)
*/
char *get_if_name(const char *if_text);
const char *get_if_name(const char *if_text);
/** Convert plain interface name to the displayed name in the combo box.
*

View File

@ -153,7 +153,7 @@ set_link_type_list(GtkWidget *linktype_om, GtkWidget *entry)
{
gchar *entry_text;
gchar *if_text;
gchar *if_name;
const gchar *if_name;
GList *if_list;
GList *if_entry;
if_info_t *if_info;
@ -1178,7 +1178,7 @@ capture_start_confirmed(void) {
/* XXX - would better be doing this in main.c */
if(capture_opts->iface == NULL) {
gchar *if_device;
gchar *if_name;
const gchar *if_name;
/* did the user ever selected a capture interface before? */
if(prefs.capture_device == NULL) {
@ -1301,7 +1301,7 @@ capture_dlg_prep(gpointer parent_w) {
#endif
gchar *entry_text;
gchar *if_text;
gchar *if_name;
const gchar *if_name;
const gchar *filter_text;
const gchar *g_save_file;
gchar *cf_name;

View File

@ -38,7 +38,6 @@
#include <epan/packet.h>
#include "capture.h"
#include "wiretap/libpcap.h"
#include "capture_loop.h"
#include "capture_info.h"
#include "globals.h"

View File

@ -94,7 +94,6 @@
#include <setjmp.h>
#include "capture-pcap-util.h"
#include <wiretap/wtap-capture.h>
#include <wiretap/libpcap.h>
#ifdef _WIN32
#include "capture-wpcap.h"
#include "capture_errs.h"
@ -581,7 +580,9 @@ add_decode_as(const gchar *cl_param)
return TRUE;
}
void log_func_ignore (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
static void
log_func_ignore (const gchar *log_domain _U_, GLogLevelFlags log_level _U_,
const gchar *message _U_, gpointer user_data _U_)
{
}
@ -1379,7 +1380,6 @@ capture(char *save_file, int out_file_type)
struct pcap_stat stats;
gboolean write_ok;
gboolean close_ok;
dfilter_t *rfcode = NULL;
int save_file_fd;
/* Initialize all data structures used for dissection. */