]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Convert some format pointers to "char *" from "u_char *", and some data
authorguy <guy>
Thu, 25 Apr 2002 04:54:02 +0000 (04:54 +0000)
committerguy <guy>
Thu, 25 Apr 2002 04:54:02 +0000 (04:54 +0000)
pointers from "char *" to "u_char *", to eliminate signed vs. unsigned
complaints from some compilers.

Don't use "++"s in initialization, to avoid warnings from the Sun C
compiler.

print-smb.c
smbutil.c

index bb8e7aca7b44feea8d3a62238414d857bbd26ef8..ffdc99a037262dcba04dd32466a84109e3e3b473 100644 (file)
@@ -12,7 +12,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-     "@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.21 2002-02-06 11:14:51 guy Exp $";
+     "@(#) $Header: /tcpdump/master/tcpdump/print-smb.c,v 1.22 2002-04-25 04:54:02 guy Exp $";
 #endif
 
 #include <stdio.h>
@@ -175,7 +175,7 @@ print_trans2(const u_char *words, const u_char *dat, const u_char *buf, const u_
     static struct smbfnsint *fn = &trans2_fns[0];
     const u_char *data, *param;
     const u_char *w = words + 1;
-    const u_char *f1 = NULL, *f2 = NULL;
+    const char *f1 = NULL, *f2 = NULL;
     int pcnt, dcnt;
 
     TCHECK(words[0]);
@@ -226,8 +226,8 @@ print_trans2(const u_char *words, const u_char *dat, const u_char *buf, const u_
     if (fn->descript.fn)
        (*fn->descript.fn)(param, data, pcnt, dcnt);
     else {
-       smb_fdata(param, f1 ? f1 : (u_char *)"Paramaters=\n", param + pcnt);
-       smb_fdata(data, f2 ? f2 : (u_char *)"Data=\n", data + dcnt);
+       smb_fdata(param, f1 ? f1 : "Parameters=\n", param + pcnt);
+       smb_fdata(data, f2 ? f2 : "Data=\n", data + dcnt);
     }
     return;
 trunc:
@@ -331,7 +331,7 @@ print_ipc(const u_char *param, int paramlen, const u_char *data, int datalen)
 static void
 print_trans(const u_char *words, const u_char *data1, const u_char *buf, const u_char *maxbuf)
 {
-    const u_char *f1, *f2, *f3, *f4;
+    const char *f1, *f2, *f3, *f4;
     const u_char *data, *param;
     const u_char *w = words + 1;
     int datalen, paramlen;
@@ -385,7 +385,7 @@ trunc:
 static void
 print_negprot(const u_char *words, const u_char *data, const u_char *buf, const u_char *maxbuf)
 {
-    u_char *f1 = NULL, *f2 = NULL;
+    const char *f1 = NULL, *f2 = NULL;
 
     TCHECK(words[0]);
     if (request)
@@ -420,7 +420,7 @@ static void
 print_sesssetup(const u_char *words, const u_char *data, const u_char *buf, const u_char *maxbuf)
 {
     int wcnt;
-    u_char *f1 = NULL, *f2 = NULL;
+    const char *f1 = NULL, *f2 = NULL;
 
     TCHECK(words[0]);
     wcnt = words[0];
@@ -764,7 +764,7 @@ print_smb(const u_char *buf, const u_char *maxbuf)
     TCHECK(words[0]);
 
     for (;;) {
-       const u_char *f1, *f2;
+       const char *f1, *f2;
        int wct;
        int bcc;
 
@@ -951,7 +951,7 @@ nbt_udp137_print(const u_char *data, int length)
     int name_trn_id, response, opcode, nm_flags, rcode;
     int qdcount, ancount, nscount, arcount;
     char *opcodestr;
-    const char *p;
+    const u_char *p;
     int total, i;
 
     TCHECK2(data[10], 2);
@@ -1080,14 +1080,14 @@ nbt_udp137_print(const u_char *data, int length)
                        p += 2;
                    }
                } else {
-                   print_data(p, min(rdlen, length - ((const u_char *)p - data)));
+                   print_data(p, min(rdlen, length - (p - data)));
                    p += rdlen;
                }
            }
        }
     }
 
-    if ((u_char*)p < maxbuf)
+    if (p < maxbuf)
        smb_fdata(p, "AdditionalData:\n", maxbuf);
 
 out:
index 505a271d9363f5de660a212b714789c7e12bf743..729885fcb31fedd653846da1697bc288b2212fa3 100644 (file)
--- a/smbutil.c
+++ b/smbutil.c
@@ -12,7 +12,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-     "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.19 2002-04-20 09:42:58 guy Exp $";
+     "@(#) $Header: /tcpdump/master/tcpdump/smbutil.c,v 1.20 2002-04-25 04:54:03 guy Exp $";
 #endif
 
 #include <sys/param.h>
@@ -338,7 +338,7 @@ write_bits(unsigned int val, char *fmt)
 
 /* convert a UCS2 string into iso-8859-1 string */
 static const char *
-unistr(const char *s, int *len)
+unistr(const u_char *s, int *len)
 {
     static char buf[1000];
     int l=0;
@@ -354,8 +354,8 @@ unistr(const char *s, int *len)
 
     /* maybe it isn't unicode - a cheap trick */
     if (!use_unicode || (s[0] && s[1])) {
-       *len = strlen(s) + 1;
-       return s;
+       *len = strlen((const char *)s) + 1;
+       return (const char *)s;
     }
 
     *len = 0;
@@ -400,8 +400,11 @@ smb_fdata1(const u_char *buf, const char *fmt, const u_char *maxbuf)
        case '{':
          {
            char bitfmt[128];
-           char *p = strchr(++fmt, '}');
-           int l = PTR_DIFF(p, fmt);
+           char *p;
+           int l;
+
+           p = strchr(++fmt, '}');
+           l = PTR_DIFF(p, fmt);
            strncpy(bitfmt, fmt, l);
            bitfmt[l] = 0;
            fmt = p + 1;