From: Guy Harris Date: Sun, 11 Aug 2019 19:23:36 +0000 (-0700) Subject: More use of %zu to print sizeof values. X-Git-Tag: tcpdump-4.99-bp~702 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/b1e5f800b368548e4cd47169a514209e62637f5d More use of %zu to print sizeof values. --- diff --git a/print-cfm.c b/print-cfm.c index 971c9600..63d58e39 100644 --- a/print-cfm.c +++ b/print-cfm.c @@ -341,8 +341,8 @@ cfm_print(netdissect_options *ndo, case CFM_OPCODE_CCM: msg_ptr.cfm_ccm = (const struct cfm_ccm_t *)tptr; if (first_tlv_offset < sizeof(*msg_ptr.cfm_ccm)) { - ND_PRINT(" (too small 1, must be >= %lu)", - (unsigned long) sizeof(*msg_ptr.cfm_ccm)); + ND_PRINT(" (too small 1, must be >= %zu)", + sizeof(*msg_ptr.cfm_ccm)); return; } if (tlen < sizeof(*msg_ptr.cfm_ccm)) @@ -471,8 +471,8 @@ cfm_print(netdissect_options *ndo, case CFM_OPCODE_LTM: msg_ptr.cfm_ltm = (const struct cfm_ltm_t *)tptr; if (first_tlv_offset < sizeof(*msg_ptr.cfm_ltm)) { - ND_PRINT(" (too small 4, must be >= %lu)", - (unsigned long) sizeof(*msg_ptr.cfm_ltm)); + ND_PRINT(" (too small 4, must be >= %zu)", + sizeof(*msg_ptr.cfm_ltm)); return; } if (tlen < sizeof(*msg_ptr.cfm_ltm)) @@ -494,8 +494,8 @@ cfm_print(netdissect_options *ndo, case CFM_OPCODE_LTR: msg_ptr.cfm_ltr = (const struct cfm_ltr_t *)tptr; if (first_tlv_offset < sizeof(*msg_ptr.cfm_ltr)) { - ND_PRINT(" (too small 5, must be >= %lu)", - (unsigned long) sizeof(*msg_ptr.cfm_ltr)); + ND_PRINT(" (too small 5, must be >= %zu)", + sizeof(*msg_ptr.cfm_ltr)); return; } if (tlen < sizeof(*msg_ptr.cfm_ltr)) diff --git a/print-isoclns.c b/print-isoclns.c index 6bbe75c3..176279c1 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -1763,9 +1763,9 @@ isis_print_tlv_ip_reach(netdissect_options *ndo, while (length > 0) { if ((size_t)length < sizeof(*tlv_ip_reach)) { - ND_PRINT("short IPv4 Reachability (%u vs %lu)", + ND_PRINT("short IPv4 Reachability (%u vs %zu)", length, - (unsigned long)sizeof(*tlv_ip_reach)); + sizeof(*tlv_ip_reach)); return (0); } @@ -2435,8 +2435,8 @@ isis_print(netdissect_options *ndo, case ISIS_PDU_L1_LAN_IIH: case ISIS_PDU_L2_LAN_IIH: if (fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_IIH_LAN_HEADER_SIZE)) { - ND_PRINT(", bogus fixed header length %u should be %lu", - fixed_len, (unsigned long)(ISIS_COMMON_HEADER_SIZE+ISIS_IIH_LAN_HEADER_SIZE)); + ND_PRINT(", bogus fixed header length %u should be %zu", + fixed_len, ISIS_COMMON_HEADER_SIZE+ISIS_IIH_LAN_HEADER_SIZE); return (0); } ND_TCHECK_SIZE(header_iih_lan); @@ -2480,8 +2480,8 @@ isis_print(netdissect_options *ndo, case ISIS_PDU_PTP_IIH: if (fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_IIH_PTP_HEADER_SIZE)) { - ND_PRINT(", bogus fixed header length %u should be %lu", - fixed_len, (unsigned long)(ISIS_COMMON_HEADER_SIZE+ISIS_IIH_PTP_HEADER_SIZE)); + ND_PRINT(", bogus fixed header length %u should be %zu", + fixed_len, ISIS_COMMON_HEADER_SIZE+ISIS_IIH_PTP_HEADER_SIZE); return (0); } ND_TCHECK_SIZE(header_iih_ptp); @@ -2521,8 +2521,8 @@ isis_print(netdissect_options *ndo, case ISIS_PDU_L1_LSP: case ISIS_PDU_L2_LSP: if (fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_LSP_HEADER_SIZE)) { - ND_PRINT(", bogus fixed header length %u should be %lu", - fixed_len, (unsigned long)ISIS_LSP_HEADER_SIZE); + ND_PRINT(", bogus fixed header length %u should be %zu", + fixed_len, ISIS_LSP_HEADER_SIZE); return (0); } ND_TCHECK_SIZE(header_lsp); @@ -2579,8 +2579,8 @@ isis_print(netdissect_options *ndo, case ISIS_PDU_L1_CSNP: case ISIS_PDU_L2_CSNP: if (fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_CSNP_HEADER_SIZE)) { - ND_PRINT(", bogus fixed header length %u should be %lu", - fixed_len, (unsigned long)(ISIS_COMMON_HEADER_SIZE+ISIS_CSNP_HEADER_SIZE)); + ND_PRINT(", bogus fixed header length %u should be %zu", + fixed_len, ISIS_COMMON_HEADER_SIZE+ISIS_CSNP_HEADER_SIZE); return (0); } ND_TCHECK_SIZE(header_csnp); @@ -2617,8 +2617,8 @@ isis_print(netdissect_options *ndo, case ISIS_PDU_L1_PSNP: case ISIS_PDU_L2_PSNP: if (fixed_len != (ISIS_COMMON_HEADER_SIZE+ISIS_PSNP_HEADER_SIZE)) { - ND_PRINT("- bogus fixed header length %u should be %lu", - fixed_len, (unsigned long)(ISIS_COMMON_HEADER_SIZE+ISIS_PSNP_HEADER_SIZE)); + ND_PRINT("- bogus fixed header length %u should be %zu", + fixed_len, ISIS_COMMON_HEADER_SIZE+ISIS_PSNP_HEADER_SIZE); return (0); } ND_TCHECK_SIZE(header_psnp); diff --git a/print-ospf.c b/print-ospf.c index eeb7c40d..c7491617 100644 --- a/print-ospf.c +++ b/print-ospf.c @@ -517,8 +517,8 @@ ospf_print_lshdr(netdissect_options *ndo, ND_TCHECK_2(lshp->ls_length); ls_length = GET_BE_U_2(lshp->ls_length); if (ls_length < sizeof(struct lsa_hdr)) { - ND_PRINT("\n\t Bogus length %u < header (%lu)", ls_length, - (unsigned long)sizeof(struct lsa_hdr)); + ND_PRINT("\n\t Bogus length %u < header (%zu)", ls_length, + sizeof(struct lsa_hdr)); return(-1); } diff --git a/print-rsvp.c b/print-rsvp.c index 17dd7358..c1efc1de 100644 --- a/print-rsvp.c +++ b/print-rsvp.c @@ -698,8 +698,8 @@ rsvp_obj_print(netdissect_options *ndo, return -1; } if(rsvp_obj_len < sizeof(struct rsvp_object_header)) { - ND_PRINT("%sERROR: object header too short %u < %lu", indent, rsvp_obj_len, - (unsigned long)sizeof(struct rsvp_object_header)); + ND_PRINT("%sERROR: object header too short %u < %zu", indent, rsvp_obj_len, + sizeof(struct rsvp_object_header)); return -1; } @@ -1921,8 +1921,8 @@ rsvp_print(netdissect_options *ndo, GET_BE_U_2(rsvp_com_header->checksum)); if (tlen < sizeof(struct rsvp_common_header)) { - ND_PRINT("ERROR: common header too short %u < %lu", tlen, - (unsigned long)sizeof(struct rsvp_common_header)); + ND_PRINT("ERROR: common header too short %u < %zu", tlen, + sizeof(struct rsvp_common_header)); return; } @@ -1969,8 +1969,8 @@ rsvp_print(netdissect_options *ndo, GET_BE_U_2(rsvp_com_header->checksum)); if (subtlen < sizeof(struct rsvp_common_header)) { - ND_PRINT("ERROR: common header too short %u < %lu", subtlen, - (unsigned long)sizeof(struct rsvp_common_header)); + ND_PRINT("ERROR: common header too short %u < %zu", subtlen, + sizeof(struct rsvp_common_header)); return; } diff --git a/print-slow.c b/print-slow.c index dc364cec..1eb4c96a 100644 --- a/print-slow.c +++ b/print-slow.c @@ -388,8 +388,8 @@ slow_marker_lacp_print(netdissect_options *ndo, /* length includes the type and length fields */ if (tlv_len < sizeof(struct tlv_header_t)) { - ND_PRINT("\n\t ERROR: illegal length - should be >= %lu", - (unsigned long) sizeof(struct tlv_header_t)); + ND_PRINT("\n\t ERROR: illegal length - should be >= %zu", + sizeof(struct tlv_header_t)); return; } @@ -409,8 +409,8 @@ slow_marker_lacp_print(netdissect_options *ndo, case ((SLOW_PROTO_LACP << 8) + LACP_TLV_PARTNER_INFO): if (tlv_tlen != sizeof(struct lacp_tlv_actor_partner_info_t)) { - ND_PRINT("\n\t ERROR: illegal length - should be %lu", - (unsigned long) (sizeof(struct tlv_header_t) + sizeof(struct lacp_tlv_actor_partner_info_t))); + ND_PRINT("\n\t ERROR: illegal length - should be %zu", + sizeof(struct tlv_header_t) + sizeof(struct lacp_tlv_actor_partner_info_t)); goto badlength; } @@ -432,8 +432,8 @@ slow_marker_lacp_print(netdissect_options *ndo, case ((SLOW_PROTO_LACP << 8) + LACP_TLV_COLLECTOR_INFO): if (tlv_tlen != sizeof(struct lacp_tlv_collector_info_t)) { - ND_PRINT("\n\t ERROR: illegal length - should be %lu", - (unsigned long) (sizeof(struct tlv_header_t) + sizeof(struct lacp_tlv_collector_info_t))); + ND_PRINT("\n\t ERROR: illegal length - should be %zu", + sizeof(struct tlv_header_t) + sizeof(struct lacp_tlv_collector_info_t)); goto badlength; } @@ -447,8 +447,8 @@ slow_marker_lacp_print(netdissect_options *ndo, case ((SLOW_PROTO_MARKER << 8) + MARKER_TLV_MARKER_INFO): if (tlv_tlen != sizeof(struct marker_tlv_marker_info_t)) { - ND_PRINT("\n\t ERROR: illegal length - should be %lu", - (unsigned long) (sizeof(struct tlv_header_t) + sizeof(struct marker_tlv_marker_info_t))); + ND_PRINT("\n\t ERROR: illegal length - should be %zu", + sizeof(struct tlv_header_t) + sizeof(struct marker_tlv_marker_info_t)); goto badlength; } @@ -575,8 +575,8 @@ slow_oam_print(netdissect_options *ndo, if (GET_U_1(tlv.slow_oam_info->info_length) != sizeof(struct slow_oam_info_t)) { - ND_PRINT("\n\t ERROR: illegal length - should be %lu", - (unsigned long) sizeof(struct slow_oam_info_t)); + ND_PRINT("\n\t ERROR: illegal length - should be %zu", + sizeof(struct slow_oam_info_t)); hexdump = TRUE; goto badlength_code_info; } @@ -676,8 +676,8 @@ slow_oam_print(netdissect_options *ndo, if (GET_U_1(tlv.slow_oam_link_event->event_length) != sizeof(struct slow_oam_link_event_t)) { - ND_PRINT("\n\t ERROR: illegal length - should be %lu", - (unsigned long) sizeof(struct slow_oam_link_event_t)); + ND_PRINT("\n\t ERROR: illegal length - should be %zu", + sizeof(struct slow_oam_link_event_t)); hexdump = TRUE; goto badlength_event_notif; } diff --git a/print-tcp.c b/print-tcp.c index d5c5f6d6..3310b9e9 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -227,8 +227,8 @@ tcp_print(netdissect_options *ndo, hlen = TH_OFF(tp) * 4; if (hlen < sizeof(*tp)) { - ND_PRINT(" tcp %u [bad hdr length %u - too short, < %lu]", - length - hlen, hlen, (unsigned long)sizeof(*tp)); + ND_PRINT(" tcp %u [bad hdr length %u - too short, < %zu]", + length - hlen, hlen, sizeof(*tp)); return; }