| OLD | NEW |
| 1 /* zlib.h -- interface of the 'zlib' general purpose compression library | 1 /* zlib.h -- interface of the 'zlib' general purpose compression library |
| 2 version 1.2.8, April 28th, 2013 | 2 version 1.2.8, April 28th, 2013 |
| 3 | 3 |
| 4 Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler | 4 Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler |
| 5 | 5 |
| 6 This software is provided 'as-is', without any express or implied | 6 This software is provided 'as-is', without any express or implied |
| 7 warranty. In no event will the authors be held liable for any damages | 7 warranty. In no event will the authors be held liable for any damages |
| 8 arising from the use of this software. | 8 arising from the use of this software. |
| 9 | 9 |
| 10 Permission is granted to anyone to use this software for any purpose, | 10 Permission is granted to anyone to use this software for any purpose, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 #define inflateReset2 FPDFAPI_inflateReset2 | 89 #define inflateReset2 FPDFAPI_inflateReset2 |
| 90 #define inflateUndermine FPDFAPI_inflateUndermine | 90 #define inflateUndermine FPDFAPI_inflateUndermine |
| 91 #define inflateMark FPDFAPI_inflateMark | 91 #define inflateMark FPDFAPI_inflateMark |
| 92 #define adler32_combine64 FPDFAPI_adler32_combine64 | 92 #define adler32_combine64 FPDFAPI_adler32_combine64 |
| 93 #define inflateResetKeep FPDFAPI_inflateResetKeep | 93 #define inflateResetKeep FPDFAPI_inflateResetKeep |
| 94 #define deflateResetKeep FPDFAPI_deflateResetKeep | 94 #define deflateResetKeep FPDFAPI_deflateResetKeep |
| 95 | 95 |
| 96 #include "zconf.h" | 96 #include "zconf.h" |
| 97 | 97 |
| 98 /* Sunliang.Liu 20100908 sync the config to the old revision. NO_GZIP */ | 98 /* Sunliang.Liu 20100908 sync the config to the old revision. NO_GZIP */ |
| 99 #define NO_GZIP»» /* XYQ */ | 99 #define NO_GZIP /* XYQ */ |
| 100 | 100 |
| 101 #ifdef __cplusplus | 101 #ifdef __cplusplus |
| 102 extern "C" { | 102 extern "C" { |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 #define ZLIB_VERSION "1.2.8" | 105 #define ZLIB_VERSION "1.2.8" |
| 106 #define ZLIB_VERNUM 0x1280 | 106 #define ZLIB_VERNUM 0x1280 |
| 107 #define ZLIB_VER_MAJOR 1 | 107 #define ZLIB_VER_MAJOR 1 |
| 108 #define ZLIB_VER_MINOR 2 | 108 #define ZLIB_VER_MINOR 2 |
| 109 #define ZLIB_VER_REVISION 8 | 109 #define ZLIB_VER_REVISION 8 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 135 The zlib format was designed to be compact and fast for use in memory | 135 The zlib format was designed to be compact and fast for use in memory |
| 136 and on communications channels. The gzip format was designed for single- | 136 and on communications channels. The gzip format was designed for single- |
| 137 file compression on file systems, has a larger header than zlib to maintain | 137 file compression on file systems, has a larger header than zlib to maintain |
| 138 directory information, and uses a different, slower check method than zlib. | 138 directory information, and uses a different, slower check method than zlib. |
| 139 | 139 |
| 140 The library does not install any signal handler. The decoder checks | 140 The library does not install any signal handler. The decoder checks |
| 141 the consistency of the compressed data, so the library should never crash | 141 the consistency of the compressed data, so the library should never crash |
| 142 even in case of corrupted input. | 142 even in case of corrupted input. |
| 143 */ | 143 */ |
| 144 | 144 |
| 145 typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); | 145 typedef voidpf(*alloc_func) OF((voidpf opaque, uInt items, uInt size)); |
| 146 typedef void (*free_func) OF((voidpf opaque, voidpf address)); | 146 typedef void(*free_func) OF((voidpf opaque, voidpf address)); |
| 147 | 147 |
| 148 struct internal_state; | 148 struct internal_state; |
| 149 | 149 |
| 150 typedef struct z_stream_s { | 150 typedef struct z_stream_s { |
| 151 z_const Bytef *next_in; /* next input byte */ | 151 z_const Bytef* next_in; /* next input byte */ |
| 152 uInt avail_in; /* number of bytes available at next_in */ | 152 uInt avail_in; /* number of bytes available at next_in */ |
| 153 uLong total_in; /* total number of input bytes read so far */ | 153 uLong total_in; /* total number of input bytes read so far */ |
| 154 | 154 |
| 155 Bytef *next_out; /* next output byte should be put there */ | 155 Bytef* next_out; /* next output byte should be put there */ |
| 156 uInt avail_out; /* remaining free space at next_out */ | 156 uInt avail_out; /* remaining free space at next_out */ |
| 157 uLong total_out; /* total number of bytes output so far */ | 157 uLong total_out; /* total number of bytes output so far */ |
| 158 | 158 |
| 159 z_const char *msg; /* last error message, NULL if no error */ | 159 z_const char* msg; /* last error message, NULL if no error */ |
| 160 struct internal_state FAR *state; /* not visible by applications */ | 160 struct internal_state FAR* state; /* not visible by applications */ |
| 161 | 161 |
| 162 alloc_func zalloc; /* used to allocate the internal state */ | 162 alloc_func zalloc; /* used to allocate the internal state */ |
| 163 free_func zfree; /* used to free the internal state */ | 163 free_func zfree; /* used to free the internal state */ |
| 164 voidpf opaque; /* private data object passed to zalloc and zfree */ | 164 voidpf opaque; /* private data object passed to zalloc and zfree */ |
| 165 | 165 |
| 166 int data_type; /* best guess about the data type: binary or text */ | 166 int data_type; /* best guess about the data type: binary or text */ |
| 167 uLong adler; /* adler32 value of the uncompressed data */ | 167 uLong adler; /* adler32 value of the uncompressed data */ |
| 168 uLong reserved; /* reserved for future use */ | 168 uLong reserved; /* reserved for future use */ |
| 169 } z_stream; | 169 } z_stream; |
| 170 | 170 |
| 171 typedef z_stream FAR *z_streamp; | 171 typedef z_stream FAR* z_streamp; |
| 172 | 172 |
| 173 /* | 173 /* |
| 174 gzip header information passed to and from zlib routines. See RFC 1952 | 174 gzip header information passed to and from zlib routines. See RFC 1952 |
| 175 for more details on the meanings of these fields. | 175 for more details on the meanings of these fields. |
| 176 */ | 176 */ |
| 177 typedef struct gz_header_s { | 177 typedef struct gz_header_s { |
| 178 int text; /* true if compressed data believed to be text */ | 178 int text; /* true if compressed data believed to be text */ |
| 179 uLong time; /* modification time */ | 179 uLong time; /* modification time */ |
| 180 int xflags; /* extra flags (not used when writing a gzip file) */ | 180 int xflags; /* extra flags (not used when writing a gzip file) */ |
| 181 int os; /* operating system */ | 181 int os; /* operating system */ |
| 182 Bytef *extra; /* pointer to extra field or Z_NULL if none */ | 182 Bytef* extra; /* pointer to extra field or Z_NULL if none */ |
| 183 uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ | 183 uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ |
| 184 uInt extra_max; /* space at extra (only when reading header) */ | 184 uInt extra_max; /* space at extra (only when reading header) */ |
| 185 Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ | 185 Bytef* name; /* pointer to zero-terminated file name or Z_NULL */ |
| 186 uInt name_max; /* space at name (only when reading header) */ | 186 uInt name_max; /* space at name (only when reading header) */ |
| 187 Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ | 187 Bytef* comment; /* pointer to zero-terminated comment or Z_NULL */ |
| 188 uInt comm_max; /* space at comment (only when reading header) */ | 188 uInt comm_max; /* space at comment (only when reading header) */ |
| 189 int hcrc; /* true if there was or will be a header crc */ | 189 int hcrc; /* true if there was or will be a header crc */ |
| 190 int done; /* true when done reading gzip header (not used | 190 int done; /* true when done reading gzip header (not used |
| 191 when writing a gzip file) */ | 191 when writing a gzip file) */ |
| 192 } gz_header; | 192 } gz_header; |
| 193 | 193 |
| 194 typedef gz_header FAR *gz_headerp; | 194 typedef gz_header FAR* gz_headerp; |
| 195 | 195 |
| 196 /* | 196 /* |
| 197 The application must update next_in and avail_in when avail_in has dropped | 197 The application must update next_in and avail_in when avail_in has dropped |
| 198 to zero. It must update next_out and avail_out when avail_out has dropped | 198 to zero. It must update next_out and avail_out when avail_out has dropped |
| 199 to zero. The application must initialize zalloc, zfree and opaque before | 199 to zero. The application must initialize zalloc, zfree and opaque before |
| 200 calling the init function. All other fields are set by the compression | 200 calling the init function. All other fields are set by the compression |
| 201 library and must not be updated by the application. | 201 library and must not be updated by the application. |
| 202 | 202 |
| 203 The opaque value provided by the application will be passed as the first | 203 The opaque value provided by the application will be passed as the first |
| 204 parameter for calls of zalloc and zfree. This can be useful for custom | 204 parameter for calls of zalloc and zfree. This can be useful for custom |
| (...skipping 12 matching lines...) Expand all Loading... |
| 217 library ensures this (see zutil.c). To reduce memory requirements and avoid | 217 library ensures this (see zutil.c). To reduce memory requirements and avoid |
| 218 any allocation of 64K objects, at the expense of compression ratio, compile | 218 any allocation of 64K objects, at the expense of compression ratio, compile |
| 219 the library with -DMAX_WBITS=14 (see zconf.h). | 219 the library with -DMAX_WBITS=14 (see zconf.h). |
| 220 | 220 |
| 221 The fields total_in and total_out can be used for statistics or progress | 221 The fields total_in and total_out can be used for statistics or progress |
| 222 reports. After compression, total_in holds the total size of the | 222 reports. After compression, total_in holds the total size of the |
| 223 uncompressed data and may be saved for use in the decompressor (particularly | 223 uncompressed data and may be saved for use in the decompressor (particularly |
| 224 if the decompressor wants to decompress everything in a single step). | 224 if the decompressor wants to decompress everything in a single step). |
| 225 */ | 225 */ |
| 226 | 226 |
| 227 /* constants */ | 227 /* constants */ |
| 228 | 228 |
| 229 #define Z_NO_FLUSH 0 | 229 #define Z_NO_FLUSH 0 |
| 230 #define Z_PARTIAL_FLUSH 1 | 230 #define Z_PARTIAL_FLUSH 1 |
| 231 #define Z_SYNC_FLUSH 2 | 231 #define Z_SYNC_FLUSH 2 |
| 232 #define Z_FULL_FLUSH 3 | 232 #define Z_FULL_FLUSH 3 |
| 233 #define Z_FINISH 4 | 233 #define Z_FINISH 4 |
| 234 #define Z_BLOCK 5 | 234 #define Z_BLOCK 5 |
| 235 #define Z_TREES 6 | 235 #define Z_TREES 6 |
| 236 /* Allowed flush values; see deflate() and inflate() below for details */ | 236 /* Allowed flush values; see deflate() and inflate() below for details */ |
| 237 | 237 |
| 238 #define Z_OK 0 | 238 #define Z_OK 0 |
| 239 #define Z_STREAM_END 1 | 239 #define Z_STREAM_END 1 |
| 240 #define Z_NEED_DICT 2 | 240 #define Z_NEED_DICT 2 |
| 241 #define Z_ERRNO (-1) | 241 #define Z_ERRNO (-1) |
| 242 #define Z_STREAM_ERROR (-2) | 242 #define Z_STREAM_ERROR (-2) |
| 243 #define Z_DATA_ERROR (-3) | 243 #define Z_DATA_ERROR (-3) |
| 244 #define Z_MEM_ERROR (-4) | 244 #define Z_MEM_ERROR (-4) |
| 245 #define Z_BUF_ERROR (-5) | 245 #define Z_BUF_ERROR (-5) |
| 246 #define Z_VERSION_ERROR (-6) | 246 #define Z_VERSION_ERROR (-6) |
| 247 /* Return codes for the compression/decompression functions. Negative values | 247 /* Return codes for the compression/decompression functions. Negative values |
| 248 * are errors, positive values are used for special but normal events. | 248 * are errors, positive values are used for special but normal events. |
| 249 */ | 249 */ |
| 250 | 250 |
| 251 #define Z_NO_COMPRESSION 0 | 251 #define Z_NO_COMPRESSION 0 |
| 252 #define Z_BEST_SPEED 1 | 252 #define Z_BEST_SPEED 1 |
| 253 #define Z_BEST_COMPRESSION 9 | 253 #define Z_BEST_COMPRESSION 9 |
| 254 #define Z_DEFAULT_COMPRESSION (-1) | 254 #define Z_DEFAULT_COMPRESSION (-1) |
| 255 /* compression levels */ | 255 /* compression levels */ |
| 256 | 256 |
| 257 #define Z_FILTERED 1 | 257 #define Z_FILTERED 1 |
| 258 #define Z_HUFFMAN_ONLY 2 | 258 #define Z_HUFFMAN_ONLY 2 |
| 259 #define Z_RLE 3 | 259 #define Z_RLE 3 |
| 260 #define Z_FIXED 4 | 260 #define Z_FIXED 4 |
| 261 #define Z_DEFAULT_STRATEGY 0 | 261 #define Z_DEFAULT_STRATEGY 0 |
| 262 /* compression strategy; see deflateInit2() below for details */ | 262 /* compression strategy; see deflateInit2() below for details */ |
| 263 | 263 |
| 264 #define Z_BINARY 0 | 264 #define Z_BINARY 0 |
| 265 #define Z_TEXT 1 | 265 #define Z_TEXT 1 |
| 266 #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ | 266 #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ |
| 267 #define Z_UNKNOWN 2 | 267 #define Z_UNKNOWN 2 |
| 268 /* Possible values of the data_type field (though see inflate()) */ | 268 /* Possible values of the data_type field (though see inflate()) */ |
| 269 | 269 |
| 270 #define Z_DEFLATED 8 | 270 #define Z_DEFLATED 8 |
| 271 /* The deflate compression method (the only one supported in this version) */ | 271 /* The deflate compression method (the only one supported in this version) */ |
| 272 | 272 |
| 273 #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ | 273 #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ |
| 274 | 274 |
| 275 #define zlib_version zlibVersion() | 275 #define zlib_version zlibVersion() |
| 276 /* for compatibility with versions < 1.0.2 */ | 276 /* for compatibility with versions < 1.0.2 */ |
| 277 | 277 |
| 278 /* basic functions */ |
| 278 | 279 |
| 279 /* basic functions */ | 280 ZEXTERN const char* ZEXPORT zlibVersion OF((void)); |
| 280 | |
| 281 ZEXTERN const char * ZEXPORT zlibVersion OF((void)); | |
| 282 /* The application can compare zlibVersion and ZLIB_VERSION for consistency. | 281 /* The application can compare zlibVersion and ZLIB_VERSION for consistency. |
| 283 If the first character differs, the library code actually used is not | 282 If the first character differs, the library code actually used is not |
| 284 compatible with the zlib.h header file used by the application. This check | 283 compatible with the zlib.h header file used by the application. This check |
| 285 is automatically made by deflateInit and inflateInit. | 284 is automatically made by deflateInit and inflateInit. |
| 286 */ | 285 */ |
| 287 | 286 |
| 288 /* | 287 /* |
| 289 ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); | 288 ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); |
| 290 | 289 |
| 291 Initializes the internal stream state for compression. The fields | 290 Initializes the internal stream state for compression. The fields |
| 292 zalloc, zfree and opaque must be initialized before by the caller. If | 291 zalloc, zfree and opaque must be initialized before by the caller. If |
| 293 zalloc and zfree are set to Z_NULL, deflateInit updates them to use default | 292 zalloc and zfree are set to Z_NULL, deflateInit updates them to use default |
| 294 allocation functions. | 293 allocation functions. |
| 295 | 294 |
| 296 The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: | 295 The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: |
| 297 1 gives best speed, 9 gives best compression, 0 gives no compression at all | 296 1 gives best speed, 9 gives best compression, 0 gives no compression at all |
| 298 (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION | 297 (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION |
| 299 requests a default compromise between speed and compression (currently | 298 requests a default compromise between speed and compression (currently |
| 300 equivalent to level 6). | 299 equivalent to level 6). |
| 301 | 300 |
| 302 deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough | 301 deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough |
| 303 memory, Z_STREAM_ERROR if level is not a valid compression level, or | 302 memory, Z_STREAM_ERROR if level is not a valid compression level, or |
| 304 Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible | 303 Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible |
| 305 with the version assumed by the caller (ZLIB_VERSION). msg is set to null | 304 with the version assumed by the caller (ZLIB_VERSION). msg is set to null |
| 306 if there is no error message. deflateInit does not perform any compression: | 305 if there is no error message. deflateInit does not perform any compression: |
| 307 this will be done by deflate(). | 306 this will be done by deflate(). |
| 308 */ | 307 */ |
| 309 | 308 |
| 310 | |
| 311 ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); | 309 ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); |
| 312 /* | 310 /* |
| 313 deflate compresses as much data as possible, and stops when the input | 311 deflate compresses as much data as possible, and stops when the input |
| 314 buffer becomes empty or the output buffer becomes full. It may introduce | 312 buffer becomes empty or the output buffer becomes full. It may introduce |
| 315 some output latency (reading input without producing any output) except when | 313 some output latency (reading input without producing any output) except when |
| 316 forced to flush. | 314 forced to flush. |
| 317 | 315 |
| 318 The detailed semantics are as follows. deflate performs one or both of the | 316 The detailed semantics are as follows. deflate performs one or both of the |
| 319 following actions: | 317 following actions: |
| 320 | 318 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 deflate() returns Z_OK if some progress has been made (more input | 405 deflate() returns Z_OK if some progress has been made (more input |
| 408 processed or more output produced), Z_STREAM_END if all input has been | 406 processed or more output produced), Z_STREAM_END if all input has been |
| 409 consumed and all output has been produced (only when flush is set to | 407 consumed and all output has been produced (only when flush is set to |
| 410 Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example | 408 Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example |
| 411 if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible | 409 if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible |
| 412 (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not | 410 (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not |
| 413 fatal, and deflate() can be called again with more input and more output | 411 fatal, and deflate() can be called again with more input and more output |
| 414 space to continue compressing. | 412 space to continue compressing. |
| 415 */ | 413 */ |
| 416 | 414 |
| 417 | |
| 418 ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); | 415 ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); |
| 419 /* | 416 /* |
| 420 All dynamically allocated data structures for this stream are freed. | 417 All dynamically allocated data structures for this stream are freed. |
| 421 This function discards any unprocessed input and does not flush any pending | 418 This function discards any unprocessed input and does not flush any pending |
| 422 output. | 419 output. |
| 423 | 420 |
| 424 deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the | 421 deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the |
| 425 stream state was inconsistent, Z_DATA_ERROR if the stream was freed | 422 stream state was inconsistent, Z_DATA_ERROR if the stream was freed |
| 426 prematurely (some input or output was discarded). In the error case, msg | 423 prematurely (some input or output was discarded). In the error case, msg |
| 427 may be set but then points to a static string (which must not be | 424 may be set but then points to a static string (which must not be |
| 428 deallocated). | 425 deallocated). |
| 429 */ | 426 */ |
| 430 | 427 |
| 431 | |
| 432 /* | 428 /* |
| 433 ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); | 429 ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); |
| 434 | 430 |
| 435 Initializes the internal stream state for decompression. The fields | 431 Initializes the internal stream state for decompression. The fields |
| 436 next_in, avail_in, zalloc, zfree and opaque must be initialized before by | 432 next_in, avail_in, zalloc, zfree and opaque must be initialized before by |
| 437 the caller. If next_in is not Z_NULL and avail_in is large enough (the | 433 the caller. If next_in is not Z_NULL and avail_in is large enough (the |
| 438 exact value depends on the compression method), inflateInit determines the | 434 exact value depends on the compression method), inflateInit determines the |
| 439 compression method from the zlib header and allocates all data structures | 435 compression method from the zlib header and allocates all data structures |
| 440 accordingly; otherwise the allocation will be deferred to the first call of | 436 accordingly; otherwise the allocation will be deferred to the first call of |
| 441 inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to | 437 inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to |
| 442 use default allocation functions. | 438 use default allocation functions. |
| 443 | 439 |
| 444 inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough | 440 inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough |
| 445 memory, Z_VERSION_ERROR if the zlib library version is incompatible with the | 441 memory, Z_VERSION_ERROR if the zlib library version is incompatible with the |
| 446 version assumed by the caller, or Z_STREAM_ERROR if the parameters are | 442 version assumed by the caller, or Z_STREAM_ERROR if the parameters are |
| 447 invalid, such as a null pointer to the structure. msg is set to null if | 443 invalid, such as a null pointer to the structure. msg is set to null if |
| 448 there is no error message. inflateInit does not perform any decompression | 444 there is no error message. inflateInit does not perform any decompression |
| 449 apart from possibly reading the zlib header if present: actual decompression | 445 apart from possibly reading the zlib header if present: actual decompression |
| 450 will be done by inflate(). (So next_in and avail_in may be modified, but | 446 will be done by inflate(). (So next_in and avail_in may be modified, but |
| 451 next_out and avail_out are unused and unchanged.) The current implementation | 447 next_out and avail_out are unused and unchanged.) The current implementation |
| 452 of inflateInit() does not process any header information -- that is deferred | 448 of inflateInit() does not process any header information -- that is deferred |
| 453 until inflate() is called. | 449 until inflate() is called. |
| 454 */ | 450 */ |
| 455 | 451 |
| 456 | |
| 457 ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); | 452 ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); |
| 458 /* | 453 /* |
| 459 inflate decompresses as much data as possible, and stops when the input | 454 inflate decompresses as much data as possible, and stops when the input |
| 460 buffer becomes empty or the output buffer becomes full. It may introduce | 455 buffer becomes empty or the output buffer becomes full. It may introduce |
| 461 some output latency (reading input without producing any output) except when | 456 some output latency (reading input without producing any output) except when |
| 462 forced to flush. | 457 forced to flush. |
| 463 | 458 |
| 464 The detailed semantics are as follows. inflate performs one or both of the | 459 The detailed semantics are as follows. inflate performs one or both of the |
| 465 following actions: | 460 following actions: |
| 466 | 461 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 value), Z_STREAM_ERROR if the stream structure was inconsistent (for example | 557 value), Z_STREAM_ERROR if the stream structure was inconsistent (for example |
| 563 next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, | 558 next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, |
| 564 Z_BUF_ERROR if no progress is possible or if there was not enough room in the | 559 Z_BUF_ERROR if no progress is possible or if there was not enough room in the |
| 565 output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and | 560 output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and |
| 566 inflate() can be called again with more input and more output space to | 561 inflate() can be called again with more input and more output space to |
| 567 continue decompressing. If Z_DATA_ERROR is returned, the application may | 562 continue decompressing. If Z_DATA_ERROR is returned, the application may |
| 568 then call inflateSync() to look for a good compression block if a partial | 563 then call inflateSync() to look for a good compression block if a partial |
| 569 recovery of the data is desired. | 564 recovery of the data is desired. |
| 570 */ | 565 */ |
| 571 | 566 |
| 572 | |
| 573 ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); | 567 ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); |
| 574 /* | 568 /* |
| 575 All dynamically allocated data structures for this stream are freed. | 569 All dynamically allocated data structures for this stream are freed. |
| 576 This function discards any unprocessed input and does not flush any pending | 570 This function discards any unprocessed input and does not flush any pending |
| 577 output. | 571 output. |
| 578 | 572 |
| 579 inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state | 573 inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state |
| 580 was inconsistent. In the error case, msg may be set but then points to a | 574 was inconsistent. In the error case, msg may be set but then points to a |
| 581 static string (which must not be deallocated). | 575 static string (which must not be deallocated). |
| 582 */ | 576 */ |
| 583 | 577 |
| 584 | 578 /* Advanced functions */ |
| 585 /* Advanced functions */ | |
| 586 | 579 |
| 587 /* | 580 /* |
| 588 The following functions are needed only in some special applications. | 581 The following functions are needed only in some special applications. |
| 589 */ | 582 */ |
| 590 | 583 |
| 591 /* | 584 /* |
| 592 ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, | 585 ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, |
| 593 int level, | 586 int level, |
| 594 int method, | 587 int method, |
| 595 int windowBits, | 588 int windowBits, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 | 636 |
| 644 deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | 637 deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough |
| 645 memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid | 638 memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid |
| 646 method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is | 639 method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is |
| 647 incompatible with the version assumed by the caller (ZLIB_VERSION). msg is | 640 incompatible with the version assumed by the caller (ZLIB_VERSION). msg is |
| 648 set to null if there is no error message. deflateInit2 does not perform any | 641 set to null if there is no error message. deflateInit2 does not perform any |
| 649 compression: this will be done by deflate(). | 642 compression: this will be done by deflate(). |
| 650 */ | 643 */ |
| 651 | 644 |
| 652 ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, | 645 ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, |
| 653 const Bytef *dictionary, | 646 const Bytef* dictionary, |
| 654 uInt dictLength)); | 647 uInt dictLength)); |
| 655 /* | 648 /* |
| 656 Initializes the compression dictionary from the given byte sequence | 649 Initializes the compression dictionary from the given byte sequence |
| 657 without producing any compressed output. When using the zlib format, this | 650 without producing any compressed output. When using the zlib format, this |
| 658 function must be called immediately after deflateInit, deflateInit2 or | 651 function must be called immediately after deflateInit, deflateInit2 or |
| 659 deflateReset, and before any call of deflate. When doing raw deflate, this | 652 deflateReset, and before any call of deflate. When doing raw deflate, this |
| 660 function must be called either before any call of deflate, or immediately | 653 function must be called either before any call of deflate, or immediately |
| 661 after the completion of a deflate block, i.e. after all input has been | 654 after the completion of a deflate block, i.e. after all input has been |
| 662 consumed and all output has been delivered when using any of the flush | 655 consumed and all output has been delivered when using any of the flush |
| 663 options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The | 656 options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The |
| 664 compressor and decompressor must use exactly the same dictionary (see | 657 compressor and decompressor must use exactly the same dictionary (see |
| (...skipping 21 matching lines...) Expand all Loading... |
| 686 actually used by the compressor.) If a raw deflate was requested, then the | 679 actually used by the compressor.) If a raw deflate was requested, then the |
| 687 adler32 value is not computed and strm->adler is not set. | 680 adler32 value is not computed and strm->adler is not set. |
| 688 | 681 |
| 689 deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a | 682 deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a |
| 690 parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is | 683 parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is |
| 691 inconsistent (for example if deflate has already been called for this stream | 684 inconsistent (for example if deflate has already been called for this stream |
| 692 or if not at a block boundary for raw deflate). deflateSetDictionary does | 685 or if not at a block boundary for raw deflate). deflateSetDictionary does |
| 693 not perform any compression: this will be done by deflate(). | 686 not perform any compression: this will be done by deflate(). |
| 694 */ | 687 */ |
| 695 | 688 |
| 696 ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, | 689 ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, z_streamp source)); |
| 697 z_streamp source)); | |
| 698 /* | 690 /* |
| 699 Sets the destination stream as a complete copy of the source stream. | 691 Sets the destination stream as a complete copy of the source stream. |
| 700 | 692 |
| 701 This function can be useful when several compression strategies will be | 693 This function can be useful when several compression strategies will be |
| 702 tried, for example when there are several ways of pre-processing the input | 694 tried, for example when there are several ways of pre-processing the input |
| 703 data with a filter. The streams that will be discarded should then be freed | 695 data with a filter. The streams that will be discarded should then be freed |
| 704 by calling deflateEnd. Note that deflateCopy duplicates the internal | 696 by calling deflateEnd. Note that deflateCopy duplicates the internal |
| 705 compression state which can be quite large, so this strategy is slow and can | 697 compression state which can be quite large, so this strategy is slow and can |
| 706 consume lots of memory. | 698 consume lots of memory. |
| 707 | 699 |
| 708 deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not | 700 deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not |
| 709 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent | 701 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent |
| 710 (such as zalloc being Z_NULL). msg is left unchanged in both source and | 702 (such as zalloc being Z_NULL). msg is left unchanged in both source and |
| 711 destination. | 703 destination. |
| 712 */ | 704 */ |
| 713 | 705 |
| 714 ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); | 706 ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); |
| 715 /* | 707 /* |
| 716 This function is equivalent to deflateEnd followed by deflateInit, | 708 This function is equivalent to deflateEnd followed by deflateInit, |
| 717 but does not free and reallocate all the internal compression state. The | 709 but does not free and reallocate all the internal compression state. The |
| 718 stream will keep the same compression level and any other attributes that | 710 stream will keep the same compression level and any other attributes that |
| 719 may have been set by deflateInit2. | 711 may have been set by deflateInit2. |
| 720 | 712 |
| 721 deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source | 713 deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source |
| 722 stream state was inconsistent (such as zalloc or state being Z_NULL). | 714 stream state was inconsistent (such as zalloc or state being Z_NULL). |
| 723 */ | 715 */ |
| 724 | 716 |
| 725 ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, | 717 ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy)); |
| 726 int level, | |
| 727 int strategy)); | |
| 728 /* | 718 /* |
| 729 Dynamically update the compression level and compression strategy. The | 719 Dynamically update the compression level and compression strategy. The |
| 730 interpretation of level and strategy is as in deflateInit2. This can be | 720 interpretation of level and strategy is as in deflateInit2. This can be |
| 731 used to switch between compression and straight copy of the input data, or | 721 used to switch between compression and straight copy of the input data, or |
| 732 to switch to a different kind of input data requiring a different strategy. | 722 to switch to a different kind of input data requiring a different strategy. |
| 733 If the compression level is changed, the input available so far is | 723 If the compression level is changed, the input available so far is |
| 734 compressed with the old level (and may be flushed); the new level will take | 724 compressed with the old level (and may be flushed); the new level will take |
| 735 effect only at the next call of deflate(). | 725 effect only at the next call of deflate(). |
| 736 | 726 |
| 737 Before the call of deflateParams, the stream state must be set as for | 727 Before the call of deflateParams, the stream state must be set as for |
| (...skipping 15 matching lines...) Expand all Loading... |
| 753 used by someone who understands the algorithm used by zlib's deflate for | 743 used by someone who understands the algorithm used by zlib's deflate for |
| 754 searching for the best matching string, and even then only by the most | 744 searching for the best matching string, and even then only by the most |
| 755 fanatic optimizer trying to squeeze out the last compressed bit for their | 745 fanatic optimizer trying to squeeze out the last compressed bit for their |
| 756 specific input data. Read the deflate.c source code for the meaning of the | 746 specific input data. Read the deflate.c source code for the meaning of the |
| 757 max_lazy, good_length, nice_length, and max_chain parameters. | 747 max_lazy, good_length, nice_length, and max_chain parameters. |
| 758 | 748 |
| 759 deflateTune() can be called after deflateInit() or deflateInit2(), and | 749 deflateTune() can be called after deflateInit() or deflateInit2(), and |
| 760 returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. | 750 returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. |
| 761 */ | 751 */ |
| 762 | 752 |
| 763 ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, | 753 ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, uLong sourceLen)); |
| 764 uLong sourceLen)); | |
| 765 /* | 754 /* |
| 766 deflateBound() returns an upper bound on the compressed size after | 755 deflateBound() returns an upper bound on the compressed size after |
| 767 deflation of sourceLen bytes. It must be called after deflateInit() or | 756 deflation of sourceLen bytes. It must be called after deflateInit() or |
| 768 deflateInit2(), and after deflateSetHeader(), if used. This would be used | 757 deflateInit2(), and after deflateSetHeader(), if used. This would be used |
| 769 to allocate an output buffer for deflation in a single pass, and so would be | 758 to allocate an output buffer for deflation in a single pass, and so would be |
| 770 called before deflate(). If that first deflate() call is provided the | 759 called before deflate(). If that first deflate() call is provided the |
| 771 sourceLen input bytes, an output buffer allocated to the size returned by | 760 sourceLen input bytes, an output buffer allocated to the size returned by |
| 772 deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed | 761 deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed |
| 773 to return Z_STREAM_END. Note that it is possible for the compressed size to | 762 to return Z_STREAM_END. Note that it is possible for the compressed size to |
| 774 be larger than the value returned by deflateBound() if flush options other | 763 be larger than the value returned by deflateBound() if flush options other |
| 775 than Z_FINISH or Z_NO_FLUSH are used. | 764 than Z_FINISH or Z_NO_FLUSH are used. |
| 776 */ | 765 */ |
| 777 | 766 |
| 778 ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, | 767 ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, |
| 779 unsigned *pending, | 768 unsigned* pending, |
| 780 int *bits)); | 769 int* bits)); |
| 781 /* | 770 /* |
| 782 deflatePending() returns the number of bytes and bits of output that have | 771 deflatePending() returns the number of bytes and bits of output that have |
| 783 been generated, but not yet provided in the available output. The bytes not | 772 been generated, but not yet provided in the available output. The bytes not |
| 784 provided would be due to the available output space having being consumed. | 773 provided would be due to the available output space having being consumed. |
| 785 The number of bits of output not provided are between 0 and 7, where they | 774 The number of bits of output not provided are between 0 and 7, where they |
| 786 await more bits to join them in order to fill out a full byte. If pending | 775 await more bits to join them in order to fill out a full byte. If pending |
| 787 or bits are Z_NULL, then those values are not set. | 776 or bits are Z_NULL, then those values are not set. |
| 788 | 777 |
| 789 deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source | 778 deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source |
| 790 stream state was inconsistent. | 779 stream state was inconsistent. |
| 791 */ | 780 */ |
| 792 | 781 |
| 793 ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, | 782 ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, int bits, int value)); |
| 794 int bits, | |
| 795 int value)); | |
| 796 /* | 783 /* |
| 797 deflatePrime() inserts bits in the deflate output stream. The intent | 784 deflatePrime() inserts bits in the deflate output stream. The intent |
| 798 is that this function is used to start off the deflate output with the bits | 785 is that this function is used to start off the deflate output with the bits |
| 799 leftover from a previous deflate stream when appending to it. As such, this | 786 leftover from a previous deflate stream when appending to it. As such, this |
| 800 function can only be used for raw deflate, and must be used before the first | 787 function can only be used for raw deflate, and must be used before the first |
| 801 deflate() call after a deflateInit2() or deflateReset(). bits must be less | 788 deflate() call after a deflateInit2() or deflateReset(). bits must be less |
| 802 than or equal to 16, and that many of the least significant bits of value | 789 than or equal to 16, and that many of the least significant bits of value |
| 803 will be inserted in the output. | 790 will be inserted in the output. |
| 804 | 791 |
| 805 deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough | 792 deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough |
| 806 room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the | 793 room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the |
| 807 source stream state was inconsistent. | 794 source stream state was inconsistent. |
| 808 */ | 795 */ |
| 809 | 796 |
| 810 ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, | 797 ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, gz_headerp head)); |
| 811 gz_headerp head)); | |
| 812 /* | 798 /* |
| 813 deflateSetHeader() provides gzip header information for when a gzip | 799 deflateSetHeader() provides gzip header information for when a gzip |
| 814 stream is requested by deflateInit2(). deflateSetHeader() may be called | 800 stream is requested by deflateInit2(). deflateSetHeader() may be called |
| 815 after deflateInit2() or deflateReset() and before the first call of | 801 after deflateInit2() or deflateReset() and before the first call of |
| 816 deflate(). The text, time, os, extra field, name, and comment information | 802 deflate(). The text, time, os, extra field, name, and comment information |
| 817 in the provided gz_header structure are written to the gzip header (xflag is | 803 in the provided gz_header structure are written to the gzip header (xflag is |
| 818 ignored -- the extra flags are set according to the compression level). The | 804 ignored -- the extra flags are set according to the compression level). The |
| 819 caller must assure that, if not Z_NULL, name and comment are terminated with | 805 caller must assure that, if not Z_NULL, name and comment are terminated with |
| 820 a zero byte, and that if extra is not Z_NULL, that extra_len bytes are | 806 a zero byte, and that if extra is not Z_NULL, that extra_len bytes are |
| 821 available there. If hcrc is true, a gzip header crc is included. Note that | 807 available there. If hcrc is true, a gzip header crc is included. Note that |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 invalid, such as a null pointer to the structure. msg is set to null if | 861 invalid, such as a null pointer to the structure. msg is set to null if |
| 876 there is no error message. inflateInit2 does not perform any decompression | 862 there is no error message. inflateInit2 does not perform any decompression |
| 877 apart from possibly reading the zlib header if present: actual decompression | 863 apart from possibly reading the zlib header if present: actual decompression |
| 878 will be done by inflate(). (So next_in and avail_in may be modified, but | 864 will be done by inflate(). (So next_in and avail_in may be modified, but |
| 879 next_out and avail_out are unused and unchanged.) The current implementation | 865 next_out and avail_out are unused and unchanged.) The current implementation |
| 880 of inflateInit2() does not process any header information -- that is | 866 of inflateInit2() does not process any header information -- that is |
| 881 deferred until inflate() is called. | 867 deferred until inflate() is called. |
| 882 */ | 868 */ |
| 883 | 869 |
| 884 ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, | 870 ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, |
| 885 const Bytef *dictionary, | 871 const Bytef* dictionary, |
| 886 uInt dictLength)); | 872 uInt dictLength)); |
| 887 /* | 873 /* |
| 888 Initializes the decompression dictionary from the given uncompressed byte | 874 Initializes the decompression dictionary from the given uncompressed byte |
| 889 sequence. This function must be called immediately after a call of inflate, | 875 sequence. This function must be called immediately after a call of inflate, |
| 890 if that call returned Z_NEED_DICT. The dictionary chosen by the compressor | 876 if that call returned Z_NEED_DICT. The dictionary chosen by the compressor |
| 891 can be determined from the adler32 value returned by that call of inflate. | 877 can be determined from the adler32 value returned by that call of inflate. |
| 892 The compressor and decompressor must use exactly the same dictionary (see | 878 The compressor and decompressor must use exactly the same dictionary (see |
| 893 deflateSetDictionary). For raw inflate, this function can be called at any | 879 deflateSetDictionary). For raw inflate, this function can be called at any |
| 894 time to set the dictionary. If the provided dictionary is smaller than the | 880 time to set the dictionary. If the provided dictionary is smaller than the |
| 895 window and there is already data in the window, then the provided dictionary | 881 window and there is already data in the window, then the provided dictionary |
| 896 will amend what's there. The application must insure that the dictionary | 882 will amend what's there. The application must insure that the dictionary |
| 897 that was used for compression is provided. | 883 that was used for compression is provided. |
| 898 | 884 |
| 899 inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a | 885 inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a |
| 900 parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is | 886 parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is |
| 901 inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the | 887 inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the |
| 902 expected one (incorrect adler32 value). inflateSetDictionary does not | 888 expected one (incorrect adler32 value). inflateSetDictionary does not |
| 903 perform any decompression: this will be done by subsequent calls of | 889 perform any decompression: this will be done by subsequent calls of |
| 904 inflate(). | 890 inflate(). |
| 905 */ | 891 */ |
| 906 | 892 |
| 907 ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, | 893 ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, |
| 908 Bytef *dictionary, | 894 Bytef* dictionary, |
| 909 uInt *dictLength)); | 895 uInt* dictLength)); |
| 910 /* | 896 /* |
| 911 Returns the sliding dictionary being maintained by inflate. dictLength is | 897 Returns the sliding dictionary being maintained by inflate. dictLength is |
| 912 set to the number of bytes in the dictionary, and that many bytes are copied | 898 set to the number of bytes in the dictionary, and that many bytes are copied |
| 913 to dictionary. dictionary must have enough space, where 32768 bytes is | 899 to dictionary. dictionary must have enough space, where 32768 bytes is |
| 914 always enough. If inflateGetDictionary() is called with dictionary equal to | 900 always enough. If inflateGetDictionary() is called with dictionary equal to |
| 915 Z_NULL, then only the dictionary length is returned, and nothing is copied. | 901 Z_NULL, then only the dictionary length is returned, and nothing is copied. |
| 916 Similary, if dictLength is Z_NULL, then it is not set. | 902 Similary, if dictLength is Z_NULL, then it is not set. |
| 917 | 903 |
| 918 inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the | 904 inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the |
| 919 stream state is inconsistent. | 905 stream state is inconsistent. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 931 | 917 |
| 932 inflateSync returns Z_OK if a possible full flush point has been found, | 918 inflateSync returns Z_OK if a possible full flush point has been found, |
| 933 Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point | 919 Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point |
| 934 has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. | 920 has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. |
| 935 In the success case, the application may save the current current value of | 921 In the success case, the application may save the current current value of |
| 936 total_in which indicates where valid compressed data was found. In the | 922 total_in which indicates where valid compressed data was found. In the |
| 937 error case, the application may repeatedly call inflateSync, providing more | 923 error case, the application may repeatedly call inflateSync, providing more |
| 938 input each time, until success or end of the input data. | 924 input each time, until success or end of the input data. |
| 939 */ | 925 */ |
| 940 | 926 |
| 941 ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, | 927 ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, z_streamp source)); |
| 942 z_streamp source)); | |
| 943 /* | 928 /* |
| 944 Sets the destination stream as a complete copy of the source stream. | 929 Sets the destination stream as a complete copy of the source stream. |
| 945 | 930 |
| 946 This function can be useful when randomly accessing a large stream. The | 931 This function can be useful when randomly accessing a large stream. The |
| 947 first pass through the stream can periodically record the inflate state, | 932 first pass through the stream can periodically record the inflate state, |
| 948 allowing restarting inflate at those points when randomly accessing the | 933 allowing restarting inflate at those points when randomly accessing the |
| 949 stream. | 934 stream. |
| 950 | 935 |
| 951 inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not | 936 inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not |
| 952 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent | 937 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent |
| 953 (such as zalloc being Z_NULL). msg is left unchanged in both source and | 938 (such as zalloc being Z_NULL). msg is left unchanged in both source and |
| 954 destination. | 939 destination. |
| 955 */ | 940 */ |
| 956 | 941 |
| 957 ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); | 942 ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); |
| 958 /* | 943 /* |
| 959 This function is equivalent to inflateEnd followed by inflateInit, | 944 This function is equivalent to inflateEnd followed by inflateInit, |
| 960 but does not free and reallocate all the internal decompression state. The | 945 but does not free and reallocate all the internal decompression state. The |
| 961 stream will keep attributes that may have been set by inflateInit2. | 946 stream will keep attributes that may have been set by inflateInit2. |
| 962 | 947 |
| 963 inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source | 948 inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source |
| 964 stream state was inconsistent (such as zalloc or state being Z_NULL). | 949 stream state was inconsistent (such as zalloc or state being Z_NULL). |
| 965 */ | 950 */ |
| 966 | 951 |
| 967 ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, | 952 ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, int windowBits)); |
| 968 int windowBits)); | |
| 969 /* | 953 /* |
| 970 This function is the same as inflateReset, but it also permits changing | 954 This function is the same as inflateReset, but it also permits changing |
| 971 the wrap and window size requests. The windowBits parameter is interpreted | 955 the wrap and window size requests. The windowBits parameter is interpreted |
| 972 the same as it is for inflateInit2. | 956 the same as it is for inflateInit2. |
| 973 | 957 |
| 974 inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source | 958 inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source |
| 975 stream state was inconsistent (such as zalloc or state being Z_NULL), or if | 959 stream state was inconsistent (such as zalloc or state being Z_NULL), or if |
| 976 the windowBits parameter is invalid. | 960 the windowBits parameter is invalid. |
| 977 */ | 961 */ |
| 978 | 962 |
| 979 ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, | 963 ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, int bits, int value)); |
| 980 int bits, | |
| 981 int value)); | |
| 982 /* | 964 /* |
| 983 This function inserts bits in the inflate input stream. The intent is | 965 This function inserts bits in the inflate input stream. The intent is |
| 984 that this function is used to start inflating at a bit position in the | 966 that this function is used to start inflating at a bit position in the |
| 985 middle of a byte. The provided bits will be used before any bytes are used | 967 middle of a byte. The provided bits will be used before any bytes are used |
| 986 from next_in. This function should only be used with raw inflate, and | 968 from next_in. This function should only be used with raw inflate, and |
| 987 should be used before the first inflate() call after inflateInit2() or | 969 should be used before the first inflate() call after inflateInit2() or |
| 988 inflateReset(). bits must be less than or equal to 16, and that many of the | 970 inflateReset(). bits must be less than or equal to 16, and that many of the |
| 989 least significant bits of value will be inserted in the input. | 971 least significant bits of value will be inserted in the input. |
| 990 | 972 |
| 991 If bits is negative, then the input stream bit buffer is emptied. Then | 973 If bits is negative, then the input stream bit buffer is emptied. Then |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1018 inflateMark() is used to mark locations in the input data for random | 1000 inflateMark() is used to mark locations in the input data for random |
| 1019 access, which may be at bit positions, and to note those cases where the | 1001 access, which may be at bit positions, and to note those cases where the |
| 1020 output of a code may span boundaries of random access blocks. The current | 1002 output of a code may span boundaries of random access blocks. The current |
| 1021 location in the input stream can be determined from avail_in and data_type | 1003 location in the input stream can be determined from avail_in and data_type |
| 1022 as noted in the description for the Z_BLOCK flush parameter for inflate. | 1004 as noted in the description for the Z_BLOCK flush parameter for inflate. |
| 1023 | 1005 |
| 1024 inflateMark returns the value noted above or -1 << 16 if the provided | 1006 inflateMark returns the value noted above or -1 << 16 if the provided |
| 1025 source stream state was inconsistent. | 1007 source stream state was inconsistent. |
| 1026 */ | 1008 */ |
| 1027 | 1009 |
| 1028 ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, | 1010 ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, gz_headerp head)); |
| 1029 gz_headerp head)); | |
| 1030 /* | 1011 /* |
| 1031 inflateGetHeader() requests that gzip header information be stored in the | 1012 inflateGetHeader() requests that gzip header information be stored in the |
| 1032 provided gz_header structure. inflateGetHeader() may be called after | 1013 provided gz_header structure. inflateGetHeader() may be called after |
| 1033 inflateInit2() or inflateReset(), and before the first call of inflate(). | 1014 inflateInit2() or inflateReset(), and before the first call of inflate(). |
| 1034 As inflate() processes the gzip stream, head->done is zero until the header | 1015 As inflate() processes the gzip stream, head->done is zero until the header |
| 1035 is completed, at which time head->done is set to one. If a zlib stream is | 1016 is completed, at which time head->done is set to one. If a zlib stream is |
| 1036 being decoded, then head->done is set to -1 to indicate that there will be | 1017 being decoded, then head->done is set to -1 to indicate that there will be |
| 1037 no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be | 1018 no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be |
| 1038 used to force inflate() to return immediately after header processing is | 1019 used to force inflate() to return immediately after header processing is |
| 1039 complete and before any actual data is decompressed. | 1020 complete and before any actual data is decompressed. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 deflate streams. | 1061 deflate streams. |
| 1081 | 1062 |
| 1082 See inflateBack() for the usage of these routines. | 1063 See inflateBack() for the usage of these routines. |
| 1083 | 1064 |
| 1084 inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of | 1065 inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of |
| 1085 the parameters are invalid, Z_MEM_ERROR if the internal state could not be | 1066 the parameters are invalid, Z_MEM_ERROR if the internal state could not be |
| 1086 allocated, or Z_VERSION_ERROR if the version of the library does not match | 1067 allocated, or Z_VERSION_ERROR if the version of the library does not match |
| 1087 the version of the header file. | 1068 the version of the header file. |
| 1088 */ | 1069 */ |
| 1089 | 1070 |
| 1090 typedef unsigned (*in_func) OF((void FAR *, | 1071 typedef unsigned(*in_func) OF((void FAR*, z_const unsigned char FAR* FAR*)); |
| 1091 z_const unsigned char FAR * FAR *)); | 1072 typedef int(*out_func) OF((void FAR*, unsigned char FAR*, unsigned)); |
| 1092 typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); | |
| 1093 | 1073 |
| 1094 ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, | 1074 ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, |
| 1095 in_func in, void FAR *in_desc, | 1075 in_func in, |
| 1096 out_func out, void FAR *out_desc)); | 1076 void FAR* in_desc, |
| 1077 out_func out, |
| 1078 void FAR* out_desc)); |
| 1097 /* | 1079 /* |
| 1098 inflateBack() does a raw inflate with a single call using a call-back | 1080 inflateBack() does a raw inflate with a single call using a call-back |
| 1099 interface for input and output. This is potentially more efficient than | 1081 interface for input and output. This is potentially more efficient than |
| 1100 inflate() for file i/o applications, in that it avoids copying between the | 1082 inflate() for file i/o applications, in that it avoids copying between the |
| 1101 output and the sliding window by simply making the window itself the output | 1083 output and the sliding window by simply making the window itself the output |
| 1102 buffer. inflate() can be faster on modern CPUs when used with large | 1084 buffer. inflate() can be faster on modern CPUs when used with large |
| 1103 buffers. inflateBack() trusts the application to not change the output | 1085 buffers. inflateBack() trusts the application to not change the output |
| 1104 buffer passed by the output function, at least until inflateBack() returns. | 1086 buffer passed by the output function, at least until inflateBack() returns. |
| 1105 | 1087 |
| 1106 inflateBackInit() must be called first to allocate the internal state | 1088 inflateBackInit() must be called first to allocate the internal state |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format | 1187 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format |
| 1206 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! | 1188 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! |
| 1207 26: 0 = returns value, 1 = void -- 1 means inferred string length returned | 1189 26: 0 = returns value, 1 = void -- 1 means inferred string length returned |
| 1208 | 1190 |
| 1209 Remainder: | 1191 Remainder: |
| 1210 27-31: 0 (reserved) | 1192 27-31: 0 (reserved) |
| 1211 */ | 1193 */ |
| 1212 | 1194 |
| 1213 #ifndef Z_SOLO | 1195 #ifndef Z_SOLO |
| 1214 | 1196 |
| 1215 /* utility functions */ | 1197 /* utility functions */ |
| 1216 | 1198 |
| 1217 /* | 1199 /* |
| 1218 The following utility functions are implemented on top of the basic | 1200 The following utility functions are implemented on top of the basic |
| 1219 stream-oriented functions. To simplify the interface, some default options | 1201 stream-oriented functions. To simplify the interface, some default options |
| 1220 are assumed (compression level and memory usage, standard memory allocation | 1202 are assumed (compression level and memory usage, standard memory allocation |
| 1221 functions). The source code of these utility functions can be modified if | 1203 functions). The source code of these utility functions can be modified if |
| 1222 you need special options. | 1204 you need special options. |
| 1223 */ | 1205 */ |
| 1224 | 1206 |
| 1225 ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, | 1207 ZEXTERN int ZEXPORT compress |
| 1226 const Bytef *source, uLong sourceLen)); | 1208 OF((Bytef * dest, uLongf* destLen, const Bytef* source, uLong sourceLen)); |
| 1227 /* | 1209 /* |
| 1228 Compresses the source buffer into the destination buffer. sourceLen is | 1210 Compresses the source buffer into the destination buffer. sourceLen is |
| 1229 the byte length of the source buffer. Upon entry, destLen is the total size | 1211 the byte length of the source buffer. Upon entry, destLen is the total size |
| 1230 of the destination buffer, which must be at least the value returned by | 1212 of the destination buffer, which must be at least the value returned by |
| 1231 compressBound(sourceLen). Upon exit, destLen is the actual size of the | 1213 compressBound(sourceLen). Upon exit, destLen is the actual size of the |
| 1232 compressed buffer. | 1214 compressed buffer. |
| 1233 | 1215 |
| 1234 compress returns Z_OK if success, Z_MEM_ERROR if there was not | 1216 compress returns Z_OK if success, Z_MEM_ERROR if there was not |
| 1235 enough memory, Z_BUF_ERROR if there was not enough room in the output | 1217 enough memory, Z_BUF_ERROR if there was not enough room in the output |
| 1236 buffer. | 1218 buffer. |
| 1237 */ | 1219 */ |
| 1238 | 1220 |
| 1239 ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, | 1221 ZEXTERN int ZEXPORT compress2 OF((Bytef * dest, |
| 1240 const Bytef *source, uLong sourceLen, | 1222 uLongf* destLen, |
| 1223 const Bytef* source, |
| 1224 uLong sourceLen, |
| 1241 int level)); | 1225 int level)); |
| 1242 /* | 1226 /* |
| 1243 Compresses the source buffer into the destination buffer. The level | 1227 Compresses the source buffer into the destination buffer. The level |
| 1244 parameter has the same meaning as in deflateInit. sourceLen is the byte | 1228 parameter has the same meaning as in deflateInit. sourceLen is the byte |
| 1245 length of the source buffer. Upon entry, destLen is the total size of the | 1229 length of the source buffer. Upon entry, destLen is the total size of the |
| 1246 destination buffer, which must be at least the value returned by | 1230 destination buffer, which must be at least the value returned by |
| 1247 compressBound(sourceLen). Upon exit, destLen is the actual size of the | 1231 compressBound(sourceLen). Upon exit, destLen is the actual size of the |
| 1248 compressed buffer. | 1232 compressed buffer. |
| 1249 | 1233 |
| 1250 compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough | 1234 compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough |
| 1251 memory, Z_BUF_ERROR if there was not enough room in the output buffer, | 1235 memory, Z_BUF_ERROR if there was not enough room in the output buffer, |
| 1252 Z_STREAM_ERROR if the level parameter is invalid. | 1236 Z_STREAM_ERROR if the level parameter is invalid. |
| 1253 */ | 1237 */ |
| 1254 | 1238 |
| 1255 ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); | 1239 ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); |
| 1256 /* | 1240 /* |
| 1257 compressBound() returns an upper bound on the compressed size after | 1241 compressBound() returns an upper bound on the compressed size after |
| 1258 compress() or compress2() on sourceLen bytes. It would be used before a | 1242 compress() or compress2() on sourceLen bytes. It would be used before a |
| 1259 compress() or compress2() call to allocate the destination buffer. | 1243 compress() or compress2() call to allocate the destination buffer. |
| 1260 */ | 1244 */ |
| 1261 | 1245 |
| 1262 ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, | 1246 ZEXTERN int ZEXPORT uncompress |
| 1263 const Bytef *source, uLong sourceLen)); | 1247 OF((Bytef * dest, uLongf* destLen, const Bytef* source, uLong sourceLen)); |
| 1264 /* | 1248 /* |
| 1265 Decompresses the source buffer into the destination buffer. sourceLen is | 1249 Decompresses the source buffer into the destination buffer. sourceLen is |
| 1266 the byte length of the source buffer. Upon entry, destLen is the total size | 1250 the byte length of the source buffer. Upon entry, destLen is the total size |
| 1267 of the destination buffer, which must be large enough to hold the entire | 1251 of the destination buffer, which must be large enough to hold the entire |
| 1268 uncompressed data. (The size of the uncompressed data must have been saved | 1252 uncompressed data. (The size of the uncompressed data must have been saved |
| 1269 previously by the compressor and transmitted to the decompressor by some | 1253 previously by the compressor and transmitted to the decompressor by some |
| 1270 mechanism outside the scope of this compression library.) Upon exit, destLen | 1254 mechanism outside the scope of this compression library.) Upon exit, destLen |
| 1271 is the actual size of the uncompressed buffer. | 1255 is the actual size of the uncompressed buffer. |
| 1272 | 1256 |
| 1273 uncompress returns Z_OK if success, Z_MEM_ERROR if there was not | 1257 uncompress returns Z_OK if success, Z_MEM_ERROR if there was not |
| 1274 enough memory, Z_BUF_ERROR if there was not enough room in the output | 1258 enough memory, Z_BUF_ERROR if there was not enough room in the output |
| 1275 buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In | 1259 buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In |
| 1276 the case where there is not enough room, uncompress() will fill the output | 1260 the case where there is not enough room, uncompress() will fill the output |
| 1277 buffer with the uncompressed data up to that point. | 1261 buffer with the uncompressed data up to that point. |
| 1278 */ | 1262 */ |
| 1279 | 1263 |
| 1280 /* gzip file access functions */ | 1264 /* gzip file access functions */ |
| 1281 | 1265 |
| 1282 /* | 1266 /* |
| 1283 This library supports reading and writing files in gzip (.gz) format with | 1267 This library supports reading and writing files in gzip (.gz) format with |
| 1284 an interface similar to that of stdio, using the functions that start with | 1268 an interface similar to that of stdio, using the functions that start with |
| 1285 "gz". The gzip format is different from the zlib format. gzip is a gzip | 1269 "gz". The gzip format is different from the zlib format. gzip is a gzip |
| 1286 wrapper, documented in RFC 1952, wrapped around a deflate stream. | 1270 wrapper, documented in RFC 1952, wrapped around a deflate stream. |
| 1287 */ | 1271 */ |
| 1288 | 1272 |
| 1289 typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ | 1273 typedef struct gzFile_s* gzFile; /* semi-opaque gzip file descriptor */ |
| 1290 | 1274 |
| 1291 /* | 1275 /* |
| 1292 ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); | 1276 ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); |
| 1293 | 1277 |
| 1294 Opens a gzip (.gz) file for reading or writing. The mode parameter is as | 1278 Opens a gzip (.gz) file for reading or writing. The mode parameter is as |
| 1295 in fopen ("rb" or "wb") but can also include a compression level ("wb9") or | 1279 in fopen ("rb" or "wb") but can also include a compression level ("wb9") or |
| 1296 a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only | 1280 a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only |
| 1297 compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' | 1281 compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' |
| 1298 for fixed code compression as in "wb9F". (See the description of | 1282 for fixed code compression as in "wb9F". (See the description of |
| 1299 deflateInit2 for more information about the strategy parameter.) 'T' will | 1283 deflateInit2 for more information about the strategy parameter.) 'T' will |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1319 reading, this will be detected automatically by looking for the magic two- | 1303 reading, this will be detected automatically by looking for the magic two- |
| 1320 byte gzip header. | 1304 byte gzip header. |
| 1321 | 1305 |
| 1322 gzopen returns NULL if the file could not be opened, if there was | 1306 gzopen returns NULL if the file could not be opened, if there was |
| 1323 insufficient memory to allocate the gzFile state, or if an invalid mode was | 1307 insufficient memory to allocate the gzFile state, or if an invalid mode was |
| 1324 specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). | 1308 specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). |
| 1325 errno can be checked to determine if the reason gzopen failed was that the | 1309 errno can be checked to determine if the reason gzopen failed was that the |
| 1326 file could not be opened. | 1310 file could not be opened. |
| 1327 */ | 1311 */ |
| 1328 | 1312 |
| 1329 ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); | 1313 ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char* mode)); |
| 1330 /* | 1314 /* |
| 1331 gzdopen associates a gzFile with the file descriptor fd. File descriptors | 1315 gzdopen associates a gzFile with the file descriptor fd. File descriptors |
| 1332 are obtained from calls like open, dup, creat, pipe or fileno (if the file | 1316 are obtained from calls like open, dup, creat, pipe or fileno (if the file |
| 1333 has been previously opened with fopen). The mode parameter is as in gzopen. | 1317 has been previously opened with fopen). The mode parameter is as in gzopen. |
| 1334 | 1318 |
| 1335 The next call of gzclose on the returned gzFile will also close the file | 1319 The next call of gzclose on the returned gzFile will also close the file |
| 1336 descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor | 1320 descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor |
| 1337 fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, | 1321 fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, |
| 1338 mode);. The duplicated descriptor should be saved to avoid a leak, since | 1322 mode);. The duplicated descriptor should be saved to avoid a leak, since |
| 1339 gzdopen does not close fd if it fails. If you are using fileno() to get the | 1323 gzdopen does not close fd if it fails. If you are using fileno() to get the |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 middle of a gzip stream. Note that gzread does not return -1 in the event | 1380 middle of a gzip stream. Note that gzread does not return -1 in the event |
| 1397 of an incomplete gzip stream. This error is deferred until gzclose(), which | 1381 of an incomplete gzip stream. This error is deferred until gzclose(), which |
| 1398 will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip | 1382 will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip |
| 1399 stream. Alternatively, gzerror can be used before gzclose to detect this | 1383 stream. Alternatively, gzerror can be used before gzclose to detect this |
| 1400 case. | 1384 case. |
| 1401 | 1385 |
| 1402 gzread returns the number of uncompressed bytes actually read, less than | 1386 gzread returns the number of uncompressed bytes actually read, less than |
| 1403 len for end of file, or -1 for error. | 1387 len for end of file, or -1 for error. |
| 1404 */ | 1388 */ |
| 1405 | 1389 |
| 1406 ZEXTERN int ZEXPORT gzwrite OF((gzFile file, | 1390 ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len)); |
| 1407 voidpc buf, unsigned len)); | |
| 1408 /* | 1391 /* |
| 1409 Writes the given number of uncompressed bytes into the compressed file. | 1392 Writes the given number of uncompressed bytes into the compressed file. |
| 1410 gzwrite returns the number of uncompressed bytes written or 0 in case of | 1393 gzwrite returns the number of uncompressed bytes written or 0 in case of |
| 1411 error. | 1394 error. |
| 1412 */ | 1395 */ |
| 1413 | 1396 |
| 1414 ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); | 1397 ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char* format, ...)); |
| 1415 /* | 1398 /* |
| 1416 Converts, formats, and writes the arguments to the compressed file under | 1399 Converts, formats, and writes the arguments to the compressed file under |
| 1417 control of the format string, as in fprintf. gzprintf returns the number of | 1400 control of the format string, as in fprintf. gzprintf returns the number of |
| 1418 uncompressed bytes actually written, or 0 in case of error. The number of | 1401 uncompressed bytes actually written, or 0 in case of error. The number of |
| 1419 uncompressed bytes written is limited to 8191, or one less than the buffer | 1402 uncompressed bytes written is limited to 8191, or one less than the buffer |
| 1420 size given to gzbuffer(). The caller should assure that this limit is not | 1403 size given to gzbuffer(). The caller should assure that this limit is not |
| 1421 exceeded. If it is exceeded, then gzprintf() will return an error (0) with | 1404 exceeded. If it is exceeded, then gzprintf() will return an error (0) with |
| 1422 nothing written. In this case, there may also be a buffer overflow with | 1405 nothing written. In this case, there may also be a buffer overflow with |
| 1423 unpredictable consequences, which is possible only if zlib was compiled with | 1406 unpredictable consequences, which is possible only if zlib was compiled with |
| 1424 the insecure functions sprintf() or vsprintf() because the secure snprintf() | 1407 the insecure functions sprintf() or vsprintf() because the secure snprintf() |
| 1425 or vsnprintf() functions were not available. This can be determined using | 1408 or vsnprintf() functions were not available. This can be determined using |
| 1426 zlibCompileFlags(). | 1409 zlibCompileFlags(). |
| 1427 */ | 1410 */ |
| 1428 | 1411 |
| 1429 ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); | 1412 ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char* s)); |
| 1430 /* | 1413 /* |
| 1431 Writes the given null-terminated string to the compressed file, excluding | 1414 Writes the given null-terminated string to the compressed file, excluding |
| 1432 the terminating null character. | 1415 the terminating null character. |
| 1433 | 1416 |
| 1434 gzputs returns the number of characters written, or -1 in case of error. | 1417 gzputs returns the number of characters written, or -1 in case of error. |
| 1435 */ | 1418 */ |
| 1436 | 1419 |
| 1437 ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); | 1420 ZEXTERN char* ZEXPORT gzgets OF((gzFile file, char* buf, int len)); |
| 1438 /* | 1421 /* |
| 1439 Reads bytes from the compressed file until len-1 characters are read, or a | 1422 Reads bytes from the compressed file until len-1 characters are read, or a |
| 1440 newline character is read and transferred to buf, or an end-of-file | 1423 newline character is read and transferred to buf, or an end-of-file |
| 1441 condition is encountered. If any characters are read or if len == 1, the | 1424 condition is encountered. If any characters are read or if len == 1, the |
| 1442 string is terminated with a null character. If no characters are read due | 1425 string is terminated with a null character. If no characters are read due |
| 1443 to an end-of-file or len < 1, then the buffer is left untouched. | 1426 to an end-of-file or len < 1, then the buffer is left untouched. |
| 1444 | 1427 |
| 1445 gzgets returns buf which is a null-terminated string, or it returns NULL | 1428 gzgets returns buf which is a null-terminated string, or it returns NULL |
| 1446 for end-of-file or in case of error. If there was an error, the contents at | 1429 for end-of-file or in case of error. If there was an error, the contents at |
| 1447 buf are indeterminate. | 1430 buf are indeterminate. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1502 extremely slow. If the file is opened for writing, only forward seeks are | 1485 extremely slow. If the file is opened for writing, only forward seeks are |
| 1503 supported; gzseek then compresses a sequence of zeroes up to the new | 1486 supported; gzseek then compresses a sequence of zeroes up to the new |
| 1504 starting position. | 1487 starting position. |
| 1505 | 1488 |
| 1506 gzseek returns the resulting offset location as measured in bytes from | 1489 gzseek returns the resulting offset location as measured in bytes from |
| 1507 the beginning of the uncompressed stream, or -1 in case of error, in | 1490 the beginning of the uncompressed stream, or -1 in case of error, in |
| 1508 particular if the file is opened for writing and the new starting position | 1491 particular if the file is opened for writing and the new starting position |
| 1509 would be before the current position. | 1492 would be before the current position. |
| 1510 */ | 1493 */ |
| 1511 | 1494 |
| 1512 ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); | 1495 ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); |
| 1513 /* | 1496 /* |
| 1514 Rewinds the given file. This function is supported only for reading. | 1497 Rewinds the given file. This function is supported only for reading. |
| 1515 | 1498 |
| 1516 gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) | 1499 gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) |
| 1517 */ | 1500 */ |
| 1518 | 1501 |
| 1519 /* | 1502 /* |
| 1520 ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); | 1503 ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); |
| 1521 | 1504 |
| 1522 Returns the starting position for the next gzread or gzwrite on the given | 1505 Returns the starting position for the next gzread or gzwrite on the given |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 gzdirect(). | 1549 gzdirect(). |
| 1567 | 1550 |
| 1568 When writing, gzdirect() returns true (1) if transparent writing was | 1551 When writing, gzdirect() returns true (1) if transparent writing was |
| 1569 requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: | 1552 requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: |
| 1570 gzdirect() is not needed when writing. Transparent writing must be | 1553 gzdirect() is not needed when writing. Transparent writing must be |
| 1571 explicitly requested, so the application already knows the answer. When | 1554 explicitly requested, so the application already knows the answer. When |
| 1572 linking statically, using gzdirect() will include all of the zlib code for | 1555 linking statically, using gzdirect() will include all of the zlib code for |
| 1573 gzip file reading and decompression, which may not be desired.) | 1556 gzip file reading and decompression, which may not be desired.) |
| 1574 */ | 1557 */ |
| 1575 | 1558 |
| 1576 ZEXTERN int ZEXPORT gzclose OF((gzFile file)); | 1559 ZEXTERN int ZEXPORT gzclose OF((gzFile file)); |
| 1577 /* | 1560 /* |
| 1578 Flushes all pending output if necessary, closes the compressed file and | 1561 Flushes all pending output if necessary, closes the compressed file and |
| 1579 deallocates the (de)compression state. Note that once file is closed, you | 1562 deallocates the (de)compression state. Note that once file is closed, you |
| 1580 cannot call gzerror with file, since its structures have been deallocated. | 1563 cannot call gzerror with file, since its structures have been deallocated. |
| 1581 gzclose must not be called more than once on the same file, just as free | 1564 gzclose must not be called more than once on the same file, just as free |
| 1582 must not be called more than once on the same allocation. | 1565 must not be called more than once on the same allocation. |
| 1583 | 1566 |
| 1584 gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a | 1567 gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a |
| 1585 file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the | 1568 file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the |
| 1586 last read ended in the middle of a gzip stream, or Z_OK on success. | 1569 last read ended in the middle of a gzip stream, or Z_OK on success. |
| 1587 */ | 1570 */ |
| 1588 | 1571 |
| 1589 ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); | 1572 ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); |
| 1590 ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); | 1573 ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); |
| 1591 /* | 1574 /* |
| 1592 Same as gzclose(), but gzclose_r() is only for use when reading, and | 1575 Same as gzclose(), but gzclose_r() is only for use when reading, and |
| 1593 gzclose_w() is only for use when writing or appending. The advantage to | 1576 gzclose_w() is only for use when writing or appending. The advantage to |
| 1594 using these instead of gzclose() is that they avoid linking in zlib | 1577 using these instead of gzclose() is that they avoid linking in zlib |
| 1595 compression or decompression code that is not used when only reading or only | 1578 compression or decompression code that is not used when only reading or only |
| 1596 writing respectively. If gzclose() is used, then both compression and | 1579 writing respectively. If gzclose() is used, then both compression and |
| 1597 decompression code will be included the application when linking to a static | 1580 decompression code will be included the application when linking to a static |
| 1598 zlib library. | 1581 zlib library. |
| 1599 */ | 1582 */ |
| 1600 | 1583 |
| 1601 ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); | 1584 ZEXTERN const char* ZEXPORT gzerror OF((gzFile file, int* errnum)); |
| 1602 /* | 1585 /* |
| 1603 Returns the error message for the last error which occurred on the given | 1586 Returns the error message for the last error which occurred on the given |
| 1604 compressed file. errnum is set to zlib error number. If an error occurred | 1587 compressed file. errnum is set to zlib error number. If an error occurred |
| 1605 in the file system and not in the compression library, errnum is set to | 1588 in the file system and not in the compression library, errnum is set to |
| 1606 Z_ERRNO and the application may consult errno to get the exact error code. | 1589 Z_ERRNO and the application may consult errno to get the exact error code. |
| 1607 | 1590 |
| 1608 The application must not modify the returned string. Future calls to | 1591 The application must not modify the returned string. Future calls to |
| 1609 this function may invalidate the previously returned string. If file is | 1592 this function may invalidate the previously returned string. If file is |
| 1610 closed, then the string previously returned by gzerror will no longer be | 1593 closed, then the string previously returned by gzerror will no longer be |
| 1611 available. | 1594 available. |
| 1612 | 1595 |
| 1613 gzerror() should be used to distinguish errors from end-of-file for those | 1596 gzerror() should be used to distinguish errors from end-of-file for those |
| 1614 functions above that do not distinguish those cases in their return values. | 1597 functions above that do not distinguish those cases in their return values. |
| 1615 */ | 1598 */ |
| 1616 | 1599 |
| 1617 ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); | 1600 ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); |
| 1618 /* | 1601 /* |
| 1619 Clears the error and end-of-file flags for file. This is analogous to the | 1602 Clears the error and end-of-file flags for file. This is analogous to the |
| 1620 clearerr() function in stdio. This is useful for continuing to read a gzip | 1603 clearerr() function in stdio. This is useful for continuing to read a gzip |
| 1621 file that is being written concurrently. | 1604 file that is being written concurrently. |
| 1622 */ | 1605 */ |
| 1623 | 1606 |
| 1624 #endif /* !Z_SOLO */ | 1607 #endif /* !Z_SOLO */ |
| 1625 | 1608 |
| 1626 /* checksum functions */ | 1609 /* checksum functions */ |
| 1627 | 1610 |
| 1628 /* | 1611 /* |
| 1629 These functions are not related to compression but are exported | 1612 These functions are not related to compression but are exported |
| 1630 anyway because they might be useful in applications using the compression | 1613 anyway because they might be useful in applications using the compression |
| 1631 library. | 1614 library. |
| 1632 */ | 1615 */ |
| 1633 | 1616 |
| 1634 ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); | 1617 ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef* buf, uInt len)); |
| 1635 /* | 1618 /* |
| 1636 Update a running Adler-32 checksum with the bytes buf[0..len-1] and | 1619 Update a running Adler-32 checksum with the bytes buf[0..len-1] and |
| 1637 return the updated checksum. If buf is Z_NULL, this function returns the | 1620 return the updated checksum. If buf is Z_NULL, this function returns the |
| 1638 required initial value for the checksum. | 1621 required initial value for the checksum. |
| 1639 | 1622 |
| 1640 An Adler-32 checksum is almost as reliable as a CRC32 but can be computed | 1623 An Adler-32 checksum is almost as reliable as a CRC32 but can be computed |
| 1641 much faster. | 1624 much faster. |
| 1642 | 1625 |
| 1643 Usage example: | 1626 Usage example: |
| 1644 | 1627 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1655 z_off_t len2)); | 1638 z_off_t len2)); |
| 1656 | 1639 |
| 1657 Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 | 1640 Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 |
| 1658 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for | 1641 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for |
| 1659 each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of | 1642 each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of |
| 1660 seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note | 1643 seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note |
| 1661 that the z_off_t type (like off_t) is a signed integer. If len2 is | 1644 that the z_off_t type (like off_t) is a signed integer. If len2 is |
| 1662 negative, the result has no meaning or utility. | 1645 negative, the result has no meaning or utility. |
| 1663 */ | 1646 */ |
| 1664 | 1647 |
| 1665 ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); | 1648 ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef* buf, uInt len)); |
| 1666 /* | 1649 /* |
| 1667 Update a running CRC-32 with the bytes buf[0..len-1] and return the | 1650 Update a running CRC-32 with the bytes buf[0..len-1] and return the |
| 1668 updated CRC-32. If buf is Z_NULL, this function returns the required | 1651 updated CRC-32. If buf is Z_NULL, this function returns the required |
| 1669 initial value for the crc. Pre- and post-conditioning (one's complement) is | 1652 initial value for the crc. Pre- and post-conditioning (one's complement) is |
| 1670 performed within this function so it shouldn't be done by the application. | 1653 performed within this function so it shouldn't be done by the application. |
| 1671 | 1654 |
| 1672 Usage example: | 1655 Usage example: |
| 1673 | 1656 |
| 1674 uLong crc = crc32(0L, Z_NULL, 0); | 1657 uLong crc = crc32(0L, Z_NULL, 0); |
| 1675 | 1658 |
| 1676 while (read_buffer(buffer, length) != EOF) { | 1659 while (read_buffer(buffer, length) != EOF) { |
| 1677 crc = crc32(crc, buffer, length); | 1660 crc = crc32(crc, buffer, length); |
| 1678 } | 1661 } |
| 1679 if (crc != original_crc) error(); | 1662 if (crc != original_crc) error(); |
| 1680 */ | 1663 */ |
| 1681 | 1664 |
| 1682 /* | 1665 /* |
| 1683 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); | 1666 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); |
| 1684 | 1667 |
| 1685 Combine two CRC-32 check values into one. For two sequences of bytes, | 1668 Combine two CRC-32 check values into one. For two sequences of bytes, |
| 1686 seq1 and seq2 with lengths len1 and len2, CRC-32 check values were | 1669 seq1 and seq2 with lengths len1 and len2, CRC-32 check values were |
| 1687 calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 | 1670 calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 |
| 1688 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and | 1671 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and |
| 1689 len2. | 1672 len2. |
| 1690 */ | 1673 */ |
| 1691 | 1674 |
| 1692 | 1675 /* various hacks, don't look :) */ |
| 1693 /* various hacks, don't look :) */ | |
| 1694 | 1676 |
| 1695 /* deflateInit and inflateInit are macros to allow checking the zlib version | 1677 /* deflateInit and inflateInit are macros to allow checking the zlib version |
| 1696 * and the compiler's view of z_stream: | 1678 * and the compiler's view of z_stream: |
| 1697 */ | 1679 */ |
| 1698 ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, | 1680 ZEXTERN int ZEXPORT deflateInit_ |
| 1699 const char *version, int stream_size)); | 1681 OF((z_streamp strm, int level, const char* version, int stream_size)); |
| 1700 ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, | 1682 ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, |
| 1701 const char *version, int stream_size)); | 1683 const char* version, |
| 1702 ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, | 1684 int stream_size)); |
| 1703 int windowBits, int memLevel, | 1685 ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, |
| 1704 int strategy, const char *version, | 1686 int level, |
| 1687 int method, |
| 1688 int windowBits, |
| 1689 int memLevel, |
| 1690 int strategy, |
| 1691 const char* version, |
| 1705 int stream_size)); | 1692 int stream_size)); |
| 1706 ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, | 1693 ZEXTERN int ZEXPORT inflateInit2_ |
| 1707 const char *version, int stream_size)); | 1694 OF((z_streamp strm, int windowBits, const char* version, int stream_size)); |
| 1708 ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, | 1695 ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, |
| 1709 unsigned char FAR *window, | 1696 int windowBits, |
| 1710 const char *version, | 1697 unsigned char FAR* window, |
| 1698 const char* version, |
| 1711 int stream_size)); | 1699 int stream_size)); |
| 1712 #define deflateInit(strm, level) \ | 1700 #define deflateInit(strm, level) \ |
| 1713 deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) | 1701 deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) |
| 1714 #define inflateInit(strm) \ | 1702 #define inflateInit(strm) \ |
| 1715 inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) | 1703 inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) |
| 1716 #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ | 1704 #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ |
| 1717 deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ | 1705 deflateInit2_((strm), (level), (method), (windowBits), (memLevel), \ |
| 1718 (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) | 1706 (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) |
| 1719 #define inflateInit2(strm, windowBits) \ | 1707 #define inflateInit2(strm, windowBits) \ |
| 1720 inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ | 1708 inflateInit2_((strm), (windowBits), ZLIB_VERSION, (int)sizeof(z_stream)) |
| 1721 (int)sizeof(z_stream)) | 1709 #define inflateBackInit(strm, windowBits, window) \ |
| 1722 #define inflateBackInit(strm, windowBits, window) \ | 1710 inflateBackInit_((strm), (windowBits), (window), ZLIB_VERSION, \ |
| 1723 inflateBackInit_((strm), (windowBits), (window), \ | 1711 (int)sizeof(z_stream)) |
| 1724 ZLIB_VERSION, (int)sizeof(z_stream)) | |
| 1725 | 1712 |
| 1726 #ifndef Z_SOLO | 1713 #ifndef Z_SOLO |
| 1727 | 1714 |
| 1728 /* gzgetc() macro and its supporting function and exposed data structure. Note | 1715 /* gzgetc() macro and its supporting function and exposed data structure. Note |
| 1729 * that the real internal state is much larger than the exposed structure. | 1716 * that the real internal state is much larger than the exposed structure. |
| 1730 * This abbreviated structure exposes just enough for the gzgetc() macro. The | 1717 * This abbreviated structure exposes just enough for the gzgetc() macro. The |
| 1731 * user should not mess with these exposed elements, since their names or | 1718 * user should not mess with these exposed elements, since their names or |
| 1732 * behavior could change in the future, perhaps even capriciously. They can | 1719 * behavior could change in the future, perhaps even capriciously. They can |
| 1733 * only be used by the gzgetc() macro. You have been warned. | 1720 * only be used by the gzgetc() macro. You have been warned. |
| 1734 */ | 1721 */ |
| 1735 struct gzFile_s { | 1722 struct gzFile_s { |
| 1736 unsigned have; | 1723 unsigned have; |
| 1737 unsigned char *next; | 1724 unsigned char* next; |
| 1738 z_off64_t pos; | 1725 z_off64_t pos; |
| 1739 }; | 1726 }; |
| 1740 ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ | 1727 ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ |
| 1741 #ifdef Z_PREFIX_SET | 1728 #ifdef Z_PREFIX_SET |
| 1742 # undef z_gzgetc | 1729 #undef z_gzgetc |
| 1743 # define z_gzgetc(g) \ | 1730 #define z_gzgetc(g) \ |
| 1744 ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) | 1731 ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) |
| 1745 #else | 1732 #else |
| 1746 # define gzgetc(g) \ | 1733 #define gzgetc(g) \ |
| 1747 ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) | 1734 ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) |
| 1748 #endif | 1735 #endif |
| 1749 | 1736 |
| 1750 /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or | 1737 /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or |
| 1751 * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if | 1738 * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if |
| 1752 * both are true, the application gets the *64 functions, and the regular | 1739 * both are true, the application gets the *64 functions, and the regular |
| 1753 * functions are changed to 64 bits) -- in case these are set on systems | 1740 * functions are changed to 64 bits) -- in case these are set on systems |
| 1754 * without large file support, _LFS64_LARGEFILE must also be true | 1741 * without large file support, _LFS64_LARGEFILE must also be true |
| 1755 */ | 1742 */ |
| 1756 #ifdef Z_LARGE64 | 1743 #ifdef Z_LARGE64 |
| 1757 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); | 1744 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char*, const char*)); |
| 1758 ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); | 1745 ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); |
| 1759 ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); | 1746 ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); |
| 1760 ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); | 1747 ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); |
| 1761 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); | 1748 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); |
| 1762 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); | 1749 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); |
| 1763 #endif | 1750 #endif |
| 1764 | 1751 |
| 1765 #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) | 1752 #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) |
| 1766 # ifdef Z_PREFIX_SET | 1753 #ifdef Z_PREFIX_SET |
| 1767 # define z_gzopen z_gzopen64 | 1754 #define z_gzopen z_gzopen64 |
| 1768 # define z_gzseek z_gzseek64 | 1755 #define z_gzseek z_gzseek64 |
| 1769 # define z_gztell z_gztell64 | 1756 #define z_gztell z_gztell64 |
| 1770 # define z_gzoffset z_gzoffset64 | 1757 #define z_gzoffset z_gzoffset64 |
| 1771 # define z_adler32_combine z_adler32_combine64 | 1758 #define z_adler32_combine z_adler32_combine64 |
| 1772 # define z_crc32_combine z_crc32_combine64 | 1759 #define z_crc32_combine z_crc32_combine64 |
| 1773 # else | |
| 1774 # define gzopen gzopen64 | |
| 1775 # define gzseek gzseek64 | |
| 1776 # define gztell gztell64 | |
| 1777 # define gzoffset gzoffset64 | |
| 1778 # define adler32_combine adler32_combine64 | |
| 1779 # define crc32_combine crc32_combine64 | |
| 1780 # endif | |
| 1781 # ifndef Z_LARGE64 | |
| 1782 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); | |
| 1783 ZEXTERN off64_t ZEXPORT gzseek64 OF((gzFile, off64_t, int)); | |
| 1784 ZEXTERN off64_t ZEXPORT gztell64 OF((gzFile)); | |
| 1785 ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); | |
| 1786 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off64_t)); | |
| 1787 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off64_t)); | |
| 1788 # endif | |
| 1789 #else | 1760 #else |
| 1790 ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); | 1761 #define gzopen gzopen64 |
| 1791 ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); | 1762 #define gzseek gzseek64 |
| 1792 ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); | 1763 #define gztell gztell64 |
| 1793 ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); | 1764 #define gzoffset gzoffset64 |
| 1794 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); | 1765 #define adler32_combine adler32_combine64 |
| 1795 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); | 1766 #define crc32_combine crc32_combine64 |
| 1767 #endif |
| 1768 #ifndef Z_LARGE64 |
| 1769 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char*, const char*)); |
| 1770 ZEXTERN off64_t ZEXPORT gzseek64 OF((gzFile, off64_t, int)); |
| 1771 ZEXTERN off64_t ZEXPORT gztell64 OF((gzFile)); |
| 1772 ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); |
| 1773 ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off64_t)); |
| 1774 ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off64_t)); |
| 1775 #endif |
| 1776 #else |
| 1777 ZEXTERN gzFile ZEXPORT gzopen OF((const char*, const char*)); |
| 1778 ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); |
| 1779 ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); |
| 1780 ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); |
| 1781 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); |
| 1782 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); |
| 1796 #endif | 1783 #endif |
| 1797 | 1784 |
| 1798 #else /* Z_SOLO */ | 1785 #else /* Z_SOLO */ |
| 1799 | 1786 |
| 1800 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); | 1787 ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); |
| 1801 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); | 1788 ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); |
| 1802 | 1789 |
| 1803 #endif /* !Z_SOLO */ | 1790 #endif /* !Z_SOLO */ |
| 1804 | 1791 |
| 1805 /* hack for buggy compilers */ | 1792 /* hack for buggy compilers */ |
| 1806 #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) | 1793 #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) |
| 1807 struct internal_state {int dummy;}; | 1794 struct internal_state { |
| 1795 int dummy; |
| 1796 }; |
| 1808 #endif | 1797 #endif |
| 1809 | 1798 |
| 1810 /* undocumented functions */ | 1799 /* undocumented functions */ |
| 1811 ZEXTERN const char * ZEXPORT zError OF((int)); | 1800 ZEXTERN const char* ZEXPORT zError OF((int)); |
| 1812 ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); | 1801 ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); |
| 1813 ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); | 1802 ZEXTERN const z_crc_t FAR* ZEXPORT get_crc_table OF((void)); |
| 1814 ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); | 1803 ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); |
| 1815 ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); | 1804 ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); |
| 1816 ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); | 1805 ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); |
| 1817 #if defined(_WIN32) && !defined(Z_SOLO) | 1806 #if defined(_WIN32) && !defined(Z_SOLO) |
| 1818 ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, | 1807 ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t* path, const char* mode)); |
| 1819 const char *mode)); | |
| 1820 #endif | 1808 #endif |
| 1821 #if defined(STDC) || defined(Z_HAVE_STDARG_H) | 1809 #if defined(STDC) || defined(Z_HAVE_STDARG_H) |
| 1822 # ifndef Z_SOLO | 1810 #ifndef Z_SOLO |
| 1823 ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, | 1811 ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, |
| 1824 const char *format, | 1812 const char* format, |
| 1825 va_list va)); | 1813 va_list va)); |
| 1826 # endif | 1814 #endif |
| 1827 #endif | 1815 #endif |
| 1828 | 1816 |
| 1829 #ifdef __cplusplus | 1817 #ifdef __cplusplus |
| 1830 } | 1818 } |
| 1831 #endif | 1819 #endif |
| 1832 | 1820 |
| 1833 #endif /* ZLIB_H */ | 1821 #endif /* ZLIB_H */ |
| OLD | NEW |