From 6fdadf83710c37f70c1d2d621eacb9cbb327b23b Mon Sep 17 00:00:00 2001 From: Katja Marttila Date: Fri, 5 Mar 2021 08:58:04 +0200 Subject: Cppcheck: Fix local variable shadowing outer variable Change-Id: Idff9a40c5089b4de7b8afd1c280603601317beda Reviewed-by: Arttu Tarkiainen --- src/libs/installer/componentmodel.cpp | 6 +++--- src/libs/installer/installiconsoperation.cpp | 10 +++++----- src/libs/installer/utils.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/libs/installer') diff --git a/src/libs/installer/componentmodel.cpp b/src/libs/installer/componentmodel.cpp index aab487b45..642828ad7 100644 --- a/src/libs/installer/componentmodel.cpp +++ b/src/libs/installer/componentmodel.cpp @@ -260,9 +260,9 @@ bool ComponentModel::setData(const QModelIndex &index, const QVariant &value, in newValue = (oldValue == Qt::Checked) ? Qt::Unchecked : Qt::Checked; } QSet changed = updateCheckedState(nodes << component, newValue); - foreach (const QModelIndex &index, changed) { - emit dataChanged(index, index); - emit checkStateChanged(index); + foreach (const QModelIndex &changedIndex, changed) { + emit dataChanged(changedIndex, changedIndex); + emit checkStateChanged(changedIndex); } updateAndEmitModelState(); // update the internal state } else { diff --git a/src/libs/installer/installiconsoperation.cpp b/src/libs/installer/installiconsoperation.cpp index 9443b7f71..de1ddcc4f 100644 --- a/src/libs/installer/installiconsoperation.cpp +++ b/src/libs/installer/installiconsoperation.cpp @@ -134,8 +134,8 @@ bool InstallIconsOperation::performOperation() if (status == PackageManagerCore::Canceled || status == PackageManagerCore::Failure) return true; - const QString &source = it.next(); - QString target = targetDir.absoluteFilePath(sourceDir.relativeFilePath(source)); + const QString &source2 = it.next(); + QString target = targetDir.absoluteFilePath(sourceDir.relativeFilePath(source2)); emit outputTextChanged(target); @@ -185,7 +185,7 @@ bool InstallIconsOperation::performOperation() } // copy the file to its new location - QFile cf(source); + QFile cf(source2); if (!cf.copy(target)) { setError(UserDefinedError); setErrorString(tr("Failed to copy file \"%1\": %2").arg( @@ -193,8 +193,8 @@ bool InstallIconsOperation::performOperation() undoOperation(); return false; } - deleteFileNowOrLater(source); - files.push_back(source); + deleteFileNowOrLater(source2); + files.push_back(source2); files.push_back(target); setValue(QLatin1String("files"), files); } else if (fi.isDir() && !QDir(target).exists()) { diff --git a/src/libs/installer/utils.cpp b/src/libs/installer/utils.cpp index 59be2171b..7506a13fe 100644 --- a/src/libs/installer/utils.cpp +++ b/src/libs/installer/utils.cpp @@ -351,12 +351,12 @@ static QString qt_create_commandline(const QString &program, const QStringList & // as escaping the quote -- rather put the \ behind the quote: e.g. // rather use "foo"\ than "foo\" QString endQuote(QLatin1Char('\"')); - int i = tmp.length(); - while (i > 0 && tmp.at(i - 1) == QLatin1Char('\\')) { - --i; + int j = tmp.length(); + while (j > 0 && tmp.at(j - 1) == QLatin1Char('\\')) { + --j; endQuote += QLatin1Char('\\'); } - args += QLatin1String(" \"") + tmp.left(i) + endQuote; + args += QLatin1String(" \"") + tmp.left(j) + endQuote; } else { args += QLatin1Char(' ') + tmp; } -- cgit v1.2.3