mirror of https://gerrit.osmocom.org/libosmocore
osmo_float_str_to_int: When using strtoll(), use LLONG_{MAX,MIN}
When we use strtoll(), the return type is "long long" and we cannot compare against LONG_MAX and LONG_MIN but must compare against LLONG_MAX and LLONG_MIN. Change-Id: I9c18ac237b4aacd56639d1faffa6841c8ad7b8da Closes: OS#4787
This commit is contained in:
parent
f445150c57
commit
cb11a60d25
|
@ -1263,7 +1263,7 @@ int osmo_float_str_to_int(int64_t *val, const char *str, unsigned int precision)
|
|||
if (!point || point > str) {
|
||||
errno = 0;
|
||||
integer = strtoll(str, &endptr, 10);
|
||||
if ((errno == ERANGE && (integer == LONG_MAX || integer == LONG_MIN))
|
||||
if ((errno == ERANGE && (integer == LLONG_MAX || integer == LLONG_MIN))
|
||||
|| (errno != 0 && integer == 0))
|
||||
return -ERANGE;
|
||||
|
||||
|
@ -1295,7 +1295,7 @@ int osmo_float_str_to_int(int64_t *val, const char *str, unsigned int precision)
|
|||
}
|
||||
errno = 0;
|
||||
decimal = strtoll(decimal_str + skip_digits, &endptr, 10);
|
||||
if ((errno == ERANGE && (decimal == LONG_MAX || decimal == LONG_MIN))
|
||||
if ((errno == ERANGE && (decimal == LLONG_MAX || decimal == LLONG_MIN))
|
||||
|| (errno != 0 && decimal == 0))
|
||||
return -ERANGE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue