diff options
author | Casper van Donderen <casper.vandonderen@nokia.com> | 2011-08-31 08:14:28 (GMT) |
---|---|---|
committer | Casper van Donderen <casper.vandonderen@nokia.com> | 2011-08-31 08:14:28 (GMT) |
commit | 9c5f08452da280a90de48d0fa3862748cc428df4 (patch) | |
tree | 38e6d4192e6fcf4e807727e05d4508ecb9ecedde /src/corelib | |
parent | 76d680844382ea24d40caaf9e0349e7b5af69ada (diff) | |
parent | 1e48d40597bbe12321a5a3e42b3595dc17a7f8e7 (diff) | |
download | Qt-9c5f08452da280a90de48d0fa3862748cc428df4.zip Qt-9c5f08452da280a90de48d0fa3862748cc428df4.tar.gz Qt-9c5f08452da280a90de48d0fa3862748cc428df4.tar.bz2 |
Merge remote branch 'mainline/4.8'
Conflicts:
tools/qdoc3/cppcodemarker.cpp
tools/qdoc3/node.cpp
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/io/qdir.cpp | 6 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qlist.h | 31 |
3 files changed, 24 insertions, 15 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index c0c62e1..d9086c1 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -2008,7 +2008,7 @@ QString QDir::cleanPath(const QString &path) const QChar *p = name.unicode(); for (int i = 0, last = -1, iwrite = 0; i < len; ++i) { if (p[i] == QLatin1Char('/')) { - while (i < len-1 && p[i+1] == QLatin1Char('/')) { + while (i+1 < len && p[i+1] == QLatin1Char('/')) { #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) //allow unc paths if (!i) break; @@ -2016,9 +2016,9 @@ QString QDir::cleanPath(const QString &path) i++; } bool eaten = false; - if (i < len - 1 && p[i+1] == QLatin1Char('.')) { + if (i+1 < len && p[i+1] == QLatin1Char('.')) { int dotcount = 1; - if (i < len - 2 && p[i+2] == QLatin1Char('.')) + if (i+2 < len && p[i+2] == QLatin1Char('.')) dotcount++; if (i == len - dotcount - 1) { if (dotcount == 1) { diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 8e4fb32..e1b4232 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2788,6 +2788,8 @@ int QDateTime::secsTo(const QDateTime &other) const } /*! + \since 4.7 + Returns the number of milliseconds from this datetime to the \a other datetime. If the \a other datetime is earlier than this datetime, the value returned is negative. diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 4eb05d6..9f7b23f 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -769,25 +769,32 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::clear() template <typename T> Q_OUTOFLINE_TEMPLATE int QList<T>::removeAll(const T &_t) { - detachShared(); + int index = indexOf(_t); + if (index == -1) + return 0; + const T t = _t; - int removedCount=0, i=0; - Node *n; - while (i < p.size()) - if ((n = reinterpret_cast<Node *>(p.at(i)))->t() == t) { - node_destruct(n); - p.remove(i); - ++removedCount; - } else { - ++i; - } + detach(); + + Node *i = reinterpret_cast<Node *>(p.at(index)); + Node *e = reinterpret_cast<Node *>(p.end()); + Node *n = i; + node_destruct(i); + while (++i != e) { + if (i->t() == t) + node_destruct(i); + else + *n++ = *i; + } + + int removedCount = e - n; + d->end -= removedCount; return removedCount; } template <typename T> Q_OUTOFLINE_TEMPLATE bool QList<T>::removeOne(const T &_t) { - detachShared(); int index = indexOf(_t); if (index != -1) { removeAt(index); |