From 189d5a6a01298168f174f2ac2954c58500fc535b Mon Sep 17 00:00:00 2001 From: f4exb Date: Sun, 21 Jul 2024 23:15:32 +0200 Subject: [PATCH] More Sonar fixes --- ft8/ft8.cpp | 7 ++-- .../channelrx/demoddatv/ldpctool/encoder.h | 12 +++---- .../demoddatv/ldpctool/layered_decoder.h | 35 ++++++++----------- .../demoddatv/ldpctool/ldpc_tool.cpp | 12 +++---- .../mod802.15.4/ieee_802_15_4_macframe.h | 7 ++-- 5 files changed, 30 insertions(+), 43 deletions(-) diff --git a/ft8/ft8.cpp b/ft8/ft8.cpp index 31d77ff0d..b11c09604 100644 --- a/ft8/ft8.cpp +++ b/ft8/ft8.cpp @@ -1949,8 +1949,8 @@ void FT8::soft_decode_mags(FT8Params& params, const std::vector zeroi(zoX*zoY); + std::vector onei(zoX*zoY); for (int biti = 0; biti < nbSymbolBits; biti++) { @@ -2006,9 +2006,6 @@ void FT8::soft_decode_mags(FT8Params& params, const std::vector class LDPCEncoder { LDPCInterface *ldpc; - int N, K, R; - bool initialized; + int N = 2; + int K = 1; + int R = 1; + bool initialized = false; TYPE one() { @@ -43,11 +45,7 @@ class LDPCEncoder return b < TYPE(0) ? -a : b > TYPE(0) ? a : TYPE(0); } public: - LDPCEncoder() : - N(2), - K(1), - R(1), - initialized(false) + LDPCEncoder() { } diff --git a/plugins/channelrx/demoddatv/ldpctool/layered_decoder.h b/plugins/channelrx/demoddatv/ldpctool/layered_decoder.h index a7cdee3c7..d8762c77e 100644 --- a/plugins/channelrx/demoddatv/ldpctool/layered_decoder.h +++ b/plugins/channelrx/demoddatv/ldpctool/layered_decoder.h @@ -78,12 +78,21 @@ template class LDPCDecoder { private: - TYPE *bnl, *pty, *inp, *out; - uint16_t *pos; - uint8_t *cnc; + TYPE *bnl = nullptr; + TYPE *pty = nullptr; + TYPE *inp = nullptr; + TYPE *out = nullptr; + uint16_t *pos = nullptr; + uint8_t *cnc = nullptr; ALG alg; - int M, N, K, R, q, CNL, LT; - bool initialized; + int M = 0; + int N = 0; + int K = 0; + int R = 0; + int q = 0; + int CNL = 0; + int LT = 0; + bool initialized = false; void reset() { @@ -140,21 +149,7 @@ private: } public: - LDPCDecoder() : - bnl(nullptr), - pty(nullptr), - inp(nullptr), - out(nullptr), - pos(nullptr), - cnc(nullptr), - M(0), - N(0), - K(0), - R(0), - q(0), - CNL(0), - LT(0), - initialized(false) + LDPCDecoder() { } diff --git a/plugins/channelrx/demoddatv/ldpctool/ldpc_tool.cpp b/plugins/channelrx/demoddatv/ldpctool/ldpc_tool.cpp index eebc9b24a..7b1b54952 100644 --- a/plugins/channelrx/demoddatv/ldpctool/ldpc_tool.cpp +++ b/plugins/channelrx/demoddatv/ldpctool/ldpc_tool.cpp @@ -125,16 +125,16 @@ int main(int argc, char **argv) // DVB-S2 MODCOD definitions static const char *mc_tabnames[2][32] = { // [shortframes][modcod] {// Normal frames - 0, "B1", "B2", "B3", "B4", "B5", "B6", "B7", + nullptr, "B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9", "B10", "B11", "B5", "B6", "B7", "B9", "B10", "B11", "B6", "B7", "B8", "B9", "B10", "B11", - "B7", "B8", "B8", "B10", "B11", 0, 0, 0 + "B7", "B8", "B8", "B10", "B11", nullptr, nullptr, nullptr }, {// Short frames - 0, "C1", "C2", "C3", "C4", "C5", "C6", "C7", - "C8", "C9", "C10", 0, "C5", "C6", "C7", "C9", - "C10", 0, "C6", "C7", "C8", "C9", "C10", 0, - "C7", "C8", "C8", "C10", 0, 0, 0, 0 + nullptr, "C1", "C2", "C3", "C4", "C5", "C6", "C7", + "C8", "C9", "C10", nullptr, "C5", "C6", "C7", "C9", + "C10", nullptr, "C6", "C7", "C8", "C9", "C10", nullptr, + "C7", "C8", "C8", "C10", nullptr, nullptr, nullptr, nullptr }}; const char *tabname = mc_tabnames[shortframes][modcod]; diff --git a/plugins/channeltx/mod802.15.4/ieee_802_15_4_macframe.h b/plugins/channeltx/mod802.15.4/ieee_802_15_4_macframe.h index e9e456195..2e141edae 100644 --- a/plugins/channeltx/mod802.15.4/ieee_802_15_4_macframe.h +++ b/plugins/channeltx/mod802.15.4/ieee_802_15_4_macframe.h @@ -50,19 +50,16 @@ struct IEEE_802_15_4_MacFrame uint16_t m_frameControl; uint8_t m_sequenceNumber; uint16_t m_destPANID; - uint16_t m_destShortAddress; + uint16_t m_destShortAddress = 0; ieee_802_15_4_address m_destAddress; uint16_t m_sourcePANID; - uint16_t m_sourceShortAddress; + uint16_t m_sourceShortAddress = 0; ieee_802_15_4_address m_sourceAddress; uint8_t m_payload[IEEE_802_15_4_MAC_PAYLOAD_MAX_LENGTH]; uint8_t m_payloadLength; IEEE_802_15_4_MacFrame() { - m_destShortAddress = 0; - m_sourceShortAddress = 0; - if (false) { // Example ACK frame