Skip to content

Commit cd9fabb

Browse files
committed
test wchar_t for location inputs
1 parent dcbe2c7 commit cd9fabb

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/geotools.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ bool GeoTools::coordinates_to_lat_lon(wxString& coord, wxString& lat, wxString&
6868
bool is_numeric = true;
6969

7070
std::locale loc{ "" };
71-
char decimal_symbol = std::use_facet< std::numpunct<char> >(loc).decimal_point();
71+
wchar_t decimal_symbol = std::use_facet< std::numpunct<wchar_t> >(loc).decimal_point();
7272

7373
/*
7474
for (int i = 0; i < str.Length(); i++) {
@@ -164,15 +164,15 @@ bool GeoTools::coordinate_to_dms(wxString& coord, double* d, double* m, double*
164164
{
165165

166166
std::locale loc{ "" };
167-
char decimal_symbol = std::use_facet< std::numpunct<char> >(loc).decimal_point();
167+
wchar_t decimal_symbol = std::use_facet< std::numpunct<wchar_t> >(loc).decimal_point();
168168

169169
wxString str = coord.Lower();
170170
str.Replace("north", "n");
171171
str.Replace("south", "s");
172172
str.Replace("east", "e");
173173
str.Replace("west", "w");
174174

175-
char c_prev = ' ';
175+
wchar_t c_prev = ' ';
176176
int n = 0;
177177
std::string num = "";
178178
int sign = 1;
@@ -397,6 +397,8 @@ bool GeoTools::TimeZoneBing(const double* lat, const double* lon, double* tz, bo
397397
}
398398
}
399399

400+
return success;
401+
400402
}
401403

402404
// Geocode using NREL Developer API (MapQuest) for NREL builds of SAM
@@ -486,8 +488,8 @@ bool GeoTools::GeocodeDeveloper(const wxString& address, double* lat, double* lo
486488
wxMessageBox(rapidjson::GetParseError_En(ok.Code()), "geocode developer parse error ");
487489
}
488490

489-
// if geocode was successful, get timezone
490-
if (success) {
491+
// if geocode was successful and tz , get timezone
492+
if (success && tz!=0) {
491493
success = GeoTools::TimeZoneBing(lat, lon, tz, showprogress);
492494
}
493495

0 commit comments

Comments
 (0)