From c786e0cd3c40193073ce2f59f98a4d83bbe1a9b9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 14 Feb 2010 08:34:14 +0100 Subject: Don't use QSystemLocale if QT_NO_SYSTEMLOCALE (like QWS) Reviewed-By: Trust Me --- src/corelib/tools/qlocale.cpp | 63 +++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index dd41154..9625228 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -1324,12 +1324,10 @@ QVariant QSystemLocale::query(QueryType /* type */, QVariant /* in */) const #endif -#ifndef QT_NO_SYSTEMLOCALE static QSystemLocale *_systemLocale = 0; Q_GLOBAL_STATIC_WITH_ARGS(QSystemLocale, QSystemLocale_globalSystemLocale, (true)) static QLocalePrivate *system_lp = 0; Q_GLOBAL_STATIC(QLocalePrivate, globalLocalePrivate) -#endif /****************************************************************************** ** Default system locale behavior @@ -1425,36 +1423,7 @@ static const QSystemLocale *systemLocale() return QSystemLocale_globalSystemLocale(); } -// returns the private data for the system locale. Cached data will not be -// initialized until the updateSystemPrivate is called. -static const QLocalePrivate *systemPrivate() -{ -#ifndef QT_NO_SYSTEMLOCALE - if (!system_lp) { - system_lp = globalLocalePrivate(); - // mark the locale as uninitialized system locale - system_lp->m_language_id = 0; - } - return system_lp; -#else - return locale_data; -#endif -} - -#ifndef QT_NO_SYSTEMLOCALE -static const QLocalePrivate *maybeSystemPrivate() -{ - return system_lp; -} -#endif - -static const QLocalePrivate *defaultPrivate() -{ - if (!default_lp) - default_lp = systemPrivate(); - return default_lp; -} - +static const QLocalePrivate *maybeSystemPrivate(); bool QLocalePrivate::isUninitializedSystemLocale() const { return this == maybeSystemPrivate() && m_language_id == 0; @@ -1516,6 +1485,36 @@ void QLocalePrivate::updateSystemPrivate() } #endif +// returns the private data for the system locale. Cached data will not be +// initialized until the updateSystemPrivate is called. +static const QLocalePrivate *systemPrivate() +{ +#ifndef QT_NO_SYSTEMLOCALE + if (!system_lp) { + system_lp = globalLocalePrivate(); + // mark the locale as uninitialized system locale + system_lp->m_language_id = 0; + } + return system_lp; +#else + return locale_data; +#endif +} + +#ifndef QT_NO_SYSTEMLOCALE +static const QLocalePrivate *maybeSystemPrivate() +{ + return system_lp; +} +#endif + +static const QLocalePrivate *defaultPrivate() +{ + if (!default_lp) + default_lp = systemPrivate(); + return default_lp; +} + static QString getLocaleListData(const ushort *data, int size, int index) { static const ushort separator = ';'; -- cgit v0.12