1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Fix #1062 - Always use C locale for parsing coords in airport database

This commit is contained in:
Jon Beniston 2021-11-29 10:18:22 +00:00
parent bb99edddc1
commit 259e0ad6da

View File

@ -24,6 +24,7 @@
#include <QHash> #include <QHash>
#include <QList> #include <QList>
#include <QDebug> #include <QDebug>
#include <QLocale>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -84,6 +85,7 @@ struct AirportInformation {
FILE *file; FILE *file;
QByteArray utfFilename = filename.toUtf8(); QByteArray utfFilename = filename.toUtf8();
QLocale cLocale(QLocale::C);
if ((file = fopen(utfFilename.constData(), "r")) != NULL) if ((file = fopen(utfFilename.constData(), "r")) != NULL)
{ {
char row[2048]; char row[2048];
@ -170,21 +172,21 @@ struct AirportInformation {
latitudeString = p; latitudeString = p;
latitudeLen = strlen(latitudeString)-1; latitudeLen = strlen(latitudeString)-1;
latitudeString[latitudeLen] = '\0'; latitudeString[latitudeLen] = '\0';
latitude = atof(latitudeString); latitude = cLocale.toFloat(latitudeString);
} }
else if (idx == longitudeCol) else if (idx == longitudeCol)
{ {
longitudeString = p; longitudeString = p;
longitudeLen = strlen(longitudeString)-1; longitudeLen = strlen(longitudeString)-1;
longitudeString[longitudeLen] = '\0'; longitudeString[longitudeLen] = '\0';
longitude = atof(longitudeString); longitude = cLocale.toFloat(longitudeString);
} }
else if (idx == elevationCol) else if (idx == elevationCol)
{ {
elevationString = p; elevationString = p;
elevationLen = strlen(elevationString)-1; elevationLen = strlen(elevationString)-1;
elevationString[elevationLen] = '\0'; elevationString[elevationLen] = '\0';
elevation = atof(elevationString); elevation = cLocale.toFloat(elevationString);
} }
p = strtok(NULL, ","); p = strtok(NULL, ",");
idx++; idx++;