QSystemLocale/Win: use LOCALE_RETURN_NUMBER to get numbers

Instead of parsing from a QString, which actually recurses back into
QSystemLocale.

Change-Id: I3c79b7e08fa346988dfefffd171f9b78e1d8d6ce
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 05e7d09eb373454c67219cc8f7e4b7226ec7f52e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2022-10-19 16:15:30 -07:00 committed by Qt Cherry-pick Bot
parent 78d3fa1036
commit 12326702e5

View File

@ -182,10 +182,11 @@ QVariant QSystemLocalePrivate::getLocaleInfo(LCTYPE type)
int QSystemLocalePrivate::getLocaleInfo_int(LCTYPE type)
{
const QString str = getLocaleInfo(type).toString();
bool ok = false;
const int v = str.toInt(&ok);
return ok ? v : 0;
DWORD value;
int r = GetLocaleInfo(lcid, type | LOCALE_RETURN_NUMBER,
reinterpret_cast<wchar_t *>(&value),
sizeof(value) / sizeof(wchar_t));
return r == sizeof(value) / sizeof(wchar_t) ? value : 0;
}
QSystemLocalePrivate::SubstitutionType QSystemLocalePrivate::substitution()