fix most of the compiler warnings

except strict-aliasing warnings when using libev API