• Home
  • Raw
  • Download

Lines Matching +full:zlib +full:- +full:wrapper

1 /* zlib.h -- interface of the 'zlib' general purpose compression library
4 Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
6 This software is provided 'as-is', without any express or implied
22 Jean-loup Gailly Mark Adler
26 The data format used by the zlib library is described by RFCs (Request for
28 (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
48 The 'zlib' compression library provides in-memory compression and
59 The compressed data format used by default by the in-memory functions is
60 the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
65 with "gz". The gzip format is different from the zlib format. gzip is a
66 gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
70 The zlib format was designed to be compact and fast for use in memory
71 and on communications channels. The gzip format was designed for single-
72 file compression on file systems, has a larger header than zlib to maintain
73 directory information, and uses a different, slower check method than zlib.
109 gzip header information passed to and from zlib routines. See RFC 1952
120 Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
122 Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
144 If zlib is used in a multi-threaded application, zalloc and zfree must be
147 On 16-bit systems, the functions zalloc and zfree must be able to allocate
154 the library with -DMAX_WBITS=14 (see zconf.h).
176 #define Z_ERRNO (-1)
177 #define Z_STREAM_ERROR (-2)
178 #define Z_DATA_ERROR (-3)
179 #define Z_MEM_ERROR (-4)
180 #define Z_BUF_ERROR (-5)
181 #define Z_VERSION_ERROR (-6)
189 #define Z_DEFAULT_COMPRESSION (-1)
219 compatible with the zlib.h header file used by the application. This check
239 Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
256 - Compress more input starting at next_in and update next_in and avail_in
261 - Provide more output starting at next_out and update next_out and avail_out
315 avail_out), until the flush is complete (deflate returns with non-zero
333 deflate() sets strm->adler to the adler32 checksum of all input read
336 deflate() may update strm->data_type if it can make a good guess about
373 compression method from the zlib header and allocates all data structures
379 memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
383 apart from possibly reading the zlib header if present: actual decompression
386 of inflateInit() does not process any header information -- that is deferred
401 - Decompress more input starting at next_in and update next_in and avail_in
406 - Provide more output starting at next_out and update next_out and avail_out
424 the zlib or gzip format, this will cause inflate() to return immediately
430 Also to assist in this, on return inflate() will set strm->data_type to the
431 number of unused bits in the last byte taken from strm->next_in, plus 64 if
433 128 if inflate() returned immediately after decoding an end-of-block code or
435 stream. The end-of-block will not be indicated until all of the uncompressed
436 data from that block has been written to strm->next_out. The number of
447 256 is added to the value of strm->data_type when inflate() returns
468 below), inflate sets strm->adler to the adler32 checksum of the dictionary
470 strm->adler to the adler32 checksum of all output produced so far (that is,
476 inflate() can decompress and check either zlib-wrapped or gzip-wrapped
487 corrupted (input stream not conforming to the zlib format or incorrect check
538 windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
540 with no zlib header or trailer, and will not compute an adler32 check value.
544 compressed data instead of a zlib wrapper. The gzip header will have no
547 gzip stream is being written, strm->adler is a crc32 instead of an adler32.
558 string match), or Z_RLE to limit match distances to one (run-length
572 method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is
603 Upon return of this function, strm->adler is set to the adler32 value
608 adler32 value is not computed and strm->adler is not set.
623 tried, for example when there are several ways of pre-processing the input
660 compressed and flushed. In particular, strm->avail_out must be non-zero.
664 strm->avail_out was zero.
674 used by someone who understands the algorithm used by zlib's deflate for
718 ignored -- the extra flags are set according to the compression level). The
722 the current versions of the command-line version of gzip (up through version
723 1.3.x) do not support header crc's, and will report that it is a "multi-part
752 the zlib header of the compressed stream.
754 windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
756 not looking for a zlib or gzip header, not generating a check value, and not
762 the uncompressed data as is done in the zlib, gzip, and zip formats. For
763 most applications, the zlib format should be used as is. Note that comments
767 32 to windowBits to enable zlib and gzip decoding with automatic header
768 detection, or add 16 to decode only the gzip format (the zlib format will
769 return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a
773 memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
777 apart from possibly reading the zlib header if present: actual decompression
780 of inflateInit2() does not process any header information -- that is
884 return value down 16 bits. If the upper value is -1 and the lower value is
886 If the upper value is -1 and the lower value is non-zero, then inflate is in
888 bytes from the input remaining to copy. If the upper value is not -1, then
904 inflateMark returns the value noted above or -1 << 16 if the provided
914 As inflate() processes the gzip stream, head->done is zero until the header
915 is completed, at which time head->done is set to one. If a zlib stream is
916 being decoded, then head->done is set to -1 to indicate that there will be
954 before the call. If zalloc and zfree are Z_NULL, then the default library-
977 inflateBack() does a raw inflate with a single call using a call-back
985 and to initialize the state with the user-provided window buffer.
990 A raw deflate stream is one with no zlib or gzip header or trailer.
995 behavior of inflate(), which expects either a zlib or gzip header and
1005 there is no input available, in() must return zero--buf is ignored in that
1006 case--and inflateBack() will return a buffer error. inflateBack() will call
1007 out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()
1008 should return zero on success, or non-zero on failure. If out() returns
1009 non-zero, inflateBack() will return with an error. Neither in() nor out()
1012 The length written by out() will be at most the window size. Any non-zero
1016 setting strm->next_in and strm->avail_in. If that input is exhausted, then
1017 in() will be called. Therefore strm->next_in must be initialized before
1018 calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called
1019 immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in
1020 must also be initialized, and then if strm->avail_in is not zero, input will
1021 initially be taken from strm->next_in[0 .. strm->avail_in - 1].
1025 descriptors can be optionally used to pass any information that the caller-
1028 On return, inflateBack() will set strm->next_in and strm->avail_in to
1032 in the deflate stream (in which case strm->msg is set to indicate the nature
1035 using strm->next_in which will be Z_NULL only if in() returned an error. If
1036 strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
1037 non-zero. (in() will always be called before out(), so strm->next_in is
1038 assured to be defined if out() returns non-zero.) Note that inflateBack()
1051 /* Return flags indicating compile-time options.
1061 9: ASMV or ASMINF -- use ASM code
1062 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
1065 One-time table building (smaller code, but not thread-safe if true):
1066 12: BUILDFIXED -- build static block decoding tables when needed
1067 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
1071 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
1073 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
1075 18-19: 0 (reserved)
1078 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
1079 21: FASTEST -- deflate algorithm with only one, lowest compression level
1083 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
1084 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
1085 26: 0 = returns value, 1 = void -- 1 means inferred string length returned
1088 27-31: 0 (reserved)
1096 stream-oriented functions. To simplify the interface, some default options
1161 "gz". The gzip format is different from the zlib format. gzip is a gzip
1162 wrapper, documented in RFC 1952, wrapped around a deflate stream.
1172 a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
1173 compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
1204 provided, or '+' was provided), or if fd is -1. The file descriptor is not
1206 will not detect if fd is invalid (unless fd is -1).
1222 gzbuffer() returns 0 on success, or -1 on failure, such as being called
1248 len for end of file, or -1 for error.
1268 unpredictable consequences, which is possible only if zlib was compiled with
1276 Writes the given null-terminated string to the compressed file, excluding
1279 gzputs returns the number of characters written, or -1 in case of error.
1284 Reads bytes from the compressed file until len-1 characters are read, or a
1285 newline character is read and transferred to buf, or an end-of-file
1288 to an end-of-file or len < 1, then the buffer is left untouched.
1290 gzgets returns buf which is a null-terminated string, or it returns NULL
1291 for end-of-file or in case of error. If there was an error, the contents at
1298 returns the value that was written, or -1 in case of error.
1303 Reads one byte from the compressed file. gzgetc returns this byte or -1
1310 on the next read. At least one character of push-back is allowed.
1311 gzungetc() returns the character pushed, or -1 on failure. gzungetc() will
1312 fail if c is -1, and may fail if a character has been pushed but not read
1322 is as in the deflate() function. The return value is the zlib error number
1349 the beginning of the uncompressed stream, or -1 in case of error, in
1379 for a progress indicator. On error, gzoffset() returns -1.
1384 Returns true (1) if the end-of-file indicator has been set while reading,
1385 false (0) otherwise. Note that the end-of-file indicator is set only if the
1393 unless the end-of-file indicator is reset by gzclearerr() and the input file
1430 using these instead of gzclose() is that they avoid linking in zlib
1434 zlib library.
1440 compressed file. errnum is set to zlib error number. If an error occurred
1449 gzerror() should be used to distinguish errors from end-of-file for those
1455 Clears the error and end-of-file flags for file. This is analogous to the
1471 Update a running Adler-32 checksum with the bytes buf[0..len-1] and
1475 An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
1492 Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
1493 and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
1494 each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
1500 Update a running CRC-32 with the bytes buf[0..len-1] and return the
1501 updated CRC-32. If buf is Z_NULL, this function returns the required
1502 initial value for the for the crc. Pre- and post-conditioning (one's
1519 Combine two CRC-32 check values into one. For two sequences of bytes,
1520 seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
1521 calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
1529 /* deflateInit and inflateInit are macros to allow checking the zlib version
1559 /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
1562 * functions are changed to 64 bits) -- in case these are set on systems
1565 #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
1574 #if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0