Revert parts of "fix compiler/cppcheck warnings:"

This partly reverts commit 3a945da53dd92b79b94f28cbbce428578bacc3dd.