Enabled cppcheck and cleaned up errors in source code.