From: Guy Harris Date: Fri, 29 Jul 2016 20:00:48 +0000 (-0700) Subject: Use PRIx64 to print a 64-bit number in hex. X-Git-Tag: tcpdump-4.8.0-bp~1^2 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/174b3ec974cf30a02328193c5ef50d2ed56afa91 Use PRIx64 to print a 64-bit number in hex. "lx" doesn't work on ILP32 or LLP64 platforms. --- diff --git a/print-hncp.c b/print-hncp.c index cca45f54..7bcc7494 100644 --- a/print-hncp.c +++ b/print-hncp.c @@ -151,7 +151,7 @@ format_256(const u_char *data) static char buf[4][64+5]; static int i = 0; i = (i + 1) % 4; - snprintf(buf[i], 28, "%016lx%016lx%016lx%016lx", + snprintf(buf[i], 28, "%016" PRIx64 "%016" PRIx64 "%016" PRIx64 "%016" PRIx64, EXTRACT_64BITS(data), EXTRACT_64BITS(data + 8), EXTRACT_64BITS(data + 16), @@ -467,7 +467,7 @@ hncp_print_rec(netdissect_options *ndo, if (bodylen != 8) goto invalid; hash = EXTRACT_64BITS(value); - ND_PRINT((ndo, " hash: %016lx", hash)); + ND_PRINT((ndo, " hash: %016" PRIx64, hash)); } break; @@ -481,7 +481,7 @@ hncp_print_rec(netdissect_options *ndo, sequence_number = EXTRACT_32BITS(value + 4); time = format_interval(EXTRACT_32BITS(value + 8)); hash = EXTRACT_64BITS(value + 12); - ND_PRINT((ndo, " NID: %s seqno: %u %s hash: %016lx", + ND_PRINT((ndo, " NID: %s seqno: %u %s hash: %016" PRIx64, node_identifier, sequence_number, time,