From 6f972035abeec11e9bbc459e85983439d033c8a0 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Thu, 10 Nov 2016 00:39:09 +0000 Subject: [PATCH] refs #800 Fixed some declaration shadows variable in outer scope warnings. --- src/blackgui/components/audiovolumecomponent.cpp | 4 ++-- src/blackgui/components/dbloadoverviewcomponent.cpp | 4 ++-- src/blackgui/components/internalscomponent.cpp | 4 ++-- src/blackgui/dockwidgetinfoarea.cpp | 8 ++++---- src/blackmisc/namevariantpair.cpp | 4 ++-- tests/blackcore/testinterpolator.cpp | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/blackgui/components/audiovolumecomponent.cpp b/src/blackgui/components/audiovolumecomponent.cpp index fb50282cc..cde91f8b3 100644 --- a/src/blackgui/components/audiovolumecomponent.cpp +++ b/src/blackgui/components/audiovolumecomponent.cpp @@ -94,8 +94,8 @@ namespace BlackGui if (volume > 100) { - int v = volume - 100; - volume = 100 + v / 5; + int vol = volume - 100; + volume = 100 + vol / 5; } if (volume != ui->hs_Volume->value()) diff --git a/src/blackgui/components/dbloadoverviewcomponent.cpp b/src/blackgui/components/dbloadoverviewcomponent.cpp index 1767f1c83..f2f2a6d95 100644 --- a/src/blackgui/components/dbloadoverviewcomponent.cpp +++ b/src/blackgui/components/dbloadoverviewcomponent.cpp @@ -113,9 +113,9 @@ namespace BlackGui const QString sharedUrlHtml("%2"); QString sharedUrlsHtml; - for (const CUrl &url : sharedUrls) + for (const CUrl &sharedUrl : sharedUrls) { - sharedUrlsHtml += sharedUrlHtml.arg(url.getFullUrl(), url.getHost()); + sharedUrlsHtml += sharedUrlHtml.arg(sharedUrl.getFullUrl(), sharedUrl.getHost()); sharedUrlsHtml += " "; } ui->lbl_SharedUrls->setText(sharedUrlsHtml.trimmed()); diff --git a/src/blackgui/components/internalscomponent.cpp b/src/blackgui/components/internalscomponent.cpp index 4910f289c..bb000db87 100644 --- a/src/blackgui/components/internalscomponent.cpp +++ b/src/blackgui/components/internalscomponent.cpp @@ -103,13 +103,13 @@ namespace BlackGui return; } QJsonParseError jsonError; - QJsonDocument json(QJsonDocument::fromJson(jsonParts.toUtf8(), &jsonError)); + QJsonDocument jsonDoc(QJsonDocument::fromJson(jsonParts.toUtf8(), &jsonError)); if (jsonError.error != QJsonParseError::NoError) { CLogMessage(this).validationError("Parse error: %1") << jsonError.errorString(); return; } - parts.convertFromJson(json.object()); + parts.convertFromJson(jsonDoc.object()); partsToGui(parts); } else diff --git a/src/blackgui/dockwidgetinfoarea.cpp b/src/blackgui/dockwidgetinfoarea.cpp index d05b45a17..085ee8725 100644 --- a/src/blackgui/dockwidgetinfoarea.cpp +++ b/src/blackgui/dockwidgetinfoarea.cpp @@ -98,7 +98,7 @@ namespace BlackGui { CDockWidget::initialFloating(); // initial floating to init position & size QList infoAreaDockWidgets = this->findEmbeddedDockWidgetInfoAreaComponents(); - foreach(CEnableForDockWidgetInfoArea * dwia, infoAreaDockWidgets) + for(CEnableForDockWidgetInfoArea *dwia : infoAreaDockWidgets) { Q_ASSERT_X(dwia, Q_FUNC_INFO, "Missing info area"); dwia->setParentDockWidgetInfoArea(this); @@ -109,7 +109,7 @@ namespace BlackGui { QList widgets = this->findChildren(); QList widgetsWithDockWidgetInfoAreaComponent; - foreach(QWidget * w, widgets) + for(QWidget *w : widgets) { Q_ASSERT(w); CEnableForDockWidgetInfoArea *dwc = dynamic_cast(w); @@ -122,11 +122,11 @@ namespace BlackGui if (nestedInfoAreas.isEmpty()) return widgetsWithDockWidgetInfoAreaComponent; // we have to exclude the nested embedded areas - foreach(CDockWidgetInfoArea * ia, nestedInfoAreas) + for(CDockWidgetInfoArea *ia : nestedInfoAreas) { QList nestedInfoAreaComponents = ia->findEmbeddedDockWidgetInfoAreaComponents(); if (nestedInfoAreaComponents.isEmpty()) { continue; } - foreach(CEnableForDockWidgetInfoArea * iac, nestedInfoAreaComponents) + for(CEnableForDockWidgetInfoArea *iac : nestedInfoAreaComponents) { bool r = widgetsWithDockWidgetInfoAreaComponent.removeOne(iac); Q_ASSERT(r); // why is the nested component not in the child list? diff --git a/src/blackmisc/namevariantpair.cpp b/src/blackmisc/namevariantpair.cpp index 5629c7667..83ee4c739 100644 --- a/src/blackmisc/namevariantpair.cpp +++ b/src/blackmisc/namevariantpair.cpp @@ -60,8 +60,8 @@ namespace BlackMisc { if (static_cast(variant.type()) == QMetaType::Int) { - CIcons::IconIndex index = variant.value(); - this->m_icon = CIconList::iconByIndex(index); + CIcons::IconIndex iconIndex = variant.value(); + this->m_icon = CIconList::iconByIndex(iconIndex); } else { diff --git a/tests/blackcore/testinterpolator.cpp b/tests/blackcore/testinterpolator.cpp index 504567e52..b9f78209a 100644 --- a/tests/blackcore/testinterpolator.cpp +++ b/tests/blackcore/testinterpolator.cpp @@ -147,10 +147,10 @@ namespace BlackCoreTest timer.start(); for (qint64 currentTime = ts - 2 * deltaT; currentTime < ts; currentTime += 250) { - IInterpolator::PartsStatus status; - CAircraftPartsList pl(interpolator.getPartsBeforeTime(cs, ts, status)); + IInterpolator::PartsStatus partsStatus; + CAircraftPartsList pl(interpolator.getPartsBeforeTime(cs, ts, partsStatus)); fetchedParts++; - QVERIFY2(status.isSupportingParts(), "Parts not supported"); + QVERIFY2(partsStatus.isSupportingParts(), "Parts not supported"); QVERIFY2(!pl.isEmpty(), "Parts empty"); } timeMs = timer.elapsed();