diff options
-rw-r--r-- | src/corelib/plugin/qfactoryloader.cpp | 3 | ||||
-rw-r--r-- | src/corelib/plugin/qlibrary.cpp | 2 | ||||
-rw-r--r-- | src/corelib/plugin/qlibrary_win.cpp | 2 | ||||
-rw-r--r-- | src/corelib/plugin/qpluginloader.cpp | 6 | ||||
-rw-r--r-- | src/corelib/thread/qthreadpool.cpp | 2 |
5 files changed, 8 insertions, 7 deletions
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 7556f5caf8..78f540cf56 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -265,7 +265,8 @@ QList<QJsonObject> QFactoryLoader::metaData() const metaData.append(d->libraryList.at(i)->metaData); #endif - foreach (const QStaticPlugin &plugin, QPluginLoader::staticPlugins()) { + const auto staticPlugins = QPluginLoader::staticPlugins(); + for (const QStaticPlugin &plugin : staticPlugins) { const QJsonObject object = plugin.metaData(); if (object.value(iidKeyLiteral()) != QLatin1String(d->iid.constData(), d->iid.size())) continue; diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 38e82fc059..45859e058e 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -406,7 +406,7 @@ inline void QLibraryStore::cleanup() if (qt_debug_component()) { // dump all objects that remain - foreach (QLibraryPrivate *lib, data->libraryMap) { + for (QLibraryPrivate *lib : qAsConst(data->libraryMap)) { if (lib) qDebug() << "On QtCore unload," << lib->fileName << "was leaked, with" << lib->libraryRefCount.load() << "users"; diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp index f5604a24bd..47a220bf69 100644 --- a/src/corelib/plugin/qlibrary_win.cpp +++ b/src/corelib/plugin/qlibrary_win.cpp @@ -104,7 +104,7 @@ bool QLibraryPrivate::load_sys() attempts.prepend(QDir::rootPath() + fileName); #endif - Q_FOREACH (const QString &attempt, attempts) { + for (const QString &attempt : qAsConst(attempts)) { #ifndef Q_OS_WINRT pHnd = LoadLibrary((wchar_t*)QDir::toNativeSeparators(attempt).utf16()); #else // Q_OS_WINRT diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index 8264a27842..af6e3e0e93 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -300,9 +300,9 @@ static QString locatePlugin(const QString& fileName) paths.prepend(QStringLiteral(".")); // search in current dir first } - foreach (const QString &path, paths) { - foreach (const QString &prefix, prefixes) { - foreach (const QString &suffix, suffixes) { + for (const QString &path : qAsConst(paths)) { + for (const QString &prefix : qAsConst(prefixes)) { + for (const QString &suffix : qAsConst(suffixes)) { const QString fn = path + QLatin1Char('/') + basePath + prefix + baseName + suffix; if (debug) qDebug() << "Trying..." << fn; diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index b6b3be8d92..c23e7ace15 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -263,7 +263,7 @@ void QThreadPoolPrivate::reset() allThreadsCopy.swap(allThreads); locker.unlock(); - foreach (QThreadPoolThread *thread, allThreadsCopy) { + for (QThreadPoolThread *thread : qAsConst(allThreadsCopy)) { thread->runnableReady.wakeAll(); thread->wait(); delete thread; |