mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-10-08 08:10:26 -04:00
5.9 KiB
5.9 KiB
CubicSDR Project Evaluation
Project: CubicSDR v0.2.8 License: GPL-2.0+ Language: C++ (C++11/14) Last Updated: 2026-07-23
Architecture
- ~197 source files across well-organized modules: SDR I/O, demodulation, audio, visualization, and modem plugins
- Threading model: Producer-consumer pattern with blocking queues for SDR -> demod -> audio pipeline
- Build: Single monolithic CMakeLists.txt (~1100 lines) supporting Windows/macOS/Linux
- Vendored deps: lodepng, tinyxml, rtaudio, cubicvr2, hamlib, liquid-dsp in
external/
Key Strengths
- Clean modular source organization (
sdr/,demod/,audio/,visual/,modules/modem/) - Proper thread safety with atomics, mutexes, lock_guard, shared_ptr throughout
- SPDX license headers on most source files (~177 of 197; missing from auto-generated form/dialog files)
- Cross-platform support (Win/Mac/Linux)
Key Weaknesses
| Issue | Severity |
|---|---|
| Zero test coverage — no test framework, no test files, CI only builds | Critical |
Monolithic files — AppFrame.cpp is ~3,200 lines |
High |
Memory safety — raw new/delete for threads, 20 reinterpret_casts in DataTree, suppressed MSVC C4996 warnings |
High |
Outdated CMake — targets 2.8.12, uses -std=c++0x draft flag, deprecated patterns |
Medium |
| Incomplete .gitignore — missing IDE, OS, and build artifact patterns | Medium |
| Minimal docs — no CONTRIBUTING, CHANGELOG, API docs, or Doxygen | Medium |
| 18 open TODOs in project code, including acknowledged bugs | Low-Medium |
| No input validation on XML config files | Medium |
Recommendations (Priority Order)
- Add unit tests — Start with
DataTree,Timer,ThreadBlockingQueue, frequency conversion utilities - Fix
.gitignore— Add.vs/,*.obj,CMakeCache.txt,.DS_Store, IDE files - Modernize CMake — Bump to 3.10+, use
target_compile_features(cxx_std_14), replace deprecated variables - Replace raw
new/deletewithstd::unique_ptr/std::shared_ptrfor thread objects inCubicSDR.cpp - Split
AppFrame.cpp— Extract menu handling, keyboard shortcuts, device management into separate files - Remove MSVC C4996 suppression — Address the underlying unsafe CRT calls (
sprintf->snprintf, etc.) - Replace
reinterpret_casttype punning inDataTree.hwithmemcpy-based serialization (avoids UB) - Use git submodules or a package manager for vendored external dependencies
- Add CI test execution after builds
- Resolve or convert to tracked issues the 18 open TODOs
Detailed Findings
TODO/FIXME Comments (18 in project code)
| File | Comment | Severity |
|---|---|---|
CubicSDRDefs.h |
TODO: Make the waterfall resolutions an option. |
Low |
AppFrame.cpp |
TODO: refactor these.. |
Medium |
AppFrame.cpp |
TODO: Move the stuff from there to here |
Medium |
AppFrame.cpp |
TODO: Catch key-ups outside of original target |
Low |
DataTree.h |
TODO: smarter way with templates? (x2) |
Medium |
DataTree.cpp |
TODO: code below returns a forced cast in (char*) beware... |
High |
DataTree.cpp |
TODO: stack recursion optimization (x2) |
Low |
DemodulatorThread.cpp |
TODO: handle digital modems with audio output |
Medium |
DemodulatorMgr.cpp |
TODO: This is probably unnecessary and confusing |
Medium |
SoapySDRThread.cpp |
Various TODOs about timing and bandwidth (x3) | Low |
GainCanvas.cpp |
TODO: if it not desirable, do not update in AGC mode |
Low |
ScopeCanvas.cpp |
TODO: find out why frontbuffer drawing has stopped working in wx 3.1.0? |
Medium |
PrimaryGLContext.cpp |
TODO: Better recording indicator... |
Low |
BookmarkView.cpp |
TODO: keys for other actions? |
Low |
Memory Safety Concerns
DataTree.hcontains 20reinterpret_castoperations for type punning — potential aliasing violations and undefined behavior. Usememcpyorstd::bit_castinstead.CubicSDR.cppallocates thread objects (std::thread*) with rawnewand manualdelete. Any exception between allocation and deletion causes a leak. Should usestd::unique_ptr<std::thread>.IOThread.cppcatch(...)re-throws after setting termination flags — correct for cleanup, but callers rarely handle the propagated exception- MSVC C4996 warning is globally suppressed, hiding potential buffer overflow risks from unsafe CRT functions.
Build System Issues
cmake_minimum_required(VERSION 2.8.12)— should be 3.10+- Uses
ADD_DEFINITIONS(-std=c++0x)instead oftarget_compile_features()—c++0xis the C++11 draft, not the finalized standard - Uses deprecated
CMAKE_CREATE_WIN32_EXEvariable - Uses global
include_directories()instead oftarget_include_directories() - Hardcoded library paths:
link_directories(/usr/local/lib), ALSA paths at/usr/includeand/usr/lib - Header/source file lists in CMakeLists.txt have some mismatches (
.cppfiles listed as headers,.hfiles listed as sources)
Documentation
- README.md is minimal with no inline build instructions
- No CONTRIBUTING.md, CHANGELOG.md, CODE_OF_CONDUCT.md, or architecture docs
- No Doxygen or API documentation
- Build instructions exist only on external wiki; user manual in separate repository
CI/CD
- No CI configuration exists (no
.circleci/,.github/workflows/, or.travis.yml) - Recent commits are macOS-focused (bundling, code signing)
- Single branch (
master), 37 tags from 0.1.0 to 0.2.7
.gitignore
Currently only covers build/, cmake_build/, dist/. Missing entries for:
- IDE files (
.vs/,*.suo,.idea/,*.xcworkspace,*.xcodeproj) - OS files (
.DS_Store,Thumbs.db,desktop.ini) - Compiled artifacts (
*.o,*.obj,*.dll,*.so,*.dylib,*.exe,*.lib,*.a) - CMake generated files (
CMakeCache.txt,CMakeFiles/,cmake_install.cmake,Makefile) - Package files (
*.deb,*.rpm,*.dmg)