fix most of the compiler warnings

except strict-aliasing warnings when using libev API
I left it for future functions bit, yes I can do that