r9949: Portability fixes for mingw32