Go to the source code of this file.
|
local void gz_reset | OF ((gz_statep)) |
|
local gzFile gz_open | OF ((const void *, int, const char *)) |
|
local void | gz_reset (gz_statep state) |
|
local gzFile | gz_open (const void *path, int fd, const char *mode) |
|
gzFile ZEXPORT | gzopen (const char *path, const char *mode) |
|
gzFile ZEXPORT | gzopen64 (const char *path, const char *mode) |
|
gzFile ZEXPORT | gzdopen (int fd, const char *mode) |
|
int ZEXPORT | gzbuffer (gzFile file, unsigned size) |
|
int ZEXPORT | gzrewind (gzFile file) |
|
z_off64_t ZEXPORT | gzseek64 (gzFile file, z_off64_t offset, int whence) |
|
z_off_t ZEXPORT | gzseek (gzFile file, z_off_t offset, int whence) |
|
z_off64_t ZEXPORT | gztell64 (gzFile file) |
|
z_off_t ZEXPORT | gztell (gzFile file) |
|
z_off64_t ZEXPORT | gzoffset64 (gzFile file) |
|
z_off_t ZEXPORT | gzoffset (gzFile file) |
|
int ZEXPORT | gzeof (gzFile file) |
|
const char *ZEXPORT | gzerror (gzFile file, int *errnum) |
|
void ZEXPORT | gzclearerr (gzFile file) |
|
void ZLIB_INTERNAL | gz_error (gz_statep state, int err, const char *msg) |
|
unsigned ZLIB_INTERNAL | gz_intmax () |
|
Definition at line 545 of file gzlib.cc.
548 if (state->msg != NULL) {
568 if ((state->msg = (
char *)malloc(strlen(state->path) + strlen(msg) + 3)) ==
573 #if !defined(NO_snprintf) && !defined(NO_vsnprintf)
574 snprintf(state->msg, strlen(state->path) + strlen(msg) + 3,
575 "%s%s%s", state->path,
": ", msg);
577 strcpy(state->msg, state->path);
578 strcat(state->msg,
": ");
579 strcat(state->msg, msg);
Definition at line 89 of file gzlib.cc.
119 if (*mode >=
'0' && *mode <=
'9')
120 state->level = *mode -
'0';
126 #ifndef NO_GZCOMPRESS
156 state->strategy =
Z_RLE;
188 len = wcstombs(NULL, (
const wchar_t *)path, 0);
189 if (len == (
size_t)-1)
194 len = strlen((
const char *)path);
195 state->path = (
char*)malloc(len + 1);
196 if (state->path == NULL) {
203 wcstombs(state->path, (
const wchar_t *)path, len + 1);
208 #if !defined(NO_snprintf) && !defined(NO_vsnprintf)
209 snprintf(state->path, len + 1,
"%s", (
const char *)path);
211 strcpy(state->path, path);
223 (cloexec ? O_CLOEXEC : 0) |
227 (O_WRONLY | O_CREAT |
229 (exclusive ? O_EXCL : 0) |
236 state->fd = fd > -1 ? fd : (
238 fd == -2 ? _wopen((
const wchar_t *)path, oflag, 0666) :
240 open((const char *)path, oflag, 0666));
241 if (state->fd == -1) {
251 state->start =
LSEEK(state->fd, 0, SEEK_CUR);
252 if (state->start == -1) state->start = 0;
local void gz_reset(gz_statep state)
#define Z_DEFAULT_STRATEGY
#define Z_DEFAULT_COMPRESSION
Definition at line 74 of file gzlib.cc.
85 state->strm.avail_in = 0;
void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg)
int ZEXPORT gzbuffer |
( |
gzFile |
file, |
|
|
unsigned |
size |
|
) |
| |
Definition at line 301 of file gzlib.cc.
313 if (state->size != 0)
Definition at line 520 of file gzlib.cc.
void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg)
gzFile ZEXPORT gzdopen |
( |
int |
fd, |
|
|
const char * |
mode |
|
) |
| |
Definition at line 275 of file gzlib.cc.
280 if (fd == -1 || (path = (
char *)malloc(7 + 3 *
sizeof(
int))) == NULL)
282 #if !defined(NO_snprintf) && !defined(NO_vsnprintf)
283 snprintf(path, 7 + 3 *
sizeof(
int),
"<fd:%d>", fd);
285 sprintf(path,
"<fd:%d>", fd);
local gzFile gz_open(const void *path, int fd, const char *mode)
Definition at line 485 of file gzlib.cc.
497 return state->mode ==
GZ_READ ? state->past : 0;
const char* ZEXPORT gzerror |
( |
gzFile |
file, |
|
|
int * |
errnum |
|
) |
| |
Definition at line 501 of file gzlib.cc.
514 *errnum = state->err;
515 return state->err ==
Z_MEM_ERROR ?
"out of memory" :
516 (state->msg == NULL ?
"" : state->msg);
z_off_t ZEXPORT gzoffset |
( |
gzFile |
file | ) |
|
Definition at line 476 of file gzlib.cc.
481 return ret == (z_off_t)ret ? (z_off_t)ret : -1;
z_off64_t ZEXPORT gzoffset64(gzFile file)
z_off64_t ZEXPORT gzoffset64 |
( |
gzFile |
file | ) |
|
Definition at line 454 of file gzlib.cc.
467 offset =
LSEEK(state->fd, 0, SEEK_CUR);
471 offset -= state->strm.avail_in;
gzFile ZEXPORT gzopen |
( |
const char * |
path, |
|
|
const char * |
mode |
|
) |
| |
Definition at line 263 of file gzlib.cc.
265 return gz_open(path, -1, mode);
local gzFile gz_open(const void *path, int fd, const char *mode)
gzFile ZEXPORT gzopen64 |
( |
const char * |
path, |
|
|
const char * |
mode |
|
) |
| |
Definition at line 269 of file gzlib.cc.
271 return gz_open(path, -1, mode);
local gzFile gz_open(const void *path, int fd, const char *mode)
Definition at line 324 of file gzlib.cc.
339 if (
LSEEK(state->fd, state->start, SEEK_SET) == -1)
local void gz_reset(gz_statep state)
z_off_t ZEXPORT gzseek |
( |
gzFile |
file, |
|
|
z_off_t |
offset, |
|
|
int |
whence |
|
) |
| |
Definition at line 420 of file gzlib.cc.
424 ret =
gzseek64(file, (z_off64_t)offset, whence);
425 return ret == (z_off_t)ret ? (z_off_t)ret : -1;
z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence)
z_off64_t ZEXPORT gzseek64 |
( |
gzFile |
file, |
|
|
z_off64_t |
offset, |
|
|
int |
whence |
|
) |
| |
Definition at line 346 of file gzlib.cc.
364 if (whence != SEEK_SET && whence != SEEK_CUR)
368 if (whence == SEEK_SET)
369 offset -= state->x.
pos;
370 else if (state->seek)
371 offset += state->skip;
375 if (state->mode ==
GZ_READ && state->how ==
COPY &&
376 state->x.pos + offset >= 0) {
377 ret =
LSEEK(state->fd, offset - state->x.have, SEEK_CUR);
385 state->strm.avail_in = 0;
386 state->x.pos += offset;
394 offset += state->x.pos;
403 n =
GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ?
404 (
unsigned)offset : state->x.have;
414 state->skip = offset;
416 return state->x.pos + offset;
void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg)
int ZEXPORT gzrewind(gzFile file)
z_off_t ZEXPORT gztell |
( |
gzFile |
file | ) |
|
Definition at line 445 of file gzlib.cc.
450 return ret == (z_off_t)ret ? (z_off_t)ret : -1;
z_off64_t ZEXPORT gztell64(gzFile file)
z_off64_t ZEXPORT gztell64 |
( |
gzFile |
file | ) |
|
Definition at line 429 of file gzlib.cc.
441 return state->x.
pos + (state->seek ? state->skip : 0);