]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Style update
authorFrancois-Xavier Le Bail <[email protected]>
Tue, 6 Feb 2018 18:15:45 +0000 (19:15 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 6 Feb 2018 19:01:55 +0000 (20:01 +0100)
Use parens around the sizeof argument, to match the style used elsewhere.

print-802_11.c
print-bootp.c
print-isoclns.c
print-ppp.c
print-tcp.c
signature.c
tcpdump.c

index b211a55a7be50900aeedbbf0782994ef1fe9b00f..f761d494b2ba8404cefd0b470b7303a66d7a5367 100644 (file)
@@ -826,7 +826,7 @@ static const float ieee80211_float_htrates[MAX_MCS_INDEX+1][2][2] = {
 };
 
 static const char *auth_alg_text[]={"Open System","Shared Key","EAP"};
-#define NUM_AUTH_ALGS  (sizeof auth_alg_text / sizeof auth_alg_text[0])
+#define NUM_AUTH_ALGS  (sizeof(auth_alg_text) / sizeof(auth_alg_text[0]))
 
 static const char *status_text[] = {
        "Successful",                                           /*  0 */
@@ -908,7 +908,7 @@ static const char *status_text[] = {
        "The Destination STA is not a QSTA.",                   /* 50 */
 
 };
-#define NUM_STATUSES   (sizeof status_text / sizeof status_text[0])
+#define NUM_STATUSES   (sizeof(status_text) / sizeof(status_text[0]))
 
 static const char *reason_text[] = {
        "Reserved",                                             /* 0 */
@@ -976,7 +976,7 @@ static const char *reason_text[] = {
        "Association denied due to requesting STA not supporting HT "
          "features",                                           /* 46 */
 };
-#define NUM_REASONS    (sizeof reason_text / sizeof reason_text[0])
+#define NUM_REASONS    (sizeof(reason_text) / sizeof(reason_text[0]))
 
 static int
 wep_print(netdissect_options *ndo,
@@ -1087,7 +1087,7 @@ parse_elements(netdissect_options *ndo,
                        offset += 2;
                        length -= 2;
                        if (rates.length != 0) {
-                               if (rates.length > sizeof rates.rate)
+                               if (rates.length > sizeof(rates.rate))
                                        return 0;
                                memcpy(&rates.rate, p + offset, rates.length);
                                offset += rates.length;
@@ -1171,7 +1171,7 @@ parse_elements(netdissect_options *ndo,
                                length -= tim.length;
                                break;
                        }
-                       if (tim.length - 3U > sizeof tim.bitmap)
+                       if (tim.length - 3U > sizeof(tim.bitmap))
                                return 0;
                        memcpy(&tim.count, p + offset, 3);
                        offset += 3;
index cbbac30d7f77a355d477ca49cafc4c2746c4f074..c62785b00f2a10af52cc4569ff188d35fcdbe44a 100644 (file)
@@ -360,7 +360,7 @@ bootp_print(netdissect_options *ndo,
        ND_TCHECK_1(bp->bp_sname);              /* check first char only */
        if (EXTRACT_U_1(bp->bp_sname)) {
                ND_PRINT("\n\t  sname \"");
-               if (fn_printztn(ndo, bp->bp_sname, (u_int)sizeof bp->bp_sname,
+               if (fn_printztn(ndo, bp->bp_sname, (u_int)sizeof(bp->bp_sname),
                    ndo->ndo_snapend)) {
                        ND_PRINT("\"");
                        ND_PRINT("%s", tstr + 1);
@@ -371,7 +371,7 @@ bootp_print(netdissect_options *ndo,
        ND_TCHECK_1(bp->bp_file);               /* check first char only */
        if (EXTRACT_U_1(bp->bp_file)) {
                ND_PRINT("\n\t  file \"");
-               if (fn_printztn(ndo, bp->bp_file, (u_int)sizeof bp->bp_file,
+               if (fn_printztn(ndo, bp->bp_file, (u_int)sizeof(bp->bp_file),
                    ndo->ndo_snapend)) {
                        ND_PRINT("\"");
                        ND_PRINT("%s", tstr + 1);
index e5de4ab11b125efa22de328ae6d911e891b33dda..bcd8e88499520f8263732f7f87ed8069e7e3bf0d 100644 (file)
@@ -2166,7 +2166,7 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
 
     if (!ND_TTEST_LEN(tptr, byte_length))
         return (0);
-    memset(prefix, 0, sizeof prefix);   /* clear the copy buffer */
+    memset(prefix, 0, sizeof(prefix));   /* clear the copy buffer */
     memcpy(prefix,tptr,byte_length);    /* copy as much as is stored in the TLV */
     tptr+=byte_length;
     processed+=byte_length;
index de17538ad7559212e957924bbe11f8cd8f09ec9a..180f8d60dffe505d6313a04d7ef7ed85bc452a35 100644 (file)
@@ -213,7 +213,7 @@ static const char *lcpconfopts[] = {
        "PPP-Muxing",           /* (30) */
 };
 
-#define NUM_LCPOPTS    (sizeof lcpconfopts / sizeof lcpconfopts[0])
+#define NUM_LCPOPTS    (sizeof(lcpconfopts) / sizeof(lcpconfopts[0]))
 
 /* ECP - to be supported */
 
index 554f8a61eaaa6b423509c6dbe761f4bb93087081..41392f99a1852435597660653d781c66722be619 100644 (file)
@@ -267,16 +267,16 @@ tcp_print(netdissect_options *ndo,
                         if (sport > dport)
                                 rev = 1;
                         else if (sport == dport) {
-                                if (UNALIGNED_MEMCMP(src, dst, sizeof ip6->ip6_dst) > 0)
+                                if (UNALIGNED_MEMCMP(src, dst, sizeof(ip6->ip6_dst)) > 0)
                                         rev = 1;
                         }
                         if (rev) {
-                                UNALIGNED_MEMCPY(&tha.src, dst, sizeof ip6->ip6_dst);
-                                UNALIGNED_MEMCPY(&tha.dst, src, sizeof ip6->ip6_src);
+                                UNALIGNED_MEMCPY(&tha.src, dst, sizeof(ip6->ip6_dst));
+                                UNALIGNED_MEMCPY(&tha.dst, src, sizeof(ip6->ip6_src));
                                 tha.port = dport << 16 | sport;
                         } else {
-                                UNALIGNED_MEMCPY(&tha.dst, dst, sizeof ip6->ip6_dst);
-                                UNALIGNED_MEMCPY(&tha.src, src, sizeof ip6->ip6_src);
+                                UNALIGNED_MEMCPY(&tha.dst, dst, sizeof(ip6->ip6_dst));
+                                UNALIGNED_MEMCPY(&tha.src, src, sizeof(ip6->ip6_src));
                                 tha.port = sport << 16 | dport;
                         }
 
@@ -318,20 +318,20 @@ tcp_print(netdissect_options *ndo,
                         if (sport > dport)
                                 rev = 1;
                         else if (sport == dport) {
-                                if (UNALIGNED_MEMCMP(ip->ip_src, ip->ip_dst, sizeof ip->ip_dst) > 0)
+                                if (UNALIGNED_MEMCMP(ip->ip_src, ip->ip_dst, sizeof(ip->ip_dst)) > 0)
                                         rev = 1;
                         }
                         if (rev) {
                                 UNALIGNED_MEMCPY(&tha.src, ip->ip_dst,
-                                                 sizeof ip->ip_dst);
+                                                 sizeof(ip->ip_dst));
                                 UNALIGNED_MEMCPY(&tha.dst, ip->ip_src,
-                                                 sizeof ip->ip_src);
+                                                 sizeof(ip->ip_src));
                                 tha.port = dport << 16 | sport;
                         } else {
                                 UNALIGNED_MEMCPY(&tha.dst, ip->ip_dst,
-                                                 sizeof ip->ip_dst);
+                                                 sizeof(ip->ip_dst));
                                 UNALIGNED_MEMCPY(&tha.src, ip->ip_src,
-                                                 sizeof ip->ip_src);
+                                                 sizeof(ip->ip_src));
                                 tha.port = sport << 16 | dport;
                         }
 
index 466af01f7314e2e1c35295ab4be1e97ad821b47c..6f624428bcee954ac1ac6a3e4de9d2520021436f 100644 (file)
@@ -81,8 +81,8 @@ signature_compute_hmac_md5(const uint8_t *text, int text_len, unsigned char *key
      */
 
     /* start out by storing key in pads */
-    memset(k_ipad, 0, sizeof k_ipad);
-    memset(k_opad, 0, sizeof k_opad);
+    memset(k_ipad, 0, sizeof(k_ipad));
+    memset(k_opad, 0, sizeof(k_opad));
     memcpy(k_ipad, key, key_len);
     memcpy(k_opad, key, key_len);
 
index 81321f7967c68788b3fb2807e86dc773fba593c4..f0505fe2a30e2ba4f22bf64785204fef64443ab7 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1327,7 +1327,7 @@ main(int argc, char **argv)
        /*
         * Initialize the netdissect code.
         */
-       if (nd_init(ebuf, sizeof ebuf) == -1)
+       if (nd_init(ebuf, sizeof(ebuf)) == -1)
                error("%s", ebuf);
 
        memset(ndo, 0, sizeof(*ndo));
@@ -1528,7 +1528,7 @@ main(int argc, char **argv)
 
                case 'm':
                        if (nd_have_smi_support()) {
-                               if (nd_load_smi_module(optarg, ebuf, sizeof ebuf) == -1)
+                               if (nd_load_smi_module(optarg, ebuf, sizeof(ebuf)) == -1)
                                        error("%s", ebuf);
                        } else {
                                (void)fprintf(stderr, "%s: ignoring option `-m %s' ",