From: Mark Adler Date: Sun, 2 Aug 2015 00:38:56 +0000 (-0700) Subject: Compile the gzopen_w() function when __CYGWIN__ defined. X-Git-Tag: 1.9.9-b1~793^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa1c29c7f44d4c8362e5f29927a83b7139cc747e;p=thirdparty%2Fzlib-ng.git Compile the gzopen_w() function when __CYGWIN__ defined. Conflicts: gzlib.c zlib.h --- diff --git a/gzguts.h b/gzguts.h index a2698ee7d..ffaa5826e 100644 --- a/gzguts.h +++ b/gzguts.h @@ -35,6 +35,10 @@ # include #endif +#if defined(_WIN32) || defined(__CYGWIN__) +# define WIDECHAR +#endif + #ifdef WINAPI_FAMILY # define open _open # define read _read diff --git a/gzlib.c b/gzlib.c index 8b23ecd98..f7b4ca382 100644 --- a/gzlib.c +++ b/gzlib.c @@ -131,7 +131,7 @@ local gzFile gz_open(const void *path, int fd, const char *mode) { } /* save the path name for error messages */ -#if defined(_WIN32) || defined(__CYGWIN__) +#ifdef WIDECHAR if (fd == -2) { len = wcstombs(NULL, path, 0); if (len == (size_t)-1) @@ -144,7 +144,7 @@ local gzFile gz_open(const void *path, int fd, const char *mode) { free(state); return NULL; } -#if defined(_WIN32) || defined(__CYGWIN__) +#ifdef WIDECHAR if (fd == -2) if (len) { wcstombs(state->path, path, len + 1); @@ -231,7 +231,7 @@ gzFile ZEXPORT gzdopen(int fd, const char *mode) { } /* -- see zlib.h -- */ -#if defined(_WIN32) || defined(__CYGWIN__) +#ifdef WIDECHAR gzFile ZEXPORT gzopen_w(const wchar_t *path, const char *mode) { return gz_open(path, -2, mode); }