Fix most of, if not all, of the cppcheck warnings.

Refs #9970
Merge branch 'feature/9970_refactor_project_serialisation' into develop