Fixes from multi-platform work

Hi, I've tested pion on Mint, Debian Testing & Stable, Fedora 20 & 17, and MingW64 on 32-bit and 64-bit Windows 7, and these are the fixes I made.

I've also fixed all the warnings, and set `-Werror` so that they stay fixed.