RemoteLinux: Replace foreach with ranged for loop

Change-Id: Iee251639c20131c8fc2fd2e182b131a9786411c7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Jarek Kobus
2022-10-05 13:17:43 +02:00
parent 392585f76d
commit c4e6493ff1
2 changed files with 5 additions and 4 deletions

View File

@@ -43,7 +43,8 @@ QString RemoteLinuxEnvironmentAspect::userEnvironmentChangesAsString() const
{ {
QString env; QString env;
QString placeHolder = QLatin1String("%1=%2 "); QString placeHolder = QLatin1String("%1=%2 ");
foreach (const Utils::EnvironmentItem &item, userEnvironmentChanges()) const Utils::EnvironmentItems items = userEnvironmentChanges();
for (const Utils::EnvironmentItem &item : items)
env.append(placeHolder.arg(item.name, item.value)); env.append(placeHolder.arg(item.name, item.value));
return env.mid(0, env.size() - 1); return env.mid(0, env.size() - 1);
} }

View File

@@ -379,9 +379,9 @@ bool TarPackageCreationStep::appendFile(QFile &tarFile, const QFileInfo &fileInf
return false; return false;
} }
if (fileInfo.isDir()) { if (fileInfo.isDir()) {
QDir dir(fileInfo.absoluteFilePath()); const QDir dir(fileInfo.absoluteFilePath());
foreach (const QString &fileName, const QStringList files = dir.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
dir.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)) { for (const QString &fileName : files) {
const QString thisLocalFilePath = dir.path() + QLatin1Char('/') + fileName; const QString thisLocalFilePath = dir.path() + QLatin1Char('/') + fileName;
const QString thisRemoteFilePath = remoteFilePath + QLatin1Char('/') + fileName; const QString thisRemoteFilePath = remoteFilePath + QLatin1Char('/') + fileName;
if (!appendFile(tarFile, QFileInfo(thisLocalFilePath), thisRemoteFilePath)) if (!appendFile(tarFile, QFileInfo(thisLocalFilePath), thisRemoteFilePath))