Fix cppcheck warnings: Member variable is not initialized in the constructor.
Fix cppcheck warnings: Variable is assigned a value that is never used.
Fix cppcheck warnings: The scope of the variable can be reduced.
Fix cppcheck warnings: Technically the member function can be const.
Fix cppcheck warnings: C-style pointer casting.