From 12326702e528f60fb0254fd397c8a4f352ae3236 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 19 Oct 2022 16:15:30 -0700 Subject: [PATCH] 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 (cherry picked from commit 05e7d09eb373454c67219cc8f7e4b7226ec7f52e) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qlocale_win.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp index 44e2d84785c..23944d04dd8 100644 --- a/src/corelib/text/qlocale_win.cpp +++ b/src/corelib/text/qlocale_win.cpp @@ -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(&value), + sizeof(value) / sizeof(wchar_t)); + return r == sizeof(value) / sizeof(wchar_t) ? value : 0; } QSystemLocalePrivate::SubstitutionType QSystemLocalePrivate::substitution()