Fix cppcheck warning:
Using iterator to member container 'm_sinkBuddies' that may be invalid
clearBuddiesLists() was iterating directly over m_sourceBuddies and
m_sinkBuddies while calling removeBuddy(), which modifies the buddy
relationship lists. This could invalidate the active iterator and result in
undefined behavior.
The issue could lead to intermittent failures during buddy cleanup operations,
such as device removal, device reload, or application shutdown, depending on
container state and timing.
Iterate over copies of the buddy lists so that removing relationships does not
affect the iterators used for traversal.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
In std::vector<T,Allocator>::erase, The iterator pos must be valid and
dereferenceable. Thus the end() iterator (which is valid, but is not
dereferenceable) cannot be used as a value for pos.
Protect against that by checking the result of std::find() before erasing
a buddy entry. The buddy should always be present when removeBuddy() is
called, but avoid undefined behavior if that assumption is violated.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
The signed 64-bit deserialization code used a signed temporary value while
assembling bytes:
tmp = (tmp << 8) | byte;
For negative values, tmp was initialized to -1 for sign extension. Left-shifting
this negative value is undefined behavior in C++.
Use an unsigned temporary while constructing the 64-bit representation and
convert to qint64 after all bytes have been assembled. This preserves the
existing two's complement sign handling while avoiding undefined behavior.
Fixes static analysis warning about shifting a negative value.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
The signed integer deserialization code used a signed temporary value while
assembling bytes:
tmp = (tmp << 8) | byte;
For negative values, tmp was initialized to -1 for sign extension, causing a
left shift of a negative value, which is undefined behavior in C++.
Use an unsigned temporary while constructing the 32-bit representation and
convert to qint32 only after all bytes have been assembled. This preserves the
existing two's complement sign handling while avoiding undefined signed shifts.
Fixes static analysis (cppcheck) warning about shifting a negative value.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Remove an invalid out-of-bounds array access that attempted to handle
ERROR_INSUFFICIENT_BUFFER. The statement did not resize the fixed-size
buffer and had no effect other than invoking undefined behavior.
The function only uses QueryDosDeviceA() as an existence check for COM
ports, so removing the dead error-handling code does not change its
behavior.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
cppcheck reported that GLScopeSettings::operator=() did not assign the
m_freerun member variable.
m_freerun is part of the GLScope configuration state: it is initialized
in resetToDefaults(), and is persisted through serialize()/deserialize().
However, when a GLScopeSettings object was copied using the assignment
operator, the freerun state was not transferred from the source object.
This could result in two GLScopeSettings instances having different
freerun values after assignment, with the destination object retaining
its previous value instead of matching the source object.
Add the missing m_freerun assignment to ensure operator=() performs a
complete copy of the settings state and matches the existing
serialization behavior.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
The MeshCore mod plugin references SWGMeshcoreModActions in
meshcoremod.cpp, but MeshcoreMod.yaml had no MeshcoreModActions
section. When swagger files are regenerated, the auto-generated
SWGChannelActions.h/cpp lose the meshcore_mod_actions member and
accessors, which would break compilation of meshcoremod.cpp.
Changes across five files:
- MeshcoreMod.yaml: add MeshcoreModActions definition (sendNow
field, matching existing hand-authored SWGMeshcoreModActions)
- ChannelActions.yaml: add MeshcoreModActions pointing to
the new section
- SWGModelFactory.h: add #include and create() registration
block for SWGMeshcoreModActions (was missing despite
SWGMeshcoreModSettings/MeshcoreDemod* being registered)
- webapirequestmapper.cpp: add channelActionsKey routing branch
for MeshcoreModActions (was completely absent)
- webapiutils.cpp: add m_channelURIToSettingsKey and
m_channelTypeToSettingsKey entries for both MeshcoreDemod and
MeshcoreMod (were missing, unlike ChirpChat and Meshtastic
which have entries for their channel types)
Previously, devices claimed by another device set were omitted from the
device selection lists. Display these devices as disabled and marked
"[in use]" instead of hiding them.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Added optional scrollbar to be able to scroll back through waterfall.
When scrolling is enabled:
Can adjust power scale for complete waterfall, not just future spectra.
Waterfall time axis can use local time or UTC.
Waterfall not lost when resizing window.
Can now zoom when device is stopped.
Added Min averaging type.
Added button to load spectrum from .csv file.
Add button to save spectrum/waterfall to .png or jpg.
Changed show all controls button to a combobox with choices of Min/Std/All (Minimum/Standard/All).
Changed some buttons in spectrum GUI from QPushButton to QToolButton so their size matches the others.
Fix spectrum from displaying a mixture of old and new spectrums (m_currentSpectrum was a pointer to SpectrumVis buffer).
Added M1 and M2 memories to allow display of reference spectra.
Added math operations to allow spectrum to be difference of current spectrum and either memory or a moving average.
Fixed measurement counts, so they are performed once per spectrum, not on displayed spectra.
Added spectrum mask measurement, to check when a spectrum exceeds mask held in M1 or M2.
Optionally display power/frequency under cursor in status line.
Optionally display peak power/frequency in status line.
Fix incorrect nyquist sample replication, when zoom used.
Fix cursor not changing from resize to pointer when moving over spectrum measurements window.
Add spectrum colour setting.