From 8bf13294819d57468a85a6bd2646b3467932bbb4 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 19 May 2020 13:42:56 +0200 Subject: [PATCH] libmm-glib,helpers: use locale-independent strtod() Otherwise parsing may fail, e.g. as in this unit test: # Start of smoni tests # DEBUG: testing SMONI response: ^SMONI: 2G,71,-61,262,02,0143,83BA,33,33,3,6,G,NOCONN # DEBUG: testing SMONI response: ^SMONI: 2G,SEARCH,SEARCH # DEBUG: testing SMONI response: ^SMONI: 2G,673,-89,262,07,4EED,A500,16,16,7,4,G,5,-107,LIMSRV # DEBUG: testing SMONI response: ^SMONI: 2G,673,-80,262,07,4EED,A500,35,35,7,4,G,643,4,0,-80,0,S_FR # DEBUG: testing SMONI response: ^SMONI: 3G,10564,296,-7.5,-79,262,02,0143,00228FF,-92,-78,NOCONN ** ERROR:cinterion/tests/test-modem-helpers-cinterion.c:1036:test_smoni_response: assertion failed (fabs (ecn0 - smoni_response_tests[i].ecn0) < 0.1): (0,5 < 0,1) Bail out! ERROR:cinterion/tests/test-modem-helpers-cinterion.c:1036:test_smoni_response: assertion failed (fabs (ecn0 - smoni_response_tests[i].ecn0) < 0.1): (0,5 < 0,1) Aborted (core dumped) --- libmm-glib/mm-common-helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmm-glib/mm-common-helpers.c b/libmm-glib/mm-common-helpers.c index d2c54a1c..da1cc1cc 100644 --- a/libmm-glib/mm-common-helpers.c +++ b/libmm-glib/mm-common-helpers.c @@ -1565,7 +1565,7 @@ mm_get_double_from_str (const gchar *str, return FALSE; errno = 0; - num = strtod (str, NULL); + num = g_ascii_strtod (str, NULL); if (!errno) { *out = num; return TRUE;