Skip to content

Commit

Permalink
nmea parsing: call strtod with locale "C" (fixes #6687)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jan 4, 2013
1 parent 9385ac9 commit b75c89b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/gps/tok.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit b75c89b

Please sign in to comment.