diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-07 00:06:28 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-07 00:06:28 (GMT) |
commit | ca4bc7c16bdf27855a13b15dbabd8019ab2bef24 (patch) | |
tree | c15bc918bd87994d83b87ef922da9cc17253d92d /src/corelib | |
parent | 739c1c6a4322c0d48afd2a24e3dc2156fee577e1 (diff) | |
parent | 71a328397720af7229fd6ee48acaa19f7339a8de (diff) | |
download | Qt-ca4bc7c16bdf27855a13b15dbabd8019ab2bef24.zip Qt-ca4bc7c16bdf27855a13b15dbabd8019ab2bef24.tar.gz Qt-ca4bc7c16bdf27855a13b15dbabd8019ab2bef24.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/concurrent/qthreadpool.cpp | 18 | ||||
-rw-r--r-- | src/corelib/concurrent/qthreadpool.h | 2 | ||||
-rw-r--r-- | src/corelib/concurrent/qthreadpool_p.h | 2 | ||||
-rw-r--r-- | src/corelib/io/qdir.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qmetaobject_p.h | 7 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 2 | ||||
-rw-r--r-- | src/corelib/plugin/qlibrary.cpp | 14 | ||||
-rw-r--r-- | src/corelib/plugin/qplugin.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 5 | ||||
-rw-r--r-- | src/corelib/tools/qvarlengtharray.h | 19 | ||||
-rw-r--r-- | src/corelib/tools/qvarlengtharray.qdoc | 32 |
11 files changed, 83 insertions, 22 deletions
diff --git a/src/corelib/concurrent/qthreadpool.cpp b/src/corelib/concurrent/qthreadpool.cpp index a4057f1..9e4189e 100644 --- a/src/corelib/concurrent/qthreadpool.cpp +++ b/src/corelib/concurrent/qthreadpool.cpp @@ -41,7 +41,6 @@ #include "qthreadpool.h" #include "qthreadpool_p.h" -#include "qelapsedtimer.h" #ifndef QT_NO_THREAD @@ -289,18 +288,11 @@ void QThreadPoolPrivate::reset() isExiting = false; } -void QThreadPoolPrivate::waitForDone(int msecs) +void QThreadPoolPrivate::waitForDone() { QMutexLocker locker(&mutex); - if (msecs < 0){ - while (!(queue.isEmpty() && activeThreads == 0)) - noActiveThreads.wait(locker.mutex()); - } else { - QElapsedTimer timer; - timer.start(); - while (!(queue.isEmpty() && activeThreads == 0) && (timer.elapsed() < msecs)) - noActiveThreads.wait(locker.mutex(), msecs - timer.elapsed()); - } + while (!(queue.isEmpty() && activeThreads == 0)) + noActiveThreads.wait(locker.mutex()); } /*! \internal @@ -618,10 +610,10 @@ void QThreadPool::releaseThread() /*! Waits for each thread to exit and removes all threads from the thread pool. */ -void QThreadPool::waitForDone(int msecs) +void QThreadPool::waitForDone() { Q_D(QThreadPool); - d->waitForDone(msecs); + d->waitForDone(); d->reset(); } diff --git a/src/corelib/concurrent/qthreadpool.h b/src/corelib/concurrent/qthreadpool.h index 9895c41..cc1e059 100644 --- a/src/corelib/concurrent/qthreadpool.h +++ b/src/corelib/concurrent/qthreadpool.h @@ -84,7 +84,7 @@ public: void reserveThread(); void releaseThread(); - void waitForDone(int msecs = -1); + void waitForDone(); }; QT_END_NAMESPACE diff --git a/src/corelib/concurrent/qthreadpool_p.h b/src/corelib/concurrent/qthreadpool_p.h index 1a0e4ab..8a2cf98 100644 --- a/src/corelib/concurrent/qthreadpool_p.h +++ b/src/corelib/concurrent/qthreadpool_p.h @@ -82,7 +82,7 @@ public: void startThread(QRunnable *runnable = 0); void reset(); - void waitForDone(int msecs = -1); + void waitForDone(); bool startFrontRunnable(); void stealRunnable(QRunnable *); diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 1b60936..e54d95e 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -2125,7 +2125,7 @@ QString QDir::cleanPath(const QString &path) QString ret = (used == len ? name : QString(out, used)); // Strip away last slash except for root directories if (ret.length() > 1 && ret.endsWith(QLatin1Char('/'))) { -#ifdef Q_OS_WIN +#if defined (Q_OS_WIN) || defined (Q_OS_SYMBIAN) if (!(ret.length() == 3 && ret.at(1) == QLatin1Char(':'))) #endif ret.chop(1); diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h index a176149..b538787 100644 --- a/src/corelib/kernel/qmetaobject_p.h +++ b/src/corelib/kernel/qmetaobject_p.h @@ -196,7 +196,7 @@ static QByteArray normalizeTypeInternal(const char *t, const char *e, bool fixSc if (*(e-1) == '&') { // treat const reference as value t += 6; --e; - } else if (is_ident_char(*(e-1))) { // treat const value as value + } else if (is_ident_char(*(e-1)) || *(e-1) == '>') { // treat const value as value t += 6; } } @@ -287,13 +287,16 @@ static QByteArray normalizeTypeInternal(const char *t, const char *e, bool fixSc } // cv qualifers can appear after the type as well - if (t != e && (e - t >= 5 && strncmp("const", t, 5) == 0)) { + if (!is_ident_char(c) && t != e && (e - t >= 5 && strncmp("const", t, 5) == 0) + && (e - t == 5 || !is_ident_char(t[5]))) { t += 5; while (t != e && is_space(*t)) ++t; if (adjustConst && t != e && *t == '&') { // treat const ref as value ++t; + } else if (adjustConst && !star) { + // treat const as value } else if (!star) { // move const to the front (but not if const comes after a *) result.prepend("const "); diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index dfd6a08..411f22e 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1472,7 +1472,7 @@ void QObject::moveToThread(QThread *targetThread) } else if (d->threadData != currentData) { qWarning("QObject::moveToThread: Current thread (%p) is not the object's thread (%p).\n" "Cannot move to target thread (%p)\n", - d->threadData->thread, currentData->thread, targetData->thread); + currentData->thread, d->threadData->thread, targetData->thread); #ifdef Q_WS_MAC qWarning("On Mac OS X, you might be loading two sets of Qt binaries into the same process. " diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index a2c575a..0f99948 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -620,6 +620,20 @@ bool QLibraryPrivate::isPlugin(QSettings *settings) QByteArray key; bool success = false; +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) + if (fileName.endsWith(QLatin1String(".debug"))) { + // refuse to load a file that ends in .debug + // these are the debug symbols from the libraries + // the problem is that they are valid shared library files + // and dlopen is known to crash while opening them + + // pretend we didn't see the file + errorString = QLibrary::tr("The shared library was not found."); + pluginState = IsNotAPlugin; + return false; + } +#endif + QFileInfo fileinfo(fileName); #ifndef QT_NO_DATESTRING diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h index b798437..7f541f1 100644 --- a/src/corelib/plugin/qplugin.h +++ b/src/corelib/plugin/qplugin.h @@ -110,7 +110,7 @@ void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunctio # define QPLUGIN_DEBUG_STR "true" # endif # define Q_PLUGIN_VERIFICATION_DATA \ - static const char *qt_plugin_verification_data = \ + static const char qt_plugin_verification_data[] = \ "pattern=""QT_PLUGIN_VERIFICATION_DATA""\n" \ "version="QT_VERSION_STR"\n" \ "debug="QPLUGIN_DEBUG_STR"\n" \ diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index dc1666a..459d76a 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -1336,7 +1336,10 @@ bool QDate::isValid(int year, int month, int day) bool QDate::isLeapYear(int y) { if (y < 1582) { - return qAbs(y) % 4 == 0; + if ( y < 1) { // No year 0 in Julian calendar, so -1, -5, -9 etc are leap years + ++y; + } + return y % 4 == 0; } else { return (y % 4 == 0 && y % 100 != 0) || y % 400 == 0; } diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index aecb66e..9773d4b 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -107,6 +107,10 @@ public: Q_ASSERT(idx >= 0 && idx < s); return ptr[idx]; } + inline const T &at(int idx) const { return operator[](idx); } + + T value(int i) const; + T value(int i, const T &defaultValue) const; inline void append(const T &t) { if (s == a) // i.e. s != 0 @@ -248,6 +252,21 @@ Q_OUTOFLINE_TEMPLATE void QVarLengthArray<T, Prealloc>::realloc(int asize, int a } } +template <class T, int Prealloc> +Q_OUTOFLINE_TEMPLATE T QVarLengthArray<T, Prealloc>::value(int i) const +{ + if (i < 0 || i >= size()) { + return T(); + } + return at(i); +} +template <class T, int Prealloc> +Q_OUTOFLINE_TEMPLATE T QVarLengthArray<T, Prealloc>::value(int i, const T &defaultValue) const +{ + return (i < 0 || i >= size()) ? defaultValue : at(i); +} + + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index bb7a3de..38901e5 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -197,7 +197,7 @@ \a i must be a valid index position in the array (i.e., 0 <= \a i < size()). - \sa data() + \sa data(), at() */ /*! \fn const T &QVarLengthArray::operator[](int i) const @@ -272,3 +272,33 @@ Constructs a copy of \a other. */ +/*! \fn const T &QVarLengthArray::at(int i) const + + Returns a reference to the item at index position \a i. + + \a i must be a valid index position in the array (i.e., 0 <= \a i + < size()). + + \sa value(), operator[]() +*/ + +/*! \fn T QVarLengthArray::value(int i) const + + Returns the value at index position \a i. + + If the index \a i is out of bounds, the function returns + a \l{default-constructed value}. If you are certain that + \a i is within bounds, you can use at() instead, which is slightly + faster. + + \sa at(), operator[]() +*/ + +/*! \fn T QVarLengthArray::value(int i, const T &defaultValue) const + + \overload + + If the index \a i is out of bounds, the function returns + \a defaultValue. +*/ + |