mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 15:40:44 +00:00
Update deps/libz
This commit is contained in:
parent
aace0ae9bd
commit
95e934825a
6
deps/libz/compress.c
vendored
6
deps/libz/compress.c
vendored
@ -19,7 +19,7 @@
|
||||
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
|
||||
Z_STREAM_ERROR if the level parameter is invalid.
|
||||
*/
|
||||
int ZEXPORT compress2 (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)
|
||||
int compress2 (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)
|
||||
{
|
||||
z_stream stream;
|
||||
int err;
|
||||
@ -54,7 +54,7 @@ int ZEXPORT compress2 (Bytef *dest, uLongf *destLen, const Bytef *source, uLong
|
||||
|
||||
/* ===========================================================================
|
||||
*/
|
||||
int ZEXPORT compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
|
||||
int compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
|
||||
{
|
||||
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
|
||||
}
|
||||
@ -63,7 +63,7 @@ int ZEXPORT compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong s
|
||||
If the default memLevel or windowBits for deflateInit() is changed, then
|
||||
this function needs to be updated.
|
||||
*/
|
||||
uLong ZEXPORT compressBound (uLong sourceLen)
|
||||
uLong compressBound (uLong sourceLen)
|
||||
{
|
||||
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
|
||||
(sourceLen >> 25) + 13;
|
||||
|
94
deps/libz/deflate.c
vendored
94
deps/libz/deflate.c
vendored
@ -70,31 +70,31 @@ typedef enum {
|
||||
finish_done /* finish done, accept no more input or output */
|
||||
} block_state;
|
||||
|
||||
typedef block_state (*compress_func) OF((deflate_state *s, int flush));
|
||||
typedef block_state (*compress_func) (deflate_state *s, int flush);
|
||||
/* Compression function. Returns the block state after the call. */
|
||||
|
||||
local void fill_window OF((deflate_state *s));
|
||||
local block_state deflate_stored OF((deflate_state *s, int flush));
|
||||
local block_state deflate_fast OF((deflate_state *s, int flush));
|
||||
static void fill_window (deflate_state *s);
|
||||
static block_state deflate_stored (deflate_state *s, int flush);
|
||||
static block_state deflate_fast (deflate_state *s, int flush);
|
||||
#ifndef FASTEST
|
||||
local block_state deflate_slow OF((deflate_state *s, int flush));
|
||||
static block_state deflate_slow (deflate_state *s, int flush);
|
||||
#endif
|
||||
local block_state deflate_rle OF((deflate_state *s, int flush));
|
||||
local block_state deflate_huff OF((deflate_state *s, int flush));
|
||||
local void lm_init OF((deflate_state *s));
|
||||
local void putShortMSB OF((deflate_state *s, uInt b));
|
||||
local void flush_pending OF((z_streamp strm));
|
||||
local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
|
||||
static block_state deflate_rle (deflate_state *s, int flush);
|
||||
static block_state deflate_huff (deflate_state *s, int flush);
|
||||
static void lm_init (deflate_state *s);
|
||||
static void putShortMSB (deflate_state *s, uInt b);
|
||||
static void flush_pending (z_streamp strm);
|
||||
static int read_buf (z_streamp strm, Bytef *buf, unsigned size);
|
||||
#ifdef ASMV
|
||||
void match_init OF((void)); /* asm code initialization */
|
||||
uInt longest_match OF((deflate_state *s, IPos cur_match));
|
||||
void match_init (void); /* asm code initialization */
|
||||
uInt longest_match (deflate_state *s, IPos cur_match);
|
||||
#else
|
||||
local uInt longest_match OF((deflate_state *s, IPos cur_match));
|
||||
static uInt longest_match (deflate_state *s, IPos cur_match);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
local void check_match OF((deflate_state *s, IPos start, IPos match,
|
||||
int length));
|
||||
static void check_match (deflate_state *s, IPos start, IPos match,
|
||||
int length);
|
||||
#endif
|
||||
|
||||
/* ===========================================================================
|
||||
@ -123,12 +123,12 @@ typedef struct config_s {
|
||||
} config;
|
||||
|
||||
#ifdef FASTEST
|
||||
local const config configuration_table[2] = {
|
||||
static const config configuration_table[2] = {
|
||||
/* good lazy nice chain */
|
||||
/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
|
||||
/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */
|
||||
#else
|
||||
local const config configuration_table[10] = {
|
||||
static const config configuration_table[10] = {
|
||||
/* good lazy nice chain */
|
||||
/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
|
||||
/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */
|
||||
@ -193,12 +193,12 @@ local const config configuration_table[10] = {
|
||||
s->head[s->hash_size-1] = NIL; \
|
||||
zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
|
||||
|
||||
int ZEXPORT deflateResetKeep (z_streamp strm);
|
||||
int deflateResetKeep (z_streamp strm);
|
||||
|
||||
int ZEXPORT deflatePending (z_streamp strm, unsigned *pending, int *bits);
|
||||
int deflatePending (z_streamp strm, unsigned *pending, int *bits);
|
||||
|
||||
/* ========================================================================= */
|
||||
int ZEXPORT deflateInit_(z_streamp strm, int level, const char *version, int stream_size)
|
||||
int deflateInit_(z_streamp strm, int level, const char *version, int stream_size)
|
||||
{
|
||||
return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
|
||||
Z_DEFAULT_STRATEGY, version, stream_size);
|
||||
@ -206,7 +206,7 @@ int ZEXPORT deflateInit_(z_streamp strm, int level, const char *version, int str
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy,
|
||||
int deflateInit2_(z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy,
|
||||
const char *version, int stream_size)
|
||||
{
|
||||
deflate_state *s;
|
||||
@ -308,7 +308,7 @@ int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, int windowBits,
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
int ZEXPORT deflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength)
|
||||
int deflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength)
|
||||
{
|
||||
deflate_state *s;
|
||||
uInt str, n;
|
||||
@ -374,7 +374,7 @@ int ZEXPORT deflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
int ZEXPORT deflateResetKeep (z_streamp strm)
|
||||
int deflateResetKeep (z_streamp strm)
|
||||
{
|
||||
deflate_state *s;
|
||||
|
||||
@ -408,7 +408,7 @@ int ZEXPORT deflateResetKeep (z_streamp strm)
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
int ZEXPORT deflateReset (z_streamp strm)
|
||||
int deflateReset (z_streamp strm)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -419,7 +419,7 @@ int ZEXPORT deflateReset (z_streamp strm)
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
int ZEXPORT deflateSetHeader (z_streamp strm, gz_headerp head)
|
||||
int deflateSetHeader (z_streamp strm, gz_headerp head)
|
||||
{
|
||||
struct internal_state_deflate *state = (struct internal_state_deflate*)strm->state;
|
||||
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
|
||||
@ -430,7 +430,7 @@ int ZEXPORT deflateSetHeader (z_streamp strm, gz_headerp head)
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
int ZEXPORT deflatePending (z_streamp strm, unsigned *pending, int *bits)
|
||||
int deflatePending (z_streamp strm, unsigned *pending, int *bits)
|
||||
{
|
||||
struct internal_state_deflate *state = (struct internal_state_deflate*)strm->state;
|
||||
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
|
||||
@ -442,7 +442,7 @@ int ZEXPORT deflatePending (z_streamp strm, unsigned *pending, int *bits)
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
int ZEXPORT deflatePrime (z_streamp strm, int bits, int value)
|
||||
int deflatePrime (z_streamp strm, int bits, int value)
|
||||
{
|
||||
deflate_state *s;
|
||||
int put;
|
||||
@ -465,7 +465,7 @@ int ZEXPORT deflatePrime (z_streamp strm, int bits, int value)
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
int ZEXPORT deflateParams(z_streamp strm, int level, int strategy)
|
||||
int deflateParams(z_streamp strm, int level, int strategy)
|
||||
{
|
||||
deflate_state *s;
|
||||
compress_func func;
|
||||
@ -503,7 +503,7 @@ int ZEXPORT deflateParams(z_streamp strm, int level, int strategy)
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
int ZEXPORT deflateTune(z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain)
|
||||
int deflateTune(z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain)
|
||||
{
|
||||
deflate_state *s;
|
||||
|
||||
@ -533,7 +533,7 @@ int ZEXPORT deflateTune(z_streamp strm, int good_length, int max_lazy, int nice_
|
||||
* upper bound of about 14% expansion does not seem onerous for output buffer
|
||||
* allocation.
|
||||
*/
|
||||
uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen)
|
||||
uLong deflateBound(z_streamp strm, uLong sourceLen)
|
||||
{
|
||||
deflate_state *s;
|
||||
uLong complen, wraplen;
|
||||
@ -593,7 +593,7 @@ uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen)
|
||||
* IN assertion: the stream state is correct and there is enough room in
|
||||
* pending_buf.
|
||||
*/
|
||||
local void putShortMSB (deflate_state *s, uInt b)
|
||||
static void putShortMSB (deflate_state *s, uInt b)
|
||||
{
|
||||
put_byte(s, (Byte)(b >> 8));
|
||||
put_byte(s, (Byte)(b & 0xff));
|
||||
@ -605,7 +605,7 @@ local void putShortMSB (deflate_state *s, uInt b)
|
||||
* to avoid allocating a large strm->next_out buffer and copying into it.
|
||||
* (See also read_buf()).
|
||||
*/
|
||||
local void flush_pending(z_streamp strm)
|
||||
static void flush_pending(z_streamp strm)
|
||||
{
|
||||
unsigned len;
|
||||
deflate_state *s = (deflate_state*)strm->state;
|
||||
@ -627,7 +627,7 @@ local void flush_pending(z_streamp strm)
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
int ZEXPORT deflate (z_streamp strm, int flush)
|
||||
int deflate (z_streamp strm, int flush)
|
||||
{
|
||||
int old_flush; /* value of flush param for previous deflate call */
|
||||
deflate_state *s;
|
||||
@ -939,7 +939,7 @@ int ZEXPORT deflate (z_streamp strm, int flush)
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
int ZEXPORT deflateEnd (z_streamp strm)
|
||||
int deflateEnd (z_streamp strm)
|
||||
{
|
||||
struct internal_state_deflate *state;
|
||||
int status;
|
||||
@ -975,7 +975,7 @@ int ZEXPORT deflateEnd (z_streamp strm)
|
||||
* To simplify the source, this is not supported for 16-bit MSDOS (which
|
||||
* doesn't have enough memory anyway to duplicate compression states).
|
||||
*/
|
||||
int ZEXPORT deflateCopy (z_streamp dest, z_streamp source)
|
||||
int deflateCopy (z_streamp dest, z_streamp source)
|
||||
{
|
||||
#ifdef MAXSEG_64K
|
||||
return Z_STREAM_ERROR;
|
||||
@ -1035,7 +1035,7 @@ int ZEXPORT deflateCopy (z_streamp dest, z_streamp source)
|
||||
* allocating a large strm->next_in buffer and copying from it.
|
||||
* (See also flush_pending()).
|
||||
*/
|
||||
local int read_buf(z_streamp strm, Bytef *buf, unsigned size)
|
||||
static int read_buf(z_streamp strm, Bytef *buf, unsigned size)
|
||||
{
|
||||
struct internal_state_deflate *state = (struct internal_state_deflate*)strm->state;
|
||||
unsigned len = strm->avail_in;
|
||||
@ -1063,7 +1063,7 @@ local int read_buf(z_streamp strm, Bytef *buf, unsigned size)
|
||||
/* ===========================================================================
|
||||
* Initialize the "longest match" routines for a new zlib stream
|
||||
*/
|
||||
local void lm_init (deflate_state *s)
|
||||
static void lm_init (deflate_state *s)
|
||||
{
|
||||
s->window_size = (ulg)2L*s->w_size;
|
||||
|
||||
@ -1104,7 +1104,7 @@ local void lm_init (deflate_state *s)
|
||||
/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
|
||||
* match.S. The code will be functionally equivalent.
|
||||
*/
|
||||
local uInt longest_match(deflate_state *s, IPos cur_match)
|
||||
static uInt longest_match(deflate_state *s, IPos cur_match)
|
||||
{
|
||||
unsigned chain_length = s->max_chain_length;/* max hash chain length */
|
||||
register Bytef *scan = s->window + s->strstart; /* current string */
|
||||
@ -1251,7 +1251,7 @@ local uInt longest_match(deflate_state *s, IPos cur_match)
|
||||
/* ---------------------------------------------------------------------------
|
||||
* Optimized version for FASTEST only
|
||||
*/
|
||||
local uInt longest_match(s, cur_match)
|
||||
static uInt longest_match(s, cur_match)
|
||||
deflate_state *s;
|
||||
IPos cur_match; /* current match */
|
||||
{
|
||||
@ -1310,7 +1310,7 @@ local uInt longest_match(s, cur_match)
|
||||
/* ===========================================================================
|
||||
* Check that the match at match_start is indeed a match.
|
||||
*/
|
||||
local void check_match(s, start, match, length)
|
||||
static void check_match(s, start, match, length)
|
||||
deflate_state *s;
|
||||
IPos start, match;
|
||||
int length;
|
||||
@ -1344,7 +1344,7 @@ local void check_match(s, start, match, length)
|
||||
* performed for at least two bytes (required for the zip translate_eol
|
||||
* option -- not supported here).
|
||||
*/
|
||||
local void fill_window(deflate_state *s)
|
||||
static void fill_window(deflate_state *s)
|
||||
{
|
||||
register unsigned n, m;
|
||||
register Posf *p;
|
||||
@ -1517,7 +1517,7 @@ local void fill_window(deflate_state *s)
|
||||
* NOTE: this function should be optimized to avoid extra copying from
|
||||
* window to pending_buf.
|
||||
*/
|
||||
local block_state deflate_stored(deflate_state *s, int flush)
|
||||
static block_state deflate_stored(deflate_state *s, int flush)
|
||||
{
|
||||
/* Stored blocks are limited to 0xffff bytes, pending_buf is limited
|
||||
* to pending_buf_size, and each stored block has a 5 byte header:
|
||||
@ -1579,7 +1579,7 @@ local block_state deflate_stored(deflate_state *s, int flush)
|
||||
* new strings in the dictionary only for unmatched strings or for short
|
||||
* matches. It is used only for the fast compression options.
|
||||
*/
|
||||
local block_state deflate_fast(deflate_state *s, int flush)
|
||||
static block_state deflate_fast(deflate_state *s, int flush)
|
||||
{
|
||||
IPos hash_head; /* head of the hash chain */
|
||||
int bflush; /* set if current block must be flushed */
|
||||
@ -1679,7 +1679,7 @@ local block_state deflate_fast(deflate_state *s, int flush)
|
||||
* evaluation for matches: a match is finally adopted only if there is
|
||||
* no better match at the next window position.
|
||||
*/
|
||||
local block_state deflate_slow(deflate_state *s, int flush)
|
||||
static block_state deflate_slow(deflate_state *s, int flush)
|
||||
{
|
||||
IPos hash_head; /* head of hash chain */
|
||||
int bflush; /* set if current block must be flushed */
|
||||
@ -1808,7 +1808,7 @@ local block_state deflate_slow(deflate_state *s, int flush)
|
||||
* one. Do not maintain a hash table. (It will be regenerated if this run of
|
||||
* deflate switches away from Z_RLE.)
|
||||
*/
|
||||
local block_state deflate_rle(deflate_state *s, int flush)
|
||||
static block_state deflate_rle(deflate_state *s, int flush)
|
||||
{
|
||||
int bflush; /* set if current block must be flushed */
|
||||
uInt prev; /* byte at distance one to match */
|
||||
@ -1879,7 +1879,7 @@ local block_state deflate_rle(deflate_state *s, int flush)
|
||||
* For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
|
||||
* (It will be regenerated if this run of deflate switches away from Huffman.)
|
||||
*/
|
||||
local block_state deflate_huff(deflate_state *s, int flush)
|
||||
static block_state deflate_huff(deflate_state *s, int flush)
|
||||
{
|
||||
int bflush; /* set if current block must be flushed */
|
||||
|
||||
|
42
deps/libz/gzlib.c
vendored
42
deps/libz/gzlib.c
vendored
@ -16,12 +16,12 @@
|
||||
#endif
|
||||
|
||||
/* Forward declarations */
|
||||
z_off_t ZEXPORT gzoffset(gzFile file);
|
||||
int ZEXPORT gzbuffer(gzFile file, unsigned size);
|
||||
z_off_t gzoffset(gzFile file);
|
||||
int gzbuffer(gzFile file, unsigned size);
|
||||
|
||||
/* Local functions */
|
||||
local void gz_reset OF((gz_statep));
|
||||
local gzFile gz_open OF((const void *, int, const char *));
|
||||
static void gz_reset OF((gz_statep));
|
||||
static gzFile gz_open OF((const void *, int, const char *));
|
||||
|
||||
#if defined UNDER_CE
|
||||
|
||||
@ -76,7 +76,7 @@ char ZLIB_INTERNAL *gz_strwinerror (error)
|
||||
#endif /* UNDER_CE */
|
||||
|
||||
/* Reset gzip file state */
|
||||
local void gz_reset(gz_statep state)
|
||||
static void gz_reset(gz_statep state)
|
||||
{
|
||||
state->x.have = 0; /* no output data available */
|
||||
if (state->mode == GZ_READ) { /* for reading ... */
|
||||
@ -91,7 +91,7 @@ local void gz_reset(gz_statep state)
|
||||
}
|
||||
|
||||
/* Open a gzip file either by name or file descriptor. */
|
||||
local gzFile gz_open(const void *path, int fd, const char *mode)
|
||||
static gzFile gz_open(const void *path, int fd, const char *mode)
|
||||
{
|
||||
gz_statep state;
|
||||
size_t len;
|
||||
@ -264,17 +264,17 @@ local gzFile gz_open(const void *path, int fd, const char *mode)
|
||||
return (gzFile)state;
|
||||
}
|
||||
|
||||
gzFile ZEXPORT gzopen(const char *path, const char *mode)
|
||||
gzFile gzopen(const char *path, const char *mode)
|
||||
{
|
||||
return gz_open(path, -1, mode);
|
||||
}
|
||||
|
||||
gzFile ZEXPORT gzopen64(const char *path, const char *mode)
|
||||
gzFile gzopen64(const char *path, const char *mode)
|
||||
{
|
||||
return gz_open(path, -1, mode);
|
||||
}
|
||||
|
||||
gzFile ZEXPORT gzdopen(int fd, const char *mode)
|
||||
gzFile gzdopen(int fd, const char *mode)
|
||||
{
|
||||
char *path; /* identifier for error messages */
|
||||
gzFile gz;
|
||||
@ -292,13 +292,13 @@ gzFile ZEXPORT gzdopen(int fd, const char *mode)
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
gzFile ZEXPORT gzopen_w(const wchar_t *path, const char *mode)
|
||||
gzFile gzopen_w(const wchar_t *path, const char *mode)
|
||||
{
|
||||
return gz_open(path, -2, mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
int ZEXPORT gzbuffer(gzFile file, unsigned size)
|
||||
int gzbuffer(gzFile file, unsigned size)
|
||||
{
|
||||
gz_statep state;
|
||||
|
||||
@ -320,7 +320,7 @@ int ZEXPORT gzbuffer(gzFile file, unsigned size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZEXPORT gzrewind(gzFile file)
|
||||
int gzrewind(gzFile file)
|
||||
{
|
||||
gz_statep state;
|
||||
|
||||
@ -341,7 +341,7 @@ int ZEXPORT gzrewind(gzFile file)
|
||||
return 0;
|
||||
}
|
||||
|
||||
z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence)
|
||||
z_off64_t gzseek64(gzFile file, z_off64_t offset, int whence)
|
||||
{
|
||||
unsigned n;
|
||||
z_off64_t ret;
|
||||
@ -414,7 +414,7 @@ z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence)
|
||||
return state->x.pos + offset;
|
||||
}
|
||||
|
||||
z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence)
|
||||
z_off_t gzseek(gzFile file, z_off_t offset, int whence)
|
||||
{
|
||||
z_off64_t ret;
|
||||
|
||||
@ -422,7 +422,7 @@ z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence)
|
||||
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
|
||||
}
|
||||
|
||||
z_off64_t ZEXPORT gztell64(gzFile file)
|
||||
z_off64_t gztell64(gzFile file)
|
||||
{
|
||||
gz_statep state;
|
||||
|
||||
@ -437,7 +437,7 @@ z_off64_t ZEXPORT gztell64(gzFile file)
|
||||
return state->x.pos + (state->seek ? state->skip : 0);
|
||||
}
|
||||
|
||||
z_off_t ZEXPORT gztell(gzFile file)
|
||||
z_off_t gztell(gzFile file)
|
||||
{
|
||||
z_off64_t ret;
|
||||
|
||||
@ -445,7 +445,7 @@ z_off_t ZEXPORT gztell(gzFile file)
|
||||
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
|
||||
}
|
||||
|
||||
z_off64_t ZEXPORT gzoffset64(gzFile file)
|
||||
z_off64_t gzoffset64(gzFile file)
|
||||
{
|
||||
z_off64_t offset;
|
||||
gz_statep state;
|
||||
@ -466,13 +466,13 @@ z_off64_t ZEXPORT gzoffset64(gzFile file)
|
||||
return offset;
|
||||
}
|
||||
|
||||
z_off_t ZEXPORT gzoffset(gzFile file)
|
||||
z_off_t gzoffset(gzFile file)
|
||||
{
|
||||
z_off64_t ret = gzoffset64(file);
|
||||
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
|
||||
}
|
||||
|
||||
int ZEXPORT gzeof(gzFile file)
|
||||
int gzeof(gzFile file)
|
||||
{
|
||||
gz_statep state;
|
||||
|
||||
@ -487,7 +487,7 @@ int ZEXPORT gzeof(gzFile file)
|
||||
return state->mode == GZ_READ ? state->past : 0;
|
||||
}
|
||||
|
||||
const char * ZEXPORT gzerror(gzFile file, int *errnum)
|
||||
const char * gzerror(gzFile file, int *errnum)
|
||||
{
|
||||
gz_statep state;
|
||||
|
||||
@ -505,7 +505,7 @@ const char * ZEXPORT gzerror(gzFile file, int *errnum)
|
||||
(state->msg == NULL ? "" : state->msg);
|
||||
}
|
||||
|
||||
void ZEXPORT gzclearerr(gzFile file)
|
||||
void gzclearerr(gzFile file)
|
||||
{
|
||||
gz_statep state;
|
||||
|
||||
|
38
deps/libz/gzread.c
vendored
38
deps/libz/gzread.c
vendored
@ -6,20 +6,20 @@
|
||||
#include "gzguts.h"
|
||||
|
||||
/* Local functions */
|
||||
local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *));
|
||||
local int gz_avail OF((gz_statep));
|
||||
local int gz_look OF((gz_statep));
|
||||
local int gz_decomp OF((gz_statep));
|
||||
local int gz_fetch OF((gz_statep));
|
||||
local int gz_skip OF((gz_statep, z_off64_t));
|
||||
static int gz_load (gz_statep, unsigned char *, unsigned, unsigned *);
|
||||
static int gz_avail (gz_statep);
|
||||
static int gz_look (gz_statep);
|
||||
static int gz_decomp (gz_statep);
|
||||
static int gz_fetch (gz_statep);
|
||||
static int gz_skip (gz_statep, z_off64_t);
|
||||
|
||||
int ZEXPORT gzgetc_(gzFile file);
|
||||
int gzgetc_(gzFile file);
|
||||
|
||||
/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
|
||||
state->fd, and update state->eof, state->err, and state->msg as appropriate.
|
||||
This function needs to loop on read(), since read() is not guaranteed to
|
||||
read the number of bytes requested, depending on the type of descriptor. */
|
||||
local int gz_load(gz_statep state, unsigned char *buf, unsigned len, unsigned *have)
|
||||
static int gz_load(gz_statep state, unsigned char *buf, unsigned len, unsigned *have)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -46,7 +46,7 @@ local int gz_load(gz_statep state, unsigned char *buf, unsigned len, unsigned *h
|
||||
If strm->avail_in != 0, then the current data is moved to the beginning of
|
||||
the input buffer, and then the remainder of the buffer is loaded with the
|
||||
available data from the input file. */
|
||||
local int gz_avail(gz_statep state)
|
||||
static int gz_avail(gz_statep state)
|
||||
{
|
||||
unsigned got;
|
||||
z_streamp strm = &(state->strm);
|
||||
@ -80,7 +80,7 @@ local int gz_avail(gz_statep state)
|
||||
case, all further file reads will be directly to either the output buffer or
|
||||
a user buffer. If decompressing, the inflate state will be initialized.
|
||||
gz_look() will return 0 on success or -1 on failure. */
|
||||
local int gz_look(gz_statep state)
|
||||
static int gz_look(gz_statep state)
|
||||
{
|
||||
z_streamp strm = &(state->strm);
|
||||
|
||||
@ -165,7 +165,7 @@ local int gz_look(gz_statep state)
|
||||
data. If the gzip stream completes, state->how is reset to LOOK to look for
|
||||
the next gzip stream or raw data, once state->x.have is depleted. Returns 0
|
||||
on success, -1 on failure. */
|
||||
local int gz_decomp(gz_statep state)
|
||||
static int gz_decomp(gz_statep state)
|
||||
{
|
||||
int ret = Z_OK;
|
||||
unsigned had;
|
||||
@ -218,7 +218,7 @@ local int gz_decomp(gz_statep state)
|
||||
looked for to determine whether to copy or decompress. Returns -1 on error,
|
||||
otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
|
||||
end of the input file has been reached and all data has been processed. */
|
||||
local int gz_fetch(gz_statep state)
|
||||
static int gz_fetch(gz_statep state)
|
||||
{
|
||||
z_streamp strm = &(state->strm);
|
||||
|
||||
@ -247,7 +247,7 @@ local int gz_fetch(gz_statep state)
|
||||
}
|
||||
|
||||
/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
|
||||
local int gz_skip(gz_statep state, z_off64_t len)
|
||||
static int gz_skip(gz_statep state, z_off64_t len)
|
||||
{
|
||||
unsigned n;
|
||||
|
||||
@ -276,7 +276,7 @@ local int gz_skip(gz_statep state, z_off64_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZEXPORT gzread(gzFile file, voidp buf, unsigned len)
|
||||
int gzread(gzFile file, voidp buf, unsigned len)
|
||||
{
|
||||
unsigned got, n;
|
||||
gz_statep state;
|
||||
@ -372,7 +372,7 @@ int ZEXPORT gzread(gzFile file, voidp buf, unsigned len)
|
||||
#else
|
||||
# undef gzgetc
|
||||
#endif
|
||||
int ZEXPORT gzgetc(gzFile file)
|
||||
int gzgetc(gzFile file)
|
||||
{
|
||||
int ret;
|
||||
unsigned char buf[1];
|
||||
@ -400,12 +400,12 @@ int ZEXPORT gzgetc(gzFile file)
|
||||
return ret < 1 ? -1 : buf[0];
|
||||
}
|
||||
|
||||
int ZEXPORT gzgetc_(gzFile file)
|
||||
int gzgetc_(gzFile file)
|
||||
{
|
||||
return gzgetc(file);
|
||||
}
|
||||
|
||||
int ZEXPORT gzungetc(int c, gzFile file)
|
||||
int gzungetc(int c, gzFile file)
|
||||
{
|
||||
gz_statep state;
|
||||
|
||||
@ -462,7 +462,7 @@ int ZEXPORT gzungetc(int c, gzFile file)
|
||||
return c;
|
||||
}
|
||||
|
||||
char * ZEXPORT gzgets(gzFile file, char *buf, int len)
|
||||
char * gzgets(gzFile file, char *buf, int len)
|
||||
{
|
||||
unsigned left, n;
|
||||
char *str;
|
||||
@ -522,7 +522,7 @@ char * ZEXPORT gzgets(gzFile file, char *buf, int len)
|
||||
return str;
|
||||
}
|
||||
|
||||
int ZEXPORT gzdirect(gzFile file)
|
||||
int gzdirect(gzFile file)
|
||||
{
|
||||
gz_statep state;
|
||||
|
||||
|
30
deps/libz/gzwrite.c
vendored
30
deps/libz/gzwrite.c
vendored
@ -6,15 +6,15 @@
|
||||
#include "gzguts.h"
|
||||
|
||||
/* Local functions */
|
||||
local int gz_init OF((gz_statep));
|
||||
local int gz_comp OF((gz_statep, int));
|
||||
local int gz_zero OF((gz_statep, z_off64_t));
|
||||
static int gz_init (gz_statep);
|
||||
static int gz_comp (gz_statep, int);
|
||||
static int gz_zero (gz_statep, z_off64_t);
|
||||
|
||||
int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va);
|
||||
int gzvprintf(gzFile file, const char *format, va_list va);
|
||||
|
||||
/* Initialize state for writing a gzip file. Mark initialization by setting
|
||||
state->size to non-zero. Return -1 on failure or 0 on success. */
|
||||
local int gz_init(gz_statep state)
|
||||
static int gz_init(gz_statep state)
|
||||
{
|
||||
int ret;
|
||||
z_streamp strm = &(state->strm);
|
||||
@ -68,7 +68,7 @@ local int gz_init(gz_statep state)
|
||||
then the deflate() state is reset to start a new gzip stream. If gz->direct
|
||||
is true, then simply write to the output file without compressing, and
|
||||
ignore flush. */
|
||||
local int gz_comp(gz_statep state, int flush)
|
||||
static int gz_comp(gz_statep state, int flush)
|
||||
{
|
||||
int ret, got;
|
||||
unsigned have;
|
||||
@ -129,7 +129,7 @@ local int gz_comp(gz_statep state, int flush)
|
||||
}
|
||||
|
||||
/* Compress len zeros to output. Return -1 on error, 0 on success. */
|
||||
local int gz_zero(gz_statep state, z_off64_t len)
|
||||
static int gz_zero(gz_statep state, z_off64_t len)
|
||||
{
|
||||
int first;
|
||||
unsigned n;
|
||||
@ -158,7 +158,7 @@ local int gz_zero(gz_statep state, z_off64_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len)
|
||||
int gzwrite(gzFile file, voidpc buf, unsigned len)
|
||||
{
|
||||
unsigned put = len;
|
||||
gz_statep state;
|
||||
@ -234,7 +234,7 @@ int ZEXPORT gzwrite(gzFile file, voidpc buf, unsigned len)
|
||||
return (int)put;
|
||||
}
|
||||
|
||||
int ZEXPORT gzputc(gzFile file, int c)
|
||||
int gzputc(gzFile file, int c)
|
||||
{
|
||||
unsigned have;
|
||||
unsigned char buf[1];
|
||||
@ -279,7 +279,7 @@ int ZEXPORT gzputc(gzFile file, int c)
|
||||
return c & 0xff;
|
||||
}
|
||||
|
||||
int ZEXPORT gzputs(gzFile file, const char *str)
|
||||
int gzputs(gzFile file, const char *str)
|
||||
{
|
||||
int ret;
|
||||
unsigned len;
|
||||
@ -293,7 +293,7 @@ int ZEXPORT gzputs(gzFile file, const char *str)
|
||||
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||
#include <stdarg.h>
|
||||
|
||||
int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
|
||||
int gzvprintf(gzFile file, const char *format, va_list va)
|
||||
{
|
||||
int size, len;
|
||||
gz_statep state;
|
||||
@ -355,7 +355,7 @@ int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va)
|
||||
return len;
|
||||
}
|
||||
|
||||
int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
|
||||
int gzprintf(gzFile file, const char *format, ...)
|
||||
{
|
||||
va_list va;
|
||||
int ret;
|
||||
@ -368,7 +368,7 @@ int ZEXPORTVA gzprintf(gzFile file, const char *format, ...)
|
||||
|
||||
#else /* !STDC && !Z_HAVE_STDARG_H */
|
||||
|
||||
int ZEXPORTVA gzprintf (gzFile file, const char *format, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10,
|
||||
int gzprintf (gzFile file, const char *format, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10,
|
||||
int a11, int a12, int a13, int a14, int a15, int a16, int a17, int a18, int a19, int a20)
|
||||
{
|
||||
int size, len;
|
||||
@ -442,7 +442,7 @@ int ZEXPORTVA gzprintf (gzFile file, const char *format, int a1, int a2, int a3,
|
||||
|
||||
#endif
|
||||
|
||||
int ZEXPORT gzflush(gzFile file, int flush)
|
||||
int gzflush(gzFile file, int flush)
|
||||
{
|
||||
gz_statep state;
|
||||
|
||||
@ -471,7 +471,7 @@ int ZEXPORT gzflush(gzFile file, int flush)
|
||||
return state->err;
|
||||
}
|
||||
|
||||
int ZEXPORT gzsetparams(gzFile file, int level, int strategy)
|
||||
int gzsetparams(gzFile file, int level, int strategy)
|
||||
{
|
||||
gz_statep state;
|
||||
z_streamp strm;
|
||||
|
10
deps/libz/infback.c
vendored
10
deps/libz/infback.c
vendored
@ -16,7 +16,7 @@
|
||||
#include "inffast.h"
|
||||
|
||||
/* function prototypes */
|
||||
local void fixedtables OF((struct inflate_state FAR *state));
|
||||
static void fixedtables (struct inflate_state FAR *state);
|
||||
|
||||
/*
|
||||
strm provides memory allocation functions in zalloc and zfree, or
|
||||
@ -25,7 +25,7 @@ local void fixedtables OF((struct inflate_state FAR *state));
|
||||
windowBits is in the range 8..15, and window is a user-supplied
|
||||
window and output buffer that is 2**windowBits bytes.
|
||||
*/
|
||||
int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits, unsigned char FAR *window, const char *version, int stream_size)
|
||||
int inflateBackInit_(z_streamp strm, int windowBits, unsigned char FAR *window, const char *version, int stream_size)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
|
||||
@ -74,7 +74,7 @@ int ZEXPORT inflateBackInit_(z_streamp strm, int windowBits, unsigned char FAR *
|
||||
used for threaded applications, since the rewriting of the tables and virgin
|
||||
may not be thread-safe.
|
||||
*/
|
||||
local void fixedtables(struct inflate_state FAR *state)
|
||||
static void fixedtables(struct inflate_state FAR *state)
|
||||
{
|
||||
#ifdef BUILDFIXED
|
||||
static int virgin = 1;
|
||||
@ -241,7 +241,7 @@ local void fixedtables(struct inflate_state FAR *state)
|
||||
inflateBack() can also return Z_STREAM_ERROR if the input parameters
|
||||
are not correct, i.e. strm is Z_NULL or the state was not initialized.
|
||||
*/
|
||||
int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, out_func out, void FAR *out_desc)
|
||||
int inflateBack(z_streamp strm, in_func in, void FAR *in_desc, out_func out, void FAR *out_desc)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
z_const unsigned char FAR *next; /* next input */
|
||||
@ -617,7 +617,7 @@ inf_leave:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ZEXPORT inflateBackEnd(z_streamp strm)
|
||||
int inflateBackEnd(z_streamp strm)
|
||||
{
|
||||
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == Z_NULL)
|
||||
return Z_STREAM_ERROR;
|
||||
|
60
deps/libz/inflate.c
vendored
60
deps/libz/inflate.c
vendored
@ -96,25 +96,25 @@
|
||||
#endif
|
||||
|
||||
/* function prototypes */
|
||||
int ZEXPORT inflateReset2(z_streamp strm, int windowBits);
|
||||
local void fixedtables OF((struct inflate_state FAR *state));
|
||||
local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
|
||||
unsigned copy));
|
||||
int inflateReset2(z_streamp strm, int windowBits);
|
||||
static void fixedtables (struct inflate_state FAR *state);
|
||||
static int updatewindow (z_streamp strm, const unsigned char FAR *end,
|
||||
unsigned copy);
|
||||
#ifdef BUILDFIXED
|
||||
void makefixed OF((void));
|
||||
void makefixed (void);
|
||||
#endif
|
||||
local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
|
||||
unsigned len));
|
||||
static unsigned syncsearch (unsigned FAR *have, const unsigned char FAR *buf,
|
||||
unsigned len);
|
||||
|
||||
long ZEXPORT inflateMark(z_streamp strm);
|
||||
long inflateMark(z_streamp strm);
|
||||
|
||||
int ZEXPORT inflateResetKeep(z_streamp strm);
|
||||
int inflateResetKeep(z_streamp strm);
|
||||
|
||||
int ZEXPORT inflateUndermine(z_streamp strm, int subvert);
|
||||
int inflateUndermine(z_streamp strm, int subvert);
|
||||
|
||||
int ZEXPORT inflateGetDictionary(z_streamp strm, Bytef *dictionary, uInt *dictLength);
|
||||
int inflateGetDictionary(z_streamp strm, Bytef *dictionary, uInt *dictLength);
|
||||
|
||||
int ZEXPORT inflateResetKeep(z_streamp strm)
|
||||
int inflateResetKeep(z_streamp strm)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
|
||||
@ -138,7 +138,7 @@ int ZEXPORT inflateResetKeep(z_streamp strm)
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
int ZEXPORT inflateReset(z_streamp strm)
|
||||
int inflateReset(z_streamp strm)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
|
||||
@ -150,7 +150,7 @@ int ZEXPORT inflateReset(z_streamp strm)
|
||||
return inflateResetKeep(strm);
|
||||
}
|
||||
|
||||
int ZEXPORT inflateReset2(z_streamp strm, int windowBits)
|
||||
int inflateReset2(z_streamp strm, int windowBits)
|
||||
{
|
||||
int wrap;
|
||||
struct inflate_state FAR *state = NULL;
|
||||
@ -187,7 +187,7 @@ int ZEXPORT inflateReset2(z_streamp strm, int windowBits)
|
||||
return inflateReset(strm);
|
||||
}
|
||||
|
||||
int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, const char *version, int stream_size)
|
||||
int inflateInit2_(z_streamp strm, int windowBits, const char *version, int stream_size)
|
||||
{
|
||||
int ret;
|
||||
struct inflate_state FAR *state;
|
||||
@ -225,12 +225,12 @@ int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, const char *version, i
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ZEXPORT inflateInit_(z_streamp strm, const char *version, int stream_size)
|
||||
int inflateInit_(z_streamp strm, const char *version, int stream_size)
|
||||
{
|
||||
return inflateInit2_(strm, DEF_WBITS, version, stream_size);
|
||||
}
|
||||
|
||||
int ZEXPORT inflatePrime(z_streamp strm, int bits, int value)
|
||||
int inflatePrime(z_streamp strm, int bits, int value)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
|
||||
@ -258,7 +258,7 @@ int ZEXPORT inflatePrime(z_streamp strm, int bits, int value)
|
||||
used for threaded applications, since the rewriting of the tables and virgin
|
||||
may not be thread-safe.
|
||||
*/
|
||||
local void fixedtables(struct inflate_state FAR *state)
|
||||
static void fixedtables(struct inflate_state FAR *state)
|
||||
{
|
||||
#ifdef BUILDFIXED
|
||||
static int virgin = 1;
|
||||
@ -375,7 +375,7 @@ void makefixed(void)
|
||||
output will fall in the output data, making match copies simpler and faster.
|
||||
The advantage may be dependent on the size of the processor's data caches.
|
||||
*/
|
||||
local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy)
|
||||
static int updatewindow(z_streamp strm, const Bytef *end, unsigned copy)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
unsigned dist;
|
||||
@ -598,7 +598,7 @@ when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it
|
||||
will return Z_BUF_ERROR if it has not reached the end of the stream.
|
||||
*/
|
||||
|
||||
int ZEXPORT inflate(z_streamp strm, int flush)
|
||||
int inflate(z_streamp strm, int flush)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
unsigned char FAR *next; /* next input */
|
||||
@ -1245,7 +1245,7 @@ inf_leave:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ZEXPORT inflateEnd(z_streamp strm)
|
||||
int inflateEnd(z_streamp strm)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == Z_NULL)
|
||||
@ -1258,7 +1258,7 @@ int ZEXPORT inflateEnd(z_streamp strm)
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
int ZEXPORT inflateGetDictionary(z_streamp strm, Bytef *dictionary, uInt *dictLength)
|
||||
int inflateGetDictionary(z_streamp strm, Bytef *dictionary, uInt *dictLength)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
|
||||
@ -1278,7 +1278,7 @@ int ZEXPORT inflateGetDictionary(z_streamp strm, Bytef *dictionary, uInt *dictLe
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
int ZEXPORT inflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength)
|
||||
int inflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
unsigned long dictid;
|
||||
@ -1310,7 +1310,7 @@ int ZEXPORT inflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt d
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
int ZEXPORT inflateGetHeader(z_streamp strm, gz_headerp head)
|
||||
int inflateGetHeader(z_streamp strm, gz_headerp head)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
|
||||
@ -1336,7 +1336,7 @@ int ZEXPORT inflateGetHeader(z_streamp strm, gz_headerp head)
|
||||
called again with more data and the *have state. *have is initialized to
|
||||
zero for the first call.
|
||||
*/
|
||||
local unsigned syncsearch(unsigned FAR *have, const unsigned char FAR *buf, unsigned len)
|
||||
static unsigned syncsearch(unsigned FAR *have, const unsigned char FAR *buf, unsigned len)
|
||||
{
|
||||
unsigned got;
|
||||
unsigned next;
|
||||
@ -1356,7 +1356,7 @@ local unsigned syncsearch(unsigned FAR *have, const unsigned char FAR *buf, unsi
|
||||
return next;
|
||||
}
|
||||
|
||||
int ZEXPORT inflateSync(z_streamp strm)
|
||||
int inflateSync(z_streamp strm)
|
||||
{
|
||||
unsigned len; /* number of bytes to look at or looked at */
|
||||
unsigned long in, out; /* temporary to save total_in and total_out */
|
||||
@ -1406,7 +1406,7 @@ int ZEXPORT inflateSync(z_streamp strm)
|
||||
block. When decompressing, PPP checks that at the end of input packet,
|
||||
inflate is waiting for these length bytes.
|
||||
*/
|
||||
int ZEXPORT inflateSyncPoint(z_streamp strm)
|
||||
int inflateSyncPoint(z_streamp strm)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
|
||||
@ -1415,7 +1415,7 @@ int ZEXPORT inflateSyncPoint(z_streamp strm)
|
||||
return state->mode == STORED && state->bits == 0;
|
||||
}
|
||||
|
||||
int ZEXPORT inflateCopy(z_streamp dest, z_streamp source)
|
||||
int inflateCopy(z_streamp dest, z_streamp source)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
struct inflate_state FAR *copy;
|
||||
@ -1460,7 +1460,7 @@ int ZEXPORT inflateCopy(z_streamp dest, z_streamp source)
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
int ZEXPORT inflateUndermine(z_streamp strm, int subvert)
|
||||
int inflateUndermine(z_streamp strm, int subvert)
|
||||
{
|
||||
struct inflate_state FAR *state = NULL;
|
||||
|
||||
@ -1476,7 +1476,7 @@ int ZEXPORT inflateUndermine(z_streamp strm, int subvert)
|
||||
#endif
|
||||
}
|
||||
|
||||
long ZEXPORT inflateMark(z_streamp strm)
|
||||
long inflateMark(z_streamp strm)
|
||||
{
|
||||
struct inflate_state FAR *state = NULL;
|
||||
|
||||
|
4
deps/libz/inftrees.h
vendored
4
deps/libz/inftrees.h
vendored
@ -60,8 +60,8 @@ typedef enum {
|
||||
DISTS
|
||||
} codetype;
|
||||
|
||||
int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
|
||||
int ZLIB_INTERNAL inflate_table (codetype type, unsigned short FAR *lens,
|
||||
unsigned codes, code FAR * FAR *table,
|
||||
unsigned FAR *bits, unsigned short FAR *work));
|
||||
unsigned FAR *bits, unsigned short FAR *work);
|
||||
|
||||
#endif
|
||||
|
98
deps/libz/trees.c
vendored
98
deps/libz/trees.c
vendored
@ -59,16 +59,16 @@
|
||||
#define REPZ_11_138 18
|
||||
/* repeat a zero length 11-138 times (7 bits of repeat count) */
|
||||
|
||||
local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
|
||||
static const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
|
||||
= {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
|
||||
|
||||
local const int extra_dbits[D_CODES] /* extra bits for each distance code */
|
||||
static const int extra_dbits[D_CODES] /* extra bits for each distance code */
|
||||
= {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
|
||||
|
||||
local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
|
||||
static const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
|
||||
= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
|
||||
|
||||
local const uch bl_order[BL_CODES]
|
||||
static const uch bl_order[BL_CODES]
|
||||
= {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
|
||||
/* The lengths of the bit length codes are sent in order of decreasing
|
||||
* probability, to avoid transmitting the lengths for unused bit length codes.
|
||||
@ -83,14 +83,14 @@ local const uch bl_order[BL_CODES]
|
||||
#if defined(GEN_TREES_H) || !defined(STDC)
|
||||
/* non ANSI compilers may not accept trees.h */
|
||||
|
||||
local ct_data static_ltree[L_CODES+2];
|
||||
static ct_data static_ltree[L_CODES+2];
|
||||
/* The static literal tree. Since the bit lengths are imposed, there is no
|
||||
* need for the L_CODES extra codes used during heap construction. However
|
||||
* The codes 286 and 287 are needed to build a canonical tree (see _tr_init
|
||||
* below).
|
||||
*/
|
||||
|
||||
local ct_data static_dtree[D_CODES];
|
||||
static ct_data static_dtree[D_CODES];
|
||||
/* The static distance tree. (Actually a trivial tree since all codes use
|
||||
* 5 bits.)
|
||||
*/
|
||||
@ -104,10 +104,10 @@ uch _dist_code[DIST_CODE_LEN];
|
||||
uch _length_code[MAX_MATCH-MIN_MATCH+1];
|
||||
/* length code for each normalized match length (0 == MIN_MATCH) */
|
||||
|
||||
local int base_length[LENGTH_CODES];
|
||||
static int base_length[LENGTH_CODES];
|
||||
/* First normalized length for each code (0 = MIN_MATCH) */
|
||||
|
||||
local int base_dist[D_CODES];
|
||||
static int base_dist[D_CODES];
|
||||
/* First normalized distance for each code (0 = distance of 1) */
|
||||
|
||||
#else
|
||||
@ -122,41 +122,41 @@ struct static_tree_desc_s {
|
||||
int max_length; /* max bit length for the codes */
|
||||
};
|
||||
|
||||
local static_tree_desc static_l_desc =
|
||||
static static_tree_desc static_l_desc =
|
||||
{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
|
||||
|
||||
local static_tree_desc static_d_desc =
|
||||
static static_tree_desc static_d_desc =
|
||||
{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
|
||||
|
||||
local static_tree_desc static_bl_desc =
|
||||
static static_tree_desc static_bl_desc =
|
||||
{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
|
||||
|
||||
/* ===========================================================================
|
||||
* Local (static) routines in this file.
|
||||
*/
|
||||
|
||||
local void tr_static_init OF((void));
|
||||
local void init_block OF((deflate_state *s));
|
||||
local void pqdownheap OF((deflate_state *s, ct_data *tree, int k));
|
||||
local void gen_bitlen OF((deflate_state *s, tree_desc *desc));
|
||||
local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count));
|
||||
local void build_tree OF((deflate_state *s, tree_desc *desc));
|
||||
local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code));
|
||||
local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
|
||||
local int build_bl_tree OF((deflate_state *s));
|
||||
local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
|
||||
int blcodes));
|
||||
local void compress_block OF((deflate_state *s, const ct_data *ltree,
|
||||
const ct_data *dtree));
|
||||
local int detect_data_type OF((deflate_state *s));
|
||||
local unsigned bi_reverse OF((unsigned value, int length));
|
||||
local void bi_windup OF((deflate_state *s));
|
||||
local void bi_flush OF((deflate_state *s));
|
||||
local void copy_block OF((deflate_state *s, charf *buf, unsigned len,
|
||||
int header));
|
||||
static void tr_static_init (void);
|
||||
static void init_block (deflate_state *s);
|
||||
static void pqdownheap (deflate_state *s, ct_data *tree, int k);
|
||||
static void gen_bitlen (deflate_state *s, tree_desc *desc);
|
||||
static void gen_codes (ct_data *tree, int max_code, ushf *bl_count);
|
||||
static void build_tree (deflate_state *s, tree_desc *desc);
|
||||
static void scan_tree (deflate_state *s, ct_data *tree, int max_code);
|
||||
static void send_tree (deflate_state *s, ct_data *tree, int max_code);
|
||||
static int build_bl_tree (deflate_state *s);
|
||||
static void send_all_trees (deflate_state *s, int lcodes, int dcodes,
|
||||
int blcodes);
|
||||
static void compress_block (deflate_state *s, const ct_data *ltree,
|
||||
const ct_data *dtree);
|
||||
static int detect_data_type (deflate_state *s);
|
||||
static unsigned bi_reverse (unsigned value, int length);
|
||||
static void bi_windup (deflate_state *s);
|
||||
static void bi_flush (deflate_state *s);
|
||||
static void copy_block (deflate_state *s, charf *buf, unsigned len,
|
||||
int header);
|
||||
|
||||
#ifdef GEN_TREES_H
|
||||
local void gen_trees_header OF((void));
|
||||
static void gen_trees_header (void);
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG
|
||||
@ -183,9 +183,9 @@ local void gen_trees_header OF((void));
|
||||
* IN assertion: length <= 16 and value fits in length bits.
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
local void send_bits OF((deflate_state *s, int value, int length));
|
||||
static void send_bits (deflate_state *s, int value, int length);
|
||||
|
||||
local void send_bits(deflate_state *s, int value, int length)
|
||||
static void send_bits(deflate_state *s, int value, int length)
|
||||
{
|
||||
Tracevv((stderr," l %2d v %4x ", length, value));
|
||||
Assert(length > 0 && length <= 15, "invalid length");
|
||||
@ -228,7 +228,7 @@ local void send_bits(deflate_state *s, int value, int length)
|
||||
/* ===========================================================================
|
||||
* Initialize the various 'constant' tables.
|
||||
*/
|
||||
local void tr_static_init(void)
|
||||
static void tr_static_init(void)
|
||||
{
|
||||
#if defined(GEN_TREES_H) || !defined(STDC)
|
||||
static int static_init_done = 0;
|
||||
@ -402,7 +402,7 @@ void ZLIB_INTERNAL _tr_init(deflate_state *s)
|
||||
/* ===========================================================================
|
||||
* Initialize a new block.
|
||||
*/
|
||||
local void init_block(deflate_state *s)
|
||||
static void init_block(deflate_state *s)
|
||||
{
|
||||
int n; /* iterates over tree elements */
|
||||
|
||||
@ -445,7 +445,7 @@ local void init_block(deflate_state *s)
|
||||
* when the heap property is re-established (each father smaller than its
|
||||
* two sons).
|
||||
*/
|
||||
local void pqdownheap(deflate_state *s, ct_data *tree, int k)
|
||||
static void pqdownheap(deflate_state *s, ct_data *tree, int k)
|
||||
{
|
||||
int v = s->heap[k];
|
||||
int j = k << 1; /* left son of k */
|
||||
@ -477,7 +477,7 @@ local void pqdownheap(deflate_state *s, ct_data *tree, int k)
|
||||
* The length opt_len is updated; static_len is also updated if stree is
|
||||
* not null.
|
||||
*/
|
||||
local void gen_bitlen(deflate_state *s, tree_desc *desc)
|
||||
static void gen_bitlen(deflate_state *s, tree_desc *desc)
|
||||
{
|
||||
ct_data *tree = desc->dyn_tree;
|
||||
int max_code = desc->max_code;
|
||||
@ -562,7 +562,7 @@ local void gen_bitlen(deflate_state *s, tree_desc *desc)
|
||||
* OUT assertion: the field code is set for all tree elements of non
|
||||
* zero code length.
|
||||
*/
|
||||
local void gen_codes (ct_data *tree, int max_code, ushf *bl_count)
|
||||
static void gen_codes (ct_data *tree, int max_code, ushf *bl_count)
|
||||
{
|
||||
ush next_code[MAX_BITS+1]; /* next code value for each bit length */
|
||||
ush codes = 0; /* running code value */
|
||||
@ -601,7 +601,7 @@ local void gen_codes (ct_data *tree, int max_code, ushf *bl_count)
|
||||
* and corresponding code. The length opt_len is updated; static_len is
|
||||
* also updated if stree is not null. The field max_code is set.
|
||||
*/
|
||||
local void build_tree(deflate_state *s, tree_desc *desc)
|
||||
static void build_tree(deflate_state *s, tree_desc *desc)
|
||||
{
|
||||
ct_data *tree = desc->dyn_tree;
|
||||
const ct_data *stree = desc->stat_desc->static_tree;
|
||||
@ -687,7 +687,7 @@ local void build_tree(deflate_state *s, tree_desc *desc)
|
||||
* Scan a literal or distance tree to determine the frequencies of the codes
|
||||
* in the bit length tree.
|
||||
*/
|
||||
local void scan_tree (deflate_state *s, ct_data *tree, int max_code)
|
||||
static void scan_tree (deflate_state *s, ct_data *tree, int max_code)
|
||||
{
|
||||
int n; /* iterates over all tree elements */
|
||||
int prevlen = -1; /* last emitted length */
|
||||
@ -729,7 +729,7 @@ local void scan_tree (deflate_state *s, ct_data *tree, int max_code)
|
||||
* Send a literal or distance tree in compressed form, using the codes in
|
||||
* bl_tree.
|
||||
*/
|
||||
local void send_tree (deflate_state *s, ct_data *tree, int max_code)
|
||||
static void send_tree (deflate_state *s, ct_data *tree, int max_code)
|
||||
{
|
||||
int n; /* iterates over all tree elements */
|
||||
int prevlen = -1; /* last emitted length */
|
||||
@ -777,7 +777,7 @@ local void send_tree (deflate_state *s, ct_data *tree, int max_code)
|
||||
* Construct the Huffman tree for the bit lengths and return the index in
|
||||
* bl_order of the last bit length code to send.
|
||||
*/
|
||||
local int build_bl_tree(deflate_state *s)
|
||||
static int build_bl_tree(deflate_state *s)
|
||||
{
|
||||
int max_blindex; /* index of last bit length code of non zero freq */
|
||||
|
||||
@ -811,7 +811,7 @@ local int build_bl_tree(deflate_state *s)
|
||||
* lengths of the bit length codes, the literal tree and the distance tree.
|
||||
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
|
||||
*/
|
||||
local void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes)
|
||||
static void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes)
|
||||
{
|
||||
int rank; /* index in bl_order */
|
||||
|
||||
@ -1020,7 +1020,7 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len,
|
||||
/* ===========================================================================
|
||||
* Send the block data compressed using the given Huffman trees
|
||||
*/
|
||||
local void compress_block(deflate_state *s, const ct_data *ltree, const ct_data *dtree)
|
||||
static void compress_block(deflate_state *s, const ct_data *ltree, const ct_data *dtree)
|
||||
{
|
||||
unsigned dist; /* distance of matched string */
|
||||
int lc; /* match length or unmatched char (if dist == 0) */
|
||||
@ -1077,7 +1077,7 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len,
|
||||
* (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
|
||||
* IN assertion: the fields Freq of dyn_ltree are set.
|
||||
*/
|
||||
local int detect_data_type(deflate_state *s)
|
||||
static int detect_data_type(deflate_state *s)
|
||||
{
|
||||
/* black_mask is the bit mask of black-listed bytes
|
||||
* set bits 0..6, 14..25, and 28..31
|
||||
@ -1110,7 +1110,7 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len,
|
||||
* method would use a table)
|
||||
* IN assertion: 1 <= len <= 15
|
||||
*/
|
||||
local unsigned bi_reverse(unsigned codes, int len)
|
||||
static unsigned bi_reverse(unsigned codes, int len)
|
||||
{
|
||||
register unsigned res = 0;
|
||||
do {
|
||||
@ -1123,7 +1123,7 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len,
|
||||
/* ===========================================================================
|
||||
* Flush the bit buffer, keeping at most 7 bits in it.
|
||||
*/
|
||||
local void bi_flush(deflate_state *s)
|
||||
static void bi_flush(deflate_state *s)
|
||||
{
|
||||
if (s->bi_valid == 16) {
|
||||
put_short(s, s->bi_buf);
|
||||
@ -1139,7 +1139,7 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len,
|
||||
/* ===========================================================================
|
||||
* Flush the bit buffer and align the output on a byte boundary
|
||||
*/
|
||||
local void bi_windup(deflate_state *s)
|
||||
static void bi_windup(deflate_state *s)
|
||||
{
|
||||
if (s->bi_valid > 8) {
|
||||
put_short(s, s->bi_buf);
|
||||
@ -1157,7 +1157,7 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len,
|
||||
* Copy a stored block, storing first the length and its
|
||||
* one's complement if requested.
|
||||
*/
|
||||
local void copy_block(deflate_state *s, charf *buf, unsigned len, int header)
|
||||
static void copy_block(deflate_state *s, charf *buf, unsigned len, int header)
|
||||
{
|
||||
bi_windup(s); /* align on byte boundary */
|
||||
|
||||
|
2
deps/libz/uncompr.c
vendored
2
deps/libz/uncompr.c
vendored
@ -21,7 +21,7 @@
|
||||
enough memory, Z_BUF_ERROR if there was not enough room in the output
|
||||
buffer, or Z_DATA_ERROR if the input data was corrupted.
|
||||
*/
|
||||
int ZEXPORT uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
|
||||
int uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
|
||||
{
|
||||
z_stream stream;
|
||||
int err;
|
||||
|
37
deps/libz/zconf.h
vendored
37
deps/libz/zconf.h
vendored
@ -309,15 +309,6 @@
|
||||
/* If building or using zlib as a DLL, define ZLIB_DLL.
|
||||
* This is not mandatory, but it offers a little performance increase.
|
||||
*/
|
||||
# ifdef ZLIB_DLL
|
||||
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXTERN extern __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXTERN extern __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
# endif /* ZLIB_DLL */
|
||||
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
|
||||
* define ZLIB_WINAPI.
|
||||
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
||||
@ -329,37 +320,9 @@
|
||||
# include <windows.h>
|
||||
/* No need for _export, use ZLIB.DEF instead. */
|
||||
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
|
||||
# define ZEXPORT WINAPI
|
||||
# ifdef WIN32
|
||||
# define ZEXPORTVA WINAPIV
|
||||
# else
|
||||
# define ZEXPORTVA FAR CDECL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (__BEOS__)
|
||||
# ifdef ZLIB_DLL
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXPORT __declspec(dllexport)
|
||||
# define ZEXPORTVA __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXPORT __declspec(dllimport)
|
||||
# define ZEXPORTVA __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ZEXTERN
|
||||
# define ZEXTERN extern
|
||||
#endif
|
||||
#ifndef ZEXPORT
|
||||
# define ZEXPORT
|
||||
#endif
|
||||
#ifndef ZEXPORTVA
|
||||
# define ZEXPORTVA
|
||||
#endif
|
||||
|
||||
#ifndef FAR
|
||||
# define FAR
|
||||
#endif
|
||||
|
37
deps/libz/zconf.h.in
vendored
37
deps/libz/zconf.h.in
vendored
@ -309,15 +309,6 @@
|
||||
/* If building or using zlib as a DLL, define ZLIB_DLL.
|
||||
* This is not mandatory, but it offers a little performance increase.
|
||||
*/
|
||||
# ifdef ZLIB_DLL
|
||||
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXTERN extern __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXTERN extern __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
# endif /* ZLIB_DLL */
|
||||
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
|
||||
* define ZLIB_WINAPI.
|
||||
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
||||
@ -329,37 +320,9 @@
|
||||
# include <windows.h>
|
||||
/* No need for _export, use ZLIB.DEF instead. */
|
||||
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
|
||||
# define ZEXPORT WINAPI
|
||||
# ifdef WIN32
|
||||
# define ZEXPORTVA WINAPIV
|
||||
# else
|
||||
# define ZEXPORTVA FAR CDECL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (__BEOS__)
|
||||
# ifdef ZLIB_DLL
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXPORT __declspec(dllexport)
|
||||
# define ZEXPORTVA __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXPORT __declspec(dllimport)
|
||||
# define ZEXPORTVA __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ZEXTERN
|
||||
# define ZEXTERN extern
|
||||
#endif
|
||||
#ifndef ZEXPORT
|
||||
# define ZEXPORT
|
||||
#endif
|
||||
#ifndef ZEXPORTVA
|
||||
# define ZEXPORTVA
|
||||
#endif
|
||||
|
||||
#ifndef FAR
|
||||
# define FAR
|
||||
#endif
|
||||
|
156
deps/libz/zutil.c
vendored
156
deps/libz/zutil.c
vendored
@ -23,12 +23,12 @@ char z_errmsg[10][21] = {
|
||||
""};
|
||||
|
||||
|
||||
const char * ZEXPORT zlibVersion(void)
|
||||
const char * zlibVersion(void)
|
||||
{
|
||||
return ZLIB_VERSION;
|
||||
}
|
||||
|
||||
uLong ZEXPORT zlibCompileFlags(void)
|
||||
uLong zlibCompileFlags(void)
|
||||
{
|
||||
uLong flags;
|
||||
|
||||
@ -128,7 +128,7 @@ void ZLIB_INTERNAL z_error (char *m)
|
||||
/* exported to allow conversion of error code to string for compress() and
|
||||
* uncompress()
|
||||
*/
|
||||
const char * ZEXPORT zError(int err)
|
||||
const char * zError(int err)
|
||||
{
|
||||
return ERR_MSG(err);
|
||||
}
|
||||
@ -141,152 +141,6 @@ const char * ZEXPORT zError(int err)
|
||||
int errno = 0;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_MEMCPY
|
||||
|
||||
void ZLIB_INTERNAL zmemcpy(Bytef *dest, const Bytef *source, uInt len)
|
||||
{
|
||||
if (len == 0) return;
|
||||
do {
|
||||
*dest++ = *source++; /* ??? to be unrolled */
|
||||
} while (--len != 0);
|
||||
}
|
||||
|
||||
int ZLIB_INTERNAL zmemcmp(const Bytef *s1, const Bytef *s2, uInt len)
|
||||
{
|
||||
uInt j;
|
||||
|
||||
for (j = 0; j < len; j++) {
|
||||
if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ZLIB_INTERNAL zmemzero(Bytef *dest, uInt len)
|
||||
{
|
||||
if (len == 0) return;
|
||||
do {
|
||||
*dest++ = 0; /* ??? to be unrolled */
|
||||
} while (--len != 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef Z_SOLO
|
||||
|
||||
#ifdef SYS16BIT
|
||||
|
||||
#ifdef __TURBOC__
|
||||
/* Turbo C in 16-bit mode */
|
||||
|
||||
# define MY_ZCALLOC
|
||||
|
||||
/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
|
||||
* and farmalloc(64K) returns a pointer with an offset of 8, so we
|
||||
* must fix the pointer. Warning: the pointer must be put back to its
|
||||
* original form in order to free it, use zcfree().
|
||||
*/
|
||||
|
||||
#define MAX_PTR 10
|
||||
/* 10*64K = 640K */
|
||||
|
||||
local int next_ptr = 0;
|
||||
|
||||
typedef struct ptr_table_s {
|
||||
voidpf org_ptr;
|
||||
voidpf new_ptr;
|
||||
} ptr_table;
|
||||
|
||||
local ptr_table table[MAX_PTR];
|
||||
/* This table is used to remember the original form of pointers
|
||||
* to large buffers (64K). Such pointers are normalized with a zero offset.
|
||||
* Since MSDOS is not a preemptive multitasking OS, this table is not
|
||||
* protected from concurrent access. This hack doesn't work anyway on
|
||||
* a protected system like OS/2. Use Microsoft C instead.
|
||||
*/
|
||||
|
||||
voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
|
||||
{
|
||||
voidpf buf = opaque; /* just to make some compilers happy */
|
||||
ulg bsize = (ulg)items*size;
|
||||
|
||||
/* If we allocate less than 65520 bytes, we assume that farmalloc
|
||||
* will return a usable pointer which doesn't have to be normalized.
|
||||
*/
|
||||
if (bsize < 65520L) {
|
||||
buf = farmalloc(bsize);
|
||||
if (*(ush*)&buf != 0) return buf;
|
||||
} else {
|
||||
buf = farmalloc(bsize + 16L);
|
||||
}
|
||||
if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
|
||||
table[next_ptr].org_ptr = buf;
|
||||
|
||||
/* Normalize the pointer to seg:0 */
|
||||
*((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
|
||||
*(ush*)&buf = 0;
|
||||
table[next_ptr++].new_ptr = buf;
|
||||
return buf;
|
||||
}
|
||||
|
||||
void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
|
||||
{
|
||||
int n;
|
||||
if (*(ush*)&ptr != 0) { /* object < 64K */
|
||||
farfree(ptr);
|
||||
return;
|
||||
}
|
||||
/* Find the original pointer */
|
||||
for (n = 0; n < next_ptr; n++) {
|
||||
if (ptr != table[n].new_ptr) continue;
|
||||
|
||||
farfree(table[n].org_ptr);
|
||||
while (++n < next_ptr) {
|
||||
table[n-1] = table[n];
|
||||
}
|
||||
next_ptr--;
|
||||
return;
|
||||
}
|
||||
ptr = opaque; /* just to make some compilers happy */
|
||||
Assert(0, "zcfree: ptr not found");
|
||||
}
|
||||
|
||||
#endif /* __TURBOC__ */
|
||||
|
||||
|
||||
#ifdef M_I86
|
||||
/* Microsoft C in 16-bit mode */
|
||||
|
||||
# define MY_ZCALLOC
|
||||
|
||||
#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
|
||||
# define _halloc halloc
|
||||
# define _hfree hfree
|
||||
#endif
|
||||
|
||||
voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
|
||||
{
|
||||
if (opaque) opaque = 0; /* to make compiler happy */
|
||||
return _halloc((long)items, size);
|
||||
}
|
||||
|
||||
void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
|
||||
{
|
||||
if (opaque) opaque = 0; /* to make compiler happy */
|
||||
_hfree(ptr);
|
||||
}
|
||||
|
||||
#endif /* M_I86 */
|
||||
|
||||
#endif /* SYS16BIT */
|
||||
|
||||
|
||||
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
|
||||
|
||||
#ifndef STDC
|
||||
extern voidp malloc OF((uInt size));
|
||||
extern voidp calloc OF((uInt items, uInt size));
|
||||
extern void free OF((voidpf ptr));
|
||||
#endif
|
||||
|
||||
voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
|
||||
{
|
||||
if (opaque) items += size - size; /* make compiler happy */
|
||||
@ -299,7 +153,3 @@ void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
|
||||
free(ptr);
|
||||
if (opaque) return; /* make compiler happy */
|
||||
}
|
||||
|
||||
#endif /* MY_ZCALLOC */
|
||||
|
||||
#endif /* !Z_SOLO */
|
||||
|
Loading…
x
Reference in New Issue
Block a user