Fix some warnings found by clang.

Closes #9032.
Merge pull request #9052 from narc0tiq/fix-clang-warnings

Fix some warnings found by clang.