Ethereal-dev: [Ethereal-dev] warning patches
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Fri, 13 Jul 2001 02:04:43 +0200
Just a few warning patches that accumulated over the last few weeks (I may have sent some of them already but in that case, the have been ignored/lost). Ciao Joerg -- Joerg Mayer <jmayer@xxxxxxxxx> I found out that "pro" means "instead of" (as in proconsul). Now I know what proactive means.
This patch does several things, but unwanted/wrong stuff can easily be deleted. Changelog: * 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 :-) Index: ethereal/text2pcap.c =================================================================== RCS file: /cvsroot/ethereal/text2pcap.c,v retrieving revision 1.2 diff -u -r1.2 text2pcap.c --- text2pcap.c 2001/05/21 03:17:14 1.2 +++ text2pcap.c 2001/07/12 23:46:56 @@ -622,7 +622,7 @@ 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]); Index: ethereal/epan/configure.in =================================================================== RCS file: /cvsroot/ethereal/epan/configure.in,v retrieving revision 1.8 diff -u -r1.8 configure.in --- configure.in 2001/05/16 16:17:52 1.8 +++ configure.in 2001/07/12 23:46:57 @@ -29,7 +29,7 @@ # 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 $CFLAGS" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) Index: ethereal/epan/proto.c =================================================================== RCS file: /cvsroot/ethereal/epan/proto.c,v retrieving revision 1.29 diff -u -r1.29 proto.c --- proto.c 2001/06/05 07:38:35 1.29 +++ proto.c 2001/07/12 23:47:06 @@ -168,7 +168,7 @@ static hf_register_info hf[] = { { &hf_text_only, { "", "", FT_NONE, BASE_NONE, NULL, 0x0, - NULL }}, + NULL, HFILL }}, }; if (gmc_hfinfo) Index: ethereal/epan/dfilter/dfilter.c =================================================================== RCS file: /cvsroot/ethereal/epan/dfilter/dfilter.c,v retrieving revision 1.4 diff -u -r1.4 dfilter.c --- dfilter.c 2001/02/13 18:34:50 1.4 +++ dfilter.c 2001/07/12 23:47:08 @@ -26,6 +26,7 @@ #endif #include <stdio.h> +#include <string.h> #ifdef NEED_SNPRINTF_H #include "snprintf.h" @@ -211,7 +212,7 @@ static void free_insns(GPtrArray *insns) { - int i; + unsigned int i; dfvm_insn_t *insn; for (i = 0; i < insns->len; i++) { Index: ethereal/epan/ftypes/ftype-double.c =================================================================== RCS file: /cvsroot/ethereal/epan/ftypes/ftype-double.c,v retrieving revision 1.3 diff -u -r1.3 ftype-double.c --- ftype-double.c 2001/03/02 17:17:56 1.3 +++ ftype-double.c 2001/07/12 23:47:08 @@ -140,6 +140,9 @@ cmp_ge, cmp_lt, cmp_le, + + NULL, + NULL, }; ftype_register(FT_DOUBLE, &double_type); Index: ethereal/epan/ftypes/ftype-integer.c =================================================================== RCS file: /cvsroot/ethereal/epan/ftypes/ftype-integer.c,v retrieving revision 1.5 diff -u -r1.5 ftype-integer.c --- ftype-integer.c 2001/03/03 00:33:24 1.5 +++ ftype-integer.c 2001/07/12 23:47:09 @@ -232,6 +232,9 @@ u_cmp_ge, u_cmp_lt, u_cmp_le, + + NULL, + NULL, }; static ftype_t uint16_type = { "FT_UINT16", @@ -255,6 +258,9 @@ u_cmp_ge, u_cmp_lt, u_cmp_le, + + NULL, + NULL, }; static ftype_t uint24_type = { "FT_UINT24", @@ -278,6 +284,9 @@ u_cmp_ge, u_cmp_lt, u_cmp_le, + + NULL, + NULL, }; static ftype_t uint32_type = { "FT_UINT32", @@ -301,6 +310,9 @@ u_cmp_ge, u_cmp_lt, u_cmp_le, + + NULL, + NULL, }; static ftype_t int8_type = { "FT_INT8", @@ -324,6 +336,9 @@ s_cmp_ge, s_cmp_lt, s_cmp_le, + + NULL, + NULL, }; static ftype_t int16_type = { "FT_INT16", @@ -347,6 +362,9 @@ s_cmp_ge, s_cmp_lt, s_cmp_le, + + NULL, + NULL, }; static ftype_t int24_type = { "FT_INT24", @@ -370,6 +388,9 @@ s_cmp_ge, s_cmp_lt, s_cmp_le, + + NULL, + NULL, }; static ftype_t int32_type = { "FT_INT32", @@ -393,6 +414,9 @@ s_cmp_ge, s_cmp_lt, s_cmp_le, + + NULL, + NULL, }; static ftype_t boolean_type = { "FT_BOOLEAN", @@ -416,6 +440,9 @@ NULL, NULL, NULL, + + NULL, + NULL, }; static ftype_t ipxnet_type = { @@ -440,6 +467,9 @@ u_cmp_ge, u_cmp_lt, u_cmp_le, + + NULL, + NULL, }; Index: ethereal/epan/ftypes/ftype-ipv4.c =================================================================== RCS file: /cvsroot/ethereal/epan/ftypes/ftype-ipv4.c,v retrieving revision 1.5 diff -u -r1.5 ftype-ipv4.c --- ftype-ipv4.c 2001/06/23 19:10:27 1.5 +++ ftype-ipv4.c 2001/07/12 23:47:10 @@ -180,6 +180,9 @@ cmp_ge, cmp_lt, cmp_le, + + NULL, + NULL, }; ftype_register(FT_IPv4, &ipv4_type); Index: ethereal/epan/ftypes/ftype-none.c =================================================================== RCS file: /cvsroot/ethereal/epan/ftypes/ftype-none.c,v retrieving revision 1.2 diff -u -r1.2 ftype-none.c --- ftype-none.c 2001/02/01 20:31:21 1.2 +++ ftype-none.c 2001/07/12 23:47:10 @@ -36,7 +36,27 @@ "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); } Index: ethereal/epan/ftypes/ftype-time.c =================================================================== RCS file: /cvsroot/ethereal/epan/ftypes/ftype-time.c,v retrieving revision 1.9 diff -u -r1.9 ftype-time.c --- ftype-time.c 2001/06/19 23:08:57 1.9 +++ ftype-time.c 2001/07/12 23:47:11 @@ -25,6 +25,7 @@ #endif #include <ctype.h> +#include <string.h> /* * Just make sure we include the prototype for strptime as well Index: ethereal/wiretap/ascend-grammar.y =================================================================== RCS file: /cvsroot/ethereal/wiretap/ascend-grammar.y,v retrieving revision 1.18 diff -u -r1.18 ascend-grammar.y --- ascend-grammar.y 2001/04/09 03:32:34 1.18 +++ ascend-grammar.y 2001/07/12 23:47:13 @@ -86,7 +86,7 @@ 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; Index: ethereal/wiretap/ascend.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/ascend.c,v retrieving revision 1.23 diff -u -r1.23 ascend.c --- ascend.c 2001/03/10 06:33:57 1.23 +++ ascend.c 2001/07/12 23:47:15 @@ -116,7 +116,7 @@ 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]) { Index: ethereal/wiretap/configure.in =================================================================== RCS file: /cvsroot/ethereal/wiretap/configure.in,v retrieving revision 1.27 diff -u -r1.27 configure.in --- configure.in 2001/06/27 07:47:50 1.27 +++ configure.in 2001/07/12 23:47:15 @@ -29,7 +29,7 @@ # 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 $CFLAGS" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) Index: ethereal/wiretap/csids.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/csids.c,v retrieving revision 1.6 diff -u -r1.6 csids.c --- csids.c 2001/03/10 06:33:57 1.6 +++ csids.c 2001/07/12 23:47:16 @@ -180,9 +180,12 @@ 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 @@ 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; Index: ethereal/wiretap/etherpeek.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/etherpeek.c,v retrieving revision 1.3 diff -u -r1.3 etherpeek.c --- etherpeek.c 2001/03/10 06:33:57 1.3 +++ etherpeek.c 2001/07/12 23:47:17 @@ -210,7 +210,7 @@ { 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_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); Index: ethereal/wiretap/file.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/file.c,v retrieving revision 1.66 diff -u -r1.66 file.c --- file.c 2001/03/10 06:33:57 1.66 +++ file.c 2001/07/12 23:47:19 @@ -149,7 +149,7 @@ { 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 @@ } /* 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); Index: ethereal/wiretap/i4b_trace.h =================================================================== RCS file: /cvsroot/ethereal/wiretap/i4b_trace.h,v retrieving revision 1.1 diff -u -r1.1 i4b_trace.h --- i4b_trace.h 1999/12/12 22:40:09 1.1 +++ i4b_trace.h 2001/07/12 23:47:20 @@ -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 */ Index: ethereal/wiretap/libpcap.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/libpcap.c,v retrieving revision 1.48 diff -u -r1.48 libpcap.c --- libpcap.c 2001/03/15 09:11:03 1.48 +++ libpcap.c 2001/07/12 23:47:24 @@ -867,7 +867,7 @@ 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 @@ 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; Index: ethereal/wiretap/netmon.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/netmon.c,v retrieving revision 1.37 diff -u -r1.37 netmon.c --- netmon.c 2001/03/10 06:33:57 1.37 +++ netmon.c 2001/07/12 23:47:27 @@ -126,7 +126,7 @@ 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 Index: ethereal/wiretap/wtap.c =================================================================== RCS file: /cvsroot/ethereal/wiretap/wtap.c,v retrieving revision 1.53 diff -u -r1.53 wtap.c --- wtap.c 2001/07/05 00:34:42 1.53 +++ wtap.c 2001/07/12 23:47:27 @@ -55,7 +55,7 @@ } /* 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 @@ *wtap_strerror(int err) { static char errbuf[128]; - int wtap_errlist_index; + unsigned int wtap_errlist_index; if (err < 0) { #ifdef HAVE_LIBZ
- Follow-Ups:
- Re: [Ethereal-dev] warning patches
- From: Guy Harris
- Re: [Ethereal-dev] warning patches
- Prev by Date: Re: [Ethereal-dev] smb-browse
- Next by Date: Re: [Ethereal-dev] configure and win32
- Previous by thread: [Ethereal-dev] RE: Help with ltconfig
- Next by thread: Re: [Ethereal-dev] warning patches
- Index(es):