cli: Adjust integer range check, replace magic numbers with constants
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 23 Apr 2019 14:03:34 +0000 (10:03 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 2 May 2019 04:12:55 +0000 (00:12 -0400)
commitbe03ae39eb6ef52c2a262e7b1e26a553b8e09d78
treefacd201104ce1a5a3334ccbe6a0027e5e6c51b93
parent6c1bb54d11fb0c686d5b37d6c71939dd3673c408
cli: Adjust integer range check, replace magic numbers with constants

The value (1ULL << 63) - 1), used for checking that integer values are
within range, actually mean INT64_MAX, so use that instead.

Also, the negative case is not quite right: the value -(INT64_MAX + 1),
-9223372036854775808, is within the range of a signed 64-bits number
(assuming two's complement), but is not accepted right now.  Adjust the
check so it accepts that value.

I tested this patch manually: we accept  -9223372036854775808 but reject
-9223372036854775809.

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
cli/babeltrace-cfg-cli-args.c
This page took 0.027035 seconds and 5 git commands to generate.