diff --git a/gzlib.c b/gzlib.c index b99c26c..e31533b 100644 --- a/gzlib.c +++ b/gzlib.c @@ -185,12 +185,13 @@ local gzFile gz_open(path, fd, mode) } /* save the path name for error messages */ - state->path = malloc(strlen(path) + 1); +# define WPATH "" + state->path = malloc(strlen(fd == -2 ? WPATH : (path) + 1); if (state->path == NULL) { free(state); return NULL; } - strcpy(state->path, path); + strcpy(state->path, fd == -2 ? WPATH : path); /* compute the flags for open() */ oflag = diff --git a/zconf.h b/zconf.h index f9a5fa7..8c6f945 100644 --- a/zconf.h +++ b/zconf.h @@ -402,6 +402,10 @@ typedef uLong FAR uLongf; # endif #endif +#ifdef _WIN32 +# include /* for wchar_t */ +#endif + /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even * though the former does not conform to the LFS document), but considering diff --git a/zconf.h.cmakein b/zconf.h.cmakein index 66368ad..4ade487 100644 --- a/zconf.h.cmakein +++ b/zconf.h.cmakein @@ -404,6 +404,10 @@ typedef uLong FAR uLongf; # endif #endif +#ifdef _WIN32 +# include /* for wchar_t */ +#endif + /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even * though the former does not conform to the LFS document), but considering diff --git a/zconf.h.in b/zconf.h.in index f9a5fa7..8c6f945 100644 --- a/zconf.h.in +++ b/zconf.h.in @@ -402,6 +402,10 @@ typedef uLong FAR uLongf; # endif #endif +#ifdef _WIN32 +# include /* for wchar_t */ +#endif + /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even * though the former does not conform to the LFS document), but considering