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)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:39 +0000 (18:19 -0400)
commit4b25c966d289b4473375bdc8754c88c8c5760f70
treef14d270d593ace56ee6bef9676480552a611cbba
parente24a0c1bd5b916b40a74f3183aa58ed93206b398
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.026767 seconds and 4 git commands to generate.