Skip to content

Commit f6e1d93

Browse files
committed
Another tweak.
1 parent 903c1f1 commit f6e1d93

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/string_test.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,32 +69,32 @@ void strtod_from_string(const std::string &st, T& d);
6969

7070
template <>
7171
void strtod_from_string(const std::string &st, double& d) {
72-
char *pr = (char *)st.data();
72+
char *pr = (char *)st.c_str();
7373
#ifdef _WIN32
7474
static _locale_t c_locale = _create_locale(LC_ALL, "C");
75-
d = _strtod_l(st.data(), &pr, c_locale);
75+
d = _strtod_l(st.c_str(), &pr, c_locale);
7676
#else
7777
static locale_t c_locale = newlocale(LC_ALL_MASK, "C", NULL);
78-
d = strtod_l(st.data(), &pr, c_locale);
78+
d = strtod_l(st.c_str(), &pr, c_locale);
7979
#endif
80-
if (pr == st.data()) {
80+
if (pr == st.c_str()) {
8181
throw std::runtime_error("bug in strtod_from_string");
8282
}
8383
}
8484

8585
template <>
8686
void strtod_from_string(const std::string &st, float& d) {
87-
char *pr = (char *)st.data();
87+
char *pr = (char *)st.c_str();
8888
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
89-
d = cygwin_strtod_l(st, &pr);
89+
d = cygwin_strtod_l(st.c_str(), &pr);
9090
#elif defined(_WIN32)
9191
static _locale_t c_locale = _create_locale(LC_ALL, "C");
92-
d = _strtof_l(st.data(), &pr, c_locale);
92+
d = _strtof_l(st.c_str(), &pr, c_locale);
9393
#else
9494
static locale_t c_locale = newlocale(LC_ALL_MASK, "C", NULL);
95-
d = strtof_l(st.data(), &pr, c_locale);
95+
d = strtof_l(st.c_str(), &pr, c_locale);
9696
#endif
97-
if (pr == st.data()) {
97+
if (pr == st.c_str()) {
9898
throw std::runtime_error("bug in strtod_from_string");
9999
}
100100
}

0 commit comments

Comments
 (0)