Check for decimal separator inconsistency in wxLocale::GetInfo().
Under wxMSW it's possible to have mismatch between the CRT locale (used by various printf-related functions) and the system locale (queried by wxLocale::GetInfo()). Warn if such a mismatch occurs and tell people to use wxLocale instead of just setlocale() to change the locale. See #12970. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68861 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
94ed214db2
commit
0043f42027
@ -1442,7 +1442,23 @@ wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat)
|
||||
: LOCALE_SDECIMAL,
|
||||
buf,
|
||||
WXSIZEOF(buf)) )
|
||||
{
|
||||
str = buf;
|
||||
|
||||
// As we get our decimal point separator from Win32 and not the
|
||||
// CRT there is a possibility of mismatch between them and this
|
||||
// can easily happen if the user code called setlocale()
|
||||
// instead of using wxLocale to change the locale. And this can
|
||||
// result in very strange bugs elsewhere in the code as the
|
||||
// assumptions that formatted strings do use the decimal
|
||||
// separator actually fail, so check for it here.
|
||||
wxASSERT_MSG
|
||||
(
|
||||
wxString::Format("%.3f", 1.23).find(str) != wxString::npos,
|
||||
"Decimal separator mismatch -- did you use setlocale()?"
|
||||
"If so, use wxLocale to change the locale instead."
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
case wxLOCALE_SHORT_DATE_FMT:
|
||||
|
Loading…
Reference in New Issue
Block a user