Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/corelib/tools/qlocale.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    8282#include <time.h>
    8383
    84 #if defined(Q_OS_LINUX) && !defined(__UCLIBC__)
     84#if defined() && !defined(__UCLIBC__)
    8585#    include <fenv.h>
    8686#endif
     
    134134#endif
    135135
     136
     137
     138
     139
     140
    136141/******************************************************************************
    137142** Helpers for accessing Qt locale database
     
    175180
    176181// Assumes that code is a
    177 // QChar code[2];
     182// QChar code[];
    178183static QLocale::Country codeToCountry(const QChar *code)
    179184{
    180185    ushort uc1 = code[0].unicode();
    181186    ushort uc2 = code[1].unicode();
     187
    182188
    183189    const unsigned char *c = country_code_list;
    184     for (; *c != 0; c += 2) {
    185         if (uc1 == c[0] && uc2 == c[1])
    186             return QLocale::Country((c - country_code_list)/2);
     190    for (; *c != 0; c += ) {
     191        if (uc1 == c[0] && uc2 == c[1])
     192            return QLocale::Country((c - country_code_list)/);
    187193    }
    188194
     
    212218        return QString();
    213219
    214     QString code(2, Qt::Uninitialized);
    215     const unsigned char *c = country_code_list + 2*(uint(country));
     220    const unsigned char *c = country_code_list + 3*(uint(country));
     221
     222    QString code(c[2] == 0 ? 2 : 3, Qt::Uninitialized);
     223
    216224    code[0] = ushort(c[0]);
    217225    code[1] = ushort(c[1]);
     226
     227
     228
    218229    return code;
    219230}
     
    251262    for (int i = 0; i < 3; ++i)
    252263        lang_begin[i] = 0;
    253     for (int i = 0; i < 2; ++i)
     264    for (int i = 0; i < ; ++i)
    254265        cntry_begin[i] = 0;
    255266
     
    282293            case 1:
    283294                // parsing country
    284                 if (cntry - cntry_begin == 2) {
     295                if (cntry - cntry_begin == ) {
    285296                    cntry_begin[0] = 0;
    286297                    break;
     
    306317
    307318    QChar lang_code[3];
    308     QChar cntry_code[2];
     319    QChar cntry_code[];
    309320    if (!splitLocaleName(name, lang_code, cntry_code))
    310321        return;
     
    450461        result = envVarLocale();
    451462        QChar lang[3];
    452         QChar cntry[2];
     463        QChar cntry[];
    453464        if ( result == "C" || (!result.isEmpty()
    454465                && splitLocaleName(QString::fromLocal8Bit(result), lang, cntry)) ) {
     
    496507                result += QLatin1String("''");
    497508            else
    498                 result += QLatin1Char('\'') + text + QLatin1Char('\'');
     509                result += Q);
    499510            continue;
    500511        }
     
    712723    case DateTimeFormatLong:
    713724    case DateTimeFormatShort:
    714         return query(type == DateTimeFormatLong ? DateFormatLong : DateFormatShort).toString()
    715             + QLatin1Char(' ') + query(type == DateTimeFormatLong ? TimeFormatLong : TimeFormatShort).toString();
     725        return query(type == DateTimeFormatLong ? DateFormatLong : DateFormatShort).toString()
     726            + QLatin1Char(' ') + query(type == DateTimeFormatLong ? TimeFormatLong : TimeFormatShort).toString();
    716727    case DayNameLong:
    717728    case DayNameShort:
     
    729740    case DateTimeToStringLong: {
    730741        const QDateTime dt = in.toDateTime();
    731         return winDateToString(dt.date(), type == DateTimeToStringShort ? DATE_SHORTDATE : DATE_LONGDATE)
    732             + QLatin1Char(' ') + winTimeToString(dt.time()); }
     742        return winDateToString(dt.date(), type == DateTimeToStringShort ? DATE_SHORTDATE : DATE_LONGDATE)
     743            + QLatin1Char(' ') + winTimeToString(dt.time()); }
    733744
    734745    case ZeroDigit:
     
    11961207
    11971208    QChar lang[3];
    1198     QChar cntry[2];
     1209    QChar cntry[];
    11991210    if (result.isEmpty() || result != "C"
    12001211            && !splitLocaleName(QString::fromLocal8Bit(result), lang, cntry)) {
     
    14661477    case CountryId: {
    14671478        QString preferredLanguage;
    1468         QString preferredCountry;
     1479        QString preferredCountry
    14691480        getMacPreferredLanguageAndCountry(&preferredLanguage, &preferredCountry);
    14701481        QLocale::Language languageCode = (preferredLanguage.isEmpty() ? QLocale::C : codeToLanguage(preferredLanguage.data()));
     
    16581669    if (_systemLocale)
    16591670        return _systemLocale;
     1671
     1672
     1673
    16601674    return QSystemLocale_globalSystemLocale();
    16611675}
     
    16671681        system_lp = globalLocalePrivate();
    16681682    *system_lp = *sys_locale->fallbackLocale().d();
     1683
     1684
     1685
     1686
    16691687
    16701688    QVariant res = sys_locale->query(QSystemLocale::LanguageId, QVariant());
     
    18081826    \endlist
    18091827
    1810     The "C" locale is identical in behavior to \l{English}/\l{UnitedStates}.
    1811 
    18121828    Use language() and country() to determine the actual language and
    18131829    country values used.
     
    18211837    pair; it does not use the system locale database.
    18221838
    1823     QLocale's data is based on Common Locale Data Repository v1.6.1.
     1839    QLocale's data is based on Common Locale Data Repository v1..1.
    18241840
    18251841    The double-to-string and string-to-double conversion functions are
     
    20222038    \value Tyap
    20232039    \value Chewa
     2040
     2041
     2042
     2043
     2044
     2045
     2046
     2047
     2048
     2049
     2050
     2051
     2052
     2053
     2054
     2055
     2056
     2057
     2058
     2059
     2060
     2061
     2062
     2063
     2064
     2065
     2066
     2067
     2068
     2069
     2070
     2071
     2072
     2073
     2074
     2075
     2076
     2077
     2078
     2079
     2080
     2081
     2082
     2083
     2084
     2085
     2086
     2087
     2088
    20242089    \omitvalue LastLanguage
    20252090
     
    22742339    \value Zambia
    22752340    \value Zimbabwe
     2341
     2342
     2343
     2344
     2345
     2346
    22762347    \omitvalue LastCountry
    22772348
     
    31683239QDateTime QLocale::toDateTime(const QString &string, FormatType format) const
    31693240{
    3170     return toDateTime(string, dateFormat(format));
     3241    return toDateTime(string, dateFormat(format));
    31713242}
    31723243#endif
     
    33983469    formats specified in the system configuration panel.
    33993470
    3400     \sa QTextCodec::locale() c()
     3471    \sa c()
    34013472*/
    34023473
     
    36543725    return meas;
    36553726}
     3727
     3728
     3729
     3730
     3731
     3732
     3733
     3734
     3735
     3736
     3737
     3738
     3739
     3740
     3741
     3742
     3743
     3744
     3745
    36563746
    36573747/*!
     
    45444634    const bool scientific = numMode == DoubleScientificMode;
    45454635    bool lastWasE = false;
     4636
    45464637    int eCnt = 0;
    45474638    int decPointCnt = 0;
     
    45584649                    return false;
    45594650            }
     4651
    45604652        } else {
    45614653            switch (c) {
     
    45954687
    45964688                case ',':
    4597                     return false;
     4689                    //it can only be placed after a digit which is before the decimal point
     4690                    if (!lastWasDigit || decPointCnt > 0)
     4691                        return false;
     4692                    break;
    45984693
    45994694                case 'e':
     
    46134708                    return false;
    46144709            }
     4710
    46154711        }
    46164712
    46174713        lastWasE = c == 'e';
    4618         buff->append(c);
     4714        if (c != ',')
     4715            buff->append(c);
    46194716    }
    46204717
     
    67886885#endif
    67896886
    6790 #if defined(Q_OS_LINUX) && !defined(__UCLIBC__)
     6887#if defined() && !defined(__UCLIBC__)
    67916888    fenv_t envp;
    67926889    feholdexcept(&envp);
     
    68046901#endif //Q_OS_WIN
    68056902
    6806 #if defined(Q_OS_LINUX) && !defined(__UCLIBC__)
     6903#if defined() && !defined(__UCLIBC__)
    68076904    fesetenv(&envp);
    68086905#endif
     
    74597556Q_CORE_EXPORT double qstrtod(const char *s00, const char **se, bool *ok)
    74607557{
     7558
    74617559    double ret = strtod((char*)s00, (char**)se);
    74627560    if (ok) {
Note: See TracChangeset for help on using the changeset viewer.