Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r421 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtCore module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4646#include <qtextcodec.h>
    4747#endif
     48
    4849#include <qdatastream.h>
    4950#include <qlist.h>
     
    175176static int ucstrcmp(const QChar *a, int alen, const QChar *b, int blen)
    176177{
    177     if (a == b)
     178    if (a == b)
    178179        return 0;
    179180    int l = qMin(alen, blen);
     
    201202}
    202203
     204
     205
     206
     207
     208
     209
     210
     211
     212
     213
     214
     215
     216
     217
     218
     219
     220
     221
     222
     223
     224
     225
     226
     227
     228
     229
     230
     231
     232
     233
     234
     235
     236
     237
     238
     239
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
     260
     261
     262
     263
     264
     265
    203266
    204267/*!
     
    302365    \internal
    303366
    304     \ingroup text
     367    \ingroup
    305368
    306369    When you get an object of type QCharRef, if you can assign to it,
     
    324387    \ingroup tools
    325388    \ingroup shared
    326     \ingroup text
    327     \mainclass
     389    \ingroup
     390
    328391
    329392    QString stores a string of 16-bit \l{QChar}s, where each QChar
     
    607670    significant digits (trailing zeroes are omitted).
    608671
     672
     673
     674
     675
     676
     677
     678
     679
     680
     681
     682
     683
     684
     685
     686
     687
     688
     689
     690
     691
     692
     693
     694
     695
     696
     697
     698
     699
     700
     701
     702
     703
     704
     705
     706
     707
     708
     709
     710
     711
     712
     713
     714
     715
     716
     717
     718
     719
     720
     721
     722
     723
     724
     725
     726
     727
     728
     729
     730
     731
     732
     733
     734
     735
     736
     737
     738
     739
    609740    \sa fromRawData(), QChar, QLatin1String, QByteArray, QStringRef
    610741*/
     
    749880    \since 4.2
    750881
    751     Returns a copy of the \a string string encoded in ucs4.
     882    Returns a copy of the \a string, where the encoding of \a string depends on
     883    the size of wchar. If wchar is 4 bytes, the \a string is interpreted as ucs-4,
     884    if wchar is 2 bytes it is interpreted as ucs-2.
    752885
    753886    If \a size is -1 (default), the \a string has to be 0 terminated.
     
    838971    of the QChar array \a unicode.
    839972
    840     QString makes a deep copy of the string data.
     973    QString makes a deep copy of the string data. The unicode data is copied as
     974    is and the Byte Order Mark is preserved if present.
    841975*/
    842976QString::QString(const QChar *unicode, int size)
     
    850984    } else {
    851985        d = (Data*) qMalloc(sizeof(Data)+size*sizeof(QChar));
     986
    852987        d->ref = 1;
    853988        d->alloc = d->size = size;
     
    8731008    } else {
    8741009        d = (Data*) qMalloc(sizeof(Data)+size*sizeof(QChar));
     1010
    8751011        d->ref = 1;
    8761012        d->alloc = d->size = size;
     
    8861022}
    8871023
     1024
     1025
     1026
     1027
     1028
     1029
     1030
     1031
     1032
     1033
     1034
     1035
     1036
     1037
     1038
     1039
     1040
    8881041/*! \fn QString::QString(const QLatin1String &str)
    8891042
     
    8981051QString::QString(QChar ch)
    8991052{
    900     d = (Data *)qMalloc(sizeof(Data) + sizeof(QChar));
     1053    void *buf = qMalloc(sizeof(Data) + sizeof(QChar));
     1054    Q_CHECK_PTR(buf);
     1055    d = reinterpret_cast<Data *>(buf);
    9011056    d->ref = 1;
    9021057    d->alloc = d->size = 1;
     
    10681223    if (d->ref != 1 || d->data != d->array) {
    10691224        Data *x = static_cast<Data *>(qMalloc(sizeof(Data) + alloc * sizeof(QChar)));
    1070         if (!x)
    1071             return;
     1225        Q_CHECK_PTR(x);
    10721226        x->size = qMin(alloc, d->size);
    10731227        ::memcpy(x->array, d->data, x->size * sizeof(QChar));
     
    10911245        }
    10921246#endif
    1093         Data *x = static_cast<Data *>(qRealloc(d, sizeof(Data) + alloc * sizeof(QChar)));
    1094         if (!x)
    1095             return;
    1096         x->alloc = alloc;
    1097         x->data = x->array;
    1098         d = x;
     1247        d = static_cast<Data *>(q_check_ptr(qRealloc(d, sizeof(Data) + alloc * sizeof(QChar))));
     1248        d->alloc = alloc;
     1249        d->data = d->array;
    10991250    }
    11001251}
     
    12501401        // Part of me - take a copy
    12511402        ushort *tmp = static_cast<ushort *>(qMalloc(size * sizeof(QChar)));
     1403
    12521404        memcpy(tmp, s, size * sizeof(QChar));
    12531405        insert(i, reinterpret_cast<const QChar *>(tmp), size);
     
    14441596QString &QString::remove(int pos, int len)
    14451597{
    1446     if (pos < 0)
     1598    if (pos < 0)
    14471599        pos += d->size;
    14481600    if (pos < 0 || pos >= d->size) {
    14491601        // range problems
    1450     } else if (pos + len >= d->size) {  // pos ok
    1451         resize(pos);
     1602    } else if (
     1603        resize(pos);
    14521604    } else if (len > 0) {
    14531605        detach();
     
    16041756void QString::replace_helper(uint *indices, int nIndices, int blen, const QChar *after, int alen)
    16051757{
    1606     if (blen == alen) {
     1758    // copy *after in case it lies inside our own d->data area
     1759    // (which we could possibly invalidate via a realloc or corrupt via memcpy operations.)
     1760    QChar *afterBuffer = const_cast<QChar *>(after);
     1761    if (after >= reinterpret_cast<QChar *>(d->data) && after < reinterpret_cast<QChar *>(d->data) + d->size) {
     1762        afterBuffer = static_cast<QChar *>(qMalloc(alen*sizeof(QChar)));
     1763        Q_CHECK_PTR(afterBuffer);
     1764        ::memcpy(afterBuffer, after, alen*sizeof(QChar));
     1765    }
     1766
     1767    QT_TRY {
    16071768        detach();
    1608         for (int i = 0; i < nIndices; ++i)
    1609             memcpy(d->data + indices[i], after, alen * sizeof(QChar));
    1610     } else if (alen < blen) {
    1611         detach();
    1612         uint to = indices[0];
    1613         if (alen)
    1614             memcpy(d->data+to, after, alen*sizeof(QChar));
    1615         to += alen;
    1616         uint movestart = indices[0] + blen;
    1617         for (int i = 1; i < nIndices; ++i) {
    1618             int msize = indices[i] - movestart;
    1619             if (msize > 0) {
     1769        if (blen == alen) {
     1770            // replace in place
     1771            for (int i = 0; i < nIndices; ++i)
     1772                memcpy(d->data + indices[i], afterBuffer, alen * sizeof(QChar));
     1773        } else if (alen < blen) {
     1774            // replace from front
     1775            uint to = indices[0];
     1776            if (alen)
     1777                memcpy(d->data+to, after, alen*sizeof(QChar));
     1778            to += alen;
     1779            uint movestart = indices[0] + blen;
     1780            for (int i = 1; i < nIndices; ++i) {
     1781                int msize = indices[i] - movestart;
     1782                if (msize > 0) {
     1783                    memmove(d->data + to, d->data + movestart, msize * sizeof(QChar));
     1784                    to += msize;
     1785                }
     1786                if (alen) {
     1787                    memcpy(d->data + to, afterBuffer, alen*sizeof(QChar));
     1788                    to += alen;
     1789                }
     1790                movestart = indices[i] + blen;
     1791            }
     1792            int msize = d->size - movestart;
     1793            if (msize > 0)
    16201794                memmove(d->data + to, d->data + movestart, msize * sizeof(QChar));
    1621                 to += msize;
     1795            resize(d->size - nIndices*(blen-alen));
     1796        } else {
     1797            // replace from back
     1798            int adjust = nIndices*(alen-blen);
     1799            int newLen = d->size + adjust;
     1800            int moveend = d->size;
     1801            resize(newLen);
     1802
     1803            while (nIndices) {
     1804                --nIndices;
     1805                int movestart = indices[nIndices] + blen;
     1806                int insertstart = indices[nIndices] + nIndices*(alen-blen);
     1807                int moveto = insertstart + alen;
     1808                memmove(d->data + moveto, d->data + movestart,
     1809                        (moveend - movestart)*sizeof(QChar));
     1810                memcpy(d->data + insertstart, afterBuffer, alen*sizeof(QChar));
     1811                moveend = movestart-blen;
    16221812            }
    1623             if (alen) {
    1624                 memcpy(d->data + to, after, alen*sizeof(QChar));
    1625                 to += alen;
    1626             }
    1627             movestart = indices[i] + blen;
    16281813        }
    1629         int msize = d->size - movestart;
    1630         if (msize > 0)
    1631             memmove(d->data + to, d->data + movestart, msize * sizeof(QChar));
    1632         resize(d->size - nIndices*(blen-alen));
    1633     } else {
    1634         // we have a table of replacement positions, use them for fast replacing
    1635         int adjust = nIndices*(alen-blen);
    1636         int newLen = d->size + adjust;
    1637         int moveend = d->size;
    1638         resize(newLen);
    1639 
    1640         while (nIndices) {
    1641             --nIndices;
    1642             int movestart = indices[nIndices] + blen;
    1643             int insertstart = indices[nIndices] + nIndices*(alen-blen);
    1644             int moveto = insertstart + alen;
    1645             memmove(d->data + moveto, d->data + movestart,
    1646                     (moveend - movestart)*sizeof(QChar));
    1647             memcpy(d->data + insertstart, after, alen*sizeof(QChar));
    1648             moveend = movestart-blen;
    1649         }
    1650     }
     1814    } QT_CATCH(const std::bad_alloc &) {
     1815        if (afterBuffer != after)
     1816            qFree(afterBuffer);
     1817        QT_RETHROW;
     1818    }
     1819    if (afterBuffer != after)
     1820        qFree(afterBuffer);
    16511821}
    16521822
     
    16761846        return *this;
    16771847
    1678     // protect against before or after being part of this
    1679     const QChar *a = after;
    1680     const QChar *b = before;
    1681     if (after >= (const QChar *)d->data && after < (const QChar *)d->data + d->size) {
    1682         QChar *copy = (QChar *)malloc(alen*sizeof(QChar));
    1683         memcpy(copy, after, alen*sizeof(QChar));
    1684         a = copy;
    1685     }
    1686     if (before >= (const QChar *)d->data && before < (const QChar *)d->data + d->size) {
    1687         QChar *copy = (QChar *)malloc(blen*sizeof(QChar));
    1688         memcpy(copy, before, blen*sizeof(QChar));
    1689         b = copy;
    1690     }
    1691 
    1692     QStringMatcher matcher(b, blen, cs);
     1848    QStringMatcher matcher(before, blen, cs);
    16931849
    16941850    int index = 0;
     
    17091865            break;
    17101866
    1711         replace_helper(indices, pos, blen, a, alen);
     1867        replace_helper(indices, pos, blen, a, alen);
    17121868
    17131869        if (index == -1)
     
    17161872        index += pos*(alen-blen);
    17171873    }
    1718 
    1719     if (a != after)
    1720         ::free((QChar *)a);
    1721     if (b != before)
    1722         ::free((QChar *)b);
    17231874
    17241875    return *this;
     
    19122063bool QString::operator==(const QString &other) const
    19132064{
    1914     return (size() == other.size()) &&
    1915         (memcmp((char*)unicode(),(char*)other.unicode(), size()*sizeof(QChar))==0);
     2065    if (d->size != other.d->size)
     2066        return false;
     2067
     2068    return qMemEquals(d->data, other.d->data, d->size);
    19162069}
    19172070
     
    25342687
    25352688    int index = 0;
    2536     int numCaptures = rx2.numCaptures();
     2689    int numCaptures = rx2.();
    25372690    int al = after.length();
    25382691    QRegExp::CaretMode caretMode = QRegExp::CaretAtZero;
     
    31403293        return false;
    31413294    if (cs == Qt::CaseSensitive) {
    3142         return memcmp((char*)d->data, (char*)s.d->data, s.d->size*sizeof(QChar)) == 0;
     3295        return ;
    31433296    } else {
    31443297        uint last = 0;
     
    32113364        return false;
    32123365    if (cs == Qt::CaseSensitive) {
    3213         return memcmp((char*)&d->data[pos], (char*)s.d->data, s.d->size*sizeof(QChar)) == 0;
     3366        return ;
    32143367    } else {
    32153368        uint last = 0;
     
    33363489}
    33373490
    3338 #if !defined(Q_WS_MAC) && !defined(Q_OS_OS2)
     3491#if !defined(Q_WS_MAC) && !defined(Q_OS_OS2)
    33393492static QByteArray toLocal8Bit_helper(const QChar *data, int length)
    33403493{
     
    34543607            size = qstrlen(str);
    34553608        d = static_cast<Data *>(qMalloc(sizeof(Data) + size * sizeof(QChar)));
     3609
    34563610        d->ref = 1;
    34573611        d->alloc = d->size = size;
     
    34613615        d->array[size] = '\0';
    34623616        while (size--)
    3463            *i++ = (uchar)*str++;
     3617           *i++ = (uchar)*str++;
    34643618    }
    34653619    return d;
     
    35703724    QByteArray mb(4096, 0);
    35713725    int len;
    3572     while (!(len=WideCharToMultiByte(CP_ACP, 0, (const WCHAR*)ch, uclen,
     3726    while (!(len=WideCharToMultiByte(CP_ACP, 0, (const *)ch, uclen,
    35733727                mb.data(), mb.size()-1, 0, &used_def)))
    35743728    {
     
    35763730        if (r == ERROR_INSUFFICIENT_BUFFER) {
    35773731            mb.resize(1+WideCharToMultiByte(CP_ACP, 0,
    3578                                 (const WCHAR*)ch, uclen,
     3732                                (const *)ch, uclen,
    35793733                                0, 0, 0, &used_def));
    35803734                // and try again...
     
    35973751        return QString();
    35983752    const int wclen_auto = 4096;
    3599     WCHAR wc_auto[wclen_auto];
     3753    wc_auto[wclen_auto];
    36003754    int wclen = wclen_auto;
    3601     WCHAR *wc = wc_auto;
     3755    *wc = wc_auto;
    36023756    int len;
    36033757    while (!(len=MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
     
    36123766                wclen = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
    36133767                                    mb, mblen, 0, 0);
    3614                 wc = new WCHAR[wclen];
     3768                wc = new [wclen];
    36153769                // and try again...
    36163770            }
     
    36553809    if (size == 0 || (!*str && size < 0))
    36563810        return QLatin1String("");
    3657 #if defined(Q_OS_WIN32)
    3658     if(QSysInfo::WindowsVersion & QSysInfo::WV_DOS_based) {
    3659         return qt_winMB2QString(str, size);
    3660     }
    3661 #endif
    36623811#if !defined(QT_NO_TEXTCODEC)
    36633812    if (size < 0)
     
    37043853        size = qstrlen(str);
    37053854
    3706     QString result;
    3707     result.resize(size); // worst case
    3708     ushort *qch = result.d->data;
    3709     uint uc = 0;
    3710     uint min_uc = 0;
    3711     int need = 0;
    3712     int error = -1;
    3713     uchar ch;
    3714     int i = 0;
    3715 
    3716     // skip utf8-encoded byte order mark
    3717     if (size >= 3
    3718         && (uchar)str[0] == 0xef && (uchar)str[1] == 0xbb && (uchar)str[2] == 0xbf)
    3719         i += 3;
    3720 
    3721     for (; i < size; ++i) {
    3722         ch = str[i];
    3723         if (need) {
    3724             if ((ch&0xc0) == 0x80) {
    3725                 uc = (uc << 6) | (ch & 0x3f);
    3726                 need--;
    3727                 if (!need) {
    3728                     if (uc > 0xffffU && uc < 0x110000U) {
    3729                         // surrogate pair
    3730                         *qch++ = QChar::highSurrogate(uc);
    3731                         uc = QChar::lowSurrogate(uc);
    3732                     } else if ((uc < min_uc) || (uc >= 0xd800 && uc <= 0xdfff) || (uc >= 0xfffe)) {
    3733                         // overlong seqence, UTF16 surrogate or BOM
    3734                         uc = QChar::ReplacementCharacter;
    3735                     }
    3736                     *qch++ = uc;
    3737                 }
    3738             } else {
    3739                 i = error;
    3740                 need = 0;
    3741                 *qch++ = QChar::ReplacementCharacter;
    3742             }
    3743         } else {
    3744             if (ch < 128) {
    3745                 *qch++ = ch;
    3746             } else if ((ch & 0xe0) == 0xc0) {
    3747                 uc = ch & 0x1f;
    3748                 need = 1;
    3749                 error = i;
    3750                 min_uc = 0x80;
    3751             } else if ((ch & 0xf0) == 0xe0) {
    3752                 uc = ch & 0x0f;
    3753                 need = 2;
    3754                 error = i;
    3755                 min_uc = 0x800;
    3756             } else if ((ch&0xf8) == 0xf0) {
    3757                 uc = ch & 0x07;
    3758                 need = 3;
    3759                 error = i;
    3760                 min_uc = 0x10000;
    3761             } else {
    3762                 // Error
    3763                 *qch++ = QChar::ReplacementCharacter;
    3764             }
    3765         }
    3766     }
    3767     if (need) {
    3768         // we have some invalid characters remaining we need to add to the string
    3769         for (int i = error; i < size; ++i)
    3770             *qch++ = QChar::ReplacementCharacter;
    3771     }
    3772 
    3773     result.truncate(qch - result.d->data);
    3774     return result;
     3855    return QUtf8::convertToUnicode(str, size, 0);
    37753856}
    37763857
     
    37953876            ++size;
    37963877    }
    3797     return QString((const QChar *)unicode, size);
     3878    return Q);
    37983879}
    37993880
     
    38193900            ++size;
    38203901    }
    3821 
    3822     QString s;
    3823     s.resize(size*2); // worst case
    3824     ushort *uc = s.d->data;
    3825     for (int i = 0; i < size; ++i) {
    3826         uint u = unicode[i];
    3827         if (u > 0xffff) {
    3828             // decompose into a surrogate pair
    3829             *uc++ = QChar::highSurrogate(u);
    3830             u = QChar::lowSurrogate(u);
    3831         }
    3832         *uc++ = u;
    3833     }
    3834     s.resize(uc - s.d->data);
    3835     return s;
     3902    return QUtf32::convertToUnicode((const char *)unicode, size*4, 0);
    38363903}
    38373904
     
    38843951    if (d->size == 0)
    38853952        return *this;
    3886     QString result;
    3887     result.resize(d->size);
     3953    QString result(d->size, Qt::Uninitialized);
    38883954    const QChar *from = (const QChar*) d->data;
    38893955    const QChar *fromend = (const QChar*) from+d->size;
     
    45564622
    45574623#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
    4558     int res;
    4559     QT_WA({
    4560         const TCHAR* s1 = (TCHAR*)data1;
    4561         const TCHAR* s2 = (TCHAR*)data2;
    4562         res = CompareStringW(GetUserDefaultLCID(), 0, s1, length1, s2, length2);
    4563     } , {
    4564         QByteArray s1 = toLocal8Bit_helper(data1, length1);
    4565         QByteArray s2 = toLocal8Bit_helper(data2, length2);
    4566         res = CompareStringA(GetUserDefaultLCID(), 0, s1.data(), s1.length(), s2.data(), s2.length());
    4567     });
     4624    int res = CompareString(GetUserDefaultLCID(), 0, (wchar_t*)data1, length1, (wchar_t*)data2, length2);
    45684625
    45694626    switch (res) {
     
    47624819        const QUnicodeTables::Properties *prop = qGetProp(c);
    47634820        if (prop->lowerCaseDiff || prop->lowerCaseSpecial) {
    4764             QString s;
    4765             s.resize(d->size);
     4821            QString s(d->size, Qt::Uninitialized);
    47664822            memcpy(s.d->data, d->data, (p - d->data)*sizeof(ushort));
    47674823            ushort *pp = s.d->data + (p - d->data);
     
    48544910        const QUnicodeTables::Properties *prop = qGetProp(c);
    48554911        if (prop->upperCaseDiff || prop->upperCaseSpecial) {
    4856             QString s;
    4857             s.resize(d->size);
     4912            QString s(d->size, Qt::Uninitialized);
    48584913            memcpy(s.d->data, d->data, (p - d->data)*sizeof(ushort));
    48594914            ushort *pp = s.d->data + (p - d->data);
     
    60066061}
    60076062
     6063
    60086064/*!
    60096065    \overload
     
    60156071QString QString::normalized(QString::NormalizationForm mode, QChar::UnicodeVersion version) const
    60166072{
     6073
     6074
     6075
     6076
     6077
     6078
     6079
    60176080    bool simple = true;
    6018     for (int i = 0; i < d->size; ++i) {
    6019         if (d->data[i] >= 0x80) {
     6081    const QChar *p = data->constData();
     6082    int len = data->length();
     6083    for (int i = from; i < len; ++i) {
     6084        if (p[i].unicode() >= 0x80) {
    60206085            simple = false;
    60216086            break;
     
    60236088    }
    60246089    if (simple)
    6025         return *this;
    6026 
    6027     QString s = *this;
     6090        return;
     6091
     6092    QString ;
    60286093    if (version != CURRENT_VERSION) {
    60296094        for (int i = 0; i < NumNormalizationCorrections; ++i) {
    60306095            const NormalizationCorrection &n = uc_normalization_corrections[i];
    60316096            if (n.version > version) {
     6097
    60326098                if (n.ucs4 > 0xffff) {
    60336099                    ushort ucs4High = QChar::highSurrogate(n.ucs4);
     
    60356101                    ushort oldHigh = QChar::highSurrogate(n.old_mapping);
    60366102                    ushort oldLow = QChar::lowSurrogate(n.old_mapping);
    6037                     int pos = 0;
    6038                     while (pos < s.d->size - 1) {
    6039                         if (s.d->data[pos] == ucs4High && s.d->data[pos + 1] == ucs4Low) {
    6040                             s.detach();
    6041                             s.d->data[pos] = oldHigh;
    6042                             s.d->data[pos + 1] = oldLow;
     6103                    while (pos < s.length() - 1) {
     6104                        if (s.at(pos).unicode() == ucs4High && s.at(pos + 1).unicode() == ucs4Low) {
     6105                            s[pos] = oldHigh;
     6106                            s[pos + 1] = oldLow;
    60436107                            ++pos;
    60446108                        }
     
    60466110                    }
    60476111                } else {
    6048                     int pos = 0;
    6049                     while (pos < s.d->size) {
    6050                         if (s.d->data[pos] == n.ucs4) {
    6051                             s.detach();
    6052                             s.d->data[pos] = n.old_mapping;
     6112                    while (pos < s.length()) {
     6113                        if (s.at(pos).unicode() == n.ucs4) {
     6114                            s[pos] = n.old_mapping;
    60536115                        }
    60546116                        ++pos;
     
    60586120        }
    60596121    }
    6060     s = decomposeHelper(s, mode < QString::NormalizationForm_KD, version);
    6061 
    6062     s = canonicalOrderHelper(s, version);
     6122    );
     6123
     6124    );
    60636125
    60646126    if (mode == QString::NormalizationForm_D || mode == QString::NormalizationForm_KD)
    6065         return s;
    6066 
    6067     return composeHelper(s);
    6068 
     6127        return;
     6128
     6129    composeHelper(data, from);
    60696130}
    60706131
     
    61526213                     *qMax(abs_field_width, larg.length());
    61536214
    6154     QString result;
    6155     result.resize(result_len);
     6215    QString result(result_len, Qt::Uninitialized);
    61566216    QChar *result_buff = (QChar*) result.unicode();
    61576217
     
    64526512
    64536513    if (d.occurrences == 0) {
    6454         qWarning("QString::arg: Argument missing: %s, %lld", toLocal8Bit().data(), a);
     6514        qWarning(;
    64556515        return *this;
    64566516    }
     
    64956555
    64966556    if (d.occurrences == 0) {
    6497         qWarning("QString::arg: Argument missing: %s, %llu", toLocal8Bit().data(), a);
     6557        qWarning(;
    64986558        return *this;
    64996559    }
     
    68966956{
    68976957    Data *x = static_cast<Data *>(qMalloc(sizeof(Data)));
     6958
    68986959    if (unicode) {
    68996960        x->data = (ushort *)unicode;
     
    69126973    \brief The QLatin1String class provides a thin wrapper around an ASCII/Latin-1 encoded string literal.
    69136974
    6914     \ingroup text
     6975    \ingroup
    69156976    \reentrant
    69166977
     
    71747235
    71757236
    7176 #ifndef QT_NO_DATASTREAM
     7237#if
    71777238/*!
    71787239    \fn QDataStream &operator<<(QDataStream &stream, const QString &string)
     
    75347595    \reentrant
    75357596    \ingroup tools
    7536     \ingroup text
     7597    \ingroup
    75377598
    75387599    QStringRef provides a read-only subset of the QString API.
     
    77217782bool operator==(const QStringRef &s1,const QStringRef &s2)
    77227783{ return (s1.size() == s2.size() &&
    7723           (memcmp((char*)s1.unicode(), (char*)s2.unicode(), s1.size()*sizeof(QChar))==0)); }
     7784          qMemEquals((const ushort *)s1.unicode(), (const ushort *)s2.unicode(), s1.size()));
     7785}
    77247786
    77257787/*! \relates QStringRef
     
    77307792bool operator==(const QString &s1,const QStringRef &s2)
    77317793{ return (s1.size() == s2.size() &&
    7732           (memcmp((char*)s1.unicode(), (char*)s2.unicode(), s1.size()*sizeof(QChar))==0)); }
     7794          qMemEquals((const ushort *)s1.unicode(), (const ushort *)s2.unicode(), s1.size()));
     7795}
    77337796
    77347797/*! \relates QStringRef
Note: See TracChangeset for help on using the changeset viewer.