diff options
| author | Mark Adler <madler@alumni.caltech.edu> | 2015-08-01 17:38:56 -0700 |
|---|---|---|
| committer | Mark Adler <madler@alumni.caltech.edu> | 2015-08-01 17:38:56 -0700 |
| commit | b4ce6caf0992296230e4e25b22a63e418bdf4dcf (patch) | |
| tree | a3162fbb31eb49e83bfb5493df1d9e3cb4d7be83 | |
| parent | 2fc6d66797b87ad40e4739520cd4e0e40d42efd3 (diff) | |
| download | zlib-b4ce6caf0992296230e4e25b22a63e418bdf4dcf.tar.gz zlib-b4ce6caf0992296230e4e25b22a63e418bdf4dcf.tar.bz2 zlib-b4ce6caf0992296230e4e25b22a63e418bdf4dcf.zip | |
Compile the gzopen_w() function when __CYGWIN__ defined.
| -rw-r--r-- | gzguts.h | 4 | ||||
| -rw-r--r-- | gzlib.c | 8 | ||||
| -rw-r--r-- | zlib.h | 2 |
3 files changed, 9 insertions, 5 deletions
| @@ -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 |
| @@ -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 |
| 307 | gzFile ZEXPORT gzopen_w(path, mode) | 307 | gzFile ZEXPORT gzopen_w(path, mode) |
| 308 | const wchar_t *path; | 308 | const wchar_t *path; |
| 309 | const char *mode; | 309 | const char *mode; |
| @@ -1757,7 +1757,7 @@ ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); | |||
| 1757 | ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); | 1757 | ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); |
| 1758 | ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); | 1758 | ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); |
| 1759 | ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); | 1759 | ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); |
| 1760 | #if defined(_WIN32) && !defined(Z_SOLO) | 1760 | #if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO) |
| 1761 | ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, | 1761 | ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, |
| 1762 | const char *mode)); | 1762 | const char *mode)); |
| 1763 | #endif | 1763 | #endif |
