mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 02:35:33 +08:00
refs #937 Resolved clazy warnings: unnecessary memory allocation.
This commit is contained in:
@@ -165,7 +165,7 @@ namespace BlackCore
|
||||
qint64 timeoutAircraftEpochMs = currentTimeMsEpoch - aircraftTimeoutMs;
|
||||
qint64 timeoutAtcEpochMs = currentTimeMsEpoch - atcTimeoutMs;
|
||||
|
||||
for (const CCallsign &callsign : m_aircraftCallsignTimestamps.keys())
|
||||
for (const CCallsign &callsign : m_aircraftCallsignTimestamps.keys()) // clazy:exclude=container-anti-pattern,range-loop
|
||||
{
|
||||
if (m_aircraftCallsignTimestamps.value(callsign) > timeoutAircraftEpochMs) { continue; }
|
||||
CLogMessage(this).debug() << "Aircraft " << callsign.toQString() << "timed out!";
|
||||
@@ -173,7 +173,7 @@ namespace BlackCore
|
||||
emit timeoutAircraft(callsign);
|
||||
}
|
||||
|
||||
for (const CCallsign &callsign : m_atcCallsignTimestamps.keys())
|
||||
for (const CCallsign &callsign : m_atcCallsignTimestamps.keys()) // clazy:exclude=container-anti-pattern,range-loop
|
||||
{
|
||||
if (m_atcCallsignTimestamps.value(callsign) > timeoutAtcEpochMs) { continue; }
|
||||
CLogMessage(this).debug() << "ATC " << callsign.toQString() << "timed out!";
|
||||
|
||||
@@ -790,9 +790,9 @@ namespace BlackCore
|
||||
{
|
||||
// Logic to set logoff time
|
||||
bool ok;
|
||||
const int h = zuluTime.left(2).toInt(&ok);
|
||||
const int h = zuluTime.leftRef(2).toInt(&ok);
|
||||
if (!ok) { return; }
|
||||
const int m = zuluTime.right(2).toInt(&ok);
|
||||
const int m = zuluTime.rightRef(2).toInt(&ok);
|
||||
if (!ok) { return; }
|
||||
QDateTime logoffDateTime = QDateTime::currentDateTimeUtc();
|
||||
logoffDateTime.setTime(QTime(h, m));
|
||||
|
||||
@@ -309,7 +309,7 @@ namespace BlackCore
|
||||
m_voiceChannelMapping.remove(BlackMisc::Aviation::CComSystem::Com1);
|
||||
|
||||
// If the voice channel is not used by anybody else
|
||||
if (!m_voiceChannelMapping.values().contains(oldVoiceChannel))
|
||||
if (!m_voiceChannelMapping.key(oldVoiceChannel))
|
||||
{
|
||||
oldVoiceChannel->leaveVoiceRoom();
|
||||
m_unusedVoiceChannels.push_back(oldVoiceChannel);
|
||||
@@ -324,7 +324,7 @@ namespace BlackCore
|
||||
{
|
||||
auto newVoiceChannel = getVoiceChannelBy(newRoomCom1);
|
||||
newVoiceChannel->setOwnAircraftCallsign(ownCallsign);
|
||||
bool inUse = m_voiceChannelMapping.values().contains(newVoiceChannel);
|
||||
bool inUse = m_voiceChannelMapping.key(newVoiceChannel);
|
||||
m_voiceChannelMapping.insert(BlackMisc::Aviation::CComSystem::Com1, newVoiceChannel);
|
||||
|
||||
// If the voice channel is not used by anybody else
|
||||
@@ -349,7 +349,7 @@ namespace BlackCore
|
||||
m_voiceChannelMapping.remove(BlackMisc::Aviation::CComSystem::Com2);
|
||||
|
||||
// If the voice channel is not used by anybody else
|
||||
if (!m_voiceChannelMapping.values().contains(oldVoiceChannel))
|
||||
if (!m_voiceChannelMapping.key(oldVoiceChannel))
|
||||
{
|
||||
oldVoiceChannel->leaveVoiceRoom();
|
||||
m_unusedVoiceChannels.push_back(oldVoiceChannel);
|
||||
@@ -364,7 +364,7 @@ namespace BlackCore
|
||||
{
|
||||
auto newVoiceChannel = getVoiceChannelBy(newRoomCom2);
|
||||
newVoiceChannel->setOwnAircraftCallsign(ownCallsign);
|
||||
bool inUse = m_voiceChannelMapping.values().contains(newVoiceChannel);
|
||||
bool inUse = m_voiceChannelMapping.key(newVoiceChannel);
|
||||
m_voiceChannelMapping.insert(BlackMisc::Aviation::CComSystem::Com2, newVoiceChannel);
|
||||
|
||||
// If the voice channel is not used by anybody else
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace BlackCore
|
||||
|
||||
if (this->m_shutdown) { return; }
|
||||
QString urlString(nwReply->url().toString());
|
||||
if (urlString.toLower().contains("logoff"))
|
||||
if (urlString.contains("logoff", Qt::CaseInsensitive))
|
||||
{
|
||||
sApp->deleteAllCookies();
|
||||
emit logoffFinished();
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace BlackCore
|
||||
CSimulatorPluginInfoList CPluginManagerSimulator::getAvailableSimulatorPlugins() const
|
||||
{
|
||||
CSimulatorPluginInfoList list;
|
||||
for (const auto &i : m_plugins.values())
|
||||
for (const auto &i : m_plugins)
|
||||
{
|
||||
list.push_back(i.info);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace BlackCore
|
||||
Weather::CWeatherDataPluginInfoList CPluginManagerWeatherData::getAvailableWeatherDataPlugins() const
|
||||
{
|
||||
BlackMisc::Weather::CWeatherDataPluginInfoList list;
|
||||
for (const auto &i : m_plugins.values())
|
||||
for (const auto &i : m_plugins)
|
||||
{
|
||||
list.push_back(i.info);
|
||||
}
|
||||
|
||||
@@ -488,12 +488,13 @@ namespace BlackCore
|
||||
|
||||
CTextMessageList radioMessages = messages.getRadioMessages();
|
||||
radioMessages.markAsSent();
|
||||
QVector<int> freqsVec;
|
||||
for (const auto &message : radioMessages)
|
||||
{
|
||||
// I could send the same message to n frequencies in one step
|
||||
// if this is really required, I need to group by message
|
||||
// currently I send individual messages
|
||||
QVector<int> freqsVec;
|
||||
freqsVec.clear();
|
||||
freqsVec.push_back(message.getFrequency().valueRounded(CFrequencyUnit::kHz(), 0));
|
||||
Vat_SendRadioMessage(m_net.data(), freqsVec.data(), freqsVec.size(), toFSD(message.getMessage()));
|
||||
emit textMessageSent(message);
|
||||
|
||||
@@ -263,8 +263,8 @@ namespace BlackCore
|
||||
{
|
||||
// ; !CLIENTS section
|
||||
int i = currentLine.lastIndexOf(' ');
|
||||
const QString attributes = currentLine.mid(i).trimmed();
|
||||
clientSectionAttributes = attributes.split(':', QString::SkipEmptyParts);
|
||||
const QVector<QStringRef> attributes = currentLine.midRef(i).trimmed().split(':', QString::SkipEmptyParts);
|
||||
for (const QStringRef &attr : attributes) { clientSectionAttributes.push_back(attr.toString()); }
|
||||
section = SectionNone; // reset
|
||||
}
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user