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>
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>
cppcheck reported boolean expressions being used in bitwise operations
when validating UDP ports. Replace accidental '&' operators with logical
'&&' operators.
Also replace hard-coded port range limits with UINT16_MAX to make the
valid UDP port range explicit and keep UDP source/sink validation
consistent.
No functional change.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
cppcheck reported that the TestMISettings copy constructor did not
initialize member variable m_title:
Member variable 'TestMISettings::m_title' is not assigned in the copy
constructor. Should it be copied?
m_title is part of the serialized settings state, so ensure copied
TestMISettings instances preserve the configured title value.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
The original leansdr code uses fatal() and fail() for unrecoverable errors by
terminating execution. When integrated into SDRangel, these error paths did
not provide a mechanism for the plugin to handle failures locally, allowing
initialization failures to escape the normal plugin lifecycle.
Convert leansdr fatal() and fail() handling into C++ exceptions so DATV can
detect framework initialization failures, report them, and cleanly return
control to SDRangel instead of allowing the error to terminate the application.
This behavior is desirable because a DATV framework configuration failure
should not bring down the entire application.
Catch initialization exceptions in DATVDemodSink::feed(), report the failure,
clean up the partially initialized framework, and return to the caller.
Add noreturn annotations to the leansdr error functions and include the
leansdr source in exception messages to make failures easier to diagnose.
This does not redesign leansdr error handling or provide recovery from
runtime DSP failures. It only adds an exception boundary between the
leansdr library code and the SDRangel plugin lifecycle.
noticed via cppcheck indicating many Array indexes could go out of bounds
due to fail and fatal returning.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace the runtime-sized temporary array in the int8_t specialization of
MinSumAlgorithm::finalp() with std::vector.
The array size is determined by the runtime value of cnt, requiring a
compiler VLA extension. Using std::vector preserves the existing behavior
while removing the dependency on non-standard language extensions.
This eliminates remaining -Wvla warnings (for me) reported from
ldpctool/algorithms.h
Part of #2830
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace the runtime-sized temporary array in
MinSumCAlgorithm::finalp() with std::vector.
The temporary array size depends on the runtime value of cnt, requiring a
compiler VLA extension. Using std::vector preserves the existing behavior
while removing the dependency on non-standard language extensions.
This eliminates ~6 of remaining -Wvla warnings (for me) reported
from ldpctool/algorithms.h
Part of #2830
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace the runtime-sized temporary array in the int8_t specialization of
OffsetMinSumAlgorithm::finalp() with std::vector.
The array size is determined by the runtime value of cnt, requiring a
compiler VLA extension. Using std::vector preserves the existing behavior
while removing the dependency on non-standard language extensions.
This eliminates ~12 of remaining -Wvla warnings (for me) reported
from ldpctool/algorithms.h
Part of #2830
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace the runtime-sized temporary arrays in
OffsetMinSumAlgorithm::finalp() with std::vector.
The array sizes depend on the runtime value of cnt, requiring compiler
support for variable length arrays. Using std::vector removes this
non-standard extension while preserving the existing algorithm and memory
layout.
This eliminates ~24 of remaining -Wvla warnings (for me) reported
from ldpctool/algorithms.h.
Part of #2830
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace the runtime-sized temporary arrays used by
MinSumAlgorithm<SIMD<...>>::finalp() with std::vector.
The array sizes are determined at runtime from the number of links,
making them variable-length arrays that rely on compiler extensions.
Using std::vector removes the dependency on VLA support while
preserving the existing algorithm and behavior.
This eliminates ~24 of remaining -Wvla warnings (for me) reported
from ldpctool/algorithms.h.
Part of #2830
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Replace the runtime-sized stack array in the spectrum processing path
with std::vector to avoid compiler VLA extensions.
Although the spectrum template is not instantiated as part of the
current SDRangel build, GCC still emits -Wvla warnings while parsing
the template definition. This change removes those warnings and keeps
the template valid for future use.
Use std::copy() and vector::data() when accessing the underlying
storage.
Part of #2830
Signed-off-by: Robin Getz <rgetz503@gmail.com>
The spectrum template was not being instantiated by the current build,
so stale accesses to cfft_engine::n went unnoticed.
Replace direct accesses to the private cfft_engine member with the
public size() accessor. This restores spectrum compilation and allows
the upcoming VLA cleanup to be built and tested.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Clear the m_open flag when closing PlutoSDR input and output
devices. Previously closeDevice() released m_deviceParams but left
m_open set, leaving the object in an inconsistent state where code
could treat a closed device as still valid.
This was exposed when reloading a running PlutoSDR device, where GUI
updates could access the partially torn-down device state.
Hopefully fixes#2833 (I don't have a windows machine to test).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Only apply channel settings after BasicChannelSettingsDialog returns an
accepted result. Previously, the return value from dialog.exec() was ignored
and settings were copied from the dialog regardless of whether the dialog was
accepted or rejected.
This could cause changes made in the channel settings dialog to be applied
even when the user discarded them. Check the dialog result before updating
the channel title, color, Reverse API configuration, and stream index to keep
the GUI state synchronized with the user's action.
This also fixes the Coverity CHECKED_RETURN warning for the unchecked
QDialog::exec() return value.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously unset FFTMeasurement members with defined default
values so newly constructed measurement objects start in a known state.
Although these fields are populated during normal measurement processing,
constructors should establish a complete and deterministic object state
rather than leaving scalar members with indeterminate values. This also
makes the class safer if the initialization sequence changes in the future.
This fixes a Coverity UNINIT_CTOR warning caused by uninitialized scalar
members in the constructor.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_min and m_max in the SensorMeasurements constructor to ensure
the object has a valid state immediately after construction, before init()
is called.
Although init() sets these values before normal use, constructors should
fully initialize all class members to avoid leaving objects with undefined
state and to make the class safe to use regardless of initialization order.
This fixes a Coverity UNINIT_CTOR warning caused by uninitialized scalar
members in the constructor.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
RadioAstronomyGUI::spectrumSeries_clicked() called
calcVrAndDistanceToPeak() without verifying that currentFFT() returned a
valid FFTMeasurement. Since currentFFT() can return nullptr and
calcVrAndDistanceToPeak() immediately dereferences the pointer, this could
result in a null pointer dereference.
Guard the calls so they are only made when a valid FFT measurement is
available, matching the existing pattern used elsewhere in the class.
Reported by Coverity (CID 649213).
Signed-off-by: Robin Getz <rgetz503@gmail.com>