From 562cadee8a0bca15aadc5fc959d358ee9ee811eb Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Mon, 1 Dec 2014 00:46:58 +0100 Subject: [PATCH] Fix several gcc, cppcheck and clang warnings --- src/blackcore/context_application_proxy.cpp | 2 +- src/blackgui/components/atcstationcomponent.cpp | 1 + src/blackgui/components/audiosetupcomponent.cpp | 1 + src/blackgui/components/audiovolumecomponent.cpp | 1 + src/blackgui/components/cockpitcomcomponent.cpp | 1 - .../components/cockpittranspondermodeledscomponent.h | 2 +- src/blackgui/components/settingscomponent.cpp | 1 + src/blackmisc/valueobject.cpp | 4 ++-- src/plugins/simulator/fs9/fs9_host.cpp | 12 ++++++++++-- 9 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/blackcore/context_application_proxy.cpp b/src/blackcore/context_application_proxy.cpp index 6ba5e0333..3ca1e8e0e 100644 --- a/src/blackcore/context_application_proxy.cpp +++ b/src/blackcore/context_application_proxy.cpp @@ -48,7 +48,7 @@ namespace BlackCore s = connection.connect(serviceName, IContextApplication::ObjectPath(), IContextApplication::InterfaceName(), "componentChanged", this, SIGNAL(componentChanged(uint, uint))); Q_ASSERT(s); - + Q_UNUSED(s); } /* diff --git a/src/blackgui/components/atcstationcomponent.cpp b/src/blackgui/components/atcstationcomponent.cpp index 2ed74e245..fd87393ca 100644 --- a/src/blackgui/components/atcstationcomponent.cpp +++ b/src/blackgui/components/atcstationcomponent.cpp @@ -49,6 +49,7 @@ namespace BlackGui Q_ASSERT(connected); connected = this->connect(this->ui->pb_AtcStationsLoadMetar, SIGNAL(clicked()), this, SLOT(getMetar())); Q_ASSERT(connected); + Q_UNUSED(connected); connect(this, &QTabWidget::currentChanged, this, &CAtcStationComponent::ps_atcStationsTabChanged); // "local" tab changed (booked, online) connect(this->ui->tvp_AtcStationsOnline, &QTableView::clicked, this, &CAtcStationComponent::ps_onlineAtcStationSelected); connect(this->ui->tvp_AtcStationsOnline, &CAtcStationView::testRequestDummyAtcOnlineStations, this, &CAtcStationComponent::ps_testCreateDummyOnlineAtcStations); diff --git a/src/blackgui/components/audiosetupcomponent.cpp b/src/blackgui/components/audiosetupcomponent.cpp index 73248b3a1..06defb1d6 100644 --- a/src/blackgui/components/audiosetupcomponent.cpp +++ b/src/blackgui/components/audiosetupcomponent.cpp @@ -59,6 +59,7 @@ namespace BlackGui Q_ASSERT(connected); connected = this->connect(this->ui->cb_SetupAudioOutputDevice, SIGNAL(currentIndexChanged(int)), this, SLOT(ps_audioDeviceSelected(int))); Q_ASSERT(connected); + Q_UNUSED(connected); this->connect(this->ui->pb_SetupAudioMicrophoneTest, &QPushButton::clicked, this, &CAudioSetupComponent::ps_startAudioTest); this->connect(this->ui->pb_SetupAudioSquelchTest, &QPushButton::clicked, this, &CAudioSetupComponent::ps_startAudioTest); diff --git a/src/blackgui/components/audiovolumecomponent.cpp b/src/blackgui/components/audiovolumecomponent.cpp index b1a428aef..17d18839e 100644 --- a/src/blackgui/components/audiovolumecomponent.cpp +++ b/src/blackgui/components/audiovolumecomponent.cpp @@ -49,6 +49,7 @@ namespace BlackGui // to audio audio context c = connect(this->ui->pb_Mute, &QPushButton::toggled, this->getIContextAudio(), &IContextAudio::setMute); Q_ASSERT(c); + Q_UNUSED(c); } void CAudioVolumeComponent::ps_onMuteChanged(bool muted) diff --git a/src/blackgui/components/cockpitcomcomponent.cpp b/src/blackgui/components/cockpitcomcomponent.cpp index 14e9d1f4f..057e419b5 100644 --- a/src/blackgui/components/cockpitcomcomponent.cpp +++ b/src/blackgui/components/cockpitcomcomponent.cpp @@ -171,7 +171,6 @@ namespace BlackGui } else if (this->getIContextAudio()) { - CSelcal selcal(selcal); this->getIContextAudio()->playSelcalTone(selcal); } else diff --git a/src/blackgui/components/cockpittranspondermodeledscomponent.h b/src/blackgui/components/cockpittranspondermodeledscomponent.h index 32b82d29a..e9443dd24 100644 --- a/src/blackgui/components/cockpittranspondermodeledscomponent.h +++ b/src/blackgui/components/cockpittranspondermodeledscomponent.h @@ -62,8 +62,8 @@ namespace BlackGui static const QString &ledsOriginator(); QScopedPointer m_ledStandby; - QScopedPointer m_ledIdent; QScopedPointer m_ledModes; + QScopedPointer m_ledIdent; }; diff --git a/src/blackgui/components/settingscomponent.cpp b/src/blackgui/components/settingscomponent.cpp index 306faf3b6..00bf39564 100644 --- a/src/blackgui/components/settingscomponent.cpp +++ b/src/blackgui/components/settingscomponent.cpp @@ -133,6 +133,7 @@ namespace BlackGui connected = this->connect(this->ui->cb_SettingsGuiFontStyle, SIGNAL(currentIndexChanged(QString)), this, SLOT(ps_fontChanged())); Q_ASSERT(connected); this->connect(this->ui->tb_SettingsGuiFontColor, &QToolButton::clicked, this, &CSettingsComponent::ps_fontColorDialog); + Q_UNUSED(connected); } /* diff --git a/src/blackmisc/valueobject.cpp b/src/blackmisc/valueobject.cpp index fa09917ac..104da67d7 100644 --- a/src/blackmisc/valueobject.cpp +++ b/src/blackmisc/valueobject.cpp @@ -64,7 +64,7 @@ namespace BlackMisc // not all classes have implemented nesting const QString m = QString("Property by index not found (setter), index: ").append(index.toQString()); - qFatal(m.toLatin1().constData()); + qFatal("%s", qPrintable(m)); } /* @@ -88,7 +88,7 @@ namespace BlackMisc // not all classes have implemented nesting const QString m = QString("Property by index not found, index: ").append(index.toQString()); - qFatal(m.toLatin1().constData()); + qFatal("%s", qPrintable(m)); return QVariant(m); // avoid compiler warning } diff --git a/src/plugins/simulator/fs9/fs9_host.cpp b/src/plugins/simulator/fs9/fs9_host.cpp index daa9beecb..824ef7c1e 100644 --- a/src/plugins/simulator/fs9/fs9_host.cpp +++ b/src/plugins/simulator/fs9/fs9_host.cpp @@ -159,8 +159,16 @@ namespace BlackSimPlugin if (m_hostStatus == Terminated) return hr; BlackMisc::CLogMessage(this).info("Hosting terminated!"); - hr = m_directPlayPeer->TerminateSession(nullptr, 0, 0); - hr = m_directPlayPeer->Close(0); + if (FAILED(hr = m_directPlayPeer->TerminateSession(nullptr, 0, 0))) + { + return printDirectPlayError(hr); + } + + if (FAILED(hr = m_directPlayPeer->Close(0))) + { + return printDirectPlayError(hr); + } + m_hostStatus = Terminated; emit statusChanged(m_hostStatus);