Skip to content

Fix multiple issues raised by Cppcheck static analysis#811

Draft
dnzbk wants to merge 3 commits into
developfrom
fix/cppcheck-errors
Draft

Fix multiple issues raised by Cppcheck static analysis#811
dnzbk wants to merge 3 commits into
developfrom
fix/cppcheck-errors

Conversation

@dnzbk

@dnzbk dnzbk commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Description

223

  • Prevent integer underflows in LoggableFrontend using int64.
  • Fix null pointer evaluation logic in QueueScriptCoordinator.
  • Resolve variable shadowing issues in DiskState.
  • Eliminate logically redundant conditions across UnpackController, Deobfuscation, and NntpServer.
  • Improve memory efficiency by passing std::string by const reference instead of by value.
  • Fix ServerPool sequence point issues (use-after-move prevention).
  • Remove redundant boolean validation in ServerJoinGroupValidator.
  • Modernize option string comparisons in Options::ValidateOptionName using std::string_view bounds checking instead of legacy strcasecmp.
  • Update Connection::DoDisconnect to return void.
  • Restore missing null pointer guards for string construction in QueueCoordinator and HistoryCoordinator.
  • Add project-level .clangd, .clang-format and .clang-tidy configurations to enforce coding standards.

Testing

  • macOS Tahoe

- Replace C-style casts with reinterpret_cast/static_cast/const_cast
- Add missing member initializers to constructors (uninitMemberVar)
- Replace NULL/0 with nullptr in pointer contexts
- Add missing override specifiers to virtual methods
- Mark final classes with final keyword
- Fix shadowed variables and signed/unsigned comparisons
- Use pre-increment (++it) over post-increment where applicable
- Refactor Options.cpp to use string_view and StrCaseCmp helpers
- Fix QueueScriptCoordinator::CheckQueue selecting last item instead
  of highest-priority event
- Fix DiskState::LoadNzbInfo losing lsFailed/lsRetry URL statuses
  when restoring queue state from disk
- Remove ServerJoinGroupValidator: m_joinGroup is bool, making the
  0-99 range check trivially unreachable
- Update CI: use modern cmake -S/-B syntax, fix compile_commands.json
  path, restrict cppcheck to warning/performance/portability checks
- Add .clang-tidy and .clangd project configuration
- Update cppcheck invocation in docs/POSIX.md
@dnzbk dnzbk requested a review from luckedea May 20, 2026 06:42
@dnzbk dnzbk changed the title Fix cppcheck errors Fix multiple issues raised by Cppcheck static analysis May 20, 2026
@dnzbk dnzbk marked this pull request as draft May 20, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant