This fixes all errors reported by cppcheck #3745.
Merge pull request #3746 from NAThompson/cppcheck_clean_3745

Cppcheck clean 3745
Merge commit '9796496098eba0f4bbd68e8f9065fb813b56e586'