From 364e3eb68084637886699ff7cd80464e836013eb Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 25 Jan 2016 12:23:56 +0100 Subject: [PATCH] rcc: eradicate all Q_FOREACH loops ... by replacing them with C++11 ramge-for loops. Change-Id: I95a91ac36c2b2bef17bf12cf7f1676653a2d807d Reviewed-by: Lars Knoll --- src/tools/rcc/main.cpp | 8 ++++---- src/tools/rcc/rcc.cpp | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp index f402a875d4..e71ea57389 100644 --- a/src/tools/rcc/main.cpp +++ b/src/tools/rcc/main.cpp @@ -49,9 +49,9 @@ QT_BEGIN_NAMESPACE void dumpRecursive(const QDir &dir, QTextStream &out) { - QFileInfoList entries = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot - | QDir::NoSymLinks); - foreach (const QFileInfo &entry, entries) { + const QFileInfoList entries = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot + | QDir::NoSymLinks); + for (const QFileInfo &entry : entries) { if (entry.isDir()) { dumpRecursive(entry.filePath(), out); } else { @@ -194,7 +194,7 @@ int runRcc(int argc, char *argv[]) const bool projectRequested = parser.isSet(projectOption); const QStringList filenamesIn = parser.positionalArguments(); - foreach (const QString &file, filenamesIn) { + for (const QString &file : filenamesIn) { if (file == QLatin1String("-")) continue; else if (!QFile::exists(file)) { diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 932ad835de..3156df3f30 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -612,9 +612,10 @@ bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file) for (ChildConstIterator it = cbegin; it != cend; ++it) { if (it.key() == filename && it.value()->m_language == s->m_language && it.value()->m_country == s->m_country) { - foreach (const QString &name, m_fileNames) + for (const QString &name : qAsConst(m_fileNames)) { qWarning("%s: Warning: potential duplicate alias detected: '%s'", qPrintable(name), qPrintable(filename)); + } break; } }