1 /* gzguts.h -- zlib internal header definitions for gz* operations
2 * Copyright (C) 2004, 2005, 2010 Mark Adler
3 * For conditions of distribution and use, see copyright notice in zlib.h
6 #ifdef _LARGEFILE64_SOURCE
7 # ifndef _LARGEFILE_SOURCE
8 # define _LARGEFILE_SOURCE
10 # ifdef _FILE_OFFSET_BITS
11 # undef _FILE_OFFSET_BITS
23 #ifdef NO_DEFLATE /* for compatibility with old definition */
24 # define NO_GZCOMPRESS
29 # define vsnprintf _vsnprintf
35 /* compile with -Dlocal if your debugger can't find static symbols */
37 /* gz* functions always use library allocation functions */
39 extern voidp malloc OF((uInt size));
40 extern void free OF((voidpf ptr));
43 /* get errno and strerror definition */
44 #if defined UNDER_CE && defined NO_ERRNO_H
45 # define zstrerror(errnum) strwinerror((DWORD)errnum)
49 # define zstrerror() strerror(errno)
51 # define zstrerror() "stdio error (consult errno)"
57 # pragma map (fdopen , "\174\174FDOPEN")
58 FILE *fdopen(int, const char *);
61 #ifdef _LARGEFILE64_SOURCE
62 # define z_off64_t off64_t
64 # define z_off64_t z_off_t
67 /* default i/o buffer size -- double this for output when reading */
68 #define GZBUFSIZE 8192
70 /* gzip modes, also provide a little integrity check on the passed structure */
73 #define GZ_WRITE 31153
74 #define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */
76 /* internal gzip file state data structure */
78 /* used for both reading and writing */
79 int mode; /* see gzip modes above */
80 int fd; /* file descriptor */
81 char *path; /* path or fd for error messages */
82 z_off64_t pos; /* current position in uncompressed data */
83 unsigned size; /* buffer size, zero if not allocated yet */
84 unsigned want; /* requested buffer size, default is GZBUFSIZE */
85 unsigned char *in; /* input buffer */
86 unsigned char *out; /* output buffer (double-sized when reading) */
87 unsigned char *next; /* next output data to deliver or write */
88 /* just for reading */
89 int how; /* 0: get header, 1: copy, 2: decompress */
90 unsigned have; /* amount of output data unused */
91 z_off64_t start; /* where the gzip data started, for rewinding */
92 z_off64_t raw; /* where the raw data started, for seeking */
93 int eof; /* true if end of input file reached */
94 /* just for writing */
95 int level; /* compression level */
96 int strategy; /* compression strategy */
98 int seek; /* true if seek request pending */
99 z_off64_t skip; /* amount to skip (already rewound if backwards) */
100 /* error information */
101 int err; /* error code */
102 char *msg; /* error message */
103 /* zlib inflate or deflate stream */
104 z_stream strm; /* stream structure in-place (not a pointer) */
106 typedef gz_state FAR *gz_statep;
108 /* shared functions */
109 ZEXTERN void ZEXPORT gz_error OF((gz_statep, int, char *));