15 #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
16 # define LSEEK lseek64
38 static char buf[1024];
41 DWORD lasterr = GetLastError();
42 DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
43 | FORMAT_MESSAGE_ALLOCATE_BUFFER,
53 && msgbuf[chars - 2] ==
'\r' && msgbuf[chars - 1] ==
'\n') {
58 if (chars >
sizeof (buf) - 1) {
59 chars =
sizeof (buf) - 1;
63 wcstombs(buf, msgbuf, chars + 1);
67 sprintf(buf,
"unknown win32 error (%ld)", error);
70 SetLastError(lasterr);
88 state->strm.avail_in = 0;
109 if (*mode >=
'0' && *mode <=
'9')
110 state->level = *mode -
'0';
116 #ifndef NO_GZCOMPRESS
136 state->strategy =
Z_RLE;
154 if (state->path == NULL) {
158 strcpy(state->path, path);
161 state->fd = fd != -1 ? fd :
171 (O_WRONLY | O_CREAT | (
176 if (state->fd == -1) {
187 if (state->start == -1) state->start = 0;
200 return gz_open(path, -1, mode);
206 return gz_open(path, -1, mode);
215 if (fd == -1 || (path = (
char *)
malloc(7 + 3 *
sizeof(
int))) == NULL)
236 if (state->size != 0)
282 if (state->err !=
Z_OK)
291 offset -= state->pos;
292 else if (state->seek)
293 offset += state->skip;
297 if (state->mode ==
GZ_READ && state->how ==
COPY &&
298 state->pos + offset >= state->raw) {
306 state->strm.avail_in = 0;
307 state->pos += offset;
315 offset += state->pos;
325 (
unsigned)offset : state->have;
335 state->skip = offset;
337 return state->pos + offset;
362 return state->pos + (state->seek ? state->skip : 0);
392 offset -= state->strm.avail_in;
418 return state->mode ==
GZ_READ ?
419 (state->eof && state->strm.avail_in == 0 && state->have == 0) : 0;
436 *errnum = state->err;
437 return state->msg == NULL ?
"" : state->msg;
467 if (state->msg != NULL) {
480 state->msg = (
char *)msg;
487 state->msg = (
char *)
"out of memory";
490 strcpy(state->msg, state->path);
int ZEXPORT gzeof(gzFile file)
z_off64_t ZEXPORT gzoffset64(gzFile file)
z_off_t ZEXPORT gztell(gzFile file)
int ZEXPORT gzrewind(gzFile file)
z_off64_t ZEXPORT gztell64(gzFile file)
z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence)
void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg)
int ZEXPORT gzbuffer(gzFile file, unsigned size)
#define ABC_NAMESPACE_IMPL_END
gzFile ZEXPORT gzdopen(int fd, const char *mode)
z_off_t ZEXPORT gzoffset(gzFile file)
#define ABC_NAMESPACE_IMPL_START
local gzFile gz_open(const char *path, int fd, const char *mode)
gzFile ZEXPORT gzopen(const char *path, const char *mode)
const char *ZEXPORT gzerror(gzFile file, int *errnum)
local void gz_reset(gz_statep state)
void ZEXPORT gzclearerr(gzFile file)
#define Z_DEFAULT_STRATEGY
unsigned ZLIB_INTERNAL gz_intmax()
gzFile ZEXPORT gzopen64(const char *path, const char *mode)
z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence)
#define Z_DEFAULT_COMPRESSION
local void gz_reset OF((gz_statep))