From 000796dc3d909f179fb6586fae7e9ce986440576 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 28 Jan 2017 16:14:08 +0100 Subject: Avoid uninitialised fields, modernise DabService::nbComponent --- src/dabOutput/dabOutput.h | 18 ++++++++---------- src/dabOutput/edi/AFPacket.h | 2 +- src/dabOutput/edi/TagItems.h | 38 ++++++++++++++------------------------ 3 files changed, 23 insertions(+), 35 deletions(-) (limited to 'src/dabOutput') diff --git a/src/dabOutput/dabOutput.h b/src/dabOutput/dabOutput.h index 11b78e6..2e5f489 100644 --- a/src/dabOutput/dabOutput.h +++ b/src/dabOutput/dabOutput.h @@ -59,17 +59,15 @@ struct edi_destination_t { }; struct edi_configuration_t { - edi_configuration_t() : - verbose(false) {} - unsigned chunk_len; // RSk, data length of each chunk - unsigned fec; // number of fragments that can be recovered - bool dump; // dump a file with the EDI packets - bool verbose; - bool enable_pft; // Enable protection and fragmentation - unsigned int tagpacket_alignment; + unsigned chunk_len = 207; // RSk, data length of each chunk + unsigned fec = 0; // number of fragments that can be recovered + bool dump = false; // dump a file with the EDI packets + bool verbose = false; + bool enable_pft = false; // Enable protection and fragmentation + unsigned int tagpacket_alignment = 0; std::vector destinations; - unsigned int dest_port; // common destination port, because it's encoded in the transport layer - unsigned int latency_frames; // if nonzero, enable interleaver with a latency of latency_frames * 24ms + unsigned int dest_port = 0; // common destination port, because it's encoded in the transport layer + unsigned int latency_frames = 0; // if nonzero, enable interleaver with a latency of latency_frames * 24ms bool enabled() const { return destinations.size() > 0; } bool interleaver_enabled() const { return latency_frames > 0; } diff --git a/src/dabOutput/edi/AFPacket.h b/src/dabOutput/edi/AFPacket.h index 0ffd13f..b4ccef1 100644 --- a/src/dabOutput/edi/AFPacket.h +++ b/src/dabOutput/edi/AFPacket.h @@ -52,7 +52,7 @@ class AFPacketiser private: static const bool have_crc = true; - uint16_t seq; //counter that overflows at 0xFFFF + uint16_t seq = 0; //counter that overflows at 0xFFFF bool m_verbose; }; diff --git a/src/dabOutput/edi/TagItems.h b/src/dabOutput/edi/TagItems.h index fb876cc..856d25b 100644 --- a/src/dabOutput/edi/TagItems.h +++ b/src/dabOutput/edi/TagItems.h @@ -54,30 +54,20 @@ class TagStarPTR : public TagItem class TagDETI : public TagItem { public: - TagDETI() - { - // set optional fields to "not present" - atstf = 0; - rfudf = 0; - ficf = 0; - - rfa = 0; //shall be zero - rfu = 0; //mnsc is valid - } std::vector Assemble(); /***** DATA in intermediary format ****/ // For the ETI Header: must be defined ! - uint8_t stat; - uint8_t mid; - uint8_t fp; - uint8_t rfa; - uint8_t rfu; - uint16_t mnsc; - uint16_t dflc; // modulo 5000 frame counter + uint8_t stat = 0; + uint8_t mid = 0; + uint8_t fp = 0; + uint8_t rfa = 0; + uint8_t rfu = 0; // MNSC is valid + uint16_t mnsc = 0; + uint16_t dflc = 0; // modulo 5000 frame counter // ATST (optional) - bool atstf; // presence of atst data + bool atstf = false; // presence of atst data /* UTCO: Offset (in seconds) between UTC and the Seconds value. The * value is expressed as an unsigned 8-bit quantity. As of February @@ -93,14 +83,14 @@ class TagDETI : public TagItem * where the TAI-UTC offset is given by the USNO bulletin using * the ClockTAI module. */ - uint8_t utco; + uint8_t utco = 0; void set_tai_utc_offset(int tai_utc_offset) { utco = tai_utc_offset - 32; } /* The number of SI seconds since 2000-01-01 T 00:00:00 UTC as an * unsigned 32-bit quantity */ - uint32_t seconds; + uint32_t seconds = 0; void set_seconds(std::chrono::system_clock::time_point t); @@ -110,16 +100,16 @@ class TagDETI : public TagItem * significant 8 bits of the TIST field of the incoming STI-D(LI) * frame, if required, may be carried in the RFAD field. */ - uint32_t tsta; + uint32_t tsta = 0xFFFFFF; // the FIC (optional) - bool ficf; + bool ficf = false; const unsigned char* fic_data; size_t fic_length; // rfu - bool rfudf; - uint32_t rfud; + bool rfudf = false; + uint32_t rfud = 0; }; -- cgit v1.2.3