Fix Windows warnings and missing prototypes

This fixes problems with missing function prototypes and 64-bit data issues on Windows.

I'm really only opening this as a PR so I can check the Travis results before merging... :kissing_cat: