Misc fixes for byterun/win32.c diff --exclude _build -urN ocaml-3.11.0+beta1.orig/byterun/win32.c ocaml-3.11.0+beta1.mingw/byterun/win32.c --- ocaml-3.11.0+beta1.orig/byterun/win32.c 2008-04-22 13:24:10.000000000 +0100 +++ ocaml-3.11.0+beta1.mingw/byterun/win32.c 2008-11-15 15:50:32.000000000 +0000 @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -35,6 +36,26 @@ #include "flexdll.h" +/* XXX including gets ../byterun/io.h for some reason. + * Including the real io.h using the full path fails because of + * some strange bug in the system header file itself. Give up and + * just define _finddata_t explicitly here. + */ +#ifndef _FSIZE_T_DEFINED +typedef unsigned long _fsize_t; +#define _FSIZE_T_DEFINED + +struct _finddata_t +{ + unsigned attrib; + time_t time_create; + time_t time_access; + time_t time_write; + _fsize_t size; + char name[FILENAME_MAX]; +}; +#endif + #ifndef S_ISREG #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) #endif @@ -93,7 +114,7 @@ pathlen = strlen(name) + 1; if (pathlen < 256) pathlen = 256; while (1) { - fullname = stat_alloc(pathlen); + fullname = caml_stat_alloc(pathlen); retcode = SearchPath(NULL, /* use system search path */ name, ".exe", /* add .exe extension if needed */ @@ -107,7 +128,7 @@ break; } if (retcode < pathlen) break; - stat_free(fullname); + caml_stat_free(fullname); pathlen = retcode + 1; } return fullname;