Skip to content

cleanup: 4 cosmetic fixes from clang-tidy worklist - #774

Merged
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:cleanup/clang-tidy-cosmetic-fixes
May 30, 2026
Merged

cleanup: 4 cosmetic fixes from clang-tidy worklist#774
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:cleanup/clang-tidy-cosmetic-fixes

Conversation

@got3nks

@got3nks got3nks commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Third cleanup pass from the worklist on #766, addressing the latent-but-tidy items the analyzer surfaces:

File Issue Check
src/libs/ec/cpp/ECTag.h EC_IPv4_t default ctor left m_ip and m_port uninitialised; default member initialisers cover the trivial ctor optin.cplusplus.UninitializedObject
src/ThreadTasks.{h,cpp} EHashes lacked the bitwise-combined value 3, but the ctor cast to it; added EH_MD4_AND_AICH member and used it directly optin.core.EnumCastOutOfRange
src/PartFileHashThread.cpp elapsedMs is dead in release where AddDebugLogLineN is a no-op; wxUnusedVar after the macro deadcode.DeadStores
src/ECSpecialMuleTags.cpp EC_TAG_PREFS_STATISTICS placeholder block used an assignment-form if whose value was overwritten by the next block; dropped the assignment, kept the existence check + TODO deadcode.DeadStores

Out of scope

The RLE.cpp:121/148/151 zero-size NULL-op warnings are intentionally left for a follow-up. The Decode() function's two-pass realloc dance defeats the analyzer's symbolic execution even after the obvious shape (allocate at least 1 byte + explicit memset + size guards) — it follows mathematically-impossible paths through the m_len == 0 branch. A real fix likely needs an early-return restructure or a switch to std::vector that the analyzer can track. Deferred so this PR stays focused.

Test plan

Depends on #770 for the baseline config that surfaced this worklist.

amule-project#770)

Third cleanup pass from the worklist, addressing the items the analyzer
flags as latent (not crashy) but worth tidying:

  - src/libs/ec/cpp/ECTag.h -- EC_IPv4_t::EC_IPv4_t() left m_ip and
    m_port uninitialised, so a stack-allocated instance built with
    the default ctor (TextClient.cpp:286 and similar) had garbage in
    the fields before the caller explicitly assigned them.  Add C++11
    default member initialisers; the empty ctor body now produces a
    well-defined zero value.  Caught on lint as
    clang-analyzer-optin.cplusplus.UninitializedObject.

  - src/ThreadTasks.h + ThreadTasks.cpp -- the EHashes enum had only
    EH_AICH = 1 and EH_MD4 = 2, but the ctor used
    (EHashes)(EH_MD4 | EH_AICH), which is value 3, not a member of
    the enum.  Add EH_MD4_AND_AICH = EH_MD4 | EH_AICH as a named
    member and use it directly, no cast needed.  Caught on lint as
    clang-analyzer-optin.core.EnumCastOutOfRange.

  - src/PartFileHashThread.cpp -- elapsedMs is computed for a debug
    log line; AddDebugLogLineN compiles to a no-op in release, so the
    variable becomes a dead store.  wxUnusedVar(elapsedMs) after the
    macro silences the warning without touching the debug-build
    output.  Caught on lint as clang-analyzer-deadcode.DeadStores.

  - src/ECSpecialMuleTags.cpp -- the EC_TAG_PREFS_STATISTICS handling
    block was a placeholder with a //#warning TODO inside and an
    assignment-form if-statement whose value was overwritten by the
    next block (real dead store, not a false positive).  Drop the
    assignment, keep the existence check + TODO so future work has
    an obvious home.  Caught on lint as
    clang-analyzer-deadcode.DeadStores.

Out of scope: the RLE.cpp zero-size memset/memcpy warnings on lines
121, 148, 151 (clang-analyzer-core.NonNullParamChecker /
uninitialized.Assign / security.ArrayBound).  The Decode() function's
two-pass realloc dance defeats the analyzer's symbolic execution
even after the obvious fixes (allocate at least 1 byte + explicit
memset + size guards); the warnings persist because the analyzer
follows mathematically-impossible paths through the m_len == 0 branch.
A proper fix likely needs an early-return restructure or a switch to
std::vector that the analyzer can track better.  Deferred.

All builds clean across amule, amuled, amulegui, amulecmd on macOS.
Re-run of clang-tidy with the amule-project#770 baseline confirms each of the
four sites no longer fires; no new warnings introduced.
@got3nks got3nks mentioned this pull request May 30, 2026
@mrjimenez
mrjimenez merged commit 3ac83a3 into amule-project:master May 30, 2026
7 checks passed
@got3nks
got3nks deleted the cleanup/clang-tidy-cosmetic-fixes branch June 3, 2026 14:16
got3nks added a commit to got3nks/amule that referenced this pull request Jun 4, 2026
…ndex

Adds 55+ merged PRs to the 3.0.0 changelog since the last update
(amule-project#747, 2026-05-27). Narrative additions cover:

- Packaging: expanded the top list to include the macOS per-arch .app
  bundles and the Windows NSIS installer alongside the existing
  AppImage / Flatpak / .dmg / .zip entries. New bullets for amule-project#785
  (alc/alcc/cas/wxcas everywhere + Windows amuleweb), amule-project#794 (.dmg
  amuleweb path), amule-project#789 (<OS>-<arch> artifact naming), amule-project#780 / amule-project#796
  (Windows DPI + comctl32 manifest), amule-project#784 (FHS share/amule paths).

- Bug Fixes & Stability: post-amule-project#744 fixes including EC notification
  leak (amule-project#797), big-library scaling (amule-project#736, amule-project#840 superseding amule-project#728),
  amulegui ghost entries (amule-project#810, amule-project#819, amule-project#841, amule-project#824, amule-project#830, amule-project#760),
  PartFile early hash (amule-project#762), server protocol fixes (amule-project#835, amule-project#788,
  amule-project#721, amule-project#787), crypto stream UB (amule-project#779), UAF prevention (amule-project#756),
  Kad rotation (amule-project#795, amule-project#799/amule-project#805), GTK warning silencing (amule-project#833,
  amule-project#826/amule-project#836), and the clang-tidy worklist (amule-project#770, amule-project#772-amule-project#774).

- Translations: late-cycle wave covering French/Turkish manpages
  (amule-project#753/amule-project#754/amule-project#776), Galician (amule-project#763), Slovenian (amule-project#771), pt-BR
  (amule-project#768/amule-project#775/amule-project#812), French (amule-project#811), plus man-page tooling for
  date+version drift (amule-project#802).

- Contributors: added ngosang for UX feedback on the late-3.0
  cycle (amule-project#817/amule-project#818/amule-project#821/amule-project#828/amule-project#844) and ongoing work on the
  user-facing manual at amule-org.github.io.

- Merged PRs flat index: extended with amule-project#746-amule-project#845 + amule-project#841.
got3nks added a commit to got3nks/amule that referenced this pull request Jun 4, 2026
…ndex

Adds 55+ merged PRs to the 3.0.0 changelog since the last update
(amule-project#747, 2026-05-27). Narrative additions cover:

- Packaging: expanded the top list to include the macOS per-arch .app
  bundles and the Windows NSIS installer alongside the existing
  AppImage / Flatpak / .dmg / .zip entries. New bullets for amule-project#785
  (alc/alcc/cas/wxcas everywhere + Windows amuleweb), amule-project#794 (.dmg
  amuleweb path), amule-project#789 (<OS>-<arch> artifact naming), amule-project#780 / amule-project#796
  (Windows DPI + comctl32 manifest), amule-project#784 (FHS share/amule paths).

- Bug Fixes & Stability: post-amule-project#744 fixes including EC notification
  leak (amule-project#797), big-library scaling (amule-project#736, amule-project#840 superseding amule-project#728),
  amulegui ghost entries (amule-project#810, amule-project#819, amule-project#841, amule-project#824, amule-project#830, amule-project#760),
  PartFile early hash (amule-project#762), server protocol fixes (amule-project#835, amule-project#788,
  amule-project#721, amule-project#787), crypto stream UB (amule-project#779), UAF prevention (amule-project#756),
  Kad rotation (amule-project#795, amule-project#799/amule-project#805), GTK warning silencing (amule-project#833,
  amule-project#826/amule-project#836), and the clang-tidy worklist (amule-project#770, amule-project#772-amule-project#774).

- Translations: late-cycle wave covering French/Turkish manpages
  (amule-project#753/amule-project#754/amule-project#776), Galician (amule-project#763), Slovenian (amule-project#771), pt-BR
  (amule-project#768/amule-project#775/amule-project#812), French (amule-project#811), plus man-page tooling for
  date+version drift (amule-project#802).

- Contributors: added ngosang for UX feedback on the late-3.0
  cycle (amule-project#817/amule-project#818/amule-project#821/amule-project#828/amule-project#844) and ongoing work on the
  user-facing manual at amule-org.github.io.

- Merged PRs flat index: extended with amule-project#746-amule-project#845 + amule-project#841.
mrjimenez pushed a commit that referenced this pull request Jun 4, 2026
Adds 55+ merged PRs to the 3.0.0 changelog since the last update
(#747, 2026-05-27). Narrative additions cover:

- Packaging: expanded the top list to include the macOS per-arch .app
  bundles and the Windows NSIS installer alongside the existing
  AppImage / Flatpak / .dmg / .zip entries. New bullets for #785
  (alc/alcc/cas/wxcas everywhere + Windows amuleweb), #794 (.dmg
  amuleweb path), #789 (<OS>-<arch> artifact naming), #780 / #796
  (Windows DPI + comctl32 manifest), #784 (FHS share/amule paths).

- Bug Fixes & Stability: post-#744 fixes including EC notification
  leak (#797), big-library scaling (#736, #840 superseding #728),
  amulegui ghost entries (#810, #819, #841, #824, #830, #760),
  PartFile early hash (#762), server protocol fixes (#835, #788,
  #721, #787), crypto stream UB (#779), UAF prevention (#756),
  Kad rotation (#795, #799/#805), GTK warning silencing (#833,
  #826/#836), and the clang-tidy worklist (#770, #772-#774).

- Translations: late-cycle wave covering French/Turkish manpages
  (#753/#754/#776), Galician (#763), Slovenian (#771), pt-BR
  (#768/#775/#812), French (#811), plus man-page tooling for
  date+version drift (#802).

- Contributors: added ngosang for UX feedback on the late-3.0
  cycle (#817/#818/#821/#828/#844) and ongoing work on the
  user-facing manual at amule-org.github.io.

- Merged PRs flat index: extended with #746-#845 + #841.
got3nks pushed a commit to got3nks/amule that referenced this pull request Aug 3, 2026
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.

2 participants