Lines Matching full:the
1 /* zlib.h -- interface of the 'zlib' general purpose compression library
7 warranty. In no event will the authors be held liable for any damages
8 arising from the use of this software.
12 freely, subject to the following restrictions:
14 1. The origin of this software must not be misrepresented; you must not
15 claim that you wrote the original software. If you use this software
16 in a product, an acknowledgment in the product documentation would be
19 misrepresented as being the original software.
26 The data format used by the zlib library is described by RFCs (Request for
27 Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
44 The 'zlib' compression library provides in-memory compression and
45 decompression functions, including integrity checks of the uncompressed
46 data. This version of the library supports only one compression method
47 (deflation) but other algorithms will be added later and will have the same
50 Compression can be done in a single step if the buffers are large
52 repeated calls of the compression function. In the latter case, the
53 application must provide more input and/or consume the output
56 The compressed data format used by default by the in-memory functions is
57 the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
60 The library also supports reading and writing files in gzip (.gz) format
61 with an interface similar to that of stdio using the functions that start
62 with "gz". The gzip format is different from the zlib format. gzip is a
67 The zlib format was designed to be compact and fast for use in memory
68 and on communications channels. The gzip format was designed for single-
72 The library does not install any signal handler. The decoder checks
73 the consistency of the compressed data, so the library should never
94 alloc_func zalloc; /* used to allocate the internal state */
95 free_func zfree; /* used to free the internal state */
98 int data_type; /* best guess about the data type: binary or text */
99 uLong adler; /* adler32 value of the uncompressed data */
107 for more details on the meanings of these fields.
129 The application must update next_in and avail_in when avail_in has
131 has dropped to zero. The application must initialize zalloc, zfree and
132 opaque before calling the init function. All other fields are set by the
133 compression library and must not be updated by the application.
135 The opaque value provided by the application will be passed as the first
137 memory management. The compression library attaches no meaning to the
140 zalloc must return Z_NULL if there is not enough memory for the object.
144 On 16-bit systems, the functions zalloc and zfree must be able to allocate
146 if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
148 have their offset normalized to zero. The default allocation function
150 requirements and avoid any allocation of 64K objects, at the expense of
151 compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
153 The fields total_in and total_out can be used for statistics or
154 progress reports. After compression, total_in holds the total size of
155 the uncompressed data and may be saved for use in the decompressor
156 (particularly if the decompressor wants to decompress everything in
179 /* Return codes for the compression/decompression functions. Negative
200 /* Possible values of the data_type field (though see inflate()) */
203 /* The deflate compression method (the only one supported in this version) */
213 /* The application can compare zlibVersion and ZLIB_VERSION for consistency.
214 If the first character differs, the library code actually used is
215 not compatible with the zlib.h header file used by the application.
222 Initializes the internal stream state for compression. The fields
223 zalloc, zfree and opaque must be initialized before by the caller.
227 The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
229 all (the input data is simply copied a block at a time).
235 Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
236 with the version assumed by the caller (ZLIB_VERSION).
244 deflate compresses as much data as possible, and stops when the input
245 buffer becomes empty or the output buffer becomes full. It may introduce some
249 The detailed semantics are as follows. deflate performs one or both of the
254 enough room in the output buffer), next_in and avail_in are updated and
255 processing will resume at this point for the next call of deflate().
258 accordingly. This action is forced if the parameter flush is non zero.
259 Forcing flush frequently degrades the compression ratio, so this parameter
263 Before the call of deflate(), the application should ensure that at least
264 one of the actions is possible, by providing more input and/or consuming
266 should never be zero before the call. The application can consume the
267 compressed output when it wants, for example when the output buffer is full
269 and with zero avail_out, it must be called again after making room in the
272 Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
276 If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
277 flushed to the output buffer and the output is aligned on a byte boundary, so
278 that the decompressor can get all input data available so far. (In particular
279 avail_in is zero after the call if enough output space has been provided
280 before the call.) Flushing may degrade compression for some compression
284 Z_SYNC_FLUSH, and the compression state is reset so that decompression can
290 with the same value of the flush parameter and more output space (updated
291 avail_out), until the flush is complete (deflate returns with non-zero
292 avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
296 If the parameter flush is set to Z_FINISH, pending input is processed,
301 deflate has returned Z_STREAM_END, the only possible operations on the
304 Z_FINISH can be used immediately after deflateInit if all the compression
306 the value returned by deflateBound (see below). If deflate does not return
309 deflate() sets strm->adler to the adler32 checksum of all input read
313 the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
315 the compression algorithm in any manner.
320 Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
334 deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
335 stream state was inconsistent, Z_DATA_ERROR if the stream was freed
336 prematurely (some input or output was discarded). In the error case,
345 Initializes the internal stream state for decompression. The fields
347 the caller. If next_in is not Z_NULL and avail_in is large enough (the exact
348 value depends on the compression method), inflateInit determines the
349 compression method from the zlib header and allocates all data structures
350 accordingly; otherwise the allocation will be deferred to the first call of
355 memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
356 version assumed by the caller. msg is set to null if there is no error
358 the zlib header if present: this will be done by inflate(). (So next_in and
365 inflate decompresses as much data as possible, and stops when the input
366 buffer becomes empty or the output buffer becomes full. It may introduce
370 The detailed semantics are as follows. inflate performs one or both of the
375 enough room in the output buffer), next_in is updated and processing
376 will resume at this point for the next call of inflate().
380 is no more input data or no more space in the output buffer (see below
381 about the flush parameter).
383 Before the call of inflate(), the application should ensure that at least
384 one of the actions is possible, by providing more input and/or consuming
385 more output, and updating the next_* and avail_* values accordingly.
386 The application can consume the uncompressed output when it wants, for
387 example when the output buffer is full (avail_out == 0), or after each
389 must be called again after making room in the output buffer because there
392 The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH,
394 output as possible to the output buffer. Z_BLOCK requests that inflate() stop
395 if and when it gets to the next deflate block boundary. When decoding the
397 the header and before the first block. When doing a raw inflate, inflate()
398 will go ahead and process the first block, and will return when it gets to
399 the end of that block, or when it runs out of data.
401 The Z_BLOCK option assists in appending to or combining deflate streams.
402 Also to assist in this, on return inflate() will set strm->data_type to the
403 number of unused bits in the last byte taken from strm->next_in, plus 64
404 if inflate() is currently decoding the last block in the deflate stream,
406 code or decoding the complete header up to just before the first byte of the
407 deflate stream. The end-of-block will not be indicated until all of the
408 uncompressed data from that block has been written to strm->next_out. The
410 bit 7 of data_type is set, in which case the number of unused bits will be
415 (a single call of inflate), the parameter flush should be set to
417 output is flushed; avail_out must be large enough to hold all the
418 uncompressed data. (The size of the uncompressed data may have been saved
419 by the compressor for this purpose.) The next operation on this stream must
420 be inflateEnd to deallocate the decompression state. The use of Z_FINISH
422 may be used for the single inflate() call.
425 possible to the output buffer, and always uses the faster approach on the
426 first call. So the only effect of the flush parameter in this implementation
427 is on the return value of inflate(), as noted below, or when it returns early
431 below), inflate sets strm->adler to the adler32 checksum of the dictionary
432 chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
433 strm->adler to the adler32 checksum of all output produced so far (that is,
435 below. At the end of the stream, inflate() checks that its computed adler32
436 checksum is equal to that saved by the compressor and returns Z_STREAM_END
437 only if the checksum is correct.
440 deflate data. The header type is detected automatically. Any information
441 contained in the gzip header is not retained, so applications that need that
443 inflateBack() and perform their own processing of the gzip header and
447 or more output produced), Z_STREAM_END if the end of the compressed data has
449 preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
450 corrupted (input stream not conforming to the zlib format or incorrect check
451 value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
453 Z_BUF_ERROR if no progress is possible or if there was not enough room in the
456 continue decompressing. If Z_DATA_ERROR is returned, the application may then
458 of the data is desired.
468 inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
469 was inconsistent. In the error case, msg may be set but then points to a
476 The following functions are needed only in some special applications.
487 This is another version of deflateInit with more compression options. The
489 the caller.
491 The method parameter is the compression method. It must be Z_DEFLATED in
492 this version of the library.
494 The windowBits parameter is the base two logarithm of the window size
495 (the size of the history buffer). It should be in the range 8..15 for this
496 version of the library. Larger values of this parameter result in better
497 compression at the expense of memory usage. The default value is 15 if
501 determines the window size. deflate() will then generate raw deflate data
505 16 to windowBits to write a simple gzip header and trailer around the
506 compressed data instead of a zlib wrapper. The gzip header will have no
508 no header crc, and the operating system will be set to 255 (unknown). If a
511 The memLevel parameter specifies how much memory should be allocated
512 for the internal compression state. memLevel=1 uses minimum memory but
514 for optimal speed. The default value is 8. See zconf.h for total memory
517 The strategy parameter is used to tune the compression algorithm. Use the
522 random distribution. In this case, the compression algorithm is tuned to
523 compress them better. The effect of Z_FILTERED is to force more Huffman
526 Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy
527 parameter only affects the compression ratio but not the correctness of the
528 compressed output even if it is not set appropriately. Z_FIXED prevents the
542 Initializes the compression dictionary from the given byte sequence
545 call of deflate. The compressor and decompressor must use exactly the same
548 The dictionary should consist of strings (byte sequences) that are likely
549 to be encountered later in the data to be compressed, with the most commonly
550 used strings preferably put towards the end of the dictionary. Using a
551 dictionary is most useful when the data to be compressed is short and can be
552 predicted with good accuracy; the data can then be compressed better than
553 with the default empty dictionary.
555 Depending on the size of the compression data structures selected by
556 deflateInit or deflateInit2, a part of the dictionary may in effect be
557 discarded, for example if the dictionary is larger than the window size in
558 deflate or deflate2. Thus the strings most likely to be useful should be
559 put at the end of the dictionary, not at the front. In addition, the
560 current implementation of deflate will use at most the window size minus
561 262 bytes of the provided dictionary.
563 Upon return of this function, strm->adler is set to the adler32 value
564 of the dictionary; the decompressor may later use this value to determine
565 which dictionary has been used by the compressor. (The adler32 value
566 applies to the whole dictionary even if only a subset of the dictionary is
567 actually used by the compressor.) If a raw deflate was requested, then the
571 parameter is invalid (such as NULL dictionary) or the stream state is
573 or if the compression method is bsort). deflateSetDictionary does not
580 Sets the destination stream as a complete copy of the source stream.
583 tried, for example when there are several ways of pre-processing the input
584 data with a filter. The streams that will be discarded should then be freed
585 by calling deflateEnd. Note that deflateCopy duplicates the internal
590 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
598 but does not free and reallocate all the internal compression state.
599 The stream will keep the same compression level and any other attributes
602 deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
610 Dynamically update the compression level and compression strategy. The
612 used to switch between compression and straight copy of the input data, or
614 strategy. If the compression level is changed, the input available so far
615 is compressed with the old level (and may be flushed); the new level will
616 take effect only at the next call of deflate().
618 Before the call of deflateParams, the stream state must be set as for
619 a call of deflate(), since the currently available input may have to
622 deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
634 used by someone who understands the algorithm used by zlib's deflate for
635 searching for the best matching string, and even then only by the most
636 fanatic optimizer trying to squeeze out the last compressed bit for their
637 specific input data. Read the deflate.c source code for the meaning of the
647 deflateBound() returns an upper bound on the compressed size after
657 deflatePrime() inserts bits in the deflate output stream. The intent
658 is that this function is used to start off the deflate output with the
660 this function can only be used for raw deflate, and must be used before the
662 less than or equal to 16, and that many of the least significant bits of
663 value will be inserted in the output.
665 deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
674 after deflateInit2() or deflateReset() and before the first call of
675 deflate(). The text, time, os, extra field, name, and comment information
676 in the provided gz_header structure are written to the gzip header (xflag is
677 ignored -- the extra flags are set according to the compression level). The
681 the current versions of the command-line version of gzip (up through version
685 If deflateSetHeader is not used, the default gzip header has text false,
686 the time set to zero, and os set to 255, with no extra, name, or comment
687 fields. The gzip header is returned to the default state by deflateReset().
689 deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
697 This is another version of inflateInit with an extra parameter. The
699 before by the caller.
701 The windowBits parameter is the base two logarithm of the maximum window
702 size (the size of the history buffer). It should be in the range 8..15 for
703 this version of the library. The default value is 15 if inflateInit is used
704 instead. windowBits must be greater than or equal to the windowBits value
707 size is given as input, inflate() will return with the error code
711 determines the window size. inflate() will then process raw deflate data,
713 looking for any check values for comparison at the end of the stream. This
714 is for use with other formats that use the deflate compressed data format
716 format is developed using the raw deflate format for compressed data, it is
718 the uncompressed data as is done in the zlib, gzip, and zip formats. For
719 most applications, the zlib format should be used as is. Note that comments
720 above on the use in deflateInit2() applies to the magnitude of windowBits.
724 detection, or add 16 to decode only the gzip format (the zlib format will
731 any decompression apart from reading the zlib header if present: this will
740 Initializes the decompression dictionary from the given uncompressed byte
742 if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
743 can be determined from the adler32 value returned by that call of inflate.
744 The compressor and decompressor must use exactly the same dictionary (see
747 inflate() to set the dictionary. The application must insure that the
751 parameter is invalid (such as NULL dictionary) or the stream state is
752 inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
760 Skips invalid compressed data until a full flush point (see above the
766 or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
767 case, the application may save the current current value of total_in which
768 indicates where valid compressed data was found. In the error case, the
770 until success or end of the input data.
776 Sets the destination stream as a complete copy of the source stream.
778 This function can be useful when randomly accessing a large stream. The
779 first pass through the stream can periodically record the inflate state,
780 allowing restarting inflate at those points when randomly accessing the
784 enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
792 but does not free and reallocate all the internal decompression state.
793 The stream will keep attributes that may have been set by inflateInit2.
795 inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
803 This function inserts bits in the inflate input stream. The intent is
804 that this function is used to start inflating at a bit position in the
805 middle of a byte. The provided bits will be used before any bytes are used
807 should be used before the first inflate() call after inflateInit2() or
808 inflateReset(). bits must be less than or equal to 16, and that many of the
809 least significant bits of value will be inserted in the input.
811 inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
818 inflateGetHeader() requests that gzip header information be stored in the
820 inflateInit2() or inflateReset(), and before the first call of inflate().
821 As inflate() processes the gzip stream, head->done is zero until the header
828 The text, time, xflags, and os fields are filled in with the gzip header
829 contents. hcrc is set to true if there is a header CRC. (The header CRC
831 contains the maximum number of bytes to write to extra. Once done is true,
832 extra_len contains the actual extra field length, and extra contains the
835 terminated with a zero unless the length is greater than name_max. If
837 terminated with a zero unless the length is greater than comm_max. When
838 any of extra, name, or comment are not Z_NULL and the respective field is
839 not present in the header, then that field is set to Z_NULL to signal its
840 absence. This allows the use of deflateSetHeader() with the returned
841 structure to duplicate the header. However if those fields are set to
842 allocated memory, then the application will need to save those pointers
845 If inflateGetHeader is not used, then the header information is simply
846 discarded. The header is always checked for validity, including the header
847 CRC if present. inflateReset() will reset the process to discard the header
848 information. The application would need to call inflateGetHeader() again to
849 retrieve the header from the next gzip stream.
851 inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
859 Initialize the internal stream state for decompression using inflateBack()
860 calls. The fields zalloc, zfree and opaque in strm must be initialized
861 before the call. If zalloc and zfree are Z_NULL, then the default library-
862 derived memory allocation routines are used. windowBits is the base two
863 logarithm of the window size, in the range 8..15. window is a caller
869 See inflateBack() for the usage of these routines.
872 the paramaters are invalid, Z_MEM_ERROR if the internal state could not
873 be allocated, or Z_VERSION_ERROR if the version of the library does not
874 match the version of the header file.
886 file i/o applications in that it avoids copying between the output and the
887 sliding window by simply making the window itself the output buffer. This
888 function trusts the application to not change the output buffer passed by
889 the output function, at least until inflateBack() returns.
891 inflateBackInit() must be called first to allocate the internal state
892 and to initialize the state with the user-provided window buffer.
895 the allocated state.
899 files and writes out uncompressed files. The utility would decode the
900 header and process the trailer on its own, hence this routine expects
901 only the raw deflate stream to decompress. This is different from the
903 trailer around the deflate stream.
905 inflateBack() uses two subroutines supplied by the caller that are then
907 routines until it reads a complete deflate stream and writes out all of the
908 uncompressed data, or until it encounters an error. The function's
909 parameters and return types are defined above in the in_func and out_func
910 typedefs. inflateBack() will call in(in_desc, &buf) which should return the
914 out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()
917 are permitted to change the contents of the window provided to
918 inflateBackInit(), which is also the buffer that out() uses to write from.
919 The length written by out() will be at most the window size. Any non-zero
922 For convenience, inflateBack() can be provided input on the first call by
930 The in_desc and out_desc parameters of inflateBack() is passed as the
932 descriptors can be optionally used to pass any information that the caller-
936 pass back any unused input that was provided by the last in() call. The
939 error in the deflate stream (in which case strm->msg is set to indicate the
940 nature of the error), or Z_STREAM_ERROR if the stream was not properly
941 initialized. In the case of Z_BUF_ERROR, an input or output error can be
943 an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to
953 inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
969 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
989 The sprintf variant used by gzprintf (zero is best):
990 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
1002 The following utility functions are implemented on top of the
1003 basic stream-oriented functions. To simplify the interface, some
1005 standard memory allocation functions). The source code of these
1012 Compresses the source buffer into the destination buffer. sourceLen is
1013 the byte length of the source buffer. Upon entry, destLen is the total
1014 size of the destination buffer, which must be at least the value returned
1015 by compressBound(sourceLen). Upon exit, destLen is the actual size of the
1017 This function can be used to compress a whole file at once if the
1020 enough memory, Z_BUF_ERROR if there was not enough room in the output
1028 Compresses the source buffer into the destination buffer. The level
1029 parameter has the same meaning as in deflateInit. sourceLen is the byte
1030 length of the source buffer. Upon entry, destLen is the total size of the
1031 destination buffer, which must be at least the value returned by
1032 compressBound(sourceLen). Upon exit, destLen is the actual size of the
1036 memory, Z_BUF_ERROR if there was not enough room in the output buffer,
1037 Z_STREAM_ERROR if the level parameter is invalid.
1042 compressBound() returns an upper bound on the compressed size after
1044 a compress() or compress2() call to allocate the destination buffer.
1050 Decompresses the source buffer into the destination buffer. sourceLen is
1051 the byte length of the source buffer. Upon entry, destLen is the total
1052 size of the destination buffer, which must be large enough to hold the
1053 entire uncompressed data. (The size of the uncompressed data must have
1054 been saved previously by the compressor and transmitted to the decompressor
1055 by some mechanism outside the scope of this compression library.)
1056 Upon exit, destLen is the actual size of the compressed buffer.
1057 This function can be used to decompress a whole file at once if the
1061 enough memory, Z_BUF_ERROR if there was not enough room in the output
1062 buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
1070 Opens a gzip (.gz) file for reading or writing. The mode parameter
1074 as in "wb1R". (See the description of deflateInit2 for more information
1075 about the strategy parameter.)
1078 case gzread will directly read from the file without decompression.
1080 gzopen returns NULL if the file could not be opened or if there was
1081 insufficient memory to allocate the (de)compression state; errno
1082 can be checked to distinguish the two cases (if errno is zero, the
1087 gzdopen() associates a gzFile with the file descriptor fd. File
1089 fileno (in the file has been previously opened with fopen).
1090 The mode parameter is as in gzopen.
1091 The next call of gzclose on the returned gzFile will also close the
1092 file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
1095 the (de)compression state.
1100 Dynamically update the compression level or strategy. See the description
1101 of deflateInit2 for the meaning of these parameters.
1102 gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
1108 Reads the given number of uncompressed bytes from the compressed file.
1109 If the input file was not in gzip format, gzread copies the given number
1110 of bytes into the buffer.
1111 gzread returns the number of uncompressed bytes actually read (0 for
1117 Writes the given number of uncompressed bytes into the compressed file.
1118 gzwrite returns the number of uncompressed bytes actually written
1124 Converts, formats, and writes the args to the compressed file under
1125 control of the format string, as in fprintf. gzprintf returns the number of
1126 uncompressed bytes actually written (0 in case of error). The number of
1127 uncompressed bytes written is limited to 4095. The caller should assure that
1131 zlib was compiled with the insecure functions sprintf() or vsprintf()
1132 because the secure snprintf() or vsnprintf() functions were not available.
1137 Writes the given null-terminated string to the compressed file, excluding
1138 the terminating null character.
1139 gzputs returns the number of characters written, or -1 in case of error.
1144 Reads bytes from the compressed file until len-1 characters are read, or
1146 condition is encountered. The string is then terminated with a null
1153 Writes c, converted to an unsigned char, into the compressed file.
1154 gzputc returns the value that was written, or -1 in case of error.
1159 Reads one byte from the compressed file. gzgetc returns this byte
1165 Push one character back onto the stream to be read again later.
1166 Only one character of push-back is allowed. gzungetc() returns the
1168 character has been pushed but not read yet, or if c is -1. The pushed
1169 character will be discarded if the stream is repositioned with gzseek()
1175 Flushes all pending output into the compressed file. The parameter
1176 flush is as in the deflate() function. The return value is the zlib
1178 the flush parameter is Z_FINISH and all output could be flushed.
1186 Sets the starting position for the next gzread or gzwrite on the
1187 given compressed file. The offset represents a number of bytes in the
1188 uncompressed data stream. The whence parameter is defined as in lseek(2);
1189 the value SEEK_END is not supported.
1190 If the file is opened for reading, this function is emulated but can be
1191 extremely slow. If the file is opened for writing, only forward seeks are
1192 supported; gzseek then compresses a sequence of zeroes up to the new
1195 gzseek returns the resulting offset location as measured in bytes from
1196 the beginning of the uncompressed stream, or -1 in case of error, in
1197 particular if the file is opened for writing and the new starting position
1198 would be before the current position.
1203 Rewinds the given file. This function is supported only for reading.
1210 Returns the starting position for the next gzread or gzwrite on the
1211 given compressed file. This position represents a number of bytes in the
1219 Returns 1 when EOF has previously been detected reading the given
1231 Flushes all pending output if necessary, closes the compressed file
1232 and deallocates all the (de)compression state. The return value is the zlib
1238 Returns the error message for the last error which occurred on the
1240 error occurred in the file system and not in the compression library,
1241 errnum is set to Z_ERRNO and the application may consult errno
1242 to get the exact error code.
1247 Clears the error and end-of-file flags for file. This is analogous to the
1256 anyway because they might be useful in applications using the
1262 Update a running Adler-32 checksum with the bytes buf[0..len-1] and
1263 return the updated checksum. If buf is NULL, this function returns
1264 the required initial value for the checksum.
1282 each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
1288 Update a running CRC-32 with the bytes buf[0..len-1] and return the
1289 updated CRC-32. If buf is NULL, this function returns the required initial
1290 value for the for the crc. Pre- and post-conditioning (one's complement) is
1291 performed within this function so it shouldn't be done by the application.
1305 /* deflateInit and inflateInit are macros to allow checking the zlib version
1306 * and the compiler's view of z_stream:
1340 calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32