This fixes all errors reported by cppcheck #3745.