diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-08-11 17:20:24 +0300 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-08-19 16:29:25 +0300 |
commit | 8e0281a8becc699ece53527c647b1ee72e50c3bd (patch) | |
tree | ec1ac57e37431ea2b46384c6834fa0057ced62e8 /tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp | |
parent | e7b07b64c7b0536eccba6ff25e23badb88226813 (diff) |
tests/auto/: port Q_FOREACH to ranged-for, local const containers
These are local containers that are either:
- Already const and didn't need Q_FOREACH to begin with
- Can be simply made const, just by adding const keyword
In one case the unittest checked that the container's size is 1, so use
list.first() instead of a for-loop.
In files where Q_FOREACH isn't used any more, remove
"#undef QT_NO_FOREACH". Also remove those files from NO_PCH_SOURCES.
Drive-by changes:
- Remove parenthesis from one-line for-loops
- Make the for-loop variable a const& where a copy isn't needed
Task-number: QTBUG-115839
Change-Id: Ide34122b9cda798b80c4ca9d2d5af76024bc7a92
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp')
-rw-r--r-- | tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index 7cb269e983..b59cf2bf3a 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -2,8 +2,6 @@ // Copyright (C) 2020 Intel Corporation. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses - #include <qstandardpaths.h> #include <QTest> #include <QOperatingSystemVersion> @@ -409,7 +407,7 @@ static inline QFileInfo findSh() QByteArray pEnv = qgetenv("PATH"); const QLatin1Char pathSep(':'); const QStringList rawPaths = QString::fromLocal8Bit(pEnv.constData()).split(pathSep, Qt::SkipEmptyParts); - foreach (const QString &path, rawPaths) { + for (const QString &path : rawPaths) { if (QFile::exists(path + sh)) return QFileInfo(path + sh); } |