From: guy Date: Fri, 13 Jul 2001 00:55:58 +0000 (+0000) Subject: From Joerg Mayer: X-Git-Url: http://git.samba.org/samba.git/?p=obnox%2Fwireshark%2Fwip.git;a=commitdiff_plain;h=0f480c2f4a00135c5acaa1250956a48fa328fdd7 From Joerg Mayer: * gcc 3.0 warning fixes: - text2pcap.c: The number of characters to scan should probably not be 0 - wiretap/csids.c: using preincrement on a variable used on both sides of an assignment might be undefined by the C99(?) standard * turn on additional warnings for epan and wiretap too - epan/configure.in - wiretap/configure.in * Fix some warnings (missing includes, signed/unsigned, missing initializers) found by turning on the warnings - all other files :-) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@3709 f5534014-38df-0310-8fa8-9805f1628bb7 --- diff --git a/epan/configure.in b/epan/configure.in index e24d87d3cb..05b98cde91 100644 --- a/epan/configure.in +++ b/epan/configure.in @@ -1,4 +1,4 @@ -# $Id: configure.in,v 1.8 2001/05/16 16:17:52 jfoster Exp $ +# $Id: configure.in,v 1.9 2001/07/13 00:55:53 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 @@ -29,7 +29,7 @@ AC_SUBST(FLEX_PATH) # If we're running gcc, add '-Wall' to CFLAGS. AC_MSG_CHECKING(to see if we can add '-Wall' to CFLAGS) if test x$GCC != x ; then - CFLAGS="-Wall $CFLAGS" + CFLAGS="-Wall -W -Wno-unused $CFLAGS" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) diff --git a/epan/dfilter/dfilter.c b/epan/dfilter/dfilter.c index ac45f2eb4d..0380f15662 100644 --- a/epan/dfilter/dfilter.c +++ b/epan/dfilter/dfilter.c @@ -1,5 +1,5 @@ /* - * $Id: dfilter.c,v 1.4 2001/02/13 18:34:50 guy Exp $ + * $Id: dfilter.c,v 1.5 2001/07/13 00:55:54 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -26,6 +26,7 @@ #endif #include +#include #ifdef NEED_SNPRINTF_H #include "snprintf.h" @@ -211,7 +212,7 @@ dfilter_new(void) static void free_insns(GPtrArray *insns) { - int i; + unsigned int i; dfvm_insn_t *insn; for (i = 0; i < insns->len; i++) { diff --git a/epan/ftypes/ftype-double.c b/epan/ftypes/ftype-double.c index ba19a8d8e7..8fa42e0032 100644 --- a/epan/ftypes/ftype-double.c +++ b/epan/ftypes/ftype-double.c @@ -1,6 +1,6 @@ /* * - * $Id: ftype-double.c,v 1.3 2001/03/02 17:17:56 gram Exp $ + * $Id: ftype-double.c,v 1.4 2001/07/13 00:55:56 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -140,6 +140,9 @@ ftype_register_double(void) cmp_ge, cmp_lt, cmp_le, + + NULL, + NULL, }; ftype_register(FT_DOUBLE, &double_type); diff --git a/epan/ftypes/ftype-integer.c b/epan/ftypes/ftype-integer.c index c0da733cea..fcfd996e97 100644 --- a/epan/ftypes/ftype-integer.c +++ b/epan/ftypes/ftype-integer.c @@ -1,5 +1,5 @@ /* - * $Id: ftype-integer.c,v 1.5 2001/03/03 00:33:24 guy Exp $ + * $Id: ftype-integer.c,v 1.6 2001/07/13 00:55:56 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -232,6 +232,9 @@ ftype_register_integers(void) u_cmp_ge, u_cmp_lt, u_cmp_le, + + NULL, + NULL, }; static ftype_t uint16_type = { "FT_UINT16", @@ -255,6 +258,9 @@ ftype_register_integers(void) u_cmp_ge, u_cmp_lt, u_cmp_le, + + NULL, + NULL, }; static ftype_t uint24_type = { "FT_UINT24", @@ -278,6 +284,9 @@ ftype_register_integers(void) u_cmp_ge, u_cmp_lt, u_cmp_le, + + NULL, + NULL, }; static ftype_t uint32_type = { "FT_UINT32", @@ -301,6 +310,9 @@ ftype_register_integers(void) u_cmp_ge, u_cmp_lt, u_cmp_le, + + NULL, + NULL, }; static ftype_t int8_type = { "FT_INT8", @@ -324,6 +336,9 @@ ftype_register_integers(void) s_cmp_ge, s_cmp_lt, s_cmp_le, + + NULL, + NULL, }; static ftype_t int16_type = { "FT_INT16", @@ -347,6 +362,9 @@ ftype_register_integers(void) s_cmp_ge, s_cmp_lt, s_cmp_le, + + NULL, + NULL, }; static ftype_t int24_type = { "FT_INT24", @@ -370,6 +388,9 @@ ftype_register_integers(void) s_cmp_ge, s_cmp_lt, s_cmp_le, + + NULL, + NULL, }; static ftype_t int32_type = { "FT_INT32", @@ -393,6 +414,9 @@ ftype_register_integers(void) s_cmp_ge, s_cmp_lt, s_cmp_le, + + NULL, + NULL, }; static ftype_t boolean_type = { "FT_BOOLEAN", @@ -416,6 +440,9 @@ ftype_register_integers(void) NULL, NULL, NULL, + + NULL, + NULL, }; static ftype_t ipxnet_type = { @@ -440,6 +467,9 @@ ftype_register_integers(void) u_cmp_ge, u_cmp_lt, u_cmp_le, + + NULL, + NULL, }; diff --git a/epan/ftypes/ftype-ipv4.c b/epan/ftypes/ftype-ipv4.c index 03e8d3a92c..0037923a92 100644 --- a/epan/ftypes/ftype-ipv4.c +++ b/epan/ftypes/ftype-ipv4.c @@ -1,5 +1,5 @@ /* - * $Id: ftype-ipv4.c,v 1.5 2001/06/23 19:10:27 guy Exp $ + * $Id: ftype-ipv4.c,v 1.6 2001/07/13 00:55:56 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -180,6 +180,9 @@ ftype_register_ipv4(void) cmp_ge, cmp_lt, cmp_le, + + NULL, + NULL, }; ftype_register(FT_IPv4, &ipv4_type); diff --git a/epan/ftypes/ftype-none.c b/epan/ftypes/ftype-none.c index f19b6e2714..09884aeb4a 100644 --- a/epan/ftypes/ftype-none.c +++ b/epan/ftypes/ftype-none.c @@ -1,5 +1,5 @@ /* - * $Id: ftype-none.c,v 1.2 2001/02/01 20:31:21 gram Exp $ + * $Id: ftype-none.c,v 1.3 2001/07/13 00:55:56 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -36,7 +36,27 @@ ftype_register_none(void) "FT_NONE", "label", 0, - }; + NULL, + NULL, + NULL, + + NULL, + NULL, + NULL, + + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + + NULL, + NULL, + }; ftype_register(FT_NONE, &none_type); } diff --git a/epan/ftypes/ftype-time.c b/epan/ftypes/ftype-time.c index bfaa18a0f5..aeab4c1c8e 100644 --- a/epan/ftypes/ftype-time.c +++ b/epan/ftypes/ftype-time.c @@ -1,5 +1,5 @@ /* - * $Id: ftype-time.c,v 1.9 2001/06/19 23:08:57 guy Exp $ + * $Id: ftype-time.c,v 1.10 2001/07/13 00:55:56 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -25,6 +25,7 @@ #endif #include +#include /* * Just make sure we include the prototype for strptime as well diff --git a/epan/proto.c b/epan/proto.c index f6d5f1464c..35de4bde33 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -1,7 +1,7 @@ /* proto.c * Routines for protocol tree * - * $Id: proto.c,v 1.29 2001/06/05 07:38:35 guy Exp $ + * $Id: proto.c,v 1.30 2001/07/13 00:55:53 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -168,7 +168,7 @@ proto_init(const char *plugin_dir,void (register_all_protocols)(void), static hf_register_info hf[] = { { &hf_text_only, { "", "", FT_NONE, BASE_NONE, NULL, 0x0, - NULL }}, + NULL, HFILL }}, }; if (gmc_hfinfo) diff --git a/text2pcap.c b/text2pcap.c index 17508a172e..dd089a39b3 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -6,7 +6,7 @@ * * (c) Copyright 2001 Ashok Narayanan * - * $Id: text2pcap.c,v 1.2 2001/05/21 03:17:14 guy Exp $ + * $Id: text2pcap.c,v 1.3 2001/07/13 00:55:52 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -622,7 +622,7 @@ parse_options (int argc, char *argv[]) break; case 'e': hdr_ethernet = TRUE; - if (!optarg || sscanf(optarg, "%0lx", &hdr_ethernet_proto) < 1) { + if (!optarg || sscanf(optarg, "%lx", &hdr_ethernet_proto) < 1) { fprintf(stderr, "Bad argument for '-e': %s\n", optarg ? optarg : ""); help(argv[0]); diff --git a/wiretap/ascend-grammar.y b/wiretap/ascend-grammar.y index 08d989ee11..4577c935dd 100644 --- a/wiretap/ascend-grammar.y +++ b/wiretap/ascend-grammar.y @@ -1,7 +1,7 @@ %{ /* ascend-grammar.y * - * $Id: ascend-grammar.y,v 1.18 2001/04/09 03:32:34 gerald Exp $ + * $Id: ascend-grammar.y,v 1.19 2001/07/13 00:55:57 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez @@ -86,7 +86,7 @@ extern int at_eof; int yyparse(void); void yyerror(char *); -int bcur = 0, bcount; +unsigned int bcur = 0, bcount; guint32 start_time, secs, usecs, caplen, wirelen; ascend_pkthdr *header; struct ascend_phdr *pseudo_header; diff --git a/wiretap/ascend.c b/wiretap/ascend.c index 7155815403..04a34783cf 100644 --- a/wiretap/ascend.c +++ b/wiretap/ascend.c @@ -1,6 +1,6 @@ /* ascend.c * - * $Id: ascend.c,v 1.23 2001/03/10 06:33:57 guy Exp $ + * $Id: ascend.c,v 1.24 2001/07/13 00:55:57 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez @@ -116,7 +116,7 @@ static void ascend_close(wtap *wth); static int ascend_seek(wtap *wth, int max_seek) { int byte, bytes_read = 0, date_off = -1, cur_off, packet_off; - int x_level = 0, r_level = 0, w1_level = 0, w2_level = 0; + unsigned int r_level = 0, x_level = 0, w1_level = 0, w2_level = 0; while (((byte = file_getc(wth->fh)) != EOF) && bytes_read < max_seek) { if (byte == ascend_xmagic[x_level]) { diff --git a/wiretap/configure.in b/wiretap/configure.in index b9d42b581b..88c23375c8 100644 --- a/wiretap/configure.in +++ b/wiretap/configure.in @@ -1,4 +1,4 @@ -# $Id: configure.in,v 1.27 2001/06/27 07:47:50 guy Exp $ +# $Id: configure.in,v 1.28 2001/07/13 00:55:57 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 @@ -29,7 +29,7 @@ AC_SUBST(FLEX_PATH) # If we're running gcc, add '-Wall' to CFLAGS. AC_MSG_CHECKING(to see if we can add '-Wall' to CFLAGS) if test x$GCC != x ; then - CFLAGS="-Wall $CFLAGS" + CFLAGS="-Wall -W -Wno-unused $CFLAGS" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) diff --git a/wiretap/csids.c b/wiretap/csids.c index d50ae18c3f..7196b0ea92 100644 --- a/wiretap/csids.c +++ b/wiretap/csids.c @@ -1,6 +1,6 @@ /* csids.c * - * $Id: csids.c,v 1.6 2001/03/10 06:33:57 guy Exp $ + * $Id: csids.c,v 1.7 2001/07/13 00:55:58 guy Exp $ * * Copyright (c) 2000 by Mike Hall * Copyright (c) 2000 by Cisco Systems @@ -180,9 +180,12 @@ static gboolean csids_read(wtap *wth, int *err, int *data_offset) if( wth->capture.csids->byteswapped == TRUE ) { guint16* swap = (guint16*)buf; - *(++swap) = BSWAP16(*swap); /* the ip len */ - *(++swap) = BSWAP16(*swap); /* ip id */ - *(++swap) = BSWAP16(*swap); /* ip flags and fragoff */ + swap++; + *(swap) = BSWAP16(*swap); /* the ip len */ + swap++; + *(swap) = BSWAP16(*swap); /* ip id */ + swap++; + *(swap) = BSWAP16(*swap); /* ip flags and fragoff */ } return TRUE; @@ -228,9 +231,12 @@ csids_seek_read (wtap *wth, if( wth->capture.csids->byteswapped == TRUE ) { guint16* swap = (guint16*)pd; - *(++swap) = BSWAP16(*swap); /* the ip len */ - *(++swap) = BSWAP16(*swap); /* ip id */ - *(++swap) = BSWAP16(*swap); /* ip flags and fragoff */ + swap++; + *(swap) = BSWAP16(*swap); /* the ip len */ + swap++; + *(swap) = BSWAP16(*swap); /* ip id */ + swap++; + *(swap) = BSWAP16(*swap); /* ip flags and fragoff */ } return 0; diff --git a/wiretap/etherpeek.c b/wiretap/etherpeek.c index 5a6181b55f..32102eba20 100644 --- a/wiretap/etherpeek.c +++ b/wiretap/etherpeek.c @@ -2,7 +2,7 @@ * Routines for opening etherpeek files * Copyright (c) 2001, Daniel Thompson * - * $Id: etherpeek.c,v 1.3 2001/03/10 06:33:57 guy Exp $ + * $Id: etherpeek.c,v 1.4 2001/07/13 00:55:58 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez @@ -210,7 +210,7 @@ static gboolean etherpeek_read_m7(wtap *wth, int *err, int *data_offset) { etherpeek_m7_packet_t ep_pkt; double t; - int i; + unsigned int i; g_assert(sizeof(ep_pkt) == ETHERPEEK_M7_PKT_SIZE); wtap_file_read_expected_bytes(&ep_pkt, sizeof(ep_pkt), wth->fh, err); @@ -265,7 +265,7 @@ static gboolean etherpeek_read_m7(wtap *wth, int *err, int *data_offset) static gboolean etherpeek_read_m56(wtap *wth, int *err, int *data_offset) { etherpeek_m56_packet_t ep_pkt; - int i; + unsigned int i; g_assert(sizeof(ep_pkt) == ETHERPEEK_M56_PKT_SIZE); wtap_file_read_expected_bytes(&ep_pkt, sizeof(ep_pkt), wth->fh, err); diff --git a/wiretap/file.c b/wiretap/file.c index 6eba00d993..62b5dcdbea 100644 --- a/wiretap/file.c +++ b/wiretap/file.c @@ -1,6 +1,6 @@ /* file.c * - * $Id: file.c,v 1.66 2001/03/10 06:33:57 guy Exp $ + * $Id: file.c,v 1.67 2001/07/13 00:55:58 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez @@ -149,7 +149,7 @@ wtap* wtap_open_offline(const char *filename, int *err, gboolean do_random) { struct stat statb; wtap *wth; - int i; + unsigned int i; /* First, make sure the file is valid */ if (stat(filename, &statb) < 0) { @@ -252,7 +252,7 @@ success: } /* Table of the file types we know about. */ -const static struct file_type_info { +static const struct file_type_info { const char *name; const char *short_name; int (*can_write_encap)(int, int); diff --git a/wiretap/i4b_trace.h b/wiretap/i4b_trace.h index 59684e1dd2..66ef59d876 100644 --- a/wiretap/i4b_trace.h +++ b/wiretap/i4b_trace.h @@ -27,7 +27,7 @@ * i4b_trace.h - header file for trace data read device * ---------------------------------------------------- * - * $Id: i4b_trace.h,v 1.1 1999/12/12 22:40:09 gram Exp $ + * $Id: i4b_trace.h,v 1.2 2001/07/13 00:55:58 guy Exp $ * * last edit-date: [Sun Feb 14 10:39:26 1999] * @@ -40,7 +40,7 @@ * structure of the header at the beginning of every trace mbuf *---------------------------------------------------------------------------*/ typedef struct { - int length; /* length of the following mbuf */ + unsigned int length; /* length of the following mbuf */ int unit; /* controller unit number */ int type; /* type of channel */ #define TRC_CH_I 0 /* Layer 1 INFO's */ diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index b85d518e38..294bb95d66 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -1,6 +1,6 @@ /* libpcap.c * - * $Id: libpcap.c,v 1.48 2001/03/15 09:11:03 guy Exp $ + * $Id: libpcap.c,v 1.49 2001/07/13 00:55:58 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez @@ -867,7 +867,7 @@ libpcap_close(wtap *wth) int wtap_pcap_encap_to_wtap_encap(int encap) { - int i; + unsigned int i; for (i = 0; i < NUM_PCAP_ENCAPS; i++) { if (pcap_to_wtap_map[i].dlt_value == encap) @@ -878,7 +878,7 @@ int wtap_pcap_encap_to_wtap_encap(int encap) static int wtap_wtap_encap_to_pcap_encap(int encap) { - int i; + unsigned int i; /* * Special-case WTAP_ENCAP_FDDI and WTAP_ENCAP_FDDI_BITSWAPPED; diff --git a/wiretap/netmon.c b/wiretap/netmon.c index f0f266f315..a0b489a71f 100644 --- a/wiretap/netmon.c +++ b/wiretap/netmon.c @@ -1,6 +1,6 @@ /* netmon.c * - * $Id: netmon.c,v 1.37 2001/03/10 06:33:57 guy Exp $ + * $Id: netmon.c,v 1.38 2001/07/13 00:55:58 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez @@ -126,7 +126,7 @@ int netmon_open(wtap *wth, int *err) int frame_table_size; guint32 *frame_table; #ifdef WORDS_BIGENDIAN - int i; + unsigned int i; #endif /* Read in the string that should be at the start of a Network diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 63475d73b0..db9bbae293 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -1,6 +1,6 @@ /* wtap.c * - * $Id: wtap.c,v 1.53 2001/07/05 00:34:42 guy Exp $ + * $Id: wtap.c,v 1.54 2001/07/13 00:55:58 guy Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez @@ -55,7 +55,7 @@ wtap_file_encap(wtap *wth) } /* Table of the encapsulation types we know about. */ -const static struct encap_type_info { +static const struct encap_type_info { const char *name; const char *short_name; } encap_table[WTAP_NUM_ENCAP_TYPES] = { @@ -183,7 +183,7 @@ const char *wtap_strerror(int err) { static char errbuf[128]; - int wtap_errlist_index; + unsigned int wtap_errlist_index; if (err < 0) { #ifdef HAVE_LIBZ