8 #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
32 static char buf[1024];
35 DWORD lasterr = GetLastError();
36 DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
37 | FORMAT_MESSAGE_ALLOCATE_BUFFER,
47 && msgbuf[chars - 2] ==
'\r' && msgbuf[chars - 1] ==
'\n') {
52 if (chars >
sizeof (buf) - 1) {
53 chars =
sizeof (
buf) - 1;
57 wcstombs(buf, msgbuf, chars + 1);
61 sprintf(buf,
"unknown win32 error (%ld)", error);
64 SetLastError(lasterr);
83 state->strm.avail_in = 0;
107 if (*mode >=
'0' && *mode <=
'9')
108 state->level = *mode -
'0';
114 #ifndef NO_GZCOMPRESS
134 state->strategy =
Z_RLE;
151 state->path =
malloc(strlen(path) + 1);
152 if (state->path ==
NULL) {
156 strcpy(state->path, path);
159 state->fd = fd != -1 ? fd :
169 (O_WRONLY | O_CREAT | (
174 if (state->fd == -1) {
185 if (state->start == -1) state->start = 0;
200 return gz_open(path, -1, mode);
208 return gz_open(path, -1, mode);
219 if (fd == -1 || (path =
malloc(7 + 3 *
sizeof(
int))) ==
NULL)
221 sprintf(path,
"<fd:%d>", fd);
242 if (state->size != 0)
292 if (state->err !=
Z_OK)
301 offset -= state->pos;
302 else if (state->seek)
303 offset += state->skip;
307 if (state->mode ==
GZ_READ && state->how ==
COPY &&
308 state->pos + offset >= state->raw) {
316 state->strm.avail_in = 0;
325 offset += state->pos;
335 (
unsigned)offset : state->have;
347 return state->pos +
offset;
376 return state->pos + (state->seek ? state->skip : 0);
408 offset -= state->strm.avail_in;
436 return state->mode ==
GZ_READ ?
437 (state->eof && state->strm.avail_in == 0 && state->have == 0) : 0;
456 *errnum = state->err;
457 return state->msg ==
NULL ?
"" : state->msg;
491 if (state->msg !=
NULL) {
504 state->msg = (
char *)msg;
509 if ((state->msg =
malloc(strlen(state->path) + strlen(msg) + 3)) ==
NULL) {
511 state->msg = (
char *)
"out of memory";
514 strcpy(state->msg, state->path);
515 strcat(state->msg,
": ");
516 strcat(state->msg, msg);
z_off64_t ZEXPORT gzoffset64(gzFile file)
gzFile ZEXPORT gzdopen(int fd, const char *mode)
#define Z_DEFAULT_COMPRESSION
local gzFile gz_open(char *path, const char *mode, int fd) const
GLsizei const GLchar *const * path
z_off64_t ZEXPORT gztell64(gzFile file)
gzFile ZEXPORT gzopen(char *path, const char *mode) const
void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg)
int ZEXPORT gzbuffer(gzFile file, unsigned size)
const char *ZEXPORT gzerror(gzFile file, int *errnum)
#define Z_DEFAULT_STRATEGY
int ZEXPORT gzrewind(gzFile file)
typedef LPVOID(WINAPI *PFNWGLCREATEIMAGEBUFFERI3DPROC)(HDC hDC
z_off_t ZEXPORT gzoffset(gzFile file)
int ZEXPORT gzeof(gzFile file)
z_off_t ZEXPORT gztell(gzFile file)
local void gz_reset(gz_statep state)
void ZEXPORT gzclearerr(gzFile file)
GLenum GLuint GLsizei const GLchar * buf
gzFile ZEXPORT gzopen64(char *path, const char *mode) const
GLdouble GLdouble GLdouble GLdouble q
typedef DWORD(WINAPI *XInputGetState_t)(DWORD dwUserIndex
unsigned ZLIB_INTERNAL gz_intmax()
z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence)
z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence)