Fix C code to build with MSVC