From 82bd1b1116b9caf75d74c9fc48040dcc07432955 Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Tue, 19 Nov 2024 08:20:42 +0100 Subject: [PATCH] refactor(afv): Fix some clang-tidy warnings --- src/core/afv/audio/callsigndelaycache.cpp | 20 ++++++++++--------- src/core/afv/audio/callsigndelaycache.h | 8 ++++---- src/core/afv/audio/callsignsampleprovider.cpp | 4 +--- src/core/afv/audio/callsignsampleprovider.h | 4 +--- src/core/afv/audio/input.cpp | 3 --- src/core/afv/audio/input.h | 2 -- src/core/afv/audio/output.cpp | 1 - src/core/afv/audio/output.h | 8 ++++---- src/core/afv/audio/receiversampleprovider.cpp | 14 +++++-------- src/core/afv/audio/receiversampleprovider.h | 7 +++---- src/core/afv/audio/soundcardsampleprovider.h | 4 ++-- src/core/afv/clients/afvclient.cpp | 11 ---------- src/core/afv/clients/afvclient.h | 3 --- .../afv/connection/apiserverconnection.cpp | 1 - src/core/afv/connection/apiserverconnection.h | 2 -- src/core/afv/connection/clientconnection.h | 3 ++- .../afv/connection/clientconnectiondata.cpp | 2 -- .../afv/connection/clientconnectiondata.h | 3 +-- src/core/afv/constants.h | 2 +- src/core/afv/crypto/cryptodtochannel.cpp | 6 ++++-- src/core/afv/crypto/cryptodtochannel.h | 4 +--- src/core/afv/crypto/cryptodtoheaderdto.h | 2 +- src/core/afv/crypto/cryptodtomode.h | 2 +- src/core/afv/crypto/cryptodtoserializer.cpp | 2 -- src/core/afv/crypto/cryptodtoserializer.h | 12 +++++------ src/core/afv/dto.h | 18 ++++++++--------- src/core/afv/model/afvmapreader.h | 2 +- src/core/afv/model/atcstationmodel.h | 9 +++------ 28 files changed, 61 insertions(+), 98 deletions(-) diff --git a/src/core/afv/audio/callsigndelaycache.cpp b/src/core/afv/audio/callsigndelaycache.cpp index e91daf805..5c0cb6b45 100644 --- a/src/core/afv/audio/callsigndelaycache.cpp +++ b/src/core/afv/audio/callsigndelaycache.cpp @@ -3,33 +3,35 @@ #include "core/afv/audio/callsigndelaycache.h" +#include + namespace swift::core::afv::audio { void CallsignDelayCache::initialise(const QString &callsign) { if (!m_delayCache.contains(callsign)) { m_delayCache[callsign] = delayDefault; } - if (!successfulTransmissionsCache.contains(callsign)) { successfulTransmissionsCache[callsign] = 0; } + if (!m_successfulTransmissionsCache.contains(callsign)) { m_successfulTransmissionsCache[callsign] = 0; } } int CallsignDelayCache::get(const QString &callsign) { return m_delayCache[callsign]; } void CallsignDelayCache::underflow(const QString &callsign) { - if (!successfulTransmissionsCache.contains(callsign)) return; + if (!m_successfulTransmissionsCache.contains(callsign)) return; - successfulTransmissionsCache[callsign] = 0; + m_successfulTransmissionsCache[callsign] = 0; increaseDelayMs(callsign); } void CallsignDelayCache::success(const QString &callsign) { - if (!successfulTransmissionsCache.contains(callsign)) return; + if (!m_successfulTransmissionsCache.contains(callsign)) return; - successfulTransmissionsCache[callsign]++; - if (successfulTransmissionsCache[callsign] > 5) + m_successfulTransmissionsCache[callsign]++; + if (m_successfulTransmissionsCache[callsign] > 5) { decreaseDelayMs(callsign); - successfulTransmissionsCache[callsign] = 0; + m_successfulTransmissionsCache[callsign] = 0; } } @@ -38,7 +40,7 @@ namespace swift::core::afv::audio if (!m_delayCache.contains(callsign)) return; m_delayCache[callsign] += delayIncrement; - if (m_delayCache[callsign] > delayMax) { m_delayCache[callsign] = delayMax; } + m_delayCache[callsign] = std::min(m_delayCache[callsign], delayMax); } void CallsignDelayCache::decreaseDelayMs(const QString &callsign) @@ -46,7 +48,7 @@ namespace swift::core::afv::audio if (!m_delayCache.contains(callsign)) return; m_delayCache[callsign] -= delayIncrement; - if (m_delayCache[callsign] < delayMin) { m_delayCache[callsign] = delayMin; } + m_delayCache[callsign] = std::max(m_delayCache[callsign], delayMin); } CallsignDelayCache &CallsignDelayCache::instance() diff --git a/src/core/afv/audio/callsigndelaycache.h b/src/core/afv/audio/callsigndelaycache.h index 86e18887c..40c02f74e 100644 --- a/src/core/afv/audio/callsigndelaycache.h +++ b/src/core/afv/audio/callsigndelaycache.h @@ -3,8 +3,8 @@ //! \file -#ifndef SWIFT_ORE_AFV_AUDIO_CALLSIGNDELAYCACHE_H -#define SWIFT_ORE_AFV_AUDIO_CALLSIGNDELAYCACHE_H +#ifndef SWIFT_CORE_AFV_AUDIO_CALLSIGNDELAYCACHE_H +#define SWIFT_CORE_AFV_AUDIO_CALLSIGNDELAYCACHE_H #include #include @@ -46,9 +46,9 @@ namespace swift::core::afv::audio static constexpr int delayMax = 300; QHash m_delayCache; - QHash successfulTransmissionsCache; + QHash m_successfulTransmissionsCache; }; } // namespace swift::core::afv::audio -#endif // guard +#endif // SWIFT_CORE_AFV_AUDIO_CALLSIGNDELAYCACHE_H diff --git a/src/core/afv/audio/callsignsampleprovider.cpp b/src/core/afv/audio/callsignsampleprovider.cpp index f6df3d336..6eb2f2e6c 100644 --- a/src/core/afv/audio/callsignsampleprovider.cpp +++ b/src/core/afv/audio/callsignsampleprovider.cpp @@ -3,7 +3,6 @@ #include "core/afv/audio/callsignsampleprovider.h" -#include #include #include #include @@ -205,8 +204,7 @@ namespace swift::core::afv::audio { double crackleFactor = (((qExp(m_distanceRatio) * qPow(m_distanceRatio, -4.0)) / 350.0) - 0.00776652); - if (crackleFactor < 0.0) { crackleFactor = 0.0; } - if (crackleFactor > 0.20) { crackleFactor = 0.20; } + crackleFactor = std::clamp(crackleFactor, 0.0, 0.2); m_crackleSoundProvider->setGain(crackleFactor * 2); m_whiteNoise->setGain(m_whiteNoiseGainMin); diff --git a/src/core/afv/audio/callsignsampleprovider.h b/src/core/afv/audio/callsignsampleprovider.h index 2f3dc0a4a..abb0bd65a 100644 --- a/src/core/afv/audio/callsignsampleprovider.h +++ b/src/core/afv/audio/callsignsampleprovider.h @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -17,7 +16,6 @@ #include "sound/sampleprovider/bufferedwaveprovider.h" #include "sound/sampleprovider/equalizersampleprovider.h" #include "sound/sampleprovider/mixingsampleprovider.h" -#include "sound/sampleprovider/pinknoisegenerator.h" #include "sound/sampleprovider/resourcesoundsampleprovider.h" #include "sound/sampleprovider/sawtoothgenerator.h" #include "sound/sampleprovider/simplecompressoreffect.h" @@ -108,4 +106,4 @@ namespace swift::core::afv::audio }; } // namespace swift::core::afv::audio -#endif // guard +#endif // SWIFT_CORE_AFV_AUDIO_CALLSIGNSAMPLEPROVIDER_H diff --git a/src/core/afv/audio/input.cpp b/src/core/afv/audio/input.cpp index a5198360e..8fe04e3f2 100644 --- a/src/core/afv/audio/input.cpp +++ b/src/core/afv/audio/input.cpp @@ -8,8 +8,6 @@ #include #include -#include -#include #include #include "misc/logmessage.h" @@ -49,7 +47,6 @@ namespace swift::core::afv::audio const int byteCount = 1920 * m_format.channelCount(); while (m_buffer.size() > byteCount) { - // qDebug() << QDateTime::currentMSecsSinceEpoch() << "CAudioInputBuffer::writeData " << m_buffer.size(); emit frameAvailable(m_buffer.left(byteCount)); m_buffer.remove(0, byteCount); } diff --git a/src/core/afv/audio/input.h b/src/core/afv/audio/input.h index 26bfda395..893c15b0b 100644 --- a/src/core/afv/audio/input.h +++ b/src/core/afv/audio/input.h @@ -15,8 +15,6 @@ #endif #include -#include -#include #include namespace swift::core::afv::audio diff --git a/src/core/afv/audio/output.cpp b/src/core/afv/audio/output.cpp index ea97683b9..60f6df487 100644 --- a/src/core/afv/audio/output.cpp +++ b/src/core/afv/audio/output.cpp @@ -5,7 +5,6 @@ #include -#include #include #include "misc/logmessage.h" diff --git a/src/core/afv/audio/output.h b/src/core/afv/audio/output.h index e2f00a4f0..a23ce795d 100644 --- a/src/core/afv/audio/output.h +++ b/src/core/afv/audio/output.h @@ -45,10 +45,10 @@ namespace swift::core::afv::audio #endif //! \copydoc QIODevice::readData - virtual qint64 readData(char *data, qint64 maxlen) override; + qint64 readData(char *data, qint64 maxlen) override; //! \copydoc QIODevice::writeData - virtual qint64 writeData(const char *data, qint64 len) override; + qint64 writeData(const char *data, qint64 len) override; private: swift::sound::sample_provider::ISampleProvider *m_sampleProvider = nullptr; //!< related provider @@ -71,7 +71,7 @@ namespace swift::core::afv::audio COutput(QObject *parent = nullptr); //! Dtor - virtual ~COutput() override { this->stop(); } + ~COutput() override { this->stop(); } //! Start output void start(const swift::misc::audio::CAudioDeviceInfo &outputDevice, @@ -103,4 +103,4 @@ namespace swift::core::afv::audio }; } // namespace swift::core::afv::audio -#endif // guard +#endif // SWIFT_CORE_AFV_AUDIO_OUTPUT_H diff --git a/src/core/afv/audio/receiversampleprovider.cpp b/src/core/afv/audio/receiversampleprovider.cpp index 5c75f100a..f3d3bbffe 100644 --- a/src/core/afv/audio/receiversampleprovider.cpp +++ b/src/core/afv/audio/receiversampleprovider.cpp @@ -5,7 +5,6 @@ #include "core/afv/audio/receiversampleprovider.h" -#include #include #include "misc/logmessage.h" @@ -65,9 +64,8 @@ namespace swift::core::afv::audio int CReceiverSampleProvider::activeCallsigns() const { - const int numberOfCallsigns = - static_cast(std::count_if(m_voiceInputs.begin(), m_voiceInputs.end(), - [](const CCallsignSampleProvider *p) { return p->inUse() == true; })); + const int numberOfCallsigns = static_cast(std::count_if( + m_voiceInputs.begin(), m_voiceInputs.end(), [](const CCallsignSampleProvider *p) { return p->inUse(); })); return numberOfCallsigns; } @@ -92,11 +90,9 @@ namespace swift::core::afv::audio if (m_doClickWhenAppropriate && numberOfInUseInputs == 0) { - CResourceSoundSampleProvider *resourceSound = - new CResourceSoundSampleProvider(Samples::instance().click(), m_mixer); + auto *resourceSound = new CResourceSoundSampleProvider(Samples::instance().click(), m_mixer); m_mixer->addMixerInput(resourceSound); m_doClickWhenAppropriate = false; - // CLogMessage(this).debug(u"AFV Click..."); } //! \todo KB 2020-04 not entirely correct, as it can be the number is the same, but changed callsign @@ -132,7 +128,7 @@ namespace swift::core::afv::audio if (!voiceInput) { it = std::find_if(m_voiceInputs.begin(), m_voiceInputs.end(), - [](const CCallsignSampleProvider *p) { return p->inUse() == false; }); + [](const CCallsignSampleProvider *p) { return !p->inUse(); }); if (it != m_voiceInputs.end()) { voiceInput = *it; @@ -162,7 +158,7 @@ namespace swift::core::afv::audio if (!voiceInput) { it = std::find_if(m_voiceInputs.begin(), m_voiceInputs.end(), - [](const CCallsignSampleProvider *p) { return p->inUse() == false; }); + [](const CCallsignSampleProvider *p) { return !p->inUse(); }); if (it != m_voiceInputs.end()) { voiceInput = *it; diff --git a/src/core/afv/audio/receiversampleprovider.h b/src/core/afv/audio/receiversampleprovider.h index 77c7865ee..2e171252c 100644 --- a/src/core/afv/audio/receiversampleprovider.h +++ b/src/core/afv/audio/receiversampleprovider.h @@ -11,7 +11,6 @@ #include "core/afv/audio/callsignsampleprovider.h" #include "misc/audio/audiosettings.h" #include "misc/aviation/callsignset.h" -#include "misc/logcategories.h" #include "sound/sampleprovider/mixingsampleprovider.h" #include "sound/sampleprovider/sampleprovider.h" #include "sound/sampleprovider/sinusgenerator.h" @@ -22,7 +21,7 @@ namespace swift::core::afv::audio //! Arguments struct TransceiverReceivingCallsignsChangedArgs { - quint16 transceiverID; //!< transceiver id + quint16 transceiverID {}; //!< transceiver id QStringList receivingCallsigns; //!< callsigns }; @@ -58,7 +57,7 @@ namespace swift::core::afv::audio //! @} //! \copydoc swift::sound::sample_provider::ISampleProvider::readSamples - virtual int readSamples(QVector &samples, qint64 count) override; + int readSamples(QVector &samples, qint64 count) override; //! @{ //! Add samples @@ -117,4 +116,4 @@ namespace swift::core::afv::audio Q_DECLARE_METATYPE(swift::core::afv::audio::TransceiverReceivingCallsignsChangedArgs) -#endif // guard +#endif // SWIFT_CORE_AFV_AUDIO_RECEIVERSAMPLEPROVIDER_H diff --git a/src/core/afv/audio/soundcardsampleprovider.h b/src/core/afv/audio/soundcardsampleprovider.h index 86e688815..0debeea32 100644 --- a/src/core/afv/audio/soundcardsampleprovider.h +++ b/src/core/afv/audio/soundcardsampleprovider.h @@ -35,7 +35,7 @@ namespace swift::core::afv::audio void pttUpdate(bool active, const QVector &txTransceivers); //! \copydoc swift::sound::sample_provider::ISampleProvider::readSamples - virtual int readSamples(QVector &samples, qint64 count) override; + int readSamples(QVector &samples, qint64 count) override; //! Add OPUS samples void addOpusSamples(const IAudioDto &audioDto, const QVector &rxTransceivers); @@ -65,4 +65,4 @@ namespace swift::core::afv::audio } // namespace swift::core::afv::audio -#endif // guard +#endif // SWIFT_CORE_AFV_AUDIO_SOUNDCARDSAMPLEPROVIDER_H diff --git a/src/core/afv/clients/afvclient.cpp b/src/core/afv/clients/afvclient.cpp index 7bb293165..4175b2b61 100644 --- a/src/core/afv/clients/afvclient.cpp +++ b/src/core/afv/clients/afvclient.cpp @@ -3,8 +3,6 @@ #include "core/afv/clients/afvclient.h" -#include - #ifdef Q_OS_WIN # include "comdef.h" #endif @@ -33,15 +31,6 @@ using namespace swift::sound::sample_provider; namespace swift::core::afv::clients { - constexpr int CAfvClient::PositionUpdatesMs; - constexpr int CAfvClient::SampleRate; - constexpr int CAfvClient::FrameSize; - constexpr double CAfvClient::MinDbIn; - constexpr double CAfvClient::MaxDbIn; - constexpr double CAfvClient::MinDbOut; - constexpr double CAfvClient::MaxDbOut; - constexpr quint32 CAfvClient::UniCom; - const QStringList &CAfvClient::getLogCategories() { static const QStringList cats { CLogCategories::audio(), CLogCategories::vatsimSpecific() }; diff --git a/src/core/afv/clients/afvclient.h b/src/core/afv/clients/afvclient.h index a18262832..de4b1c944 100644 --- a/src/core/afv/clients/afvclient.h +++ b/src/core/afv/clients/afvclient.h @@ -8,9 +8,6 @@ #include -#include -#include -#include #include #include #include diff --git a/src/core/afv/connection/apiserverconnection.cpp b/src/core/afv/connection/apiserverconnection.cpp index 60eee4208..4a3f1a3ec 100644 --- a/src/core/afv/connection/apiserverconnection.cpp +++ b/src/core/afv/connection/apiserverconnection.cpp @@ -5,7 +5,6 @@ #include #include -#include #include #include #include diff --git a/src/core/afv/connection/apiserverconnection.h b/src/core/afv/connection/apiserverconnection.h index 241c5488f..958008cea 100644 --- a/src/core/afv/connection/apiserverconnection.h +++ b/src/core/afv/connection/apiserverconnection.h @@ -6,8 +6,6 @@ #ifndef SWIFT_CORE_AFV_CONNECTION_APISERVERCONNECTION_H #define SWIFT_CORE_AFV_CONNECTION_APISERVERCONNECTION_H -#include -#include #include #include #include diff --git a/src/core/afv/connection/clientconnection.h b/src/core/afv/connection/clientconnection.h index f21704f14..85cb19ed3 100644 --- a/src/core/afv/connection/clientconnection.h +++ b/src/core/afv/connection/clientconnection.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "core/afv/connection/apiserverconnection.h" #include "core/afv/connection/clientconnectiondata.h" @@ -137,4 +138,4 @@ namespace swift::core::afv::connection }; } // namespace swift::core::afv::connection -#endif // guard +#endif // SWIFT_CORE_AFV_CONNECTION_CLIENTCONNECTION_H diff --git a/src/core/afv/connection/clientconnectiondata.cpp b/src/core/afv/connection/clientconnectiondata.cpp index f303f8928..9a3dda449 100644 --- a/src/core/afv/connection/clientconnectiondata.cpp +++ b/src/core/afv/connection/clientconnectiondata.cpp @@ -3,8 +3,6 @@ #include "core/afv/connection/clientconnectiondata.h" -#include - #include "misc/logmessage.h" using namespace swift::misc; diff --git a/src/core/afv/connection/clientconnectiondata.h b/src/core/afv/connection/clientconnectiondata.h index 3a0a55307..35a5814b7 100644 --- a/src/core/afv/connection/clientconnectiondata.h +++ b/src/core/afv/connection/clientconnectiondata.h @@ -14,7 +14,6 @@ #include "core/afv/connection/apiserverconnection.h" #include "core/afv/crypto/cryptodtochannel.h" #include "core/afv/dto.h" -#include "misc/logcategories.h" namespace swift::core::afv::connection { @@ -114,4 +113,4 @@ namespace swift::core::afv::connection }; } // namespace swift::core::afv::connection -#endif // guard +#endif // SWIFT_CORE_AFV_CONNECTION_CLIENTCONNECTIONDATA_H diff --git a/src/core/afv/constants.h b/src/core/afv/constants.h index d83e6d2ca..4477c2151 100644 --- a/src/core/afv/constants.h +++ b/src/core/afv/constants.h @@ -15,4 +15,4 @@ namespace swift::core::afv constexpr int c_sampleRate = 48000; } // namespace swift::core::afv -#endif // guard +#endif // SWIFT_CORE_AFV_CONSTANTS_H diff --git a/src/core/afv/crypto/cryptodtochannel.cpp b/src/core/afv/crypto/cryptodtochannel.cpp index ed9f9c456..194cfaef8 100644 --- a/src/core/afv/crypto/cryptodtochannel.cpp +++ b/src/core/afv/crypto/cryptodtochannel.cpp @@ -3,6 +3,8 @@ #include "core/afv/crypto/cryptodtochannel.h" +#include + #include "sodium/crypto_aead_chacha20poly1305.h" #include "misc/verify.h" @@ -28,7 +30,7 @@ namespace swift::core::afv::crypto throw std::invalid_argument("wrong receive key size"); } - if (m_receiveSequenceSizeMaxSize < 1) { m_receiveSequenceSizeMaxSize = 1; } + m_receiveSequenceSizeMaxSize = std::max(m_receiveSequenceSizeMaxSize, 1); m_receiveSequenceHistory.fill(0, m_receiveSequenceSizeMaxSize); m_receiveSequenceHistoryDepth = 0; } @@ -95,7 +97,7 @@ namespace swift::core::afv::crypto } else { - int minIndex; + int minIndex {}; uint minValue = getMin(minIndex); if (sequenceReceived < minValue) { return false; } // Possible replay attack m_receiveSequenceHistory[minIndex] = sequenceReceived; diff --git a/src/core/afv/crypto/cryptodtochannel.h b/src/core/afv/crypto/cryptodtochannel.h index b60f99ad6..099882d1a 100644 --- a/src/core/afv/crypto/cryptodtochannel.h +++ b/src/core/afv/crypto/cryptodtochannel.h @@ -6,8 +6,6 @@ #ifndef SWIFT_CORE_AFV_CRYPTO_CRYPTODTOCHANNEL_H #define SWIFT_CORE_AFV_CRYPTO_CRYPTODTOCHANNEL_H -#include - #include #include #include @@ -58,4 +56,4 @@ namespace swift::core::afv::crypto }; } // namespace swift::core::afv::crypto -#endif // guard +#endif // SWIFT_CORE_AFV_CRYPTO_CRYPTODTOCHANNEL_H diff --git a/src/core/afv/crypto/cryptodtoheaderdto.h b/src/core/afv/crypto/cryptodtoheaderdto.h index abb705f5d..0490f34b9 100644 --- a/src/core/afv/crypto/cryptodtoheaderdto.h +++ b/src/core/afv/crypto/cryptodtoheaderdto.h @@ -26,4 +26,4 @@ namespace swift::core::afv::crypto }; } // namespace swift::core::afv::crypto -#endif // gaurd +#endif // SWIFT_CORE_AFV_CRYPTO_CRYPTODTOHEADERDTO_H diff --git a/src/core/afv/crypto/cryptodtomode.h b/src/core/afv/crypto/cryptodtomode.h index f7324e365..6b59e1ec2 100644 --- a/src/core/afv/crypto/cryptodtomode.h +++ b/src/core/afv/crypto/cryptodtomode.h @@ -23,4 +23,4 @@ namespace swift::core::afv::crypto //! \private MSGPACK_ADD_ENUM(swift::core::afv::crypto::CryptoDtoMode); -#endif // guard +#endif // SWIFT_CORE_AFV_CRYPTO_CRYPTODTOMODE_H diff --git a/src/core/afv/crypto/cryptodtoserializer.cpp b/src/core/afv/crypto/cryptodtoserializer.cpp index de946e6f1..b29f5a7b1 100644 --- a/src/core/afv/crypto/cryptodtoserializer.cpp +++ b/src/core/afv/crypto/cryptodtoserializer.cpp @@ -5,8 +5,6 @@ namespace swift::core::afv::crypto { - CryptoDtoSerializer::CryptoDtoSerializer() {} - CryptoDtoSerializer::Deserializer CryptoDtoSerializer::deserialize(CCryptoDtoChannel &channel, const QByteArray &bytes, bool loopback) { diff --git a/src/core/afv/crypto/cryptodtoserializer.h b/src/core/afv/crypto/cryptodtoserializer.h index ee7add2b5..9219cd694 100644 --- a/src/core/afv/crypto/cryptodtoserializer.h +++ b/src/core/afv/crypto/cryptodtoserializer.h @@ -30,7 +30,7 @@ namespace swift::core::afv::crypto class CryptoDtoSerializer { public: - CryptoDtoSerializer(); + CryptoDtoSerializer() = default; //! Serialize a DTO template @@ -44,16 +44,16 @@ namespace swift::core::afv::crypto headerBuffer.open(QIODevice::WriteOnly); msgpack::pack(headerBuffer, header); headerBuffer.close(); - const quint16 headerLength = static_cast(headerBuffer.buffer().size()); + const auto headerLength = static_cast(headerBuffer.buffer().size()); const QByteArray dtoShortName = T::getShortDtoName(); - const quint16 dtoNameLength = static_cast(dtoShortName.size()); + const auto dtoNameLength = static_cast(dtoShortName.size()); QBuffer dtoBuffer; dtoBuffer.open(QIODevice::WriteOnly); msgpack::pack(dtoBuffer, dto); dtoBuffer.close(); - const quint16 dtoLength = static_cast(dtoBuffer.buffer().size()); + const auto dtoLength = static_cast(dtoBuffer.buffer().size()); if (header.Mode == CryptoDtoMode::AEAD_ChaCha20Poly1305) { @@ -80,7 +80,7 @@ namespace swift::core::afv::crypto nonceBuffer.write(reinterpret_cast(&header.Sequence), sizeof(header.Sequence)); nonceBuffer.close(); - unsigned long long clen; + unsigned long long clen {}; QByteArray aeadPayload; aeadPayload.fill(0, static_cast(aePayloadBuffer.size() + crypto_aead_chacha20poly1305_IETF_ABYTES)); @@ -163,4 +163,4 @@ namespace swift::core::afv::crypto }; } // namespace swift::core::afv::crypto -#endif // guard +#endif // SWIFT_CORE_AFV_CRYPTO_CRYPTODTO_SERIALIZER_H diff --git a/src/core/afv/dto.h b/src/core/afv/dto.h index 87c385040..02af7bf81 100644 --- a/src/core/afv/dto.h +++ b/src/core/afv/dto.h @@ -117,8 +117,8 @@ namespace swift::core::afv { //! @{ //! Properties - quint16 id; - quint32 frequencyHz; + quint16 id {}; + quint32 frequencyHz {}; double LatDeg = 0.0; double LonDeg = 0.0; double HeightMslM = 0.0; @@ -160,8 +160,8 @@ namespace swift::core::afv //! Properties QUuid id; QString name; - quint32 frequencyHz; - quint32 frequencyAliasHz; + quint32 frequencyHz {}; + quint32 frequencyAliasHz {}; //! @} //! From JSON @@ -219,15 +219,15 @@ namespace swift::core::afv struct TxTransceiverDto { //! Ctor - TxTransceiverDto() {} + TxTransceiverDto() = default; //! Ctor - TxTransceiverDto(const TransceiverDto &dto) { id = dto.id; } + TxTransceiverDto(const TransceiverDto &dto) : id(dto.id) {} //! Ctor - TxTransceiverDto(uint16_t value) { id = value; } + TxTransceiverDto(uint16_t value) : id(value) {} - uint16_t id; //!< id + uint16_t id {}; //!< id MSGPACK_DEFINE(id) }; @@ -281,4 +281,4 @@ namespace swift::core::afv }; } // namespace swift::core::afv -#endif // guard +#endif // SWIFT_CORE_AFV_DTO_H diff --git a/src/core/afv/model/afvmapreader.h b/src/core/afv/model/afvmapreader.h index 8d6e271eb..ba78169f1 100644 --- a/src/core/afv/model/afvmapreader.h +++ b/src/core/afv/model/afvmapreader.h @@ -42,4 +42,4 @@ namespace swift::core::afv::model }; } // namespace swift::core::afv::model -#endif // guard +#endif // SWIFT_CORE_AFV_AFVMAPREADER_H diff --git a/src/core/afv/model/atcstationmodel.h b/src/core/afv/model/atcstationmodel.h index 59c1b744a..f41b79b55 100644 --- a/src/core/afv/model/atcstationmodel.h +++ b/src/core/afv/model/atcstationmodel.h @@ -5,9 +5,6 @@ #define SWIFT_CORE_AFV_MODEL_ATCSTATIONMODEL_H #include -#include -#include -#include #include #include @@ -21,7 +18,7 @@ namespace swift::core::afv::model { public: //! Ctor - CSampleAtcStation() {} + CSampleAtcStation() = default; //! Ctor CSampleAtcStation(const QString &callsign, const swift::core::afv::TransceiverDto &transceiver); @@ -68,7 +65,7 @@ namespace swift::core::afv::model CSampleAtcStationModel(QObject *parent = nullptr); //! Dtor - virtual ~CSampleAtcStationModel() override; + ~CSampleAtcStationModel() override; //! Update the stations void updateAtcStations(const QVector &atcStations); @@ -91,4 +88,4 @@ namespace swift::core::afv::model }; } // namespace swift::core::afv::model -#endif // guard +#endif // SWIFT_CORE_AFV_MODEL_ATCSTATIONMODEL_H