]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Add some casts to squelch compiler warnings.
authorguy <guy>
Fri, 2 May 2003 08:45:21 +0000 (08:45 +0000)
committerguy <guy>
Fri, 2 May 2003 08:45:21 +0000 (08:45 +0000)
When seeing whether the difference between two pointers exceeds an
unsigned value (we know the difference is positive), subtract the
pointers and then cast the result to an unsigned integer, don't cast the
pointers to unsigned integers - the latter isn't the right way to do it
in C, and isn't LP64-clean.

print-tftp.c

index 45ec8e95bb56e071b89f1fc68dfc00b9909ea1ba..9d1c064e577c2e3aeb3def0c9dd845dbb8bc2c9e 100644 (file)
@@ -23,7 +23,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-tftp.c,v 1.34 2003-02-19 08:01:36 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-tftp.c,v 1.35 2003-05-02 08:45:21 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -111,8 +111,8 @@ tftp_print(register const u_char *bp, u_int length)
                putchar('"');
 
                /* Print the mode and any options */
-               while ((p = strchr(p, '\0')) != NULL) {
-                       if (length <= ((unsigned)p - (unsigned)&tp->th_block))
+               while ((p = (const u_char *)strchr((const char *)p, '\0')) != NULL) {
+                       if (length <= (u_int)(p - (const u_char *)&tp->th_block))
                                break;
                        p++;
                        if (*p != '\0') {