aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2015-08-01 17:38:56 -0700
committerMark Adler <madler@alumni.caltech.edu>2015-08-01 17:38:56 -0700
commitb4ce6caf0992296230e4e25b22a63e418bdf4dcf (patch)
treea3162fbb31eb49e83bfb5493df1d9e3cb4d7be83
parent2fc6d66797b87ad40e4739520cd4e0e40d42efd3 (diff)
downloadzlib-b4ce6caf0992296230e4e25b22a63e418bdf4dcf.tar.gz
zlib-b4ce6caf0992296230e4e25b22a63e418bdf4dcf.tar.bz2
zlib-b4ce6caf0992296230e4e25b22a63e418bdf4dcf.zip
Compile the gzopen_w() function when __CYGWIN__ defined.
-rw-r--r--gzguts.h4
-rw-r--r--gzlib.c8
-rw-r--r--zlib.h2
3 files changed, 9 insertions, 5 deletions
diff --git a/gzguts.h b/gzguts.h
index 593dfee..bb62175 100644
--- a/gzguts.h
+++ b/gzguts.h
@@ -39,6 +39,10 @@
39# include <io.h> 39# include <io.h>
40#endif 40#endif
41 41
42#if defined(_WIN32) || defined(__CYGWIN__)
43# define WIDECHAR
44#endif
45
42#ifdef WINAPI_FAMILY 46#ifdef WINAPI_FAMILY
43# define open _open 47# define open _open
44# define read _read 48# define read _read
diff --git a/gzlib.c b/gzlib.c
index 3e344f9..d735829 100644
--- a/gzlib.c
+++ b/gzlib.c
@@ -188,7 +188,7 @@ local gzFile gz_open(path, fd, mode)
188 } 188 }
189 189
190 /* save the path name for error messages */ 190 /* save the path name for error messages */
191#ifdef _WIN32 191#ifdef WIDECHAR
192 if (fd == -2) { 192 if (fd == -2) {
193 len = wcstombs(NULL, path, 0); 193 len = wcstombs(NULL, path, 0);
194 if (len == (size_t)-1) 194 if (len == (size_t)-1)
@@ -202,7 +202,7 @@ local gzFile gz_open(path, fd, mode)
202 free(state); 202 free(state);
203 return NULL; 203 return NULL;
204 } 204 }
205#ifdef _WIN32 205#ifdef WIDECHAR
206 if (fd == -2) 206 if (fd == -2)
207 if (len) 207 if (len)
208 wcstombs(state->path, path, len + 1); 208 wcstombs(state->path, path, len + 1);
@@ -239,7 +239,7 @@ local gzFile gz_open(path, fd, mode)
239 239
240 /* open the file with the appropriate flags (or just use fd) */ 240 /* open the file with the appropriate flags (or just use fd) */
241 state->fd = fd > -1 ? fd : ( 241 state->fd = fd > -1 ? fd : (
242#ifdef _WIN32 242#ifdef WIDECHAR
243 fd == -2 ? _wopen(path, oflag, 0666) : 243 fd == -2 ? _wopen(path, oflag, 0666) :
244#endif 244#endif
245 open((const char *)path, oflag, 0666)); 245 open((const char *)path, oflag, 0666));
@@ -303,7 +303,7 @@ gzFile ZEXPORT gzdopen(fd, mode)
303} 303}
304 304
305/* -- see zlib.h -- */ 305/* -- see zlib.h -- */
306#ifdef _WIN32 306#ifdef WIDECHAR
307gzFile ZEXPORT gzopen_w(path, mode) 307gzFile ZEXPORT gzopen_w(path, mode)
308 const wchar_t *path; 308 const wchar_t *path;
309 const char *mode; 309 const char *mode;
diff --git a/zlib.h b/zlib.h
index 7ec5fa8..7263beb 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1757,7 +1757,7 @@ ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
1757ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); 1757ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
1758ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); 1758ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
1759ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); 1759ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
1760#if defined(_WIN32) && !defined(Z_SOLO) 1760#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO)
1761ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, 1761ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
1762 const char *mode)); 1762 const char *mode));
1763#endif 1763#endif