Fix cppcheck 2.2 issues
This MR reverts the hack introduced to work around a cppcheck 2.0 bug and... addresses 3 new false positives reported by cppcheck 2.2 :-)
As usually, more details can be found in commit log messages.
cppcheck 2.2 is not yet present in our Docker images. This MR should not be merged until that happens.
Edited by Michał Kępień