Changeset 635 for trunk/src


Ignore:
Timestamp:
Mar 5, 2010, 12:31:57 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

general: QLocale: Fixed broken tools builds.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/tools/qlocale.cpp

    r623 r635  
    372372static uint default_number_options = 0;
    373373
    374 #ifndef QT_NO_SYSTEMLOCALE
    375374static QByteArray envVarLocale()
    376375{
    377     static QByteArray lang = 0;
    378 #ifdef Q_OS_UNIX
     376    QByteArray lang;
     377#if defined(Q_OS_UNIX) || defined(Q_OS_OS2)
    379378    lang = qgetenv("LC_ALL");
     379#if defined(Q_OS_UNIX)
    380380    if (lang.isNull())
    381381        lang = qgetenv("LC_NUMERIC");
     382#endif
    382383    if (lang.isNull())
    383384#endif
     
    386387}
    387388
     389#if defined(Q_OS_OS2)
     390// Gets the system locale name. Also used by QString::localeAwareCompare() so
     391// must be available in QT_NO_SYSTEMLOCALE mode.
     392Q_CORE_EXPORT QString qt_system_locale_name()
     393{
     394    QString locale = QString::fromLatin1(envVarLocale());
     395    if (locale.isEmpty()) {
     396        // get the locale from the system country code
     397        COUNTRYCODE code = { 0, 0 };
     398        COUNTRYINFO info;
     399        ULONG actual;
     400        APIRET arc = DosQueryCtryInfo(sizeof(info), &code, &info, &actual);
     401        if (arc == NO_ERROR) {
     402            UniChar localeName[8];
     403            if (UniMapCtryToLocale(info.country, localeName,
     404                                   sizeof(localeName)) == ULS_SUCCESS)
     405                locale = QString::fromUtf16(localeName);
     406        }
     407    }
     408
     409    return locale;
     410}
     411#endif
     412
     413#ifndef QT_NO_SYSTEMLOCALE
    388414
    389415#if defined(Q_OS_WIN)
     
    944970** Wrappers for OS/2 locale system functions
    945971*/
    946 
    947 Q_CORE_EXPORT QString qt_system_locale_name()
    948 {
    949     QString locale = QString::fromLatin1(envVarLocale());
    950     if (locale.isEmpty()) {
    951         // get the locale from the system country code
    952         COUNTRYCODE code = { 0, 0 };
    953         COUNTRYINFO info;
    954         ULONG actual;
    955         APIRET arc = DosQueryCtryInfo(sizeof(info), &code, &info, &actual);
    956         if (arc == NO_ERROR) {
    957             UniChar localeName[8];
    958             if (UniMapCtryToLocale(info.country, localeName,
    959                                    sizeof(localeName)) == ULS_SUCCESS)
    960                 locale = QString::fromUtf16(localeName);
    961         }
    962     }
    963 
    964     return locale;
    965 }
    966972
    967973/*!
Note: See TracChangeset for help on using the changeset viewer.