mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-08 12:45:35 +08:00
Fix cppcheck warnings
This commit is contained in:
@@ -183,7 +183,7 @@ namespace BlackCore::Afv::Clients
|
||||
m_connection->connectTo(cid, password, callsign, client,
|
||||
{ // this is the callback when the connection has been established
|
||||
this, [=](bool authenticated) {
|
||||
if (!myself) { return; }
|
||||
if (!myself) { return; } // cppcheck-suppress knownConditionTrueFalse
|
||||
|
||||
// HF stations aliased
|
||||
const QVector<StationDto> aliasedStations = m_connection->getAllAliasedStations();
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace BlackCore::Afv::Connection
|
||||
{ this, [=](QNetworkReply *nwReply) {
|
||||
// called in "this" thread
|
||||
const QScopedPointer<QNetworkReply, QScopedPointerDeleteLater> reply(nwReply);
|
||||
if (!myself || isShuttingDown()) { return; }
|
||||
if (!myself || isShuttingDown()) { return; } // cppcheck-suppress knownConditionTrueFalse
|
||||
|
||||
this->logRequestDuration(reply.data(), "authentication");
|
||||
if (reply->error() != QNetworkReply::NoError)
|
||||
@@ -278,7 +278,7 @@ namespace BlackCore::Afv::Connection
|
||||
QPointer<CApiServerConnection> myself(this);
|
||||
this->connectTo(m_username, m_password, m_client, m_networkVersion,
|
||||
{ this, [=](bool authenticated) {
|
||||
if (!myself) { return; }
|
||||
if (!myself) { return; } // cppcheck-suppress knownConditionTrueFalse
|
||||
CLogMessage(this).info(u"API server authenticated '%1': %2") << m_username << boolToYesNo(authenticated);
|
||||
} });
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace BlackCore::Afv::Connection
|
||||
{ // callback called when connected
|
||||
this, [=](bool authenticated) {
|
||||
// callback when connection has been established
|
||||
if (!myself) { return; }
|
||||
if (!myself) { return; } // cppcheck-suppress knownConditionTrueFalse
|
||||
|
||||
if (authenticated)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace BlackCore::Afv::Model
|
||||
{
|
||||
loop.exec();
|
||||
}
|
||||
const QByteArray jsonData = reply->readAll();
|
||||
const QByteArray jsonData = reply ? reply->readAll() : QByteArray {};
|
||||
if (reply) { reply->deleteLater(); }
|
||||
|
||||
if (jsonData.isEmpty()) { return; }
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace BlackCore
|
||||
eventLoop.stopWhen(m_fsdClient, &CFSDClient::flightPlanReceived, [=](const auto &cs, const auto &) { return cs == callsign; });
|
||||
if (eventLoop.exec(1500))
|
||||
{
|
||||
if (!myself || !sApp || sApp->isShuttingDown()) { return CFlightPlan(); }
|
||||
if (!myself || !sApp || sApp->isShuttingDown()) { return CFlightPlan(); } // cppcheck-suppress knownConditionTrueFalse
|
||||
if (m_flightPlanCache.contains(callsign))
|
||||
{
|
||||
plan = m_flightPlanCache[callsign];
|
||||
|
||||
@@ -644,7 +644,7 @@ namespace BlackCore::Context
|
||||
if (!m_simulatorPlugin.first.isUnspecified())
|
||||
{
|
||||
ISimulator *simulator = m_simulatorPlugin.second;
|
||||
if (simulator->isConnected())
|
||||
if (simulator && simulator->isConnected())
|
||||
{
|
||||
// we are about to unload an connected simulator
|
||||
this->updateMarkAllAsNotRendered(); // without plugin nothing can be rendered
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace BlackCore
|
||||
// "retry" possible in some cases
|
||||
do
|
||||
{
|
||||
if (ignoreCmdBootstrapUrl || !checkCmdBootstrapUrl || CNetworkUtils::canConnect(url, CNetworkUtils::getLongTimeoutMs()))
|
||||
if (ignoreCmdBootstrapUrl || !checkCmdBootstrapUrl || CNetworkUtils::canConnect(url, CNetworkUtils::getLongTimeoutMs())) // cppcheck-suppress knownConditionTrueFalse
|
||||
{
|
||||
ok = true;
|
||||
break;
|
||||
@@ -308,7 +308,6 @@ namespace BlackCore
|
||||
{
|
||||
Q_ASSERT_X(!(webRead && localRead), Q_FUNC_INFO, "Local and web read together seems to be wrong");
|
||||
CStatusMessageList msgs;
|
||||
QPointer<CSetupReader> myself(this);
|
||||
|
||||
bool available = false;
|
||||
if (webRead || localRead)
|
||||
|
||||
Reference in New Issue
Block a user