mirror of https://github.com/ecmwf/eccodes.git
Tools: Check overflow/underflow (Fix)
This commit is contained in:
parent
7b0a779890
commit
87d14a89b8
|
@ -1749,8 +1749,7 @@ static void set_value(grib_values* value, char* str, int equal)
|
|||
value->long_value = strtol(buf, &p, 10);
|
||||
if (*p == 0) {
|
||||
// check the conversion from string to long
|
||||
if ((errno == ERANGE && (value->long_value == LONG_MAX || value->long_value == LONG_MIN)) ||
|
||||
(errno != 0 && value->long_value == 0)) {
|
||||
if (errno == ERANGE && (value->long_value == LONG_MAX || value->long_value == LONG_MIN)) {
|
||||
fprintf(stderr, "ECCODES WARNING : Setting %s=%s causes overflow/underflow\n", value->name, buf);
|
||||
fprintf(stderr, "ECCODES WARNING : Value adjusted to %ld\n", value->long_value);
|
||||
//perror("strtol");
|
||||
|
|
Loading…
Reference in New Issue