From: Guy Harris Date: Tue, 17 Jan 2017 23:25:35 +0000 (-0800) Subject: Use INT32_MIN to check for the smallest possible 32-bit signed value. X-Git-Tag: tcpdump-4.9.0-bp~2 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/8ca206d7049537ec2e1c9d5830da1161e68de1ec Use INT32_MIN to check for the smallest possible 32-bit signed value. -2147483648 provokes warnings, for various reasons involving the definition of a constant in C, the rules of picking the type of a constant, and the rules for determining the type of an expression involving an integral value and the - operator. (Note that -2147483648isn't a decimal-constant in C90 or C99, as a decimal-constant can't contain a -. Therefore, it's a constant expression, consisting of the - operator applied to the constant 2147483648.) So we use INT32_MIN, which should at least make an effort to avoid those warnings. --- diff --git a/util-print.c b/util-print.c index 68f98887..5db042a3 100644 --- a/util-print.c +++ b/util-print.c @@ -425,7 +425,7 @@ signed_relts_print(netdissect_options *ndo, { if (secs < 0) { ND_PRINT((ndo, "-")); - if (secs == -2147483648) { + if (secs == INT32_MIN) { /* * -2^31; you can't fit its absolute value into * a 32-bit signed integer.