]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Enable gzopen_w for Cygwin 27/head
authorMika Lindqvist <postmaster@raasu.org>
Mon, 11 May 2015 21:02:02 +0000 (00:02 +0300)
committerMika Lindqvist <postmaster@raasu.org>
Tue, 12 May 2015 09:37:07 +0000 (12:37 +0300)
arch/x86/x86.h
gzlib.c
zlib.h

index f68663edbeab4e28da1b9bc7f3b6f1208c5be932..0380f8c95c492a61a57e81280e5060fb22fc6e33 100644 (file)
@@ -6,7 +6,11 @@
 #ifndef CPU_H
 #define CPU_H
 
-#define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
+#ifdef HAVE_HIDDEN
+# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
+#else
+# define ZLIB_INTERNAL
+#endif
 
 extern int x86_cpu_has_sse2;
 extern int x86_cpu_has_sse42;
diff --git a/gzlib.c b/gzlib.c
index 8e3b4e53530a17d88be292d130f077dd81597ff5..bef31943e186607251b9b04a63b5e13fb13131e3 100644 (file)
--- a/gzlib.c
+++ b/gzlib.c
@@ -132,7 +132,7 @@ local gzFile gz_open(const void *path, int fd, const char *mode)
     }
 
     /* save the path name for error messages */
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
     if (fd == -2) {
         len = wcstombs(NULL, path, 0);
         if (len == (size_t)-1)
@@ -146,7 +146,7 @@ local gzFile gz_open(const void *path, int fd, const char *mode)
         free(state);
         return NULL;
     }
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
     if (fd == -2)
         if (len)
             wcstombs(state->path, path, len + 1);
@@ -181,6 +181,8 @@ local gzFile gz_open(const void *path, int fd, const char *mode)
     state->fd = fd > -1 ? fd : (
 #ifdef _WIN32
         fd == -2 ? _wopen(path, oflag, 0666) :
+#elif __CYGWIN__
+        fd == -2 ? open(state->path, oflag, 0666) :
 #endif
         open((const char *)path, oflag, 0666));
     if (state->fd == -1) {
diff --git a/zlib.h b/zlib.h
index 201ea4c9d95d6d2f0db54da9a434efabb474f799..f323d5a97272c770a73bc548da2ef90138f00d63 100644 (file)
--- a/zlib.h
+++ b/zlib.h
@@ -1735,7 +1735,7 @@ ZEXTERN const z_crc_t * ZEXPORT get_crc_table   (void);
 ZEXTERN int            ZEXPORT inflateUndermine (z_stream *, int);
 ZEXTERN int            ZEXPORT inflateResetKeep (z_stream *);
 ZEXTERN int            ZEXPORT deflateResetKeep (z_stream *);
-#if defined(_WIN32) && defined(WITH_GZFILEOP)
+#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(WITH_GZFILEOP)
 ZEXTERN gzFile         ZEXPORT gzopen_w (const wchar_t *path, const char *mode);
 #endif
 #ifdef WITH_GZFILEOP