cppcheck fix part 2/3.

Note that certain warnings are false positive due to the OS used or because
the code style chosen. I'll deal with the ++/-- change in another commit.