fixed bunch of VS2010 warnings/errors (when compiled as C code)