Coverity reported an uninitialized m_rx2txGPIOEnable value when it was
used by SimplePTTGUI before settings were loaded. Initialize the setting
in resetToDefaults() to provide a defined default value.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Coverity reported an uninitialized scalar use of varPhase when the
reference and variable Goertzel filters completed at different times.
Store the last valid variable phase and magnitude values to ensure the
radial calculation always uses initialized data.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Coverity reported that an invalid sample size could leave the
conversion buffer uninitialized before it was passed to calcPower()
and the sample FIFO.
Return early when the sample conversion format is unsupported to
prevent processing invalid data.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
The HDLC encoder accumulated bits into m_bits using the |= operator
without first initializing the first byte. This resulted in an
uninitialized read of m_bits[0] when encoding the first bit of a
packet.
Initialize each output byte when writing its first bit, ensuring the
buffer contains a defined value before bits are OR'ed into it. This
also makes addBit() self-contained, eliminating the need for callers to
pre-initialize the current output byte.
Reported by Coverity.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Cppcheck reported several AISModSource members that were not initialized
by the constructor. Initialize the remaining scalar members in the
constructor initializer list to establish a well-defined initial state
and avoid undefined behavior if they are accessed before being assigned.
Reported by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace variable length arrays in SumProductAlgorithm::finalp() with a
std::vector buffers.
This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace variable length arrays in LambdaMinAlgorithm::finalp() with
std::vector storage.
Update nth_element() usage to operate on vector iterators while removing
the non-standard VLA usage.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace variable length arrays in LogDomainSPA::finalp() with
std::vector buffers.
This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace the variable length temporary array in the int8_t FACTOR
specialization of MinSumCAlgorithm::finalp() with a std::vector buffer.
This removes reliance on compiler VLA extensions and uses standard C++
storage for the temporary reduction buffer.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace the variable length temporary array in the float FACTOR
specialization of MinSumCAlgorithm::finalp() with a std::vector buffer.
This removes reliance on compiler VLA extensions and uses standard C++
storage for the temporary reduction buffer.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace the variable length temporary array in MinSumCAlgorithm::finalp()
with a std::vector buffer.
This removes reliance on compiler VLA extensions and uses standard C++
storage for the temporary reduction buffer.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace variable length arrays in the int8_t FACTOR specialization of
OffsetMinSumAlgorithm::finalp() with a single std::vector scratch buffer.
This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace variable length arrays in OffsetMinSumAlgorithm::finalp() with a
std::vector buffers.
This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace variable length arrays in the int8_t specialization of
MinSumAlgorithm::finalp() with a single std::vector scratch buffer.
This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace variable length arrays in the float specialization of
MinSumAlgorithm::finalp() with std::vector storage.
This removes reliance on compiler VLA extensions and keeps the
temporary buffers managed by standard C++ containers.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
The channel count comparison in getChannelsByDevice() accidentally used
the first plan's channel count for both operands. This caused the comparator
to always treat the channel counts as equal and sort only by bandwidth.
Use the second plan's channel count when comparing RRTurnPlans so plans are
ordered correctly by number of channels before applying the bandwidth
tie-breaker.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace variable length arrays in MinSumAlgorithm::finalp() with a
std::vector buffers.
Variable length arrays are a compiler extension and are not part of
standard C++. The replacement preserves the existing contiguous memory
layout while avoiding non-standard stack allocations.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace raw memset() initialization of hist with C++ value initialization.
This avoids bypassing std::complex object initialization and ensures the
history buffer contains valid constructed objects when HIST_FLOAT is enabled.
The previous memset() relied on the in-memory representation of
std::complex<float> and could leave non-trivial objects improperly
initialized. While this typically behaved as expected with common
implementations, it was not valid C++ object initialization.
pointed out by cppcheck as:
Using 'memset' on struct that contains a 'std::complex'
Signed-off-by: Robin Getz <rgetz503@gmail.com>
The gf2n implementation used a left shift on a potentially negative
value when masking field elements:
(~(Te)0) << N
This can result in undefined behavior for signed integer types and was
reported by static analysis (cppcheck).
Require the field element type to be unsigned and replace the mask
generation with an explicit N-bit mask constructed from the element type.
Also make the overflow check use the element type to avoid implicit
signed integer operations.
Add comments documenting the packed polynomial representation and the
GF(2^N) reduction steps to clarify the intent of the bit operations.
Fixes static analysis warning about shifting negative values.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
cppcheck reported that the displayTableSettings() declaration argument
order differed from the function definition. The header declared the
arguments as (columnIndexes, columnSizes), while the implementation and
all call sites use (columnSizes, columnIndexes).
Update the declaration to match the implementation and remove ambiguity
between the table column width and ordering arrays.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
cppcheck reported that the addToPowerFilter() declaration argument
order differed from the function definition. The header declared the
arguments as (y, x), while the implementation and all call sites use
(x, y).
Update the declaration to match the implementation and callers to avoid
confusion and potential misuse of the function arguments.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace signed %ld format specifiers with unsigned %lu conversions when
printing values stored as unsigned long.
The previous format strings passed unsigned values to signed printf
conversions, which could result in undefined behavior due to variadic
argument type mismatches. These issues were identified by cppcheck
invalidPrintfArgType_sint warnings.
Use format specifiers matching the actual argument types to ensure
correct and portable printf usage.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Fix a copy/paste error in decodeSymbols() where FT8 message type
0.3 was checked twice, preventing type 0.4 messages from being
recognized as replies.
FT8::Packing supports both 0.3 and 0.4 message types using the same
reply bit location.
Detected by cppcheck as a redundant condition.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace variable-length arrays used for DVB-S2 pilot symbol matching with
std::vector allocations.
Use vector::data() when passing buffers to the existing pointer-based
match_ph_amp() function. This removes non-standard VLA usage and improves
C++ portability without changing behavior.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace variable-length arrays used for DVB-S2 pilot symbol matching with
std::vector allocations.
Use vector::data() when passing buffers to the existing pointer-based
match_ph_amp() function. This removes additional non-standard VLA usage and
improves C++ portability without changing behavior.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace the variable-length array used for SOF symbol buffering in the
DVB-S2 frame receiver with a std::vector allocation.
Use vector::data() when passing the buffer to the existing pointer-based
conjugate product function. This removes another non-standard VLA usage and
improves C++ portability without changing behavior.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace non-standard variable-length arrays used for PLHEADER symbol
processing with std::vector allocations. Update buffer copies and pointer
interfaces accordingly while preserving existing behavior.
This removes VLA compiler/static analysis warnings and improves C++
portability.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
cppcheck reported that the std::copy() call used iterators from different
containers when restoring ADSB demod table column sizes.
The copy operation used settings.m_columnSizes as the source start iterator
but settings.m_columnIndexes as the source end iterator. This was likely a
copy/paste error and resulted in an invalid iterator range.
Use settings.m_columnSizes for both source iterators so column size settings
are restored correctly.
Signed-off-by: Robin Getz <rgetz503@gmail.com>