Changeset 11096 in ntrip
- Timestamp:
- Oct 16, 2026, 3:37:24 PM (61 minutes ago)
- Location:
- trunk/BNC/src
- Files:
-
- 3 edited
-
bncutils.cpp (modified) (1 diff)
-
pppCrdFile.cpp (modified) (3 diffs)
-
satObs.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bncutils.cpp
r11057 r11096 317 317 const QString& ggaType) { 318 318 319 double lat = strtod(latitude,NULL); 320 double lon = strtod(longitude,NULL); 321 double hei = strtod(height,NULL); 319 // QByteArray::toDouble() always uses the C locale - unlike strtod(), 320 // which follows LC_NUMERIC (set by Qt from the environment) 321 double lat = latitude.toDouble(); 322 double lon = longitude.toDouble(); 323 double hei = height.toDouble(); 322 324 QString sentences = "GPGGA,"; 323 325 if (ggaType.contains("GNGGA")) { -
trunk/BNC/src/pppCrdFile.cpp
r11027 r11096 43 43 #include <cstdlib> 44 44 #include <fstream> 45 #include <locale> 45 46 #include <sstream> 46 47 #include "pppCrdFile.h" … … 63 64 double sign = (d < 0.0) ? -1.0 : 1.0; 64 65 return sign * (fabs(d) + m / 60.0 + s / 3600.0); 66 } 67 68 // Convert a number token independent of the process locale: atof() follows 69 // LC_NUMERIC, which Qt sets from the environment, so with e.g. a German 70 // locale "123.7785" would be read as 123. 71 ////////////////////////////////////////////////////////////////////////////// 72 static double toDouble(const string& str) { 73 istringstream in(str); 74 in.imbue(locale::classic()); 75 double value = 0.0; 76 in >> value; 77 return value; 65 78 } 66 79 … … 133 146 } 134 147 else if (token.compare(0, 2, "H:") == 0) { 135 hgt = atof(token.substr(2).c_str());148 hgt = toDouble(token.substr(2)); 136 149 haveHgt = true; 137 150 } 138 151 else if (token.compare(0, 6, "EPOCH:") == 0) { 139 staInfo._epoch = atof(token.substr(6).c_str());152 staInfo._epoch = toDouble(token.substr(6)); 140 153 } 141 154 else if (token.compare(0, 4, "VEL:") == 0) { -
trunk/BNC/src/satObs.cpp
r11047 r11096 3 3 #include <sstream> 4 4 #include <cstdlib> 5 #include <limits> 5 6 #include <newmatio.h> 6 7 … … 604 605 string valStr; // may be "nan" (invalid value), which operator>> can't parse 605 606 in >> valStr; 606 frqAntenna._nadirAngleCorrection.push_back(strtod(valStr.c_str(), 0)); 607 // not strtod(): it follows LC_NUMERIC, QByteArray::toDouble() the C locale 608 frqAntenna._nadirAngleCorrection.push_back(valStr.find("nan") != string::npos ? std::numeric_limits<double>::quiet_NaN() 609 : QByteArray(valStr.c_str()).toDouble()); 607 610 } 608 611 satAntenna._freq.push_back(frqAntenna);
Note:
See TracChangeset
for help on using the changeset viewer.
