mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 15:25:34 +08:00
Fix clang-tidy and clazy warnings
This commit is contained in:
@@ -32,7 +32,7 @@ namespace BlackCore
|
||||
|
||||
DeleteAtc DeleteAtc::fromTokens(const QStringList &tokens)
|
||||
{
|
||||
if (tokens.size() < 1)
|
||||
if (tokens.isEmpty())
|
||||
{
|
||||
BlackMisc::CLogMessage(static_cast<DeleteAtc *>(nullptr)).debug(u"Wrong number of arguments.");
|
||||
return {};
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace BlackCore
|
||||
|
||||
DeletePilot DeletePilot::fromTokens(const QStringList &tokens)
|
||||
{
|
||||
if (tokens.size() < 1)
|
||||
if (tokens.isEmpty())
|
||||
{
|
||||
CLogMessage(static_cast<DeletePilot *>(nullptr)).debug(u"Wrong number of arguments.");
|
||||
return {};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2019
|
||||
/* Copyright (C) 2019
|
||||
* swift project community / contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
@@ -433,12 +433,12 @@ namespace BlackCore
|
||||
sendClientQuery(ClientQueryType::ATIS, callsign);
|
||||
}
|
||||
|
||||
void CFSDClient::sendClientQueryFlightPlan(const CCallsign callsign)
|
||||
void CFSDClient::sendClientQueryFlightPlan(const CCallsign &callsign)
|
||||
{
|
||||
sendClientQuery(ClientQueryType::FP, {}, { callsign.toQString() });
|
||||
}
|
||||
|
||||
void CFSDClient::sendClientQueryAircraftConfig(const CCallsign callsign)
|
||||
void CFSDClient::sendClientQueryAircraftConfig(const CCallsign &callsign)
|
||||
{
|
||||
QString data = QJsonDocument(JsonPackets::aircraftConfigRequest()).toJson(QJsonDocument::Compact);
|
||||
data = convertToUnicodeEscaped(data);
|
||||
@@ -504,13 +504,13 @@ namespace BlackCore
|
||||
}
|
||||
else if (queryType == ClientQueryType::FP)
|
||||
{
|
||||
if (queryData.size() == 0) { return; }
|
||||
if (queryData.isEmpty()) { return; }
|
||||
const ClientQuery clientQuery(getOwnCallsignAsString(), "SERVER", ClientQueryType::FP, queryData);
|
||||
sendQueudedMessage(clientQuery);
|
||||
}
|
||||
else if (queryType == ClientQueryType::AircraftConfig)
|
||||
{
|
||||
if (queryData.size() == 0) { return; }
|
||||
if (queryData.isEmpty()) { return; }
|
||||
const ClientQuery clientQuery(getOwnCallsignAsString(), reveiverCallsign, ClientQueryType::AircraftConfig, queryData);
|
||||
sendQueudedMessage(clientQuery);
|
||||
}
|
||||
@@ -1342,7 +1342,7 @@ namespace BlackCore
|
||||
if (!inRange) { return; } // sort out all broadcasted we DO NOT NEED
|
||||
if (!getSetupForServer().receiveAircraftParts()) { return; }
|
||||
const QJsonObject config = doc.object().value("config").toObject();
|
||||
if (config.empty()) { return; }
|
||||
if (config.isEmpty()) { return; }
|
||||
|
||||
const qint64 offsetTimeMs = currentOffsetTime(callsign);
|
||||
emit aircraftConfigReceived(clientQuery.sender(), config, offsetTimeMs);
|
||||
@@ -1938,7 +1938,7 @@ namespace BlackCore
|
||||
if (!callByTime.isEmpty())
|
||||
{
|
||||
const qint64 lastTs = callByTime.front().first;
|
||||
for (const auto &pair : callByTime)
|
||||
for (const auto &pair : std::as_const(callByTime))
|
||||
{
|
||||
const qint64 deltaTs = lastTs - pair.first;
|
||||
stats += separator % QStringLiteral("%1").arg(deltaTs, 5, 10, QChar('0')) % u": " % pair.second;
|
||||
@@ -2175,7 +2175,7 @@ namespace BlackCore
|
||||
emit atisLogoffTimeReplyReceived(cs, m_mapAtisMessages[callsign].zuluLogoff);
|
||||
|
||||
CInformationMessage atisMessage(CInformationMessage::ATIS);
|
||||
for (const QString &tm : m_mapAtisMessages[callsign].textLines)
|
||||
for (const QString &tm : std::as_const(m_mapAtisMessages[callsign].textLines))
|
||||
{
|
||||
const QString fixed = tm.trimmed();
|
||||
if (!fixed.isEmpty())
|
||||
|
||||
@@ -162,8 +162,8 @@ namespace BlackCore
|
||||
void sendClientQueryRealName(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
void sendClientQueryServer(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
void sendClientQueryAtis(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
void sendClientQueryFlightPlan(const BlackMisc::Aviation::CCallsign callsign);
|
||||
void sendClientQueryAircraftConfig(const BlackMisc::Aviation::CCallsign callsign);
|
||||
void sendClientQueryFlightPlan(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
void sendClientQueryAircraftConfig(const BlackMisc::Aviation::CCallsign &callsign);
|
||||
void sendTextMessages(const BlackMisc::Network::CTextMessageList &messages);
|
||||
void sendTextMessage(const BlackMisc::Network::CTextMessage &message);
|
||||
void sendTextMessage(TextMessageGroups receiverGroup, const QString &message);
|
||||
|
||||
Reference in New Issue
Block a user