diff options
author | guy <guy> | 2002-09-05 00:00:07 +0000 |
---|---|---|
committer | guy <guy> | 2002-09-05 00:00:07 +0000 |
commit | edb0e92cdcaf06168a38e632847b8fd2c0a62a2d (patch) | |
tree | faf57bac69529b8d0e0700df10e30844cf553779 /print-rx.c | |
parent | 28b539271c4d4ac30faa29cdb79d040c823535ab (diff) | |
download | tcpdump-edb0e92cdcaf06168a38e632847b8fd2c0a62a2d.tar.gz |
Add a few more GCC warnings on GCC >= 2 for ".devel" builds.
From Neil T. Spring: fixes for many of those warnings:
addrtoname.c, configure.in: Linux needs netinet/ether.h for
ether_ntohost
print-*.c: change char *foo = "bar" to const char *foo = "bar"
to appease -Wwrite-strings; should affect no run-time behavior.
print-*.c: make some variables unsigned.
print-bgp.c: plen ('prefix len') is unsigned, no reason to
validate by comparing to zero.
print-cnfp.c, print-rx.c: use intoa, provided by addrtoname,
instead of inet_ntoa.
print-domain.c: unsigned int l; (l=foo()) < 0 is guaranteed to
be false, so check for (u_int)-1, which represents failure,
explicitly.
print-isakmp.c: complete initialization of attrmap objects.
print-lwres.c: "if(x); print foo;" seemed much more likely to be
intended to be "if(x) { print foo; }".
print-smb.c: complete initialization of some structures.
In addition, add some fixes for the signed vs. unsigned comparison
warnings:
extract.h: cast the result of the byte-extraction-and-combining,
as, at least for the 16-bit version, C's integral promotions
will turn "u_int16_t" into "int" if there are other "int"s
nearby.
print-*.c: make some more variables unsigned, or add casts to an
unsigned type of signed values known not to be negative, or add
casts to "int" of unsigned values known to fit in an "int", and
make other changes needed to handle the aforementioned variables
now being unsigned.
print-isakmp.c: clean up the handling of error/status indicators
in notify messages.
print-ppp.c: get rid of a check that an unsigned quantity is >=
0.
print-radius.c: clean up some of the bounds checking.
print-smb.c: extract the word count into a "u_int" to avoid the
aforementioned problems with C's integral promotions.
print-snmp.c: change a check that an unsigned variable is >= 0
to a check that it's != 0.
Also, fix some formats to use "%u" rather than "%d" for unsigned
quantities.
Diffstat (limited to 'print-rx.c')
-rw-r--r-- | print-rx.c | 62 |
1 files changed, 31 insertions, 31 deletions
@@ -34,7 +34,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.32 2002-08-06 04:42:06 guy Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-rx.c,v 1.33 2002-09-05 00:00:19 guy Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -71,7 +71,7 @@ static struct tok rx_types[] = { static struct double_tok { int flag; /* Rx flag */ int packetType; /* Packet type */ - char *s; /* Flag string */ + const char *s; /* Flag string */ } rx_flags[] = { { RX_CLIENT_INITIATED, 0, "client-init" }, { RX_REQUEST_ACK, 0, "req-ack" }, @@ -343,7 +343,7 @@ static struct tok ubik_lock_types[] = { { 0, NULL }, }; -static char *voltype[] = { "read-write", "read-only", "backup" }; +static const char *voltype[] = { "read-write", "read-only", "backup" }; static struct tok afs_fs_errors[] = { { 101, "salvage volume" }, @@ -438,7 +438,7 @@ rx_print(register const u_char *bp, int length, int sport, int dport, int i; int32_t opcode; - if (snapend - bp < sizeof (struct rx_header)) { + if (snapend - bp < (int)sizeof (struct rx_header)) { printf(" [|rx] (%d)", length); return; } @@ -592,7 +592,7 @@ rx_cache_insert(const u_char *bp, const struct ip *ip, int dport, struct rx_cache_entry *rxent; const struct rx_header *rxh = (const struct rx_header *) bp; - if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) + if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) return; rxent = &rx_cache[rx_cache_next]; @@ -775,7 +775,7 @@ ack_print(register const u_char *bp, int length) if (vflag <= 1) return; - if (length <= sizeof(struct rx_header)) + if (length <= (int)sizeof(struct rx_header)) return; bp += sizeof(struct rx_header); @@ -845,10 +845,10 @@ fs_print(register const u_char *bp, int length) int fs_op; unsigned long i; - if (length <= sizeof(struct rx_header)) + if (length <= (int)sizeof(struct rx_header)) return; - if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) { + if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) { goto trunc; } @@ -996,7 +996,7 @@ fs_reply_print(register const u_char *bp, int length, int32_t opcode) unsigned long i; struct rx_header *rxh; - if (length <= sizeof(struct rx_header)) + if (length <= (int)sizeof(struct rx_header)) return; rxh = (struct rx_header *) bp; @@ -1160,10 +1160,10 @@ cb_print(register const u_char *bp, int length) int cb_op; unsigned long i; - if (length <= sizeof(struct rx_header)) + if (length <= (int)sizeof(struct rx_header)) return; - if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) { + if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) { goto trunc; } @@ -1241,7 +1241,7 @@ cb_reply_print(register const u_char *bp, int length, int32_t opcode) { struct rx_header *rxh; - if (length <= sizeof(struct rx_header)) + if (length <= (int)sizeof(struct rx_header)) return; rxh = (struct rx_header *) bp; @@ -1291,10 +1291,10 @@ prot_print(register const u_char *bp, int length) unsigned long i; int pt_op; - if (length <= sizeof(struct rx_header)) + if (length <= (int)sizeof(struct rx_header)) return; - if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) { + if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) { goto trunc; } @@ -1433,7 +1433,7 @@ prot_reply_print(register const u_char *bp, int length, int32_t opcode) struct rx_header *rxh; unsigned long i; - if (length < sizeof(struct rx_header)) + if (length < (int)sizeof(struct rx_header)) return; rxh = (struct rx_header *) bp; @@ -1545,10 +1545,10 @@ vldb_print(register const u_char *bp, int length) int vldb_op; unsigned long i; - if (length <= sizeof(struct rx_header)) + if (length <= (int)sizeof(struct rx_header)) return; - if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) { + if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) { goto trunc; } @@ -1638,7 +1638,7 @@ vldb_reply_print(register const u_char *bp, int length, int32_t opcode) struct rx_header *rxh; unsigned long i; - if (length < sizeof(struct rx_header)) + if (length < (int)sizeof(struct rx_header)) return; rxh = (struct rx_header *) bp; @@ -1687,7 +1687,7 @@ vldb_reply_print(register const u_char *bp, int length, int32_t opcode) TCHECK2(bp[0], sizeof(int32_t)); if (i < nservers) printf(" %s", - inet_ntoa(*((struct in_addr *) bp))); + intoa(((struct in_addr *) bp)->s_addr)); bp += sizeof(int32_t); } printf(" partitions"); @@ -1734,7 +1734,7 @@ vldb_reply_print(register const u_char *bp, int length, int32_t opcode) TCHECK2(bp[0], sizeof(int32_t)); if (i < nservers) printf(" %s", - inet_ntoa(*((struct in_addr *) bp))); + intoa(((struct in_addr *) bp)->s_addr)); bp += sizeof(int32_t); } printf(" partitions"); @@ -1824,10 +1824,10 @@ kauth_print(register const u_char *bp, int length) { int kauth_op; - if (length <= sizeof(struct rx_header)) + if (length <= (int)sizeof(struct rx_header)) return; - if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) { + if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) { goto trunc; } @@ -1917,7 +1917,7 @@ kauth_reply_print(register const u_char *bp, int length, int32_t opcode) { struct rx_header *rxh; - if (length <= sizeof(struct rx_header)) + if (length <= (int)sizeof(struct rx_header)) return; rxh = (struct rx_header *) bp; @@ -1968,10 +1968,10 @@ vol_print(register const u_char *bp, int length) { int vol_op; - if (length <= sizeof(struct rx_header)) + if (length <= (int)sizeof(struct rx_header)) return; - if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) { + if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) { goto trunc; } @@ -2006,7 +2006,7 @@ vol_reply_print(register const u_char *bp, int length, int32_t opcode) { struct rx_header *rxh; - if (length <= sizeof(struct rx_header)) + if (length <= (int)sizeof(struct rx_header)) return; rxh = (struct rx_header *) bp; @@ -2050,10 +2050,10 @@ bos_print(register const u_char *bp, int length) { int bos_op; - if (length <= sizeof(struct rx_header)) + if (length <= (int)sizeof(struct rx_header)) return; - if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t)) { + if (snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) { goto trunc; } @@ -2141,7 +2141,7 @@ bos_reply_print(register const u_char *bp, int length, int32_t opcode) { struct rx_header *rxh; - if (length <= sizeof(struct rx_header)) + if (length <= (int)sizeof(struct rx_header)) return; rxh = (struct rx_header *) bp; @@ -2308,7 +2308,7 @@ ubik_reply_print(register const u_char *bp, int length, int32_t opcode) { struct rx_header *rxh; - if (length < sizeof(struct rx_header)) + if (length < (int)sizeof(struct rx_header)) return; rxh = (struct rx_header *) bp; @@ -2372,7 +2372,7 @@ rx_ack_print(register const u_char *bp, int length) struct rx_ackPacket *rxa; int i, start, last; - if (length < sizeof(struct rx_header)) + if (length < (int)sizeof(struct rx_header)) return; bp += sizeof(struct rx_header); |