Cpp check updates

These are changes as indicated by the cppcheck static analyzer.

Please review the changes in these patches.  I found it very informative on how a static analysis tool can help track down bugs, performance issues, and style enformcement.