mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 01:18:38 -05:00
Merge pull request #1065 from srcejon/fix_1062
Fix #1062 - Use C locale when parsing airport/navaid files
This commit is contained in:
commit
a8d81b1458
@ -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++;
|
||||||
|
@ -198,6 +198,7 @@ struct NavAid {
|
|||||||
|
|
||||||
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];
|
||||||
@ -298,21 +299,21 @@ struct NavAid {
|
|||||||
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);
|
||||||
}
|
}
|
||||||
else if ((idx == powerCol) && (p[0] == '\"'))
|
else if ((idx == powerCol) && (p[0] == '\"'))
|
||||||
{
|
{
|
||||||
|
@ -392,9 +392,9 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>110</y>
|
<y>80</y>
|
||||||
<width>391</width>
|
<width>391</width>
|
||||||
<height>140</height>
|
<height>141</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -424,6 +424,12 @@
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableWidget" name="vorData">
|
<widget class="QTableWidget" name="vorData">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>140</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="editTriggers">
|
<property name="editTriggers">
|
||||||
<set>QAbstractItemView::NoEditTriggers</set>
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
</property>
|
</property>
|
||||||
|
@ -197,6 +197,7 @@ struct NavAid {
|
|||||||
|
|
||||||
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];
|
||||||
@ -297,21 +298,21 @@ struct NavAid {
|
|||||||
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);
|
||||||
}
|
}
|
||||||
else if ((idx == powerCol) && (p[0] == '\"'))
|
else if ((idx == powerCol) && (p[0] == '\"'))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user