From 4f9b965ff19d77514b47935a21bf926b6426babb Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 10 Jun 2008 18:22:32 +0000 Subject: [PATCH] use locale-dependent decimal separator in our wxStrtod() implementation (recloses #8740) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@54071 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/wxchar.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/common/wxchar.cpp b/src/common/wxchar.cpp index 449bc89f95..d1ab3cf838 100644 --- a/src/common/wxchar.cpp +++ b/src/common/wxchar.cpp @@ -2023,13 +2023,19 @@ WXDLLEXPORT const wxChar *wxStrstr(const wxChar *haystack, const wxChar *needle) WXDLLEXPORT double wxStrtod(const wxChar *nptr, wxChar **endptr) { + const wxChar decSep( +#if wxUSE_INTL + wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER)[0] +#else + _T('.') +#endif + ); const wxChar *start = nptr; - // FIXME: only correct for C locale while (wxIsspace(*nptr)) nptr++; if (*nptr == wxT('+') || *nptr == wxT('-')) nptr++; while (wxIsdigit(*nptr)) nptr++; - if (*nptr == wxT('.')) { + if (*nptr == decSep) { nptr++; while (wxIsdigit(*nptr)) nptr++; } @@ -2040,7 +2046,7 @@ WXDLLEXPORT double wxStrtod(const wxChar *nptr, wxChar **endptr) } wxString data(start, nptr-start); - wxWX2MBbuf dat = data.mb_str(wxConvLibc); + const wxWX2MBbuf dat = data.mb_str(wxConvLibc); char *rdat = wxMBSTRINGCAST dat; double ret = strtod(dat, &rdat); @@ -2053,7 +2059,6 @@ WXDLLEXPORT long int wxStrtol(const wxChar *nptr, wxChar **endptr, int base) { const wxChar *start = nptr; - // FIXME: only correct for C locale while (wxIsspace(*nptr)) nptr++; if (*nptr == wxT('+') || *nptr == wxT('-')) nptr++; if (((base == 0) || (base == 16)) &&