diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-06-08 18:47:57 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-06-08 18:47:57 (GMT) |
commit | d7d55ab51381f5805d52523d98623e63a99db2cf (patch) | |
tree | 5b760b92f84bdb2137fe7d53e16d78c0693fd2f4 /src/corelib/tools/qstring.cpp | |
parent | c5de4176dac960d8f7c6d2d77b0d8bf3c7311da9 (diff) | |
parent | 2ae808a23ce05bf9768ad9df107c16bb0c555ee7 (diff) | |
download | Qt-d7d55ab51381f5805d52523d98623e63a99db2cf.zip Qt-d7d55ab51381f5805d52523d98623e63a99db2cf.tar.gz Qt-d7d55ab51381f5805d52523d98623e63a99db2cf.tar.bz2 |
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
tools/qdoc3/test/qt-html-templates.qdocconf
Diffstat (limited to 'src/corelib/tools/qstring.cpp')
-rw-r--r-- | src/corelib/tools/qstring.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index e1167fa..c8d641a 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -129,7 +129,7 @@ static inline bool qt_ends_with(const QChar *haystack, int haystackLen, static int ucstricmp(const ushort *a, const ushort *ae, const ushort *b, const ushort *be) { if (a == b) - return 0; + return (ae - be); if (a == 0) return 1; if (b == 0) @@ -141,7 +141,7 @@ static int ucstricmp(const ushort *a, const ushort *ae, const ushort *b, const u uint alast = 0; uint blast = 0; - while (a != e) { + while (a < e) { // qDebug() << hex << alast << blast; // qDebug() << hex << "*a=" << *a << "alast=" << alast << "folded=" << foldCase (*a, alast); // qDebug() << hex << "*b=" << *b << "blast=" << blast << "folded=" << foldCase (*b, blast); @@ -170,7 +170,7 @@ static int ucstricmp(const ushort *a, const ushort *ae, const uchar *b) if (b == 0) return -1; - while (a != ae && *b) { + while (a < ae && *b) { int diff = foldCase(*a) - foldCase(*b); if ((diff)) return diff; @@ -4665,9 +4665,12 @@ int QString::compare_helper(const QChar *data1, int length1, QLatin1String s2, return length1; if (cs == Qt::CaseSensitive) { - while (uc != e && *c && *uc == *c) + while (uc < e && *c && *uc == *c) uc++, c++; + if (uc == e) + return -*c; + return *uc - *c; } else { return ucstricmp(uc, e, c); @@ -7118,7 +7121,7 @@ QString QString::fromRawData(const QChar *unicode, int size) */ QString &QString::setRawData(const QChar *unicode, int size) { - if (d->ref != 1 || d->alloc) { + if (d->ref != 1 || (d->data == d->array && d->alloc)) { *this = fromRawData(unicode, size); } else { #ifdef QT3_SUPPORT |