提交 b4ce6caf 编写于 作者: M Mark Adler

Compile the gzopen_w() function when __CYGWIN__ defined.

上级 2fc6d667
...@@ -39,6 +39,10 @@ ...@@ -39,6 +39,10 @@
# include <io.h> # include <io.h>
#endif #endif
#if defined(_WIN32) || defined(__CYGWIN__)
# define WIDECHAR
#endif
#ifdef WINAPI_FAMILY #ifdef WINAPI_FAMILY
# define open _open # define open _open
# define read _read # define read _read
......
...@@ -188,7 +188,7 @@ local gzFile gz_open(path, fd, mode) ...@@ -188,7 +188,7 @@ local gzFile gz_open(path, fd, mode)
} }
/* save the path name for error messages */ /* save the path name for error messages */
#ifdef _WIN32 #ifdef WIDECHAR
if (fd == -2) { if (fd == -2) {
len = wcstombs(NULL, path, 0); len = wcstombs(NULL, path, 0);
if (len == (size_t)-1) if (len == (size_t)-1)
...@@ -202,7 +202,7 @@ local gzFile gz_open(path, fd, mode) ...@@ -202,7 +202,7 @@ local gzFile gz_open(path, fd, mode)
free(state); free(state);
return NULL; return NULL;
} }
#ifdef _WIN32 #ifdef WIDECHAR
if (fd == -2) if (fd == -2)
if (len) if (len)
wcstombs(state->path, path, len + 1); wcstombs(state->path, path, len + 1);
...@@ -239,7 +239,7 @@ local gzFile gz_open(path, fd, mode) ...@@ -239,7 +239,7 @@ local gzFile gz_open(path, fd, mode)
/* open the file with the appropriate flags (or just use fd) */ /* open the file with the appropriate flags (or just use fd) */
state->fd = fd > -1 ? fd : ( state->fd = fd > -1 ? fd : (
#ifdef _WIN32 #ifdef WIDECHAR
fd == -2 ? _wopen(path, oflag, 0666) : fd == -2 ? _wopen(path, oflag, 0666) :
#endif #endif
open((const char *)path, oflag, 0666)); open((const char *)path, oflag, 0666));
...@@ -303,7 +303,7 @@ gzFile ZEXPORT gzdopen(fd, mode) ...@@ -303,7 +303,7 @@ gzFile ZEXPORT gzdopen(fd, mode)
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
#ifdef _WIN32 #ifdef WIDECHAR
gzFile ZEXPORT gzopen_w(path, mode) gzFile ZEXPORT gzopen_w(path, mode)
const wchar_t *path; const wchar_t *path;
const char *mode; const char *mode;
......
...@@ -1757,7 +1757,7 @@ ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); ...@@ -1757,7 +1757,7 @@ ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
#if defined(_WIN32) && !defined(Z_SOLO) #if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO)
ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
const char *mode)); const char *mode));
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册