-surrounded some MSVC-only sections that I forgot
-made it compatible C90 (all variable declaration moved to begin of functions)