Add gzopen_w() in Windows for wide character path names.
This commit is contained in:
@@ -135,3 +135,6 @@ EXPORTS
|
|||||||
gzflags @162
|
gzflags @162
|
||||||
inflateResetKeep @163
|
inflateResetKeep @163
|
||||||
deflateResetKeep @164
|
deflateResetKeep @164
|
||||||
|
|
||||||
|
; zlib1 v1.2.7 added:
|
||||||
|
gzopen_w @165
|
||||||
|
|||||||
@@ -134,4 +134,7 @@ EXPORTS
|
|||||||
gzgetc_ @161
|
gzgetc_ @161
|
||||||
gzflags @162
|
gzflags @162
|
||||||
inflateResetKeep @163
|
inflateResetKeep @163
|
||||||
deflateResetKeep @164
|
deflateResetKeep @164
|
||||||
|
|
||||||
|
; zlib1 v1.2.7 added:
|
||||||
|
gzopen_w @165
|
||||||
|
|||||||
2
gzguts.h
2
gzguts.h
@@ -27,7 +27,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#if defined(__TURBOC__) || defined(_MSC_VER)
|
#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
48
gzlib.c
48
gzlib.c
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
/* Local functions */
|
/* Local functions */
|
||||||
local void gz_reset OF((gz_statep));
|
local void gz_reset OF((gz_statep));
|
||||||
local gzFile gz_open OF((const char *, int, const char *));
|
local gzFile gz_open OF((const void *, int, const char *));
|
||||||
|
|
||||||
#if defined UNDER_CE
|
#if defined UNDER_CE
|
||||||
|
|
||||||
@@ -89,11 +89,12 @@ local void gz_reset(state)
|
|||||||
|
|
||||||
/* Open a gzip file either by name or file descriptor. */
|
/* Open a gzip file either by name or file descriptor. */
|
||||||
local gzFile gz_open(path, fd, mode)
|
local gzFile gz_open(path, fd, mode)
|
||||||
const char *path;
|
const void *path;
|
||||||
int fd;
|
int fd;
|
||||||
const char *mode;
|
const char *mode;
|
||||||
{
|
{
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
int oflag;
|
||||||
#ifdef O_CLOEXEC
|
#ifdef O_CLOEXEC
|
||||||
int cloexec = 0;
|
int cloexec = 0;
|
||||||
#endif
|
#endif
|
||||||
@@ -191,28 +192,33 @@ local gzFile gz_open(path, fd, mode)
|
|||||||
}
|
}
|
||||||
strcpy(state->path, path);
|
strcpy(state->path, path);
|
||||||
|
|
||||||
/* open the file with the appropriate mode (or just use fd) */
|
/* compute the flags for open() */
|
||||||
state->fd = fd != -1 ? fd :
|
oflag =
|
||||||
open(path,
|
|
||||||
#ifdef O_LARGEFILE
|
#ifdef O_LARGEFILE
|
||||||
O_LARGEFILE |
|
O_LARGEFILE |
|
||||||
#endif
|
#endif
|
||||||
#ifdef O_BINARY
|
#ifdef O_BINARY
|
||||||
O_BINARY |
|
O_BINARY |
|
||||||
#endif
|
#endif
|
||||||
#ifdef O_CLOEXEC
|
#ifdef O_CLOEXEC
|
||||||
(cloexec ? O_CLOEXEC : 0) |
|
(cloexec ? O_CLOEXEC : 0) |
|
||||||
#endif
|
#endif
|
||||||
(state->mode == GZ_READ ?
|
(state->mode == GZ_READ ?
|
||||||
O_RDONLY :
|
O_RDONLY :
|
||||||
(O_WRONLY | O_CREAT |
|
(O_WRONLY | O_CREAT |
|
||||||
#ifdef O_EXCL
|
#ifdef O_EXCL
|
||||||
(exclusive ? O_EXCL : 0) |
|
(exclusive ? O_EXCL : 0) |
|
||||||
#endif
|
#endif
|
||||||
(state->mode == GZ_WRITE ?
|
(state->mode == GZ_WRITE ?
|
||||||
O_TRUNC :
|
O_TRUNC :
|
||||||
O_APPEND))),
|
O_APPEND)));
|
||||||
0666);
|
|
||||||
|
/* open the file with the appropriate flags (or just use fd) */
|
||||||
|
state->fd = fd > -1 ? fd : (
|
||||||
|
#ifdef _WIN32
|
||||||
|
fd == -2 ? _wopen(path, oflag, 0666) :
|
||||||
|
#endif
|
||||||
|
open(path, oflag, 0666));
|
||||||
if (state->fd == -1) {
|
if (state->fd == -1) {
|
||||||
free(state->path);
|
free(state->path);
|
||||||
free(state);
|
free(state);
|
||||||
@@ -266,6 +272,16 @@ gzFile ZEXPORT gzdopen(fd, mode)
|
|||||||
return gz;
|
return gz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
#ifdef _WIN32
|
||||||
|
gzFile ZEXPORT gzopen_w(path, mode)
|
||||||
|
const w_char *path;
|
||||||
|
const char *mode;
|
||||||
|
{
|
||||||
|
return gz_open(path, -2, mode);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* -- see zlib.h -- */
|
/* -- see zlib.h -- */
|
||||||
int ZEXPORT gzbuffer(file, size)
|
int ZEXPORT gzbuffer(file, size)
|
||||||
gzFile file;
|
gzFile file;
|
||||||
|
|||||||
@@ -74,10 +74,11 @@ EXPORTS
|
|||||||
inflateInit_
|
inflateInit_
|
||||||
inflateInit2_
|
inflateInit2_
|
||||||
inflateBackInit_
|
inflateBackInit_
|
||||||
|
gzgetc_
|
||||||
zError
|
zError
|
||||||
inflateSyncPoint
|
inflateSyncPoint
|
||||||
get_crc_table
|
get_crc_table
|
||||||
inflateUndermine
|
inflateUndermine
|
||||||
inflateResetKeep
|
inflateResetKeep
|
||||||
deflateResetKeep
|
deflateResetKeep
|
||||||
gzgetc_
|
gzopen_w
|
||||||
|
|||||||
3
zconf.h
3
zconf.h
@@ -73,6 +73,9 @@
|
|||||||
# define gzoffset64 z_gzoffset64
|
# define gzoffset64 z_gzoffset64
|
||||||
# define gzopen z_gzopen
|
# define gzopen z_gzopen
|
||||||
# define gzopen64 z_gzopen64
|
# define gzopen64 z_gzopen64
|
||||||
|
# ifdef _WIN32
|
||||||
|
# define gzopen_w z_gzopen_w
|
||||||
|
# endif
|
||||||
# define gzprintf z_gzprintf
|
# define gzprintf z_gzprintf
|
||||||
# define gzputc z_gzputc
|
# define gzputc z_gzputc
|
||||||
# define gzputs z_gzputs
|
# define gzputs z_gzputs
|
||||||
|
|||||||
@@ -75,6 +75,9 @@
|
|||||||
# define gzoffset64 z_gzoffset64
|
# define gzoffset64 z_gzoffset64
|
||||||
# define gzopen z_gzopen
|
# define gzopen z_gzopen
|
||||||
# define gzopen64 z_gzopen64
|
# define gzopen64 z_gzopen64
|
||||||
|
# ifdef _WIN32
|
||||||
|
# define gzopen_w z_gzopen_w
|
||||||
|
# endif
|
||||||
# define gzprintf z_gzprintf
|
# define gzprintf z_gzprintf
|
||||||
# define gzputc z_gzputc
|
# define gzputc z_gzputc
|
||||||
# define gzputs z_gzputs
|
# define gzputs z_gzputs
|
||||||
|
|||||||
@@ -73,6 +73,9 @@
|
|||||||
# define gzoffset64 z_gzoffset64
|
# define gzoffset64 z_gzoffset64
|
||||||
# define gzopen z_gzopen
|
# define gzopen z_gzopen
|
||||||
# define gzopen64 z_gzopen64
|
# define gzopen64 z_gzopen64
|
||||||
|
# ifdef _WIN32
|
||||||
|
# define gzopen_w z_gzopen_w
|
||||||
|
# endif
|
||||||
# define gzprintf z_gzprintf
|
# define gzprintf z_gzprintf
|
||||||
# define gzputc z_gzputc
|
# define gzputc z_gzputc
|
||||||
# define gzputs z_gzputs
|
# define gzputs z_gzputs
|
||||||
|
|||||||
4
zlib.h
4
zlib.h
@@ -1732,6 +1732,10 @@ ZEXTERN const uLongf * 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)
|
||||||
|
ZEXTERN gzFile ZEXPORT gzopen_w OF((const w_char *path,
|
||||||
|
const char *mode));
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user