]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Compile the gzopen_w() function when __CYGWIN__ defined.
authorMark Adler <madler@alumni.caltech.edu>
Sun, 2 Aug 2015 00:38:56 +0000 (17:38 -0700)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Tue, 3 Nov 2015 18:10:23 +0000 (19:10 +0100)
 Conflicts:
gzlib.c
zlib.h

gzguts.h
gzlib.c

index a2698ee7d429afd208d7533acf7ccdac4c945207..ffaa5826ed68c98d681baad27628bbf9ff899777 100644 (file)
--- a/gzguts.h
+++ b/gzguts.h
 #  include <io.h>
 #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 8b23ecd98661794529bb78445b6603a0d6777463..f7b4ca382ee72e89d08e5a700ff549d15738f894 100644 (file)
--- 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);
 }