ENH: Fixed some cppcheck performance/style issues.

Change-Id: I9730dc5432804623a38a9e419ba665dd1425c6a9
Merge topic 'rk-MoreCppCheckFixes'

8528c9d ENH: Fixed some cppcheck performance/style issues.