Extern :
- zlib aggiornamento a versione 1.3.2.
This commit is contained in:
+27
-27
@@ -1,5 +1,5 @@
|
|||||||
/* zconf.h -- configuration of the zlib compression library
|
/* zconf.h -- configuration of the zlib compression library
|
||||||
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
|
* Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -33,7 +33,10 @@
|
|||||||
# ifndef Z_SOLO
|
# ifndef Z_SOLO
|
||||||
# define compress z_compress
|
# define compress z_compress
|
||||||
# define compress2 z_compress2
|
# define compress2 z_compress2
|
||||||
|
# define compress_z z_compress_z
|
||||||
|
# define compress2_z z_compress2_z
|
||||||
# define compressBound z_compressBound
|
# define compressBound z_compressBound
|
||||||
|
# define compressBound_z z_compressBound_z
|
||||||
# endif
|
# endif
|
||||||
# define crc32 z_crc32
|
# define crc32 z_crc32
|
||||||
# define crc32_combine z_crc32_combine
|
# define crc32_combine z_crc32_combine
|
||||||
@@ -44,6 +47,7 @@
|
|||||||
# define crc32_z z_crc32_z
|
# define crc32_z z_crc32_z
|
||||||
# define deflate z_deflate
|
# define deflate z_deflate
|
||||||
# define deflateBound z_deflateBound
|
# define deflateBound z_deflateBound
|
||||||
|
# define deflateBound_z z_deflateBound_z
|
||||||
# define deflateCopy z_deflateCopy
|
# define deflateCopy z_deflateCopy
|
||||||
# define deflateEnd z_deflateEnd
|
# define deflateEnd z_deflateEnd
|
||||||
# define deflateGetDictionary z_deflateGetDictionary
|
# define deflateGetDictionary z_deflateGetDictionary
|
||||||
@@ -59,6 +63,7 @@
|
|||||||
# define deflateSetDictionary z_deflateSetDictionary
|
# define deflateSetDictionary z_deflateSetDictionary
|
||||||
# define deflateSetHeader z_deflateSetHeader
|
# define deflateSetHeader z_deflateSetHeader
|
||||||
# define deflateTune z_deflateTune
|
# define deflateTune z_deflateTune
|
||||||
|
# define deflateUsed z_deflateUsed
|
||||||
# define deflate_copyright z_deflate_copyright
|
# define deflate_copyright z_deflate_copyright
|
||||||
# define get_crc_table z_get_crc_table
|
# define get_crc_table z_get_crc_table
|
||||||
# ifndef Z_SOLO
|
# ifndef Z_SOLO
|
||||||
@@ -128,9 +133,12 @@
|
|||||||
# define inflate_copyright z_inflate_copyright
|
# define inflate_copyright z_inflate_copyright
|
||||||
# define inflate_fast z_inflate_fast
|
# define inflate_fast z_inflate_fast
|
||||||
# define inflate_table z_inflate_table
|
# define inflate_table z_inflate_table
|
||||||
|
# define inflate_fixed z_inflate_fixed
|
||||||
# ifndef Z_SOLO
|
# ifndef Z_SOLO
|
||||||
# define uncompress z_uncompress
|
# define uncompress z_uncompress
|
||||||
# define uncompress2 z_uncompress2
|
# define uncompress2 z_uncompress2
|
||||||
|
# define uncompress_z z_uncompress_z
|
||||||
|
# define uncompress2_z z_uncompress2_z
|
||||||
# endif
|
# endif
|
||||||
# define zError z_zError
|
# define zError z_zError
|
||||||
# ifndef Z_SOLO
|
# ifndef Z_SOLO
|
||||||
@@ -234,10 +242,12 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ZLIB_CONST) && !defined(z_const)
|
#ifndef z_const
|
||||||
# define z_const const
|
# ifdef ZLIB_CONST
|
||||||
#else
|
# define z_const const
|
||||||
# define z_const
|
# else
|
||||||
|
# define z_const
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Z_SOLO
|
#ifdef Z_SOLO
|
||||||
@@ -300,14 +310,6 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Z_ARG /* function prototypes for stdarg */
|
|
||||||
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
|
||||||
# define Z_ARG(args) args
|
|
||||||
# else
|
|
||||||
# define Z_ARG(args) ()
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The following definitions for FAR are needed only for MSDOS mixed
|
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||||
* model programming (small or medium model with some far allocations).
|
* model programming (small or medium model with some far allocations).
|
||||||
* This was tested only with MSC; for other MSDOS compilers you may have
|
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||||
@@ -441,11 +443,11 @@ typedef uLong FAR uLongf;
|
|||||||
typedef unsigned long z_crc_t;
|
typedef unsigned long z_crc_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
|
#if HAVE_UNISTD_H-0 /* may be set to #if 1 by ./configure */
|
||||||
# define Z_HAVE_UNISTD_H
|
# define Z_HAVE_UNISTD_H
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
|
#if HAVE_STDARG_H-0 /* may be set to #if 1 by ./configure */
|
||||||
# define Z_HAVE_STDARG_H
|
# define Z_HAVE_STDARG_H
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -478,12 +480,8 @@ typedef uLong FAR uLongf;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef Z_HAVE_UNISTD_H
|
#ifndef Z_HAVE_UNISTD_H
|
||||||
# ifdef __WATCOMC__
|
# if defined(__WATCOMC__) || defined(__GO32__) || \
|
||||||
# define Z_HAVE_UNISTD_H
|
(defined(_LARGEFILE64_SOURCE) && !defined(_WIN32))
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#ifndef Z_HAVE_UNISTD_H
|
|
||||||
# if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)
|
|
||||||
# define Z_HAVE_UNISTD_H
|
# define Z_HAVE_UNISTD_H
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
@@ -518,17 +516,19 @@ typedef uLong FAR uLongf;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef z_off_t
|
#ifndef z_off_t
|
||||||
# define z_off_t long
|
# define z_off_t long long
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_WIN32) && defined(Z_LARGE64)
|
#if !defined(_WIN32) && defined(Z_LARGE64)
|
||||||
# define z_off64_t off64_t
|
# define z_off64_t off64_t
|
||||||
|
#elif defined(__MINGW32__)
|
||||||
|
# define z_off64_t long long
|
||||||
|
#elif defined(_WIN32) && !defined(__GNUC__)
|
||||||
|
# define z_off64_t __int64
|
||||||
|
#elif defined(__GO32__)
|
||||||
|
# define z_off64_t offset_t
|
||||||
#else
|
#else
|
||||||
# if defined(_WIN32) && !defined(__GNUC__)
|
# define z_off64_t z_off_t
|
||||||
# define z_off64_t __int64
|
|
||||||
# else
|
|
||||||
# define z_off64_t z_off_t
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* MVS linker does not support external names larger than 8 bytes */
|
/* MVS linker does not support external names larger than 8 bytes */
|
||||||
|
|||||||
+217
-98
@@ -1,7 +1,7 @@
|
|||||||
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
||||||
version 1.3, August 18th, 2023
|
version 1.3.2, February 17th, 2026
|
||||||
|
|
||||||
Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler
|
Copyright (C) 1995-2026 Jean-loup Gailly and Mark Adler
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -24,24 +24,28 @@
|
|||||||
|
|
||||||
|
|
||||||
The data format used by the zlib library is described by RFCs (Request for
|
The data format used by the zlib library is described by RFCs (Request for
|
||||||
Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
|
Comments) 1950 to 1952 at https://datatracker.ietf.org/doc/html/rfc1950
|
||||||
(zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
|
(zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ZLIB_H
|
#ifndef ZLIB_H
|
||||||
#define ZLIB_H
|
#define ZLIB_H
|
||||||
|
|
||||||
#include "/EgtDev/Extern/Zlib/Include/zconf.h"
|
#ifdef ZLIB_BUILD
|
||||||
|
# include <zconf.h>
|
||||||
|
#else
|
||||||
|
# include "zconf.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ZLIB_VERSION "1.3"
|
#define ZLIB_VERSION "1.3.2"
|
||||||
#define ZLIB_VERNUM 0x1300
|
#define ZLIB_VERNUM 0x1320
|
||||||
#define ZLIB_VER_MAJOR 1
|
#define ZLIB_VER_MAJOR 1
|
||||||
#define ZLIB_VER_MINOR 3
|
#define ZLIB_VER_MINOR 3
|
||||||
#define ZLIB_VER_REVISION 0
|
#define ZLIB_VER_REVISION 2
|
||||||
#define ZLIB_VER_SUBREVISION 0
|
#define ZLIB_VER_SUBREVISION 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -441,7 +445,7 @@ ZEXTERN int ZEXPORT inflate(z_streamp strm, int flush);
|
|||||||
|
|
||||||
The Z_BLOCK option assists in appending to or combining deflate streams.
|
The Z_BLOCK option assists in appending to or combining deflate streams.
|
||||||
To assist in this, on return inflate() always sets strm->data_type to the
|
To assist in this, on return inflate() always sets strm->data_type to the
|
||||||
number of unused bits in the last byte taken from strm->next_in, plus 64 if
|
number of unused bits in the input taken from strm->next_in, plus 64 if
|
||||||
inflate() is currently decoding the last block in the deflate stream, plus
|
inflate() is currently decoding the last block in the deflate stream, plus
|
||||||
128 if inflate() returned immediately after decoding an end-of-block code or
|
128 if inflate() returned immediately after decoding an end-of-block code or
|
||||||
decoding the complete header up to just before the first byte of the deflate
|
decoding the complete header up to just before the first byte of the deflate
|
||||||
@@ -587,18 +591,21 @@ ZEXTERN int ZEXPORT deflateInit2(z_streamp strm,
|
|||||||
|
|
||||||
The strategy parameter is used to tune the compression algorithm. Use the
|
The strategy parameter is used to tune the compression algorithm. Use the
|
||||||
value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
|
value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
|
||||||
filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
|
filter (or predictor), Z_RLE to limit match distances to one (run-length
|
||||||
string match), or Z_RLE to limit match distances to one (run-length
|
encoding), or Z_HUFFMAN_ONLY to force Huffman encoding only (no string
|
||||||
encoding). Filtered data consists mostly of small values with a somewhat
|
matching). Filtered data consists mostly of small values with a somewhat
|
||||||
random distribution. In this case, the compression algorithm is tuned to
|
random distribution, as produced by the PNG filters. In this case, the
|
||||||
compress them better. The effect of Z_FILTERED is to force more Huffman
|
compression algorithm is tuned to compress them better. The effect of
|
||||||
coding and less string matching; it is somewhat intermediate between
|
Z_FILTERED is to force more Huffman coding and less string matching than the
|
||||||
Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as
|
default; it is intermediate between Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY.
|
||||||
fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The
|
Z_RLE is almost as fast as Z_HUFFMAN_ONLY, but should give better
|
||||||
strategy parameter only affects the compression ratio but not the
|
compression for PNG image data than Huffman only. The degree of string
|
||||||
correctness of the compressed output even if it is not set appropriately.
|
matching from most to none is: Z_DEFAULT_STRATEGY, Z_FILTERED, Z_RLE, then
|
||||||
Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler
|
Z_HUFFMAN_ONLY. The strategy parameter affects the compression ratio but
|
||||||
decoder for special applications.
|
never the correctness of the compressed output, even if it is not set
|
||||||
|
optimally for the given data. Z_FIXED uses the default string matching, but
|
||||||
|
prevents the use of dynamic Huffman codes, allowing for a simpler decoder
|
||||||
|
for special applications.
|
||||||
|
|
||||||
deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
||||||
memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
|
memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
|
||||||
@@ -758,8 +765,8 @@ ZEXTERN int ZEXPORT deflateTune(z_streamp strm,
|
|||||||
returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
|
returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm,
|
ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen);
|
||||||
uLong sourceLen);
|
ZEXTERN z_size_t ZEXPORT deflateBound_z(z_streamp strm, z_size_t sourceLen);
|
||||||
/*
|
/*
|
||||||
deflateBound() returns an upper bound on the compressed size after
|
deflateBound() returns an upper bound on the compressed size after
|
||||||
deflation of sourceLen bytes. It must be called after deflateInit() or
|
deflation of sourceLen bytes. It must be called after deflateInit() or
|
||||||
@@ -771,6 +778,9 @@ ZEXTERN uLong ZEXPORT deflateBound(z_streamp strm,
|
|||||||
to return Z_STREAM_END. Note that it is possible for the compressed size to
|
to return Z_STREAM_END. Note that it is possible for the compressed size to
|
||||||
be larger than the value returned by deflateBound() if flush options other
|
be larger than the value returned by deflateBound() if flush options other
|
||||||
than Z_FINISH or Z_NO_FLUSH are used.
|
than Z_FINISH or Z_NO_FLUSH are used.
|
||||||
|
|
||||||
|
delfateBound_z() is the same, but takes and returns a size_t length. Note
|
||||||
|
that a long is 32 bits on Windows.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT deflatePending(z_streamp strm,
|
ZEXTERN int ZEXPORT deflatePending(z_streamp strm,
|
||||||
@@ -785,6 +795,21 @@ ZEXTERN int ZEXPORT deflatePending(z_streamp strm,
|
|||||||
or bits are Z_NULL, then those values are not set.
|
or bits are Z_NULL, then those values are not set.
|
||||||
|
|
||||||
deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
|
deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||||
|
stream state was inconsistent. If an int is 16 bits and memLevel is 9, then
|
||||||
|
it is possible for the number of pending bytes to not fit in an unsigned. In
|
||||||
|
that case Z_BUF_ERROR is returned and *pending is set to the maximum value
|
||||||
|
of an unsigned.
|
||||||
|
*/
|
||||||
|
|
||||||
|
ZEXTERN int ZEXPORT deflateUsed(z_streamp strm,
|
||||||
|
int *bits);
|
||||||
|
/*
|
||||||
|
deflateUsed() returns in *bits the most recent number of deflate bits used
|
||||||
|
in the last byte when flushing to a byte boundary. The result is in 1..8, or
|
||||||
|
0 if there has not yet been a flush. This helps determine the location of
|
||||||
|
the last bit of a deflate stream.
|
||||||
|
|
||||||
|
deflateUsed returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||||
stream state was inconsistent.
|
stream state was inconsistent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -936,10 +961,10 @@ ZEXTERN int ZEXPORT inflateSync(z_streamp strm);
|
|||||||
inflateSync returns Z_OK if a possible full flush point has been found,
|
inflateSync returns Z_OK if a possible full flush point has been found,
|
||||||
Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
|
Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
|
||||||
has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
|
has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
|
||||||
In the success case, the application may save the current current value of
|
In the success case, the application may save the current value of total_in
|
||||||
total_in which indicates where valid compressed data was found. In the
|
which indicates where valid compressed data was found. In the error case,
|
||||||
error case, the application may repeatedly call inflateSync, providing more
|
the application may repeatedly call inflateSync, providing more input each
|
||||||
input each time, until success or end of the input data.
|
time, until success or end of the input data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT inflateCopy(z_streamp dest,
|
ZEXTERN int ZEXPORT inflateCopy(z_streamp dest,
|
||||||
@@ -987,13 +1012,15 @@ ZEXTERN int ZEXPORT inflatePrime(z_streamp strm,
|
|||||||
int bits,
|
int bits,
|
||||||
int value);
|
int value);
|
||||||
/*
|
/*
|
||||||
This function inserts bits in the inflate input stream. The intent is
|
This function inserts bits in the inflate input stream. The intent is to
|
||||||
that this function is used to start inflating at a bit position in the
|
use inflatePrime() to start inflating at a bit position in the middle of a
|
||||||
middle of a byte. The provided bits will be used before any bytes are used
|
byte. The provided bits will be used before any bytes are used from
|
||||||
from next_in. This function should only be used with raw inflate, and
|
next_in. This function should be used with raw inflate, before the first
|
||||||
should be used before the first inflate() call after inflateInit2() or
|
inflate() call, after inflateInit2() or inflateReset(). It can also be used
|
||||||
inflateReset(). bits must be less than or equal to 16, and that many of the
|
after an inflate() return indicates the end of a deflate block or header
|
||||||
least significant bits of value will be inserted in the input.
|
when using Z_BLOCK. bits must be less than or equal to 16, and that many of
|
||||||
|
the least significant bits of value will be inserted in the input. The
|
||||||
|
other bits in value can be non-zero, and will be ignored.
|
||||||
|
|
||||||
If bits is negative, then the input stream bit buffer is emptied. Then
|
If bits is negative, then the input stream bit buffer is emptied. Then
|
||||||
inflatePrime() can be called again to put bits in the buffer. This is used
|
inflatePrime() can be called again to put bits in the buffer. This is used
|
||||||
@@ -1001,7 +1028,15 @@ ZEXTERN int ZEXPORT inflatePrime(z_streamp strm,
|
|||||||
to feeding inflate codes.
|
to feeding inflate codes.
|
||||||
|
|
||||||
inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
|
inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
|
||||||
stream state was inconsistent.
|
stream state was inconsistent, or if bits is out of range. If inflate was
|
||||||
|
in the middle of processing a header, trailer, or stored block lengths, then
|
||||||
|
it is possible for there to be only eight bits available in the bit buffer.
|
||||||
|
In that case, bits > 8 is considered out of range. However, when used as
|
||||||
|
outlined above, there will always be 16 bits available in the buffer for
|
||||||
|
insertion. As noted in its documentation above, inflate records the number
|
||||||
|
of bits in the bit buffer on return in data_type. 32 minus that is the
|
||||||
|
number of bits available for insertion. inflatePrime does not update
|
||||||
|
data_type with the new number of bits in buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN long ZEXPORT inflateMark(z_streamp strm);
|
ZEXTERN long ZEXPORT inflateMark(z_streamp strm);
|
||||||
@@ -1047,20 +1082,22 @@ ZEXTERN int ZEXPORT inflateGetHeader(z_streamp strm,
|
|||||||
|
|
||||||
The text, time, xflags, and os fields are filled in with the gzip header
|
The text, time, xflags, and os fields are filled in with the gzip header
|
||||||
contents. hcrc is set to true if there is a header CRC. (The header CRC
|
contents. hcrc is set to true if there is a header CRC. (The header CRC
|
||||||
was valid if done is set to one.) If extra is not Z_NULL, then extra_max
|
was valid if done is set to one.) The extra, name, and comment pointers
|
||||||
contains the maximum number of bytes to write to extra. Once done is true,
|
much each be either Z_NULL or point to space to store that information from
|
||||||
extra_len contains the actual extra field length, and extra contains the
|
the header. If extra is not Z_NULL, then extra_max contains the maximum
|
||||||
extra field, or that field truncated if extra_max is less than extra_len.
|
number of bytes that can be written to extra. Once done is true, extra_len
|
||||||
If name is not Z_NULL, then up to name_max characters are written there,
|
contains the actual extra field length, and extra contains the extra field,
|
||||||
terminated with a zero unless the length is greater than name_max. If
|
or that field truncated if extra_max is less than extra_len. If name is not
|
||||||
comment is not Z_NULL, then up to comm_max characters are written there,
|
Z_NULL, then up to name_max characters, including the terminating zero, are
|
||||||
terminated with a zero unless the length is greater than comm_max. When any
|
written there. If comment is not Z_NULL, then up to comm_max characters,
|
||||||
of extra, name, or comment are not Z_NULL and the respective field is not
|
including the terminating zero, are written there. The application can tell
|
||||||
present in the header, then that field is set to Z_NULL to signal its
|
that the name or comment did not fit in the provided space by the absence of
|
||||||
absence. This allows the use of deflateSetHeader() with the returned
|
a terminating zero. If any of extra, name, or comment are not present in
|
||||||
structure to duplicate the header. However if those fields are set to
|
the header, then that field's pointer is set to Z_NULL. This allows the use
|
||||||
allocated memory, then the application will need to save those pointers
|
of deflateSetHeader() with the returned structure to duplicate the header.
|
||||||
elsewhere so that they can be eventually freed.
|
Note that if those fields initially pointed to allocated memory, then the
|
||||||
|
application will need to save them elsewhere so that they can be eventually
|
||||||
|
freed.
|
||||||
|
|
||||||
If inflateGetHeader is not used, then the header information is simply
|
If inflateGetHeader is not used, then the header information is simply
|
||||||
discarded. The header is always checked for validity, including the header
|
discarded. The header is always checked for validity, including the header
|
||||||
@@ -1208,13 +1245,14 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags(void);
|
|||||||
21: FASTEST -- deflate algorithm with only one, lowest compression level
|
21: FASTEST -- deflate algorithm with only one, lowest compression level
|
||||||
22,23: 0 (reserved)
|
22,23: 0 (reserved)
|
||||||
|
|
||||||
The sprintf variant used by gzprintf (zero is best):
|
The sprintf variant used by gzprintf (all zeros is best):
|
||||||
24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
|
24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
|
||||||
25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
|
25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() is not secure!
|
||||||
26: 0 = returns value, 1 = void -- 1 means inferred string length returned
|
26: 0 = returns value, 1 = void -- 1 means inferred string length returned
|
||||||
|
27: 0 = gzprintf() present, 1 = not -- 1 means gzprintf() returns an error
|
||||||
|
|
||||||
Remainder:
|
Remainder:
|
||||||
27-31: 0 (reserved)
|
28-31: 0 (reserved)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef Z_SOLO
|
#ifndef Z_SOLO
|
||||||
@@ -1226,11 +1264,14 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags(void);
|
|||||||
stream-oriented functions. To simplify the interface, some default options
|
stream-oriented functions. To simplify the interface, some default options
|
||||||
are assumed (compression level and memory usage, standard memory allocation
|
are assumed (compression level and memory usage, standard memory allocation
|
||||||
functions). The source code of these utility functions can be modified if
|
functions). The source code of these utility functions can be modified if
|
||||||
you need special options.
|
you need special options. The _z versions of the functions use the size_t
|
||||||
|
type for lengths. Note that a long is 32 bits on Windows.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen,
|
ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen,
|
||||||
const Bytef *source, uLong sourceLen);
|
const Bytef *source, uLong sourceLen);
|
||||||
|
ZEXTERN int ZEXPORT compress_z(Bytef *dest, z_size_t *destLen,
|
||||||
|
const Bytef *source, z_size_t sourceLen);
|
||||||
/*
|
/*
|
||||||
Compresses the source buffer into the destination buffer. sourceLen is
|
Compresses the source buffer into the destination buffer. sourceLen is
|
||||||
the byte length of the source buffer. Upon entry, destLen is the total size
|
the byte length of the source buffer. Upon entry, destLen is the total size
|
||||||
@@ -1244,9 +1285,12 @@ ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen,
|
|||||||
buffer.
|
buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen,
|
ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen,
|
||||||
const Bytef *source, uLong sourceLen,
|
const Bytef *source, uLong sourceLen,
|
||||||
int level);
|
int level);
|
||||||
|
ZEXTERN int ZEXPORT compress2_z(Bytef *dest, z_size_t *destLen,
|
||||||
|
const Bytef *source, z_size_t sourceLen,
|
||||||
|
int level);
|
||||||
/*
|
/*
|
||||||
Compresses the source buffer into the destination buffer. The level
|
Compresses the source buffer into the destination buffer. The level
|
||||||
parameter has the same meaning as in deflateInit. sourceLen is the byte
|
parameter has the same meaning as in deflateInit. sourceLen is the byte
|
||||||
@@ -1261,21 +1305,24 @@ ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT compressBound(uLong sourceLen);
|
ZEXTERN uLong ZEXPORT compressBound(uLong sourceLen);
|
||||||
|
ZEXTERN z_size_t ZEXPORT compressBound_z(z_size_t sourceLen);
|
||||||
/*
|
/*
|
||||||
compressBound() returns an upper bound on the compressed size after
|
compressBound() returns an upper bound on the compressed size after
|
||||||
compress() or compress2() on sourceLen bytes. It would be used before a
|
compress() or compress2() on sourceLen bytes. It would be used before a
|
||||||
compress() or compress2() call to allocate the destination buffer.
|
compress() or compress2() call to allocate the destination buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen,
|
ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen,
|
||||||
const Bytef *source, uLong sourceLen);
|
const Bytef *source, uLong sourceLen);
|
||||||
|
ZEXTERN int ZEXPORT uncompress_z(Bytef *dest, z_size_t *destLen,
|
||||||
|
const Bytef *source, z_size_t sourceLen);
|
||||||
/*
|
/*
|
||||||
Decompresses the source buffer into the destination buffer. sourceLen is
|
Decompresses the source buffer into the destination buffer. sourceLen is
|
||||||
the byte length of the source buffer. Upon entry, destLen is the total size
|
the byte length of the source buffer. On entry, *destLen is the total size
|
||||||
of the destination buffer, which must be large enough to hold the entire
|
of the destination buffer, which must be large enough to hold the entire
|
||||||
uncompressed data. (The size of the uncompressed data must have been saved
|
uncompressed data. (The size of the uncompressed data must have been saved
|
||||||
previously by the compressor and transmitted to the decompressor by some
|
previously by the compressor and transmitted to the decompressor by some
|
||||||
mechanism outside the scope of this compression library.) Upon exit, destLen
|
mechanism outside the scope of this compression library.) On exit, *destLen
|
||||||
is the actual size of the uncompressed data.
|
is the actual size of the uncompressed data.
|
||||||
|
|
||||||
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
|
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
|
||||||
@@ -1285,8 +1332,10 @@ ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen,
|
|||||||
buffer with the uncompressed data up to that point.
|
buffer with the uncompressed data up to that point.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen,
|
ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen,
|
||||||
const Bytef *source, uLong *sourceLen);
|
const Bytef *source, uLong *sourceLen);
|
||||||
|
ZEXTERN int ZEXPORT uncompress2_z(Bytef *dest, z_size_t *destLen,
|
||||||
|
const Bytef *source, z_size_t *sourceLen);
|
||||||
/*
|
/*
|
||||||
Same as uncompress, except that sourceLen is a pointer, where the
|
Same as uncompress, except that sourceLen is a pointer, where the
|
||||||
length of the source is *sourceLen. On return, *sourceLen is the number of
|
length of the source is *sourceLen. On return, *sourceLen is the number of
|
||||||
@@ -1314,13 +1363,17 @@ ZEXTERN gzFile ZEXPORT gzopen(const char *path, const char *mode);
|
|||||||
'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression
|
'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression
|
||||||
as in "wb9F". (See the description of deflateInit2 for more information
|
as in "wb9F". (See the description of deflateInit2 for more information
|
||||||
about the strategy parameter.) 'T' will request transparent writing or
|
about the strategy parameter.) 'T' will request transparent writing or
|
||||||
appending with no compression and not using the gzip format.
|
appending with no compression and not using the gzip format. 'T' cannot be
|
||||||
|
used to force transparent reading. Transparent reading is automatically
|
||||||
|
performed if there is no gzip header at the start. Transparent reading can
|
||||||
|
be disabled with the 'G' option, which will instead return an error if there
|
||||||
|
is no gzip header. 'N' will open the file in non-blocking mode.
|
||||||
|
|
||||||
"a" can be used instead of "w" to request that the gzip stream that will
|
'a' can be used instead of 'w' to request that the gzip stream that will
|
||||||
be written be appended to the file. "+" will result in an error, since
|
be written be appended to the file. '+' will result in an error, since
|
||||||
reading and writing to the same gzip file is not supported. The addition of
|
reading and writing to the same gzip file is not supported. The addition of
|
||||||
"x" when writing will create the file exclusively, which fails if the file
|
'x' when writing will create the file exclusively, which fails if the file
|
||||||
already exists. On systems that support it, the addition of "e" when
|
already exists. On systems that support it, the addition of 'e' when
|
||||||
reading or writing will set the flag to close the file on an execve() call.
|
reading or writing will set the flag to close the file on an execve() call.
|
||||||
|
|
||||||
These functions, as well as gzip, will read and decode a sequence of gzip
|
These functions, as well as gzip, will read and decode a sequence of gzip
|
||||||
@@ -1339,14 +1392,22 @@ ZEXTERN gzFile ZEXPORT gzopen(const char *path, const char *mode);
|
|||||||
insufficient memory to allocate the gzFile state, or if an invalid mode was
|
insufficient memory to allocate the gzFile state, or if an invalid mode was
|
||||||
specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
|
specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
|
||||||
errno can be checked to determine if the reason gzopen failed was that the
|
errno can be checked to determine if the reason gzopen failed was that the
|
||||||
file could not be opened.
|
file could not be opened. Note that if 'N' is in mode for non-blocking, the
|
||||||
|
open() itself can fail in order to not block. In that case gzopen() will
|
||||||
|
return NULL and errno will be EAGAIN or ENONBLOCK. The call to gzopen() can
|
||||||
|
then be re-tried. If the application would like to block on opening the
|
||||||
|
file, then it can use open() without O_NONBLOCK, and then gzdopen() with the
|
||||||
|
resulting file descriptor and 'N' in the mode, which will set it to non-
|
||||||
|
blocking.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN gzFile ZEXPORT gzdopen(int fd, const char *mode);
|
ZEXTERN gzFile ZEXPORT gzdopen(int fd, const char *mode);
|
||||||
/*
|
/*
|
||||||
Associate a gzFile with the file descriptor fd. File descriptors are
|
Associate a gzFile with the file descriptor fd. File descriptors are
|
||||||
obtained from calls like open, dup, creat, pipe or fileno (if the file has
|
obtained from calls like open, dup, creat, pipe or fileno (if the file has
|
||||||
been previously opened with fopen). The mode parameter is as in gzopen.
|
been previously opened with fopen). The mode parameter is as in gzopen. An
|
||||||
|
'e' in mode will set fd's flag to close the file on an execve() call. An 'N'
|
||||||
|
in mode will set fd's non-blocking flag.
|
||||||
|
|
||||||
The next call of gzclose on the returned gzFile will also close the file
|
The next call of gzclose on the returned gzFile will also close the file
|
||||||
descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
|
descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
|
||||||
@@ -1416,10 +1477,16 @@ ZEXTERN int ZEXPORT gzread(gzFile file, voidp buf, unsigned len);
|
|||||||
stream. Alternatively, gzerror can be used before gzclose to detect this
|
stream. Alternatively, gzerror can be used before gzclose to detect this
|
||||||
case.
|
case.
|
||||||
|
|
||||||
|
gzread can be used to read a gzip file on a non-blocking device. If the
|
||||||
|
input stalls and there is no uncompressed data to return, then gzread() will
|
||||||
|
return -1, and errno will be EAGAIN or EWOULDBLOCK. gzread() can then be
|
||||||
|
called again.
|
||||||
|
|
||||||
gzread returns the number of uncompressed bytes actually read, less than
|
gzread returns the number of uncompressed bytes actually read, less than
|
||||||
len for end of file, or -1 for error. If len is too large to fit in an int,
|
len for end of file, or -1 for error. If len is too large to fit in an int,
|
||||||
then nothing is read, -1 is returned, and the error state is set to
|
then nothing is read, -1 is returned, and the error state is set to
|
||||||
Z_STREAM_ERROR.
|
Z_STREAM_ERROR. If some data was read before an error, then that data is
|
||||||
|
returned until exhausted, after which the next call will signal the error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems,
|
ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems,
|
||||||
@@ -1443,15 +1510,20 @@ ZEXTERN z_size_t ZEXPORT gzfread(voidp buf, z_size_t size, z_size_t nitems,
|
|||||||
multiple of size, then the final partial item is nevertheless read into buf
|
multiple of size, then the final partial item is nevertheless read into buf
|
||||||
and the end-of-file flag is set. The length of the partial item read is not
|
and the end-of-file flag is set. The length of the partial item read is not
|
||||||
provided, but could be inferred from the result of gztell(). This behavior
|
provided, but could be inferred from the result of gztell(). This behavior
|
||||||
is the same as the behavior of fread() implementations in common libraries,
|
is the same as that of fread() implementations in common libraries. This
|
||||||
but it prevents the direct use of gzfread() to read a concurrently written
|
could result in data loss if used with size != 1 when reading a concurrently
|
||||||
file, resetting and retrying on end-of-file, when size is not 1.
|
written file or a non-blocking file. In that case, use size == 1 or gzread()
|
||||||
|
instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len);
|
ZEXTERN int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len);
|
||||||
/*
|
/*
|
||||||
Compress and write the len uncompressed bytes at buf to file. gzwrite
|
Compress and write the len uncompressed bytes at buf to file. gzwrite
|
||||||
returns the number of uncompressed bytes written or 0 in case of error.
|
returns the number of uncompressed bytes written, or 0 in case of error or
|
||||||
|
if len is 0. If the write destination is non-blocking, then gzwrite() may
|
||||||
|
return a number of bytes written that is not 0 and less than len.
|
||||||
|
|
||||||
|
If len does not fit in an int, then 0 is returned and nothing is written.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size,
|
ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size,
|
||||||
@@ -1466,9 +1538,18 @@ ZEXTERN z_size_t ZEXPORT gzfwrite(voidpc buf, z_size_t size,
|
|||||||
if there was an error. If the multiplication of size and nitems overflows,
|
if there was an error. If the multiplication of size and nitems overflows,
|
||||||
i.e. the product does not fit in a z_size_t, then nothing is written, zero
|
i.e. the product does not fit in a z_size_t, then nothing is written, zero
|
||||||
is returned, and the error state is set to Z_STREAM_ERROR.
|
is returned, and the error state is set to Z_STREAM_ERROR.
|
||||||
|
|
||||||
|
If writing a concurrently read file or a non-blocking file with size != 1,
|
||||||
|
a partial item could be written, with no way of knowing how much of it was
|
||||||
|
not written, resulting in data loss. In that case, use size == 1 or
|
||||||
|
gzwrite() instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||||
ZEXTERN int ZEXPORTVA gzprintf(gzFile file, const char *format, ...);
|
ZEXTERN int ZEXPORTVA gzprintf(gzFile file, const char *format, ...);
|
||||||
|
#else
|
||||||
|
ZEXTERN int ZEXPORTVA gzprintf();
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
Convert, format, compress, and write the arguments (...) to file under
|
Convert, format, compress, and write the arguments (...) to file under
|
||||||
control of the string format, as in fprintf. gzprintf returns the number of
|
control of the string format, as in fprintf. gzprintf returns the number of
|
||||||
@@ -1476,11 +1557,19 @@ ZEXTERN int ZEXPORTVA gzprintf(gzFile file, const char *format, ...);
|
|||||||
of error. The number of uncompressed bytes written is limited to 8191, or
|
of error. The number of uncompressed bytes written is limited to 8191, or
|
||||||
one less than the buffer size given to gzbuffer(). The caller should assure
|
one less than the buffer size given to gzbuffer(). The caller should assure
|
||||||
that this limit is not exceeded. If it is exceeded, then gzprintf() will
|
that this limit is not exceeded. If it is exceeded, then gzprintf() will
|
||||||
return an error (0) with nothing written. In this case, there may also be a
|
return an error (0) with nothing written.
|
||||||
buffer overflow with unpredictable consequences, which is possible only if
|
|
||||||
zlib was compiled with the insecure functions sprintf() or vsprintf(),
|
In that last case, there may also be a buffer overflow with unpredictable
|
||||||
because the secure snprintf() or vsnprintf() functions were not available.
|
consequences, which is possible only if zlib was compiled with the insecure
|
||||||
This can be determined using zlibCompileFlags().
|
functions sprintf() or vsprintf(), because the secure snprintf() and
|
||||||
|
vsnprintf() functions were not available. That would only be the case for
|
||||||
|
a non-ANSI C compiler. zlib may have been built without gzprintf() because
|
||||||
|
secure functions were not available and having gzprintf() be insecure was
|
||||||
|
not an option, in which case, gzprintf() returns Z_STREAM_ERROR. All of
|
||||||
|
these possibilities can be determined using zlibCompileFlags().
|
||||||
|
|
||||||
|
If a Z_BUF_ERROR is returned, then nothing was written due to a stall on
|
||||||
|
the non-blocking write destination.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s);
|
ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s);
|
||||||
@@ -1489,6 +1578,11 @@ ZEXTERN int ZEXPORT gzputs(gzFile file, const char *s);
|
|||||||
the terminating null character.
|
the terminating null character.
|
||||||
|
|
||||||
gzputs returns the number of characters written, or -1 in case of error.
|
gzputs returns the number of characters written, or -1 in case of error.
|
||||||
|
The number of characters written may be less than the length of the string
|
||||||
|
if the write destination is non-blocking.
|
||||||
|
|
||||||
|
If the length of the string does not fit in an int, then -1 is returned
|
||||||
|
and nothing is written.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len);
|
ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len);
|
||||||
@@ -1501,8 +1595,13 @@ ZEXTERN char * ZEXPORT gzgets(gzFile file, char *buf, int len);
|
|||||||
left untouched.
|
left untouched.
|
||||||
|
|
||||||
gzgets returns buf which is a null-terminated string, or it returns NULL
|
gzgets returns buf which is a null-terminated string, or it returns NULL
|
||||||
for end-of-file or in case of error. If there was an error, the contents at
|
for end-of-file or in case of error. If some data was read before an error,
|
||||||
buf are indeterminate.
|
then that data is returned until exhausted, after which the next call will
|
||||||
|
return NULL to signal the error.
|
||||||
|
|
||||||
|
gzgets can be used on a file being concurrently written, and on a non-
|
||||||
|
blocking device, both as for gzread(). However lines may be broken in the
|
||||||
|
middle, leaving it up to the application to reassemble them as needed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzputc(gzFile file, int c);
|
ZEXTERN int ZEXPORT gzputc(gzFile file, int c);
|
||||||
@@ -1513,11 +1612,19 @@ ZEXTERN int ZEXPORT gzputc(gzFile file, int c);
|
|||||||
|
|
||||||
ZEXTERN int ZEXPORT gzgetc(gzFile file);
|
ZEXTERN int ZEXPORT gzgetc(gzFile file);
|
||||||
/*
|
/*
|
||||||
Read and decompress one byte from file. gzgetc returns this byte or -1
|
Read and decompress one byte from file. gzgetc returns this byte or -1 in
|
||||||
in case of end of file or error. This is implemented as a macro for speed.
|
case of end of file or error. If some data was read before an error, then
|
||||||
As such, it does not do all of the checking the other functions do. I.e.
|
that data is returned until exhausted, after which the next call will return
|
||||||
it does not check to see if file is NULL, nor whether the structure file
|
-1 to signal the error.
|
||||||
points to has been clobbered or not.
|
|
||||||
|
This is implemented as a macro for speed. As such, it does not do all of
|
||||||
|
the checking the other functions do. I.e. it does not check to see if file
|
||||||
|
is NULL, nor whether the structure file points to has been clobbered or not.
|
||||||
|
|
||||||
|
gzgetc can be used to read a gzip file on a non-blocking device. If the
|
||||||
|
input stalls and there is no uncompressed data to return, then gzgetc() will
|
||||||
|
return -1, and errno will be EAGAIN or EWOULDBLOCK. gzread() can then be
|
||||||
|
called again.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzungetc(int c, gzFile file);
|
ZEXTERN int ZEXPORT gzungetc(int c, gzFile file);
|
||||||
@@ -1530,6 +1637,11 @@ ZEXTERN int ZEXPORT gzungetc(int c, gzFile file);
|
|||||||
output buffer size of pushed characters is allowed. (See gzbuffer above.)
|
output buffer size of pushed characters is allowed. (See gzbuffer above.)
|
||||||
The pushed character will be discarded if the stream is repositioned with
|
The pushed character will be discarded if the stream is repositioned with
|
||||||
gzseek() or gzrewind().
|
gzseek() or gzrewind().
|
||||||
|
|
||||||
|
gzungetc(-1, file) will force any pending seek to execute. Then gztell()
|
||||||
|
will report the position, even if the requested seek reached end of file.
|
||||||
|
This can be used to determine the number of uncompressed bytes in a gzip
|
||||||
|
file without having to read it into a buffer.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzflush(gzFile file, int flush);
|
ZEXTERN int ZEXPORT gzflush(gzFile file, int flush);
|
||||||
@@ -1559,7 +1671,8 @@ ZEXTERN z_off_t ZEXPORT gzseek(gzFile file,
|
|||||||
If the file is opened for reading, this function is emulated but can be
|
If the file is opened for reading, this function is emulated but can be
|
||||||
extremely slow. If the file is opened for writing, only forward seeks are
|
extremely slow. If the file is opened for writing, only forward seeks are
|
||||||
supported; gzseek then compresses a sequence of zeroes up to the new
|
supported; gzseek then compresses a sequence of zeroes up to the new
|
||||||
starting position.
|
starting position. For reading or writing, any actual seeking is deferred
|
||||||
|
until the next read or write operation, or close operation when writing.
|
||||||
|
|
||||||
gzseek returns the resulting offset location as measured in bytes from
|
gzseek returns the resulting offset location as measured in bytes from
|
||||||
the beginning of the uncompressed stream, or -1 in case of error, in
|
the beginning of the uncompressed stream, or -1 in case of error, in
|
||||||
@@ -1567,7 +1680,7 @@ ZEXTERN z_off_t ZEXPORT gzseek(gzFile file,
|
|||||||
would be before the current position.
|
would be before the current position.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzrewind(gzFile file);
|
ZEXTERN int ZEXPORT gzrewind(gzFile file);
|
||||||
/*
|
/*
|
||||||
Rewind file. This function is supported only for reading.
|
Rewind file. This function is supported only for reading.
|
||||||
|
|
||||||
@@ -1575,7 +1688,7 @@ ZEXTERN int ZEXPORT gzrewind(gzFile file);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN z_off_t ZEXPORT gztell(gzFile file);
|
ZEXTERN z_off_t ZEXPORT gztell(gzFile file);
|
||||||
|
|
||||||
Return the starting position for the next gzread or gzwrite on file.
|
Return the starting position for the next gzread or gzwrite on file.
|
||||||
This position represents a number of bytes in the uncompressed data stream,
|
This position represents a number of bytes in the uncompressed data stream,
|
||||||
@@ -1620,8 +1733,11 @@ ZEXTERN int ZEXPORT gzdirect(gzFile file);
|
|||||||
|
|
||||||
If gzdirect() is used immediately after gzopen() or gzdopen() it will
|
If gzdirect() is used immediately after gzopen() or gzdopen() it will
|
||||||
cause buffers to be allocated to allow reading the file to determine if it
|
cause buffers to be allocated to allow reading the file to determine if it
|
||||||
is a gzip file. Therefore if gzbuffer() is used, it should be called before
|
is a gzip file. Therefore if gzbuffer() is used, it should be called before
|
||||||
gzdirect().
|
gzdirect(). If the input is being written concurrently or the device is non-
|
||||||
|
blocking, then gzdirect() may give a different answer once four bytes of
|
||||||
|
input have been accumulated, which is what is needed to confirm or deny a
|
||||||
|
gzip header. Before this, gzdirect() will return true (1).
|
||||||
|
|
||||||
When writing, gzdirect() returns true (1) if transparent writing was
|
When writing, gzdirect() returns true (1) if transparent writing was
|
||||||
requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note:
|
requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note:
|
||||||
@@ -1631,7 +1747,7 @@ ZEXTERN int ZEXPORT gzdirect(gzFile file);
|
|||||||
gzip file reading and decompression, which may not be desired.)
|
gzip file reading and decompression, which may not be desired.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN int ZEXPORT gzclose(gzFile file);
|
ZEXTERN int ZEXPORT gzclose(gzFile file);
|
||||||
/*
|
/*
|
||||||
Flush all pending output for file, if necessary, close file and
|
Flush all pending output for file, if necessary, close file and
|
||||||
deallocate the (de)compression state. Note that once file is closed, you
|
deallocate the (de)compression state. Note that once file is closed, you
|
||||||
@@ -1659,9 +1775,10 @@ ZEXTERN int ZEXPORT gzclose_w(gzFile file);
|
|||||||
ZEXTERN const char * ZEXPORT gzerror(gzFile file, int *errnum);
|
ZEXTERN const char * ZEXPORT gzerror(gzFile file, int *errnum);
|
||||||
/*
|
/*
|
||||||
Return the error message for the last error which occurred on file.
|
Return the error message for the last error which occurred on file.
|
||||||
errnum is set to zlib error number. If an error occurred in the file system
|
If errnum is not NULL, *errnum is set to zlib error number. If an error
|
||||||
and not in the compression library, errnum is set to Z_ERRNO and the
|
occurred in the file system and not in the compression library, *errnum is
|
||||||
application may consult errno to get the exact error code.
|
set to Z_ERRNO and the application may consult errno to get the exact error
|
||||||
|
code.
|
||||||
|
|
||||||
The application must not modify the returned string. Future calls to
|
The application must not modify the returned string. Future calls to
|
||||||
this function may invalidate the previously returned string. If file is
|
this function may invalidate the previously returned string. If file is
|
||||||
@@ -1712,7 +1829,8 @@ ZEXTERN uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len);
|
|||||||
ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf,
|
ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf,
|
||||||
z_size_t len);
|
z_size_t len);
|
||||||
/*
|
/*
|
||||||
Same as adler32(), but with a size_t length.
|
Same as adler32(), but with a size_t length. Note that a long is 32 bits
|
||||||
|
on Windows.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1748,7 +1866,8 @@ ZEXTERN uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len);
|
|||||||
ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf,
|
ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf,
|
||||||
z_size_t len);
|
z_size_t len);
|
||||||
/*
|
/*
|
||||||
Same as crc32(), but with a size_t length.
|
Same as crc32(), but with a size_t length. Note that a long is 32 bits on
|
||||||
|
Windows.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1758,14 +1877,14 @@ ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2);
|
|||||||
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
|
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
|
||||||
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
|
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
|
||||||
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
|
check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
|
||||||
len2.
|
len2. len2 must be non-negative, otherwise zero is returned.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2);
|
ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2);
|
||||||
|
|
||||||
Return the operator corresponding to length len2, to be used with
|
Return the operator corresponding to length len2, to be used with
|
||||||
crc32_combine_op().
|
crc32_combine_op(). len2 must be non-negative, otherwise zero is returned.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op);
|
ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op);
|
||||||
@@ -1888,9 +2007,9 @@ ZEXTERN int ZEXPORT gzgetc_(gzFile file); /* backward compatibility */
|
|||||||
ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int);
|
ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int);
|
||||||
ZEXTERN z_off_t ZEXPORT gztell64(gzFile);
|
ZEXTERN z_off_t ZEXPORT gztell64(gzFile);
|
||||||
ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile);
|
ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile);
|
||||||
ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
|
ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
|
ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
|
ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t);
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *);
|
ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *);
|
||||||
|
|||||||
+91
-35
@@ -1,5 +1,5 @@
|
|||||||
/* zutil.h -- internal interface and configuration of the compression library
|
/* zutil.h -- internal interface and configuration of the compression library
|
||||||
* Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler
|
* Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
# define ZLIB_INTERNAL
|
# define ZLIB_INTERNAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "/EgtDev/Extern/Zlib/Include/zlib.h"
|
#include "zlib.h"
|
||||||
|
|
||||||
#if defined(STDC) && !defined(Z_SOLO)
|
#if defined(STDC) && !defined(Z_SOLO)
|
||||||
# if !(defined(_WIN32_WCE) && defined(_MSC_VER))
|
# if !(defined(_WIN32_WCE) && defined(_MSC_VER))
|
||||||
@@ -36,6 +36,10 @@
|
|||||||
define "local" for the non-static meaning of "static", for readability
|
define "local" for the non-static meaning of "static", for readability
|
||||||
(compile with -Dlocal if your debugger can't find static symbols) */
|
(compile with -Dlocal if your debugger can't find static symbols) */
|
||||||
|
|
||||||
|
extern const char deflate_copyright[];
|
||||||
|
extern const char inflate_copyright[];
|
||||||
|
extern const char inflate9_copyright[];
|
||||||
|
|
||||||
typedef unsigned char uch;
|
typedef unsigned char uch;
|
||||||
typedef uch FAR uchf;
|
typedef uch FAR uchf;
|
||||||
typedef unsigned short ush;
|
typedef unsigned short ush;
|
||||||
@@ -48,6 +52,8 @@ typedef unsigned long ulg;
|
|||||||
# define Z_U8 unsigned long
|
# define Z_U8 unsigned long
|
||||||
# elif (ULLONG_MAX == 0xffffffffffffffff)
|
# elif (ULLONG_MAX == 0xffffffffffffffff)
|
||||||
# define Z_U8 unsigned long long
|
# define Z_U8 unsigned long long
|
||||||
|
# elif (ULONG_LONG_MAX == 0xffffffffffffffff)
|
||||||
|
# define Z_U8 unsigned long long
|
||||||
# elif (UINT_MAX == 0xffffffffffffffff)
|
# elif (UINT_MAX == 0xffffffffffffffff)
|
||||||
# define Z_U8 unsigned
|
# define Z_U8 unsigned
|
||||||
# endif
|
# endif
|
||||||
@@ -56,14 +62,16 @@ typedef unsigned long ulg;
|
|||||||
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
/* (size given to avoid silly warnings with Visual C++) */
|
/* (size given to avoid silly warnings with Visual C++) */
|
||||||
|
|
||||||
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
|
#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)]
|
||||||
|
|
||||||
#define ERR_RETURN(strm,err) \
|
#define ERR_RETURN(strm,err) \
|
||||||
return (strm->msg = ERR_MSG(err), (err))
|
return (strm->msg = ERR_MSG(err), (err))
|
||||||
/* To be used only when the state is known to be valid */
|
/* To be used only when the state is known to be valid */
|
||||||
|
|
||||||
/* common constants */
|
/* common constants */
|
||||||
|
#if MAX_WBITS < 9 || MAX_WBITS > 15
|
||||||
|
# error MAX_WBITS must be in 9..15
|
||||||
|
#endif
|
||||||
#ifndef DEF_WBITS
|
#ifndef DEF_WBITS
|
||||||
# define DEF_WBITS MAX_WBITS
|
# define DEF_WBITS MAX_WBITS
|
||||||
#endif
|
#endif
|
||||||
@@ -137,20 +145,11 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MACOS) || defined(TARGET_OS_MAC)
|
#if defined(MACOS)
|
||||||
# define OS_CODE 7
|
# define OS_CODE 7
|
||||||
# ifndef Z_SOLO
|
|
||||||
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
|
|
||||||
# include <unix.h> /* for fdopen */
|
|
||||||
# else
|
|
||||||
# ifndef fdopen
|
|
||||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __acorn
|
#if defined(__acorn) || defined(__riscos)
|
||||||
# define OS_CODE 13
|
# define OS_CODE 13
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -170,18 +169,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|||||||
# define OS_CODE 19
|
# define OS_CODE 19
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_BEOS_) || defined(RISCOS)
|
|
||||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
|
|
||||||
# if defined(_WIN32_WCE)
|
|
||||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
|
||||||
# else
|
|
||||||
# define fdopen(fd,type) _fdopen(fd,type)
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__BORLANDC__) && !defined(MSDOS)
|
#if defined(__BORLANDC__) && !defined(MSDOS)
|
||||||
#pragma warn -8004
|
#pragma warn -8004
|
||||||
#pragma warn -8008
|
#pragma warn -8008
|
||||||
@@ -189,11 +176,10 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* provide prototypes for these when building zlib without LFS */
|
/* provide prototypes for these when building zlib without LFS */
|
||||||
#if !defined(_WIN32) && \
|
#ifndef Z_LARGE64
|
||||||
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
|
ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off64_t);
|
||||||
ZEXTERN uLong ZEXPORT adler32_combine64(uLong, uLong, z_off_t);
|
ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off64_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine64(uLong, uLong, z_off_t);
|
ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off64_t);
|
||||||
ZEXTERN uLong ZEXPORT crc32_combine_gen64(z_off_t);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* common defaults */
|
/* common defaults */
|
||||||
@@ -232,9 +218,9 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|||||||
# define zmemzero(dest, len) memset(dest, 0, len)
|
# define zmemzero(dest, len) memset(dest, 0, len)
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len);
|
void ZLIB_INTERNAL zmemcpy(void FAR *, const void FAR *, z_size_t);
|
||||||
int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len);
|
int ZLIB_INTERNAL zmemcmp(const void FAR *, const void FAR *, z_size_t);
|
||||||
void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len);
|
void ZLIB_INTERNAL zmemzero(void FAR *, z_size_t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Diagnostic functions */
|
/* Diagnostic functions */
|
||||||
@@ -272,4 +258,74 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
|||||||
#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
|
#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
|
||||||
(((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
|
(((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
|
||||||
|
|
||||||
|
#ifdef Z_ONCE
|
||||||
|
/*
|
||||||
|
Create a local z_once() function depending on the availability of atomics.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Check for the availability of atomics. */
|
||||||
|
#if defined(__STDC__) && __STDC_VERSION__ >= 201112L && \
|
||||||
|
!defined(__STDC_NO_ATOMICS__)
|
||||||
|
|
||||||
|
#include <stdatomic.h>
|
||||||
|
typedef struct {
|
||||||
|
atomic_flag begun;
|
||||||
|
atomic_int done;
|
||||||
|
} z_once_t;
|
||||||
|
#define Z_ONCE_INIT {ATOMIC_FLAG_INIT, 0}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Run the provided init() function exactly once, even if multiple threads
|
||||||
|
invoke once() at the same time. The state must be a once_t initialized with
|
||||||
|
Z_ONCE_INIT.
|
||||||
|
*/
|
||||||
|
local void z_once(z_once_t *state, void (*init)(void)) {
|
||||||
|
if (!atomic_load(&state->done)) {
|
||||||
|
if (atomic_flag_test_and_set(&state->begun))
|
||||||
|
while (!atomic_load(&state->done))
|
||||||
|
;
|
||||||
|
else {
|
||||||
|
init();
|
||||||
|
atomic_store(&state->done, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* no atomics */
|
||||||
|
|
||||||
|
#warning zlib not thread-safe
|
||||||
|
|
||||||
|
typedef struct z_once_s {
|
||||||
|
volatile int begun;
|
||||||
|
volatile int done;
|
||||||
|
} z_once_t;
|
||||||
|
#define Z_ONCE_INIT {0, 0}
|
||||||
|
|
||||||
|
/* Test and set. Alas, not atomic, but tries to limit the period of
|
||||||
|
vulnerability. */
|
||||||
|
local int test_and_set(int volatile *flag) {
|
||||||
|
int was;
|
||||||
|
|
||||||
|
was = *flag;
|
||||||
|
*flag = 1;
|
||||||
|
return was;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Run the provided init() function once. This is not thread-safe. */
|
||||||
|
local void z_once(z_once_t *state, void (*init)(void)) {
|
||||||
|
if (!state->done) {
|
||||||
|
if (test_and_set(&state->begun))
|
||||||
|
while (!state->done)
|
||||||
|
;
|
||||||
|
else {
|
||||||
|
init();
|
||||||
|
state->done = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ?atomics */
|
||||||
|
|
||||||
|
#endif /* Z_ONCE */
|
||||||
|
|
||||||
#endif /* ZUTIL_H */
|
#endif /* ZUTIL_H */
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user