Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1062 - Use C locale when parsing airport/navaid files #1065

Merged
merged 2 commits into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions plugins/channelrx/demodadsb/ourairportsdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <QHash>
#include <QList>
#include <QDebug>
#include <QLocale>

#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -84,6 +85,7 @@ struct AirportInformation {

FILE *file;
QByteArray utfFilename = filename.toUtf8();
QLocale cLocale(QLocale::C);
if ((file = fopen(utfFilename.constData(), "r")) != NULL)
{
char row[2048];
Expand Down Expand Up @@ -170,21 +172,21 @@ struct AirportInformation {
latitudeString = p;
latitudeLen = strlen(latitudeString)-1;
latitudeString[latitudeLen] = '\0';
latitude = atof(latitudeString);
latitude = cLocale.toFloat(latitudeString);
}
else if (idx == longitudeCol)
{
longitudeString = p;
longitudeLen = strlen(longitudeString)-1;
longitudeString[longitudeLen] = '\0';
longitude = atof(longitudeString);
longitude = cLocale.toFloat(longitudeString);
}
else if (idx == elevationCol)
{
elevationString = p;
elevationLen = strlen(elevationString)-1;
elevationString[elevationLen] = '\0';
elevation = atof(elevationString);
elevation = cLocale.toFloat(elevationString);
}
p = strtok(NULL, ",");
idx++;
Expand Down
7 changes: 4 additions & 3 deletions plugins/channelrx/demodvor/navaid.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ struct NavAid {

FILE *file;
QByteArray utfFilename = filename.toUtf8();
QLocale cLocale(QLocale::C);
if ((file = fopen(utfFilename.constData(), "r")) != NULL)
{
char row[2048];
Expand Down Expand Up @@ -298,21 +299,21 @@ struct NavAid {
latitudeString = p;
latitudeLen = strlen(latitudeString)-1;
latitudeString[latitudeLen] = '\0';
latitude = atof(latitudeString);
latitude = cLocale.toFloat(latitudeString);
}
else if (idx == longitudeCol)
{
longitudeString = p;
longitudeLen = strlen(longitudeString)-1;
longitudeString[longitudeLen] = '\0';
longitude = atof(longitudeString);
longitude = cLocale.toFloat(longitudeString);
}
else if (idx == elevationCol)
{
elevationString = p;
elevationLen = strlen(elevationString)-1;
elevationString[elevationLen] = '\0';
elevation = atof(elevationString);
elevation = cLocale.toFloat(elevationString);
}
else if ((idx == powerCol) && (p[0] == '\"'))
{
Expand Down
10 changes: 8 additions & 2 deletions plugins/channelrx/demodvor/vordemodgui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>110</y>
<y>80</y>
<width>391</width>
<height>140</height>
<height>141</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -424,6 +424,12 @@
</property>
<item>
<widget class="QTableWidget" name="vorData">
<property name="minimumSize">
<size>
<width>0</width>
<height>140</height>
</size>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
Expand Down
7 changes: 4 additions & 3 deletions plugins/feature/vorlocalizer/navaid.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ struct NavAid {

FILE *file;
QByteArray utfFilename = filename.toUtf8();
QLocale cLocale(QLocale::C);
if ((file = fopen(utfFilename.constData(), "r")) != NULL)
{
char row[2048];
Expand Down Expand Up @@ -297,21 +298,21 @@ struct NavAid {
latitudeString = p;
latitudeLen = strlen(latitudeString)-1;
latitudeString[latitudeLen] = '\0';
latitude = atof(latitudeString);
latitude = cLocale.toFloat(latitudeString);
}
else if (idx == longitudeCol)
{
longitudeString = p;
longitudeLen = strlen(longitudeString)-1;
longitudeString[longitudeLen] = '\0';
longitude = atof(longitudeString);
longitude = cLocale.toFloat(longitudeString);
}
else if (idx == elevationCol)
{
elevationString = p;
elevationLen = strlen(elevationString)-1;
elevationString[elevationLen] = '\0';
elevation = atof(elevationString);
elevation = cLocale.toFloat(elevationString);
}
else if ((idx == powerCol) && (p[0] == '\"'))
{
Expand Down