Add explicit casts to reduce warnings on win32

Not sure if those are sane on other platforms - therefore i do it as a seperate PR so you can decide.

This one is based on #34 and only the top 2 commits are new...