summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qfile/tst_qfile.cpp
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-08-11 03:09:40 +0300
committerAhmad Samir <a.samirh78@gmail.com>2023-08-19 16:29:09 +0300
commite7b07b64c7b0536eccba6ff25e23badb88226813 (patch)
treed70ab6c7451f2e6b62887684fe3ab528d345a577 /tests/auto/corelib/io/qfile/tst_qfile.cpp
parentc7a8e1e9928fc2b84e6179adc69c858b17b25d48 (diff)
tests/auto/*: port Q_FOREACH to ranged-for
The loop was iterating over a temporary container, so it couldn't have changed it. Store the container in a const auto variable and use ranged-for. In files where Q_FOREACH isn't used any more, remove "#undef QT_NO_FOREACH". Task-number: QTBUG-115839 Change-Id: I402df5fa48f4287f3cc989ddae1524da43999049 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/corelib/io/qfile/tst_qfile.cpp')
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 578ff7f89f..313235fa11 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -410,7 +410,8 @@ void tst_QFile::cleanup()
// Clean out everything except the readonly-files.
const QDir dir(m_temporaryDir.path());
- foreach (const QFileInfo &fi, dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot)) {
+ const auto entries = dir.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
+ for (const QFileInfo &fi : entries) {
const QString fileName = fi.fileName();
if (fileName != QLatin1String(noReadFile) && fileName != QLatin1String(readOnlyFile)) {
const QString absoluteFilePath = fi.absoluteFilePath();