Another tweak.

This commit is contained in:
Daniel Lemire 2020-10-21 17:10:06 -04:00
parent 609c48c2a2
commit 903c1f1c31
3 changed files with 3 additions and 3 deletions

View File

@ -32,7 +32,7 @@ template <typename T> char *to_string(T d, char *buffer) {
void strtod_from_string(const char * st, float& d) { void strtod_from_string(const char * st, float& d) {
char *pr = (char *)st; char *pr = (char *)st;
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
d = cygwin_strtod_l(st, &pr, c_locale); d = cygwin_strtod_l(st, &pr);
#elif defined(_WIN32) #elif defined(_WIN32)
static _locale_t c_locale = _create_locale(LC_ALL, "C"); static _locale_t c_locale = _create_locale(LC_ALL, "C");
d = _strtof_l(st, &pr, c_locale); d = _strtof_l(st, &pr, c_locale);

View File

@ -123,7 +123,7 @@ std::pair<float, bool> strtof_from_string(char *st) {
float d; float d;
char *pr; char *pr;
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
d = cygwin_strtod_l(st, &pr, c_locale); d = cygwin_strtod_l(st, &pr);
#elif defined(_WIN32) #elif defined(_WIN32)
static _locale_t c_locale = _create_locale(LC_ALL, "C"); static _locale_t c_locale = _create_locale(LC_ALL, "C");
d = _strtof_l(st, &pr, c_locale); d = _strtof_l(st, &pr, c_locale);

View File

@ -86,7 +86,7 @@ template <>
void strtod_from_string(const std::string &st, float& d) { void strtod_from_string(const std::string &st, float& d) {
char *pr = (char *)st.data(); char *pr = (char *)st.data();
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) #if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
d = cygwin_strtod_l(st, &pr, c_locale); d = cygwin_strtod_l(st, &pr);
#elif defined(_WIN32) #elif defined(_WIN32)
static _locale_t c_locale = _create_locale(LC_ALL, "C"); static _locale_t c_locale = _create_locale(LC_ALL, "C");
d = _strtof_l(st.data(), &pr, c_locale); d = _strtof_l(st.data(), &pr, c_locale);