]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use INT32_MIN to check for the smallest possible 32-bit signed value.
authorGuy Harris <[email protected]>
Tue, 17 Jan 2017 23:25:35 +0000 (15:25 -0800)
committerFrancois-Xavier Le Bail <[email protected]>
Wed, 18 Jan 2017 08:16:42 +0000 (09:16 +0100)
-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.

util-print.c

index 68f988873770874b229bb3d8cb277e8530316dc2..5db042a3475017e6c40210fffe5b4aaa8107268f 100644 (file)
@@ -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.