Avoid binding range-loop variables to temporary QString values and
compare channel type strings by value instead of pointer address.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Add a terminating LF to tracked text files that were missing a
newline at end of file. This avoids Codacy whitespace failures and
ensures text files conform to the repository line-ending policy.
Affected files were identified and fixed with the following script.
It checks all tracked files against .gitattributes, skips files marked
as binary or -text, and reports the final 32 bytes of any non-empty text
file that does not end with LF before adding the missing newline.
git ls-files -z |
while IFS= read -r -d '' f; do
attr=$(git check-attr text -- "$f")
case "$attr" in
"$f: text: unset"|"$f: text: unspecified")
continue
;;
esac
[ -f "$f" ] || continue
[ -s "$f" ] || continue
[ "$(tail -c 1 -- "$f" | od -An -t x1 | tr -d ' \n')" = "0a" ] || {
printf '%s\n' "$f"
tail -c 32 -- "$f" | hexdump -C
printf '\n' >> "$f"
}
done
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Normalize existing text files to LF to conform to the repository-wide
line-ending policy defined by .gitattributes by:
git add --renormalize .
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Assign descriptive names to SDRangel threads so thread activity can be
identified when investigating multi-threaded behavior, including crashes,
leaks, and synchronization issues in debuggers and others tools.
Use compact names to fit platform thread-name limits (14 chars) while
retaining the component and thread role where possible.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
MessageQueue::pop() transfers ownership of the popped message to the
caller, but many handleInputMessages() implementations only deleted
the message when handleMessage() returned true. When a message was not
handled, ownership had already been transferred from the queue and the
message was leaked.
This was identified while investigating an ASAN leak in the audio
subsystem.
Update the applicable handleInputMessages() implementations to always
delete messages after handleMessage() returns. Unhandled messages are
also logged with the component and message identifier so unexpected
message routing is visible during debugging.
This change:
- Ensures every message popped from a queue has its ownership resolved.
- Prevents leaks when handleMessage() returns false.
- Makes unhandled messages visible instead of silently discarding them.
- Preserves the existing message handling logic and does not require
components to handle message types that are legitimately irrelevant
to them.
The changes are intentionally mechanical and limited to the common
message queue ownership and diagnostic pattern.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
get_spectrum_history reports what has been on a band over the last
while from the spectrum's scroll history, per bin and as a list of
signals with their duty cycles; get_waterfall_image returns the same
history as a picture, the first tool to put image content beside the
text in a result. Both switch scrolling on when it is off and say so.
list_windows shows every window with its workspace and whether it is
hidden, and set_workspace takes hidden alongside the workspace index.
capture_audio's inline copy is now mono and decimated to 16 kHz, so a
ten second capture fits under the 1 MB result limit; the file on disk
is unchanged.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Both overrode showEvent for the QTBUG-100333 redraw workaround without
calling the base class, so the window state FeatureGUI publishes on show
never ran and the windows API reported the windows hidden while they
were on screen.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The display was scaled for the gain the device had, and a change of tens of decibels left the
trace off the top or along the bottom. After the chosen gain has reached the trace the main
spectrum's reference level and range are set from it, as the GUI's autoscale button does; the
autoscale argument, default true, leaves the display alone when false, and the reply says
whether it was done. The auto tune in listen and scan does the same and says so.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The guard that removes a device set a failed listen or scan created compared only the index,
so a set another request had replaced at that index would have gone instead. The engine's UID
and the object's address are recorded at creation and checked before removal.
The Codex config writer now recognises sdrangel.url = "..." under [mcp_servers] as the server
already being defined, and refuses rather than adding a [mcp_servers.sdrangel] table a TOML
parser would reject as defined twice.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Tools: listen and scan reclaim their earlier channels before retuning the device, so a scanner
left running cannot move it in between; scan counts a range before building it; booleans are
read from JSON booleans, numbers and strings alike, so replace "false" is false and freeze 1
freezes; a MIMO device set takes receive and transmit channel types; deletion is serialised
from lookup to completion so two concurrent reclaims cannot take a third channel; tune_gain
refuses a gain or AGC key the device lacks; start_iq_recording checks the name first and cleans
up by UID; describe_settings emits a definition matched by name; remove_last_deviceset reports
a timeout; a device set a failed listen or scan created is removed again.
Capture: a name resolving to the capture directory itself is refused, a drive root works, and
files are listed by prefix rather than wildcard. The audio clock starts before the wait for the
sample rate. Subscriptions are capped per session, device set URIs checked, and absent device
sets skipped by the poll. The Codex writer drops dotted managed keys and refuses a spelling it
cannot rewrite rather than adding a duplicate table.
Bridge: one session at a time when SDRangel comes back, the stream socket is shut down rather
than closed from the other thread, SIGPIPE cannot end the process, and a failed notification
gets no reply.
Also: tool calls and audio captures give up when the server stops, so stopping the feature
cannot deadlock on a call waiting for the main thread; channels are held by UID throughout;
socket timeouts in the bridge; ResourceNotFound for a resources/read of a URI that is not there.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Initialize m_audioMagsqPeak to zero so the SimplePTT worker starts with a
defined audio peak value before any audio samples are processed.
The member was previously left uninitialized, allowing getAudioPeak() to
return an indeterminate value before the first audio peak was recorded.
This resolves the uninitialized member finding reported by Coverity
(UNINIT_CTOR).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_row, m_col, and m_count to zero so the channel dialog starts with
defined table and channel state.
The members were previously left uninitialized, allowing row, column, and
channel count operations to use indeterminate values.
This resolves the uninitialized member findings reported by Coverity
(UNINIT_CTOR).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_running to false so the remote control worker starts in a defined
stopped state.
The member was previously left uninitialized, allowing running-state checks to
use an indeterminate value.
This resolves the uninitialized member finding reported by Coverity
(UNINIT_CTOR).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the map settings change flags to false and the file index to zero so
the dialog starts with defined state before any settings or downloads are
processed.
These members were previously left uninitialized, allowing change tracking
and file index operations to use indeterminate values.
This resolves the uninitialized member findings reported by Coverity
(UNINIT_CTOR).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_latitude and m_longitude to zero so a MapItem has defined
coordinates before its position is updated.
The members were previously left uninitialized, allowing coordinate access to
use indeterminate values.
This resolves the uninitialized member findings reported by Coverity
(UNINIT_CTOR).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_targetRA and m_targetDec to zero so the DFM protocol has defined
target coordinates before a target is set.
The members were previously left uninitialized, allowing target coordinates to
contain indeterminate values.
This resolves the uninitialized member findings reported by Coverity
(UNINIT_CTOR).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_sampleRate to zero so the demod analyzer has a defined sample
rate before one is reported or configured.
The member was previously left uninitialized, allowing sample rate checks to
use an indeterminate value.
This resolves the uninitialized member finding reported by Coverity
(UNINIT_CTOR).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_loggedIn to false so the APRS worker starts with a defined
logged-out state before a connection is established.
The member was previously left uninitialized, allowing login state checks to
use an indeterminate value.
This resolves the uninitialized member finding reported by Coverity
(UNINIT_CTOR).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize m_trackerDeviceSet and m_trackedDeviceSet to nullptr so the AFC
worker has defined device set state before tracking devices are initialized.
The pointers were previously left uninitialized until the corresponding
device sets were established.
This resolves the uninitialized member findings reported by Coverity
(UNINIT_CTOR).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Store VOR round-robin turn counters using std::size_t to match the type
returned by std::vector::size() and the type used for vector indexing.
The counters were previously stored as int but converted to unsigned int
when used in rrNextTurn(). Using std::size_t consistently removes the
signed/unsigned mismatch and makes the counter type appropriate for its use
as an index into the round-robin plan.
This also allows cppcheck to correctly reason about the relationship between
the turn counter and the plan size.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Round-robin plans are generated for each available device based on the VOR
channels that can be allocated within the device's available bandwidth. A
device can legitimately produce an empty plan when none of the remaining VOR
frequency combinations fit within that bandwidth.
Empty plans are retained in m_rrPlans because each entry corresponds to a
device and must remain aligned with the per-device m_rrTurnCounters entries.
rrNextTurn() previously assumed every plan contained at least one turn and
unconditionally accessed rrPlan[turnCount]. For an empty plan, the initial
turn count is zero, resulting in an out-of-bounds access.
Skip empty plans in rrNextTurn() while still advancing the device index so
subsequent plans remain aligned with their corresponding turn counters.
This prevents invalid accesses and resolves the out-of-bounds condition
reported by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Previously, geoReply() combined the sender null check with the reply error
check, allowing a null pQGeoCode to reach the error handling and subsequent
cleanup, which deferenced the pointer it was checking.
Check for a null sender first and return immediately when dynamic_cast()
fails. Valid replies then proceed through the existing error handling and
cleanup safely.
pointed out by cppcheck's nullPointerRedundantCheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Previously, geoReply() combined the sender null check with the reply error
check, allowing a null pQGeoCode to reach the error handling and subsequent
deleteLater() call.
Check for a null sender first and return immediately when dynamic_cast()
fails. Valid replies then proceed through the existing error handling and
cleanup safely.
pointed out by cppcheck's nullPointerRedundantCheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized m_forceRRAveraging member to false to
eliminate the cppcheck UNINIT_CTOR warning. This ensures the averaging option
starts in a defined state and avoids undefined behavior from reading an
uninitialized value.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized m_tabs pointer to nullptr to eliminate
the cppcheck UNINIT_CTOR warning. This ensures the WebView tab state starts in
a defined state and avoids undefined behavior from accessing an uninitialized
pointer.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized m_rgbColor member to black to
eliminate the cppcheck UNINIT_CTOR warning. This ensures the sky map color
starts in a defined state and avoids undefined behavior from reading an
uninitialized value.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized RigCtlServerWorker target frequency,
offset, and bandwidth members to defined values to eliminate cppcheck
UNINIT_CTOR warnings. This ensures target settings start in a known state
and avoids undefined behavior from reading uninitialized values.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized m_enabled member to false to eliminate
the cppcheck UNINIT_CTOR warning and ensure the rig control server starts in a
defined disabled state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized m_workspaceIndex member to zero to
eliminate the cppcheck UNINIT_CTOR warning and ensure the workspace index
starts in a defined state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>