Skip to content

Commit b75c89b

Browse files
committedJan 4, 2013
nmea parsing: call strtod with locale "C" (fixes #6687)
1 parent 9385ac9 commit b75c89b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎src/core/gps/tok.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <ctype.h>
3535
#include <string.h>
3636
#include <limits.h>
37+
#include <locale.h>
3738

3839
#define NMEA_TOKS_COMPARE (1)
3940
#define NMEA_TOKS_PERCENT (2)
@@ -86,7 +87,10 @@ double nmea_atof( const char *str, int str_sz )
8687
{
8788
memcpy( &buff[0], str, str_sz );
8889
buff[str_sz] = '\0';
90+
const char *oldlocale = setlocale( LC_NUMERIC, NULL );
91+
setlocale( LC_NUMERIC, "C" );
8992
res = strtod( &buff[0], &tmp_ptr );
93+
setlocale( LC_NUMERIC, oldlocale );
9094
}
9195

9296
return res;

0 commit comments

Comments
 (0)
Please sign in to comment.