00001
00002
00003
00004
00005 #ifndef ZLIB_H
00006 #define ZLIB_H
00007
00008 #include "zconf.h"
00009
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013
00014 #define ZLIB_VERSION "1.2.3"
00015 #define ZLIB_VERNUM 0x1230
00016
00017 typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
00018 typedef void (*free_func) OF((voidpf opaque, voidpf address));
00019
00020 struct internal_state;
00021
00022 typedef struct z_stream_s {
00023 Bytef *next_in;
00024 uInt avail_in;
00025 uLong total_in;
00026
00027 Bytef *next_out;
00028 uInt avail_out;
00029 uLong total_out;
00030
00031 char *msg;
00032 struct internal_state FAR *state;
00033
00034 alloc_func zalloc;
00035 free_func zfree;
00036 voidpf opaque;
00037
00038 int data_type;
00039 uLong adler;
00040 uLong reserved;
00041 } z_stream;
00042
00043 typedef z_stream FAR *z_streamp;
00044
00045 typedef struct gz_header_s {
00046 int text;
00047 uLong time;
00048 int xflags;
00049 int os;
00050 Bytef *extra;
00051 uInt extra_len;
00052 uInt extra_max;
00053 Bytef *name;
00054 uInt name_max;
00055 Bytef *comment;
00056 uInt comm_max;
00057 int hcrc;
00058 int done;
00059 } gz_header;
00060
00061 typedef gz_header FAR *gz_headerp;
00062
00063
00064
00065 #define Z_NO_FLUSH 0
00066 #define Z_PARTIAL_FLUSH 1
00067 #define Z_SYNC_FLUSH 2
00068 #define Z_FULL_FLUSH 3
00069 #define Z_FINISH 4
00070 #define Z_BLOCK 5
00071
00072 #define Z_OK 0
00073 #define Z_STREAM_END 1
00074 #define Z_NEED_DICT 2
00075 #define Z_ERRNO (-1)
00076 #define Z_STREAM_ERROR (-2)
00077 #define Z_DATA_ERROR (-3)
00078 #define Z_MEM_ERROR (-4)
00079 #define Z_BUF_ERROR (-5)
00080 #define Z_VERSION_ERROR (-6)
00081
00082 #define Z_NO_COMPRESSION 0
00083 #define Z_BEST_SPEED 1
00084 #define Z_BEST_COMPRESSION 9
00085 #define Z_DEFAULT_COMPRESSION (-1)
00086
00087 #define Z_FILTERED 1
00088 #define Z_HUFFMAN_ONLY 2
00089 #define Z_RLE 3
00090 #define Z_FIXED 4
00091 #define Z_DEFAULT_STRATEGY 0
00092
00093 #define Z_BINARY 0
00094 #define Z_TEXT 1
00095 #define Z_ASCII Z_TEXT
00096 #define Z_UNKNOWN 2
00097
00098 #define Z_DEFLATED 8
00099
00100 #define Z_NULL 0
00101
00102 #define zlib_version zlibVersion()
00103
00104
00105
00106 ZEXTERN const char * ZEXPORT zlibVersion OF((void));
00107
00108 ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
00109
00110 ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
00111
00112 ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
00113
00114 ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
00115
00116
00117
00118 ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
00119 const Bytef *dictionary,
00120 uInt dictLength));
00121
00122 ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
00123 z_streamp source));
00124
00125 ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
00126
00127 ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
00128 int level,
00129 int strategy));
00130
00131 ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
00132 int good_length,
00133 int max_lazy,
00134 int nice_length,
00135 int max_chain));
00136
00137 ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
00138 uLong sourceLen));
00139
00140 ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
00141 int bits,
00142 int value));
00143
00144 ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
00145 gz_headerp head));
00146
00147 ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
00148 const Bytef *dictionary,
00149 uInt dictLength));
00150
00151 ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
00152
00153 ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
00154 z_streamp source));
00155
00156 ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
00157
00158 ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
00159 int bits,
00160 int value));
00161
00162 ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
00163 gz_headerp head));
00164
00165 typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
00166 typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
00167
00168 ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
00169 in_func in, void FAR *in_desc,
00170 out_func out, void FAR *out_desc));
00171
00172 ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
00173
00174 ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
00175
00176
00177
00178 ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
00179 const Bytef *source, uLong sourceLen));
00180
00181 ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
00182 const Bytef *source, uLong sourceLen,
00183 int level));
00184
00185 ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
00186
00187 ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
00188 const Bytef *source, uLong sourceLen));
00189
00190 typedef voidp gzFile;
00191
00192 ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
00193
00194 ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
00195
00196 ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
00197
00198 ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
00199
00200 ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
00201 voidpc buf, unsigned len));
00202
00203 ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
00204
00205 ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
00206
00207 ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
00208
00209 ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
00210
00211 ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
00212
00213 ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
00214
00215 ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
00216
00217 ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
00218 z_off_t offset, int whence));
00219
00220 ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
00221
00222 ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
00223
00224 ZEXTERN int ZEXPORT gzeof OF((gzFile file));
00225
00226 ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
00227
00228 ZEXTERN int ZEXPORT gzclose OF((gzFile file));
00229
00230 ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
00231
00232 ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
00233
00234
00235
00236 ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
00237
00238 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
00239 z_off_t len2));
00240
00241 ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
00242
00243 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
00244
00245
00246
00247 ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
00248 const char *version, int stream_size));
00249 ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
00250 const char *version, int stream_size));
00251 ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
00252 int windowBits, int memLevel,
00253 int strategy, const char *version,
00254 int stream_size));
00255 ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
00256 const char *version, int stream_size));
00257 ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
00258 unsigned char FAR *window,
00259 const char *version,
00260 int stream_size));
00261 #define deflateInit(strm, level) \
00262 deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
00263 #define inflateInit(strm) \
00264 inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
00265 #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
00266 deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
00267 (strategy), ZLIB_VERSION, sizeof(z_stream))
00268 #define inflateInit2(strm, windowBits) \
00269 inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
00270 #define inflateBackInit(strm, windowBits, window) \
00271 inflateBackInit_((strm), (windowBits), (window), \
00272 ZLIB_VERSION, sizeof(z_stream))
00273
00274 #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
00275 struct internal_state {int dummy;};
00276 #endif
00277
00278 ZEXTERN const char * ZEXPORT zError OF((int));
00279 ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z));
00280 ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
00281
00282 #ifdef __cplusplus
00283 }
00284 #endif
00285
00286 #endif