]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use %zu when printing a sizeof.
authorGuy Harris <[email protected]>
Sat, 2 Jan 2021 06:12:44 +0000 (22:12 -0800)
committerGuy Harris <[email protected]>
Sat, 2 Jan 2021 06:12:44 +0000 (22:12 -0800)
We require a C implementation that supports %z, so we can use it; there
is no guarantee that a sizeof is a long, so don't use %l.

Squelches warnings found on Solaris 11 with GCC.

print-olsr.c

index eca30142eb4600dea8f6226106e99e7623c5361b..991c87710192da7f0f014d8a2eed85732b60f847 100644 (file)
@@ -323,7 +323,7 @@ olsr_print(netdissect_options *ndo,
     tptr = pptr;
 
     if (length < sizeof(struct olsr_common)) {
-        ND_PRINT(" (packet length < %lu)", sizeof(struct olsr_common));
+        ND_PRINT(" (packet length < %zu)", sizeof(struct olsr_common));
         goto invalid;
     }
 
@@ -419,7 +419,7 @@ olsr_print(netdissect_options *ndo,
         case OLSR_HELLO_MSG:
         case OLSR_HELLO_LQ_MSG:
             if (msg_tlen < sizeof(struct olsr_hello)) {
-                ND_PRINT(" (message length < %lu)", sizeof(struct olsr_hello));
+                ND_PRINT(" (message length < %zu)", sizeof(struct olsr_hello));
                 goto invalid;
             }
 
@@ -481,7 +481,7 @@ olsr_print(netdissect_options *ndo,
         case OLSR_TC_LQ_MSG:
             if (msg_tlen < sizeof(struct olsr_tc)) {
                 goto invalid;
-                ND_PRINT(" (message length < %lu)", sizeof(struct olsr_tc));
+                ND_PRINT(" (message length < %zu)", sizeof(struct olsr_tc));
             }
             ND_TCHECK_LEN(msg_data, sizeof(struct olsr_tc));