Fix formatting specifiers for some size_t arguments.
Add suggested parentheses to RHS of ^ operator.
Fix a bunch of warnings caused by unused functions.