Change in libosmocore[master]: osmo_float_str_to_int: When using strtoll(), use LLONG_{MAX, MIN}

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Fri Oct 9 08:18:43 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/20501 )

Change subject: osmo_float_str_to_int: When using strtoll(), use LLONG_{MAX,MIN}
......................................................................

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
---
M src/utils.c
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  laforge: Looks good to me, approved; Verified
  Jenkins Builder: Verified



diff --git a/src/utils.c b/src/utils.c
index c0ab166..7fd7223 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1263,7 +1263,7 @@
 	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 @@
 		}
 		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;
 

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/20501
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I9c18ac237b4aacd56639d1faffa6841c8ad7b8da
Gerrit-Change-Number: 20501
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201009/f13f355e/attachment.htm>


More information about the gerrit-log mailing list