summaryrefslogtreecommitdiff
path: root/smbutil.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 /smbutil.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 'smbutil.c')
-rw-r--r--smbutil.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/smbutil.c b/smbutil.c
index 48e5116a..e80b6636 100644
--- a/smbutil.c
+++ b/smbutil.c
@@ -12,7 +12,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.24 2002-09-04 09:53:42 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.25 2002-09-05 00:00:25 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
@@ -252,10 +252,10 @@ print_asc(const unsigned char *buf, int len)
safeputchar(buf[i]);
}
-static char *
+static const char *
name_type_str(int name_type)
{
- char *f = NULL;
+ const char *f = NULL;
switch (name_type) {
case 0: f = "Workstation"; break;
@@ -313,9 +313,9 @@ print_data(const unsigned char *buf, int len)
static void
-write_bits(unsigned int val, char *fmt)
+write_bits(unsigned int val, const char *fmt)
{
- char *p = fmt;
+ const char *p = fmt;
int i = 0;
while ((p = strchr(fmt, '|'))) {
@@ -356,7 +356,7 @@ unistr(const u_char *s, int *len)
*len = 1;
}
- while (l < (sizeof(buf) - 1) && s[0] && s[1] == 0) {
+ while (l < (int)(sizeof(buf) - 1) && s[0] && s[1] == 0) {
buf[l] = s[0];
s += 2;
l++;
@@ -371,7 +371,7 @@ static const u_char *
smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
{
int reverse = 0;
- char *attrib_fmt = "READONLY|HIDDEN|SYSTEM|VOLUME|DIR|ARCHIVE|";
+ const char *attrib_fmt = "READONLY|HIDDEN|SYSTEM|VOLUME|DIR|ARCHIVE|";
int len;
while (*fmt && buf<maxbuf) {
@@ -573,20 +573,20 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
{
time_t t;
struct tm *lt;
- char *tstring;
- int x;
+ const char *tstring;
+ u_int32_t x;
x = EXTRACT_LE_32BITS(buf);
switch (atoi(fmt + 1)) {
case 1:
- if (x == 0 || x == -1 || x == 0xFFFFFFFF)
+ if (x == 0 || x == 0xFFFFFFFF)
t = 0;
else
t = make_unix_date(buf);
buf += 4;
break;
case 2:
- if (x == 0 || x == -1 || x == 0xFFFFFFFF)
+ if (x == 0 || x == 0xFFFFFFFF)
t = 0;
else
t = make_unix_date2(buf);
@@ -675,7 +675,7 @@ smb_fdata(const u_char *buf, const char *fmt, const u_char *maxbuf)
return(buf);
memset(s, 0, sizeof(s));
p = strchr(fmt, ']');
- if (p - fmt + 1 > sizeof(s)) {
+ if ((size_t)(p - fmt + 1) > sizeof(s)) {
/* overrun */
return(buf);
}
@@ -802,7 +802,7 @@ err_code_struct hard_msgs[] = {
static struct {
int code;
- char *class;
+ const char *class;
err_code_struct *err_msgs;
} err_classes[] = {
{ 0, "SUCCESS", NULL },