From e330a9bb44fd5deb86a46934b2b45c1ad1f9f70a Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 9 Oct 2020 15:22:49 +0200 Subject: Replace fallbackUiLocaleData() with fallbackUiLocaleIndex() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This means always initializing globalLocaleData from an entry in the locale_data array, where in principle the fallbackUiLocale() could be the system locale, which isn't held in the array. However, no actual implementation of fallbackUiLocale() uses the system locale (nor is it clear this would work if one did). Change-Id: Ie1c5ef3e8a97f21e0d82fa2dfb3cf3eb9e4c8840 Reviewed-by: Thiago Macieira Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Andrei Golubev --- src/corelib/text/qlocale.cpp | 2 +- src/corelib/text/qlocale_p.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 6253766fd5..15a65f2203 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -651,7 +651,7 @@ static void updateSystemPrivate() sys_locale->query(QSystemLocale::LocaleChanged); // Populate global with fallback as basis: - globalLocaleData = *sys_locale->fallbackUiLocaleData(); + globalLocaleData = locale_data[sys_locale->fallbackUiLocaleIndex()]; QVariant res = sys_locale->query(QSystemLocale::LanguageId); if (!res.isNull()) { diff --git a/src/corelib/text/qlocale_p.h b/src/corelib/text/qlocale_p.h index 96b4c4c4a0..6367bb1fda 100644 --- a/src/corelib/text/qlocale_p.h +++ b/src/corelib/text/qlocale_p.h @@ -129,7 +129,7 @@ public: virtual QVariant query(QueryType type, QVariant in = QVariant()) const; virtual QLocale fallbackUiLocale() const; - inline const QLocaleData *fallbackUiLocaleData() const; + inline uint fallbackUiLocaleIndex() const; private: QSystemLocale(bool); friend class QSystemLocaleSingleton; @@ -438,7 +438,7 @@ public: }; #ifndef QT_NO_SYSTEMLOCALE -const QLocaleData *QSystemLocale::fallbackUiLocaleData() const { return fallbackUiLocale().d->m_data; } +uint QSystemLocale::fallbackUiLocaleIndex() const { return fallbackUiLocale().d->m_index; } #endif template <> -- cgit v1.2.3