Miscellaneous compiler warning fixes

Compiler details and warnings are in the commit descriptions.

I'm not quite sure about platform.h line 399, is there a reason that that `if` statement was backwards?