Fix compiler warnings with trivial fixes.

Fixes include removing dead code and variables, ifdeffing
platform-specific code, and unifdeffing non-platform-specific code.