Skip to content
Permalink
Browse files
nmea parsing: call strtod with locale "C" (fixes #6687)
  • Loading branch information
jef-n committed Jan 4, 2013
1 parent 9385ac9 commit b75c89b81a9c7364a843adbac70502431d02dc3f
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/core/gps/tok.c
@@ -34,6 +34,7 @@
#include <ctype.h>
#include <string.h>
#include <limits.h>
#include <locale.h>

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

return res;

0 comments on commit b75c89b

Please sign in to comment.