aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-12-14 07:29:38 +0000
committerGuy Harris <guy@alum.mit.edu>2005-12-14 07:29:38 +0000
commiteaee2b68c511700b89997efa627146304c13887c (patch)
tree3e26508ca0699f96507b77641a4c3aaefa0af993
parent1f5bf52d6b1c3bbd922fe226ae188363fa74754a (diff)
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
-rw-r--r--capture-pcap-util.c6
-rw-r--r--capture-pcap-util.h4
-rw-r--r--capture_loop.c5
-rw-r--r--capture_loop.h8
-rw-r--r--capture_ui_utils.c4
-rw-r--r--capture_ui_utils.h2
-rw-r--r--gtk/capture_dlg.c6
-rw-r--r--gtk/capture_info_dlg.c1
-rw-r--r--tethereal.c6
9 files changed, 24 insertions, 18 deletions
diff --git a/capture-pcap-util.c b/capture-pcap-util.c
index c6e205f077..db32cfb4c7 100644
--- a/capture-pcap-util.c
+++ b/capture-pcap-util.c
@@ -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;
diff --git a/capture-pcap-util.h b/capture-pcap-util.h
index d9cd527364..1b78718341 100644
--- a/capture-pcap-util.h
+++ b/capture-pcap-util.h
@@ -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);
diff --git a/capture_loop.c b/capture_loop.c
index db0664e454..4955b136ea 100644
--- a/capture_loop.c
+++ b/capture_loop.c
@@ -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"
diff --git a/capture_loop.h b/capture_loop.h
index 4336927c4c..46133093b6 100644
--- a/capture_loop.h
+++ b/capture_loop.h
@@ -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);
diff --git a/capture_ui_utils.c b/capture_ui_utils.c
index b1307e79fa..94ac20c6ae 100644
--- a/capture_ui_utils.c
+++ b/capture_ui_utils.c
@@ -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
/*
diff --git a/capture_ui_utils.h b/capture_ui_utils.h
index a06a2db7e6..40691b4d57 100644
--- a/capture_ui_utils.h
+++ b/capture_ui_utils.h
@@ -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.
*
diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c
index e4aac968bd..51f6b7351d 100644
--- a/gtk/capture_dlg.c
+++ b/gtk/capture_dlg.c
@@ -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;
diff --git a/gtk/capture_info_dlg.c b/gtk/capture_info_dlg.c
index 71ebb521ea..6dd4feecef 100644
--- a/gtk/capture_info_dlg.c
+++ b/gtk/capture_info_dlg.c
@@ -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"
diff --git a/tethereal.c b/tethereal.c
index 37571e1ce3..1dc2ae01f6 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -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. */