Fixed some lint warnings found by cppcheck.
Fixed lint errors/warnings/style/performance found by cppcheck.