summaryrefslogtreecommitdiff
path: root/print-ascii.c
diff options
context:
space:
mode:
authorguy <guy>2002-09-05 00:00:07 +0000
committerguy <guy>2002-09-05 00:00:07 +0000
commitedb0e92cdcaf06168a38e632847b8fd2c0a62a2d (patch)
treefaf57bac69529b8d0e0700df10e30844cf553779 /print-ascii.c
parent28b539271c4d4ac30faa29cdb79d040c823535ab (diff)
downloadtcpdump-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-ascii.c')
-rw-r--r--print-ascii.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/print-ascii.c b/print-ascii.c
index 524a430e..1bbc8be4 100644
--- a/print-ascii.c
+++ b/print-ascii.c
@@ -42,7 +42,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.9 2002-08-01 08:53:00 risso Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ascii.c,v 1.10 2002-09-05 00:00:10 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
#include <stdio.h>
@@ -65,7 +65,7 @@ ascii_print_with_offset(register const u_char *cp, register u_int length,
register int nshorts;
char hexstuff[HEXDUMP_SHORTS_PER_LINE*HEXDUMP_HEXSTUFF_PER_SHORT+1], *hsp;
char asciistuff[ASCII_LINELENGTH+1], *asp;
- int maxlength = (Aflag ? ASCII_LINELENGTH : HEXDUMP_SHORTS_PER_LINE);
+ u_int maxlength = (Aflag ? ASCII_LINELENGTH : HEXDUMP_SHORTS_PER_LINE);
nshorts = length / sizeof(u_short);
i = 0;