From 259e0ad6da910576d881a6ab9dfa7a2cb2e1302e Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Mon, 29 Nov 2021 10:18:22 +0000 Subject: [PATCH 1/2] Fix #1062 - Always use C locale for parsing coords in airport database --- plugins/channelrx/demodadsb/ourairportsdb.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/channelrx/demodadsb/ourairportsdb.h b/plugins/channelrx/demodadsb/ourairportsdb.h index f41e1a2ab..94ddec3df 100644 --- a/plugins/channelrx/demodadsb/ourairportsdb.h +++ b/plugins/channelrx/demodadsb/ourairportsdb.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -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]; @@ -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++; From a65604c973602c9df85a84b66684ccc10c2537ad Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Mon, 29 Nov 2021 10:38:52 +0000 Subject: [PATCH 2/2] Use C locale in navaid parsing in VOR demods. Increase table size in VOR demod GUI so more than one row is visible. --- plugins/channelrx/demodvor/navaid.h | 7 ++++--- plugins/channelrx/demodvor/vordemodgui.ui | 10 ++++++++-- plugins/feature/vorlocalizer/navaid.h | 7 ++++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/plugins/channelrx/demodvor/navaid.h b/plugins/channelrx/demodvor/navaid.h index 6eaefcce5..0394255af 100644 --- a/plugins/channelrx/demodvor/navaid.h +++ b/plugins/channelrx/demodvor/navaid.h @@ -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]; @@ -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] == '\"')) { diff --git a/plugins/channelrx/demodvor/vordemodgui.ui b/plugins/channelrx/demodvor/vordemodgui.ui index e5bd844f3..c70091b44 100644 --- a/plugins/channelrx/demodvor/vordemodgui.ui +++ b/plugins/channelrx/demodvor/vordemodgui.ui @@ -392,9 +392,9 @@ 0 - 110 + 80 391 - 140 + 141 @@ -424,6 +424,12 @@ + + + 0 + 140 + + QAbstractItemView::NoEditTriggers diff --git a/plugins/feature/vorlocalizer/navaid.h b/plugins/feature/vorlocalizer/navaid.h index 0dc8bbf35..1ac7419f6 100644 --- a/plugins/feature/vorlocalizer/navaid.h +++ b/plugins/feature/vorlocalizer/navaid.h @@ -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]; @@ -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] == '\"')) {