Home | History | Annotate | Download | only in old

Lines Matching full:href

14 <li> <a href="#Prologue">Prologue</a>
15 <li> <a href="#Introduction">Introduction</a>
16 <li> <a href="#Utility functions">Utility functions</a>
17 <li> <a href="#Basic functions">Basic functions</a>
18 <li> <a href="#Advanced functions">Advanced functions</a>
19 <li> <a href="#Constants">Constants</a>
20 <li> <a href="#struct z_stream_s">struct z_stream_s</a>
21 <li> <a href="#Checksum functions">Checksum functions</a>
22 <li> <a href="#Misc">Misc</a>
49 <dd><a href="mailto:jloup@gzip.org">jloup@gzip.org</a>
51 <dd><a href="mailto:madler@alumni.caltech.edu">madler@alumni.caltech.edu</a>
56 <a href="ftp://ds.internic.net/rfc/rfc1950.txt">
59 <a href="ftp://ds.internic.net/rfc/rfc1951.txt">
61 (<a href="#deflate">deflate</a> format) and
62 <a href="ftp://ds.internic.net/rfc/rfc1952.txt">
67 <a href="mailto:piaip@csie.ntu.edu.tw"> piaip </a>
69 Visit <a href="http://ftp.cdrom.com/pub/infozip/zlib/">
102 <a href="#Basic functions">basic stream-oriented functions</a>.
109 <li> int <a href="#compress">compress</a> (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);
110 <li> int <a href="#compress2">compress2</a> (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level);
111 <li> int <a href="#uncompress">uncompress</a> (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);
113 <li> gzFile <a href="#gzopen">gzopen</a> (const char *path, const char *mode);
114 <li> gzFile <a href="#gzdopen">gzdopen</a> (int fd, const char *mode);
115 <li> int <a href="#gzsetparams">gzsetparams</a> (gzFile file, int level, int strategy);
116 <li> int <a href="#gzread">gzread</a> (gzFile file, voidp buf, unsigned len);
117 <li> int <a href="#gzwrite">gzwrite</a> (gzFile file, const voidp buf, unsigned len);
118 <li> int VA <a href="#gzprintf">gzprintf</a> (gzFile file, const char *format, ...);
119 <li> int <a href="#gzputs">gzputs</a> (gzFile file, const char *s);
120 <li> char * <a href="#gzgets">gzgets</a> (gzFile file, char *buf, int len);
121 <li> int <a href="#gzputc">gzputc</a> (gzFile file, int c);
122 <li> int <a href="#gzgetc">gzgetc</a> (gzFile file);
123 <li> int <a href="#gzflush">gzflush</a> (gzFile file, int flush);
124 <li> z_off_t <a href="#gzseek">gzseek</a> (gzFile file, z_off_t offset, int whence);
125 <li> z_off_t <a href="#gztell">gztell</a> (gzFile file);
126 <li> int <a href="#gzrewind">gzrewind</a> (gzFile file);
127 <li> int <a href="#gzeof">gzeof</a> (gzFile file);
128 <li> int <a href="#gzclose">gzclose</a> (gzFile file);
129 <li> const char * <a href="#gzerror">gzerror</a> (gzFile file, int *errnum);
140 This function can be used to <a href="#compress">compress</a> a whole file at once if the
142 <a href="#compress">compress</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
143 enough memory, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if there was not enough room in the output
149 parameter has the same meaning as in <a href="#deflateInit">deflateInit</a>. sourceLen is the byte
155 <a href="#compress2">compress2</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
156 memory, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if there was not enough room in the output buffer,
157 <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the level parameter is invalid.
173 <a href="#uncompress">uncompress</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
174 enough memory, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if there was not enough room in the output
175 buffer, or <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if the input data was corrupted.
187 of <a href="#deflateInit2">deflateInit2</a> for more information about the strategy parameter.)
190 <a href="#gzopen">gzopen</a> can be used to read a file which is not in gzip format ; in this
191 case <a href="#gzread">gzread</a> will directly read from the file without decompression.
194 <a href="#gzopen">gzopen</a> returns NULL if the file could not be opened or if there was
195 insufficient memory to allocate the (de)compression <a href="#state">state</a> ; errno
197 zlib error is <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a>).
202 <a href="#gzdopen">gzdopen</a>() associates a gzFile with the file descriptor fd. File
205 The mode parameter is as in <a href="#gzopen">gzopen</a>.
207 The next call of <a href="#gzclose">gzclose</a> on the returned gzFile will also close the
209 descriptor fd. If you want to keep fd open, use <a href="#gzdopen">gzdopen</a>(dup(fd), mode).
211 <a href="#gzdopen">gzdopen</a> returns NULL if there was insufficient memory to allocate
212 the (de)compression <a href="#state">state</a>.
218 of <a href="#deflateInit2">deflateInit2</a> for the meaning of these parameters.
220 <a href="#gzsetparams">gzsetparams</a> returns <a href="#Z_OK">Z_OK</a> if success, or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the file was not
227 If the input file was not in gzip format, <a href="#gzread">gzread</a> copies the given number
230 <a href="#gzread">gzread</a> returns the number of uncompressed bytes actually read (0 for
237 <a href="#gzwrite">gzwrite</a> returns the number of uncompressed bytes actually written
244 control of the format string, as in fprintf. <a href="#gzprintf">gzprintf</a> returns the number of
253 <a href="#gzputs">gzputs</a> returns the number of characters written, or -1 in case of error.
263 <a href="#gzgets">gzgets</a> returns buf, or <a href="#Z_NULL">Z_NULL</a> in case of error.
269 <a href="#gzputc">gzputc</a> returns the value that was written, or -1 in case of error.
274 Reads one byte from the compressed file. <a href="#gzgetc">gzgetc</a> returns this byte
281 flush is as in the <a href="#deflate">deflate</a>() function. The return value is the zlib
282 error number (see function <a href="#gzerror">gzerror</a> below). <a href="#gzflush">gzflush</a> returns <a href="#Z_OK">Z_OK</a> if
283 the flush parameter is <a href="#Z_FINISH">Z_FINISH</a> and all output could be flushed.
285 <a href="#gzflush">gzflush</a> should be called only when strictly necessary because it can
291 Sets the starting position for the next <a href="#gzread">gzread</a> or <a href="#gzwrite">gzwrite</a> on the
298 supported ; <a href="#gzseek">gzseek</a> then compresses a sequence of zeroes up to the new
301 <a href="#gzseek">gzseek</a> returns the resulting offset location as measured in bytes from
311 <a href="#gzrewind">gzrewind</a>(file) is equivalent to (int)<a href="#gzseek">gzseek</a>(file, 0L, SEEK_SET)
316 Returns the starting position for the next <a href="#gzread">gzread</a> or <a href="#gzwrite">gzwrite</a> on the
321 <a href="#gztell">gztell</a>(file) is equivalent to <a href="#gzseek">gzseek</a>(file, 0L, SEEK_CUR)
333 and deallocates all the (de)compression <a href="#state">state</a>. The return value is the zlib
334 error number (see function <a href
342 errnum is set to <a href="#Z_ERRNO">Z_ERRNO</a> and the application may consult errno
350 <li> const char * <a href="#zlibVersion">zlibVersion</a> (void);
351 <li> int <a href="#deflateInit">deflateInit</a> (<a href="#z_streamp">z_streamp</a> strm, int level);
352 <li> int <a href="#deflate">deflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);
353 <li> int <a href="#deflateEnd">deflateEnd</a> (<a href="#z_streamp">z_streamp</a> strm);
354 <li> int <a href="#inflateInit">inflateInit</a> (<a href="#z_streamp">z_streamp</a> strm);
355 <li> int <a href="#inflate">inflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);
356 <li> int <a href="#inflateEnd">inflateEnd</a> (<a href="#z_streamp">z_streamp</a> strm);
362 <dd> The application can compare <a href="#zlibVersion">zlibVersion</a> and ZLIB_VERSION for consistency.
365 This check is automatically made by <a href="#deflateInit">deflateInit</a> and <a href="#inflateInit">inflateInit</a>.
368 <font color="Blue"><dt> int <a name="deflateInit">deflateInit</a> (<a href="#z_streamp">z_streamp</a> strm, int level);</font>
370 Initializes the internal stream <a href="#state">state</a> for compression. The fields
371 <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and <a href="#opaque">opaque</a> must be initialized before by the caller.
372 If <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> are set to <a href="#Z_NULL">Z_NULL</a>, <a href="#deflateInit">deflateInit</a> updates them to
376 The compression level must be <a href="#Z_DEFAULT_COMPRESSION">Z_DEFAULT_COMPRESSION</a>, or between 0 and 9:
381 <a href="#Z_DEFAULT_COMPRESSION">Z_DEFAULT_COMPRESSION</a> requests a default compromise between speed and
385 <a href="#deflateInit">deflateInit</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
386 enough memory, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if level is not a valid compression level,
387 <a href="#Z_VERSION_ERROR">Z_VERSION_ERROR</a> if the zlib library version (<a href="#zlib_version">zlib_version</a>) is incompatible
389 <a href="#msg">msg</a> is set to null if there is no error message. <a href="#deflateInit">deflateInit</a> does not
390 perform any compression: this will be done by <a href="#deflate">deflate</a>().
393 <font color="Blue"><dt> int <a name="deflate">deflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);</font>
395 <a href="#deflate">deflate</a> compresses as much data as possible, and stops when the input
400 The detailed semantics are as follows. <a href="#deflate">deflate</a> performs one or both of the
404 <li> Compress more input starting at <a href="#next_in">next_in</a> and update <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a>
406 enough room in the output buffer), <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a> are updated and
407 processing will resume at this point for the next call of <a href="#deflate">deflate</a>().
410 Provide more output starting at <a href="#next_out">next_out</a> and update <a href="#next_out">next_out</a> and <a href="#avail_out">avail_out</a>
417 Before the call of <a href="#deflate">deflate</a>(), the application should ensure that at least
419 more output, and updating <a href="#avail_in">avail_in</a> or <a href="#avail_out">avail_out</a> accordingly ; <a href="#avail_out">avail_out</a>
422 (<a href="#avail_out">avail_out</a> == 0), or after each call of <a href="#deflate">deflate</a>(). If <a href="#deflate">deflate</a> returns <a href="#Z_OK">Z_OK</a>
423 and with zero <a href="#avail_out">avail_out</a>, it must be called again after making room in the
427 If the parameter flush is set to <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>, all pending output is
430 <a href="#avail_in">avail_in</a> is zero after the call if enough output space has been provided
435 If flush is set to <a href="#Z_FULL_FLUSH">Z_FULL_FLUSH</a>, all output is flushed as with
436 <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>, and the compression <a href="#state">state</a> is reset so that decompression can
438 random access is desired. Using <a href="#Z_FULL_FLUSH">Z_FULL_FLUSH</a> too often can seriously degrade
442 If <a href="#deflate">deflate</a> returns with <a href="#avail_out">avail_out</a> == 0, this function must be called again
444 <a href="#avail_out">avail_out</a>), until the flush is complete (<a href="#deflate">deflate</a> returns with non-zero
445 <a href="#avail_out">avail_out</a>).
448 If the parameter flush is set to <a href="#Z_FINISH">Z_FINISH</a>, pending input is processed,
449 pending output is flushed and <a href="#deflate">deflate</a> returns with <a href="#Z_STREAM_END">Z_STREAM_END</a> if there
450 was enough output space ; if <a href="#deflate">deflate</a> returns with <a href="#Z_OK">Z_OK</a>, this function must be
451 called again with <a href="#Z_FINISH">Z_FINISH</a> and more output space (updated <a href="#avail_out">avail_out</a>) but no
452 more input data, until it returns with <a href="#Z_STREAM_END">Z_STREAM_END</a> or an error. After
453 <a href="#deflate">deflate</a> has returned <a href="#Z_STREAM_END">Z_STREAM_END</a>, the only possible operations on the
454 stream are <a href="#deflateReset">deflateReset</a> or <a href="#deflateEnd">deflateEnd</a>.
457 <a href="#Z_FINISH">Z_FINISH</a> can be used immediately after <a href="#deflateInit">deflateInit</a> if all the compression
458 is to be done in a single step. In this case, <a href="#avail_out">avail_out</a> must be at least
459 0.1% larger than <a href="#avail_in">avail_in</a> plus 12 bytes. If <a href="#deflate">deflate</a> does not return
460 <a href="#Z_STREAM_END">Z_STREAM_END</a>, then it must be called again as described above.
463 <a href="#deflate">deflate</a>() sets strm-&gt <a href="#adler">adler</a> to the <a href="#adler32">adler32</a> checksum of all input read
464 so far (that is, <a href="#total_in">total_in</a> bytes).
467 <a href="#deflate">deflate</a>() may update <a href="#data_type">data_type</a> if it can make a good guess about
468 the input data type (<a href="#Z_ASCII">Z_ASCII</a> or <a href="#Z_BINARY">Z_BINARY</a>). In doubt, the data is considered
473 <a href="#deflate">deflate</a>() returns <a href="#Z_OK">Z_OK</a> if some progress has been made (more input
474 processed or more output produced), <a href="#Z_STREAM_END">Z_STREAM_END</a> if all input has been
476 <a href="#Z_FINISH">Z_FINISH</a>), <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream <a href="#state">state</a> was inconsistent (for example
477 if <a href="#next_in">next_in</a> or <a href="#next_out">next_out</a> was NULL), <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if no progress is possible
478 (for example <a href="#avail_in">avail_in</a> or <a href="#avail_out">avail_out</a> was zero).
481 <font color="Blue"><dt> int <a name="deflateEnd">deflateEnd</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
488 <a href="#deflateEnd">deflateEnd</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the
489 stream <a href="#state">state</a> was inconsistent, <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if the stream was freed
491 <a href="#msg">msg</a> may be set but then points to a static string (which must not be
495 <font color="Blue"><dt> int <a name="inflateInit">inflateInit</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
497 Initializes the internal stream <a href="#state">state</a> for decompression. The fields
498 <a href="#next_in">next_in</a>, <a href="#avail_in">avail_in</a>, <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and <a href="#opaque">opaque</a> must be initialized before by
499 the caller. If <a href="#next_in">next_in</a> is not <a href="#Z_NULL">Z_NULL</a> and <a href="#avail_in">avail_in</a> is large enough (the exact
500 value depends on the compression method), <a href="#inflateInit">inflateInit</a> determines the
503 <a href="#inflate">inflate</a>. If <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> are set to <a href="#Z_NULL">Z_NULL</a>, <a href="#inflateInit">inflateInit</a> updates them to
507 <a href="#inflateInit">inflateInit</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
508 memory, <a href="#Z_VERSION_ERROR">Z_VERSION_ERROR</a> if the zlib library version is incompatible with the
509 version assumed by the caller. <a href="#msg">msg</a> is set to null if there is no error
510 message. <a href="#inflateInit">inflateInit</a> does not perform any decompression apart from reading
511 the zlib header if present: this will be done by <a href="#inflate">inflate</a>(). (So <a href="#next_in">next_in</a> and
512 <a href="#avail_in">avail_in</a> may be modified, but <a href="#next_out">next_out</a> and <a href="#avail_out">avail_out</a> are unchanged.)
515 <font color="Blue"><dt> int <a name="inflate">inflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);</font>
517 <a href="#inflate">inflate</a> decompresses as much data as possible, and stops when the input
523 The detailed semantics are as follows. <a href="#inflate">inflate</a> performs one or both of the
527 <li> Decompress more input starting at <a href="#next_in">next_in</a> and update <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a>
529 enough room in the output buffer), <a href="#next_in">next_in</a> is updated and processing
530 will resume at this point for the next call of <a href="#inflate">inflate</a>().
532 <li> Provide more output starting at <a href="#next_out">next_out</a> and update <a href="#next_out">next_out</a> and
533 <a href="#avail_out">avail_out</a> accordingly. <a href="#inflate">inflate</a>() provides as much output as possible,
538 Before the call of <a href="#inflate">inflate</a>(), the application should ensure that at least
542 example when the output buffer is full (<a href="#avail_out">avail_out</a> == 0), or after each
543 call of <a href="#inflate">inflate</a>(). If <a href="#inflate">inflate</a> returns <a href="#Z_OK">Z_OK</a> and with zero <a href="#avail_out">avail_out</a>, it
548 If the parameter flush is set to <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>, <a href="#inflate">inflate</a> flushes as much
549 output as possible to the output buffer. The flushing behavior of <a href="#inflate">inflate</a> is
550 not specified for values of the flush parameter other than <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>
551 and <a href="#Z_FINISH">Z_FINISH</a>, but the current implementation actually flushes as much output
555 <a href="#inflate">inflate</a>() should normally be called until it returns <a href="#Z_STREAM_END">Z_STREAM_END</a> or an
557 (a single call of <a href="#inflate">inflate</a>), the parameter flush should be set to
558 <a href="#Z_FINISH">Z_FINISH</a>. In this case all pending input is processed and all pending
559 output is flushed ; <a href="#avail_out">avail_out</a> must be large enough to hold all the
562 be <a href="#inflateEnd">inflateEnd</a> to deallocate the decompression <a href="#state">state</a>. The use of <a href="#Z_FINISH">Z_FINISH</a>
563 is never required, but can be used to inform <a href="#inflate">inflate</a> that a faster routine
564 may be used for the single <a href="#inflate">inflate</a>() call.
567 If a preset dictionary is needed at this point (see <a href="#inflateSetDictionary">inflateSetDictionary</a>
568 below), <a href="#inflate">inflate</a> sets strm-<a href="#adler">adler</a> to the <a href="#adler32">adler32</a> checksum of the
569 dictionary chosen by the compressor and returns <a href="#Z_NEED_DICT">Z_NEED_DICT</a> ; otherwise
570 it sets strm-&gt <a href="#adler">adler</a> to the <a href="#adler32">adler32</a> checksum of all output produced
571 so far (that is, <a href="#total_out">total_out</a> bytes) and returns <a href="#Z_OK">Z_OK</a>, <a href="#Z_STREAM_END">Z_STREAM_END</a> or
572 an error code as described below. At the end of the stream, <a href="#inflate">inflate</a>()
573 checks that its computed <a href="#adler32">adler32</a> checksum is equal to that saved by the
574 compressor and returns <a href="#Z_STREAM_END">Z_STREAM_END</a> only if the checksum is correct.
577 <a href="#inflate">inflate</a>() returns <a href
578 or more output produced), <a href="#Z_STREAM_END">Z_STREAM_END</a> if the end of the compressed data has
579 been reached and all uncompressed output has been produced, <a href="#Z_NEED_DICT">Z_NEED_DICT</a> if a
580 preset dictionary is needed at this point, <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if the input data was
582 <a href="#adler32">adler32</a> checksum), <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream structure was inconsistent
583 (for example if <a href="#next_in">next_in</a> or <a href="#next_out">next_out</a> was NULL), <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
584 enough memory, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a> if no progress is possible or if there was not
585 enough room in the output buffer when <a href="#Z_FINISH">Z_FINISH</a> is used. In the <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a>
586 case, the application may then call <a href="#inflateSync">inflateSync</a> to look for a good
590 <font color="Blue"><dt> int <a name="inflateEnd">inflateEnd</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
597 <a href="#inflateEnd">inflateEnd</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream <a href="#state">state</a>
598 was inconsistent. In the error case, <a href="#msg">msg</a> may be set but then points to a
606 <li> int <a href="#deflateInit2">deflateInit2</a> (<a href="#z_streamp">z_streamp</a> strm,
607 <li> int <a href="#deflateSetDictionary">deflateSetDictionary</a> (<a href="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt dictLength);
608 <li> int <a href="#deflateCopy">deflateCopy</a> (<a href="#z_streamp">z_streamp</a> dest, <a href="#z_streamp">z_streamp</a> source);
609 <li> int <a href="#deflateReset">deflateReset</a> (<a href="#z_streamp">z_streamp</a> strm);
610 <li> int <a href="#deflateParams">deflateParams</a> (<a href="#z_streamp">z_streamp</a> strm, int level, int strategy);
611 <li> int <a href="#inflateInit2">inflateInit2</a> (<a href="#z_streamp">z_streamp</a> strm, int windowBits);
612 <li> int <a href="#inflateSetDictionary">inflateSetDictionary</a> (<a href="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt dictLength);
613 <li> int <a href="#inflateSync">inflateSync</a> (<a href="#z_streamp">z_streamp</a> strm);
614 <li> int <a href="#inflateReset">inflateReset</a> (<a href="#z_streamp">z_streamp</a> strm);
619 <font color="Blue"><dt> int <a name="deflateInit2">deflateInit2</a> (<a href="#z_streamp">z_streamp</a> strm, int level, int method, int windowBits, int memLevel, int strategy);</font>
621 <dd> This is another version of <a href="#deflateInit">deflateInit</a> with more compression options. The
622 fields <a href="#next_in">next_in</a>, <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and <a href="#opaque">opaque</a> must be initialized before by
625 The method parameter is the compression method. It must be <a href="#Z_DEFLATED">Z_DEFLATED</a> in
632 <a href="#deflateInit">deflateInit</a> is used instead.<p>
635 for the internal compression <a href="#state">state</a>. memLevel=1 uses minimum memory but
641 value <a href="#Z_DEFAULT_STRATEGY">Z_DEFAULT_STRATEGY</a> for normal data, <a href="#Z_FILTERED">Z_FILTERED</a> for data produced by a
642 filter (or predictor), or <a href="#Z_HUFFMAN_ONLY">Z_HUFFMAN_ONLY</a> to force Huffman encoding only (no
645 tuned to <a href="#compress">compress</a> them better. The effect of <a href="#Z_FILTERED">Z_FILTERED</a> is to force more
647 between Z_DEFAULT and <a href="#Z_HUFFMAN_ONLY">Z_HUFFMAN_ONLY</a>. The strategy parameter only affects
651 <a href="#deflateInit2">deflateInit2</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
652 memory, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a parameter is invalid (such as an invalid
653 method). <a href="#msg">msg</a> is set to null if there is no error message. <a href="#deflateInit2">deflateInit2</a> does
654 not perform any compression: this will be done by <a href="#deflate">deflate</a>().<p>
656 <font color="Blue"><dt> int <a name="deflateSetDictionary">deflateSetDictionary</a> (<a href="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt dictLength);</font>
660 immediately after <a href="#deflateInit">deflateInit</a>, <a href="#deflateInit2">deflateInit2</a> or <a href="#deflateReset">deflateReset</a>, before any
661 call of <a href="#deflate">deflate</a>. The compressor and decompressor must use exactly the same
662 dictionary (see <a href="#inflateSetDictionary">inflateSetDictionary</a>).<p>
672 <a href="#deflateInit">deflateInit</a> or <a href="#deflateInit2">deflateInit2</a>, a part of the dictionary may in effect be
674 <a href="#deflate">deflate</a> or deflate2. Thus the strings most likely to be useful should be
677 Upon return of this function, strm-&gt <a href="#adler">adler</a> is set to the Adler32 value
683 <a href="#deflateSetDictionary">deflateSetDictionary</a> returns <a href="#Z_OK">Z_OK</a> if success, or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a
684 parameter is invalid (such as NULL dictionary) or the stream <a href="#state">state</a> is
685 inconsistent (for example if <a href="#deflate">deflate</a> has already been called for this stream
686 or if the compression method is bsort). <a href="#deflateSetDictionary">deflateSetDictionary</a> does not
687 perform any compression: this will be done by <a href="#deflate">deflate</a>().<p>
689 <font color="Blue"><dt> int <a name="deflateCopy">deflateCopy</a> (<a href="#z_streamp">z_streamp</a> dest, <a href="#z_streamp">z_streamp</a> source);</font>
696 by calling <a href="#deflateEnd">deflateEnd</a>. Note that <a href="#deflateCopy">deflateCopy</a> duplicates the internal
697 compression <a href="#state">state</a> which can be quite large, so this strategy is slow and
700 <a href="#deflateCopy">deflateCopy</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not
701 enough memory, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source stream <a href="#state">state</a> was inconsistent
702 (such as <a href="#zalloc">zalloc</a> being NULL). <a href="#msg">msg</a> is left unchanged in both source and
705 <font color="Blue"><dt> int <a name="deflateReset">deflateReset</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
706 <dd> This function is equivalent to <a href="#deflateEnd">deflateEnd</a> followed by <a href="#deflateInit">deflateInit</a>,
707 but does not free and reallocate all the internal compression <a href="#state">state</a>.
709 that may have been set by <a href="#deflateInit2">deflateInit2</a>.<p>
711 <a href="#deflateReset">deflateReset</a> returns <a href="#Z_OK">Z_OK</a> if success, or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source
712 stream <a href="#state">state</a> was inconsistent (such as <a href="#zalloc">zalloc</a> or <a href="#state">state</a> being NULL).<p>
714 <font color="Blue"><dt> int <a name="deflateParams">deflateParams</a> (<a href="#z_streamp">z_streamp</a> strm, int level, int strategy);</font>
717 interpretation of level and strategy is as in <a href="#deflateInit2">deflateInit2</a>. This can be
722 take effect only at the next call of <a href="#deflate">deflate</a>().<p>
724 Before the call of <a href="#deflateParams">deflateParams</a>, the stream <a href="#state">state</a> must be set as for
725 a call of <a href="#deflate">deflate</a>(), since the currently available input may have to
726 be compressed and flushed. In particular, strm-&gt <a href="#avail_out">avail_out</a> must be
729 <a href="#deflateParams">deflateParams</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source
730 stream <a href="#state">state</a> was inconsistent or if a parameter was invalid, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a>
733 <font color="Blue"><dt> int <a name="inflateInit2">inflateInit2</a> (<a href="#z_streamp">z_streamp</a> strm, int windowBits);</font>
735 <dd> This is another version of <a href="#inflateInit">inflateInit</a> with an extra parameter. The
736 fields <a href="#next_in">next_in</a>, <a href="#avail_in">avail_in</a>, <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and <a href="#opaque">opaque</a> must be initialized
741 this version of the library. The default value is 15 if <a href="#inflateInit">inflateInit</a> is used
743 input, <a href="#inflate">inflate</a>() will return with the error code <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> instead of
746 <a href="#inflateInit2">inflateInit2</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not enough
747 memory, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a parameter is invalid (such as a negative
748 memLevel). <a href="#msg">msg</a> is set to null if there is no error message. <a href="#inflateInit2">inflateInit2</a>
750 present: this will be done by <a href="#inflate">inflate</a>(). (So <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a> may be
751 modified, but <a href="#next_out">next_out</a> and <a href="#avail_out">avail_out</a> are unchanged.)<p>
753 <font color="Blue"><dt> int <a name="inflateSetDictionary">inflateSetDictionary</a> (<a href="#z_streamp">z_streamp</a> strm, const Bytef *dictionary, uInt dictLength);</font>
756 sequence. This function must be called immediately after a call of <a href="#inflate">inflate</a>
757 if this call returned <a href="#Z_NEED_DICT">Z_NEED_DICT</a>. The dictionary chosen by the compressor
759 <a href="#inflate">inflate</a>. The compressor and decompressor must use exactly the same
760 dictionary (see <a href="#deflateSetDictionary">deflateSetDictionary</a>).<p>
762 <a href="#inflateSetDictionary">inflateSetDictionary</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if a
763 parameter is invalid (such as NULL dictionary) or the stream <a href="#state">state</a> is
764 inconsistent, <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if the given dictionary doesn't match the
765 expected one (incorrect Adler32 value). <a href="#inflateSetDictionary">inflateSetDictionary</a> does not
767 <a href="#inflate">inflate</a>().<p>
769 <font color="Blue"><dt> int <a name="inflateSync">inflateSync</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
772 description of <a href="#deflate">deflate</a> with <a href="#Z_FULL_FLUSH">Z_FULL_FLUSH</a>) can be found, or until all
775 <a href="#inflateSync">inflateSync</a> returns <a href="#Z_OK">Z_OK</a> if a full flush point has been found, <a href="#Z_BUF_ERROR">Z_BUF_ERROR</a>
776 if no more input was provided, <a href="#Z_DATA_ERROR">Z_DATA_ERROR</a> if no flush point has been found,
777 or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the stream structure was inconsistent. In the success
778 case, the application may save the current current value of <a href="#total_in">total_in</a> which
780 application may repeatedly call <a href="#inflateSync">inflateSync</a>, providing more input each time,
783 <font color="Blue"><dt> int <a name="inflateReset">inflateReset</a> (<a href="#z_streamp">z_streamp</a> strm);</font>
785 This function is equivalent to <a href="#inflateEnd">inflateEnd</a> followed by <a href="#inflateInit">inflateInit</a>,
786 but does not free and reallocate all the internal decompression <a href="#state">state</a>.
787 The stream will keep attributes that may have been set by <a href="#inflateInit2">inflateInit2</a>.
790 <a href="#inflateReset">inflateReset</a> returns <a href="#Z_OK">Z_OK</a> if success, or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the source
791 stream <a href="#state">state</a> was inconsistent (such as <a href="#zalloc">zalloc</a> or <a href="#state">state</a> being NULL).
802 <li> uLong <a href="#adler32">adler32</a> (uLong <a href="#adler">adler</a>, const Bytef *buf, uInt len);
803 <li> uLong <a href="#crc32">crc32</a> (uLong crc, const Bytef *buf, uInt len);
807 <font color="Blue"><dt> uLong <a name="adler32">adler32</a> (uLong <a href="#adler">adler</a>, const Bytef *buf, uInt len);</font>
817 uLong <a href="#adler">adler</a> = <a href="#adler32">adler32</a>(0L, <a href="#Z_NULL">Z_NULL</a>, 0);
820 <a href="#adler">adler</a> = <a href="#adler32">adler32</a>(<a href="#adler">adler</a>, buffer, length);
822 if (<a href="#adler">adler</a> != original_adler) error();
834 uLong crc = <a href="#crc32">crc32</a>(0L, <a href="#Z_NULL">Z_NULL</a>, 0);
837 crc = <a href="#crc32">crc32</a>(crc, buffer, length);
849 uInt <a name="avail_in">avail_in</a>; /* number of bytes available at <a href="#next_in">next_in</a> */
853 uInt <a name="avail_out">avail_out</a>; /* remaining free space at <a href="#next_out">next_out</a> */
859 alloc_func <a name="zalloc">zalloc</a>; /* used to allocate the internal <a href="#state">state</a> */
860 free_func <a name="zfree">zfree</a>; /* used to free the internal <a href="#state">state</a> */
861 voidpf <a name="opaque">opaque</a>; /* private data object passed to <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> */
864 uLong <a name="adler">adler</a>; /* <a href="#adler32">adler32</a> value of the uncompressed data */
865 uLong <a name="reserved">reserved</a>; /* <a href="#reserved">reserved</a> for future use */
866 } <a href="#z_stream_s">z_stream</a> ;
868 typedef <a href="#z_stream_s">z_stream</a> FAR * <a name="z_streamp">z_streamp</a>; ?
871 The application must update <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a> when <a href="#avail_in">avail_in</a> has
872 dropped to zero. It must update <a href="#next_out">next_out</a> and <a href="#avail_out">avail_out</a> when <a href="#avail_out">avail_out</a>
873 has dropped to zero. The application must initialize <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and
874 <a href="#opaque">opaque</a> before calling the init function. All other fields are set by the
877 The <a href="#opaque">opaque</a> value provided by the application will be passed as the first
878 parameter for calls of <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a>. This can be useful for custom
880 <a href="#opaque">opaque</a> value. <p>
882 <a href="#zalloc">zalloc</a> must return <a href="#Z_NULL">Z_NULL</a> if there is not enough memory for the object.
883 If zlib is used in a multi-threaded application, <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> must be
886 On 16-bit systems, the functions <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> must be able to allocate
889 pointers returned by <a href="#zalloc">zalloc</a> for objects of exactly 65536 bytes *must*
896 The fields <a href="#total_in">total_in</a> and <a href="#total_out">total_out</a> can be used for statistics or
897 progress reports. After compression, <a href="#total_in">total_in</a> holds the total size of
908 /* will be removed, use <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a> instead */
912 /* Allowed flush values ; see <a href="#deflate">deflate</a>() below for details */
936 /* compression strategy ; see <a href="#deflateInit2">deflateInit2</a>() below for details */
941 /* Possible values of the <a href="#data_type">data_type</a> field */
944 /* The <a href="#deflate">deflate</a> compression method (the only one supported in this version) */
946 #define <a name="Z_NULL">Z_NULL</a> 0 /* for initializing <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a>, <a href="#opaque">opaque</a> */
948 #define <a name="zlib_version">zlib_version</a> <a href="#zlibVersion">zlibVersion</a>()
955 <a href="#deflateInit">deflateInit</a> and <a href="#inflateInit">inflateInit</a> are macros to allow checking the zlib version
956 and the compiler's view of <a href="#z_stream_s">z_stream</a>.
961 <font color="Blue"><dt> int <a name="inflateSyncPoint">inflateSyncPoint</a> (<a href="#z_streamp">z_streamp</a> z);</font>