(zlib) Build fixes - who knew making this shit portable would

be so time-consuming?
This commit is contained in:
twinaphex 2014-01-10 20:09:47 +01:00
parent a2d713b3cb
commit 05eaa7ade1
7 changed files with 77 additions and 202 deletions

20
deps/rzlib/adler32.c vendored
View File

@ -62,10 +62,7 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
#endif #endif
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT adler32(adler, buf, len) uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)
uLong adler;
const Bytef *buf;
uInt len;
{ {
unsigned long sum2; unsigned long sum2;
unsigned n; unsigned n;
@ -133,10 +130,7 @@ uLong ZEXPORT adler32(adler, buf, len)
} }
/* ========================================================================= */ /* ========================================================================= */
local uLong adler32_combine_(adler1, adler2, len2) local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2)
uLong adler1;
uLong adler2;
z_off64_t len2;
{ {
unsigned long sum1; unsigned long sum1;
unsigned long sum2; unsigned long sum2;
@ -162,18 +156,12 @@ local uLong adler32_combine_(adler1, adler2, len2)
} }
/* ========================================================================= */ /* ========================================================================= */
uLong ZEXPORT adler32_combine(adler1, adler2, len2) uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2)
uLong adler1;
uLong adler2;
z_off_t len2;
{ {
return adler32_combine_(adler1, adler2, len2); return adler32_combine_(adler1, adler2, len2);
} }
uLong ZEXPORT adler32_combine64(adler1, adler2, len2) uLong ZEXPORT adler32_combine64(uLong adler1, uLong adler2, z_off64_t len2)
uLong adler1;
uLong adler2;
z_off64_t len2;
{ {
return adler32_combine_(adler1, adler2, len2); return adler32_combine_(adler1, adler2, len2);
} }

16
deps/rzlib/compress.c vendored
View File

@ -19,12 +19,7 @@
memory, Z_BUF_ERROR if there was not enough room in the output buffer, memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid. Z_STREAM_ERROR if the level parameter is invalid.
*/ */
int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) int ZEXPORT compress2 (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
int level;
{ {
z_stream stream; z_stream stream;
int err; int err;
@ -59,11 +54,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
/* =========================================================================== /* ===========================================================================
*/ */
int ZEXPORT compress (dest, destLen, source, sourceLen) int ZEXPORT compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
{ {
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
} }
@ -72,8 +63,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen)
If the default memLevel or windowBits for deflateInit() is changed, then If the default memLevel or windowBits for deflateInit() is changed, then
this function needs to be updated. this function needs to be updated.
*/ */
uLong ZEXPORT compressBound (sourceLen) uLong ZEXPORT compressBound (uLong sourceLen)
uLong sourceLen;
{ {
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13; (sourceLen >> 25) + 13;

130
deps/rzlib/deflate.c vendored
View File

@ -194,11 +194,7 @@ local const config configuration_table[10] = {
zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateInit_(strm, level, version, stream_size) int ZEXPORT deflateInit_(z_streamp strm, int level, const char *version, int stream_size)
z_streamp strm;
int level;
const char *version;
int stream_size;
{ {
return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
Z_DEFAULT_STRATEGY, version, stream_size); Z_DEFAULT_STRATEGY, version, stream_size);
@ -206,16 +202,8 @@ int ZEXPORT deflateInit_(strm, level, version, stream_size)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy,
version, stream_size) const char *version, int stream_size)
z_streamp strm;
int level;
int method;
int windowBits;
int memLevel;
int strategy;
const char *version;
int stream_size;
{ {
deflate_state *s; deflate_state *s;
int wrap = 1; int wrap = 1;
@ -316,10 +304,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) int ZEXPORT deflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength)
z_streamp strm;
const Bytef *dictionary;
uInt dictLength;
{ {
deflate_state *s; deflate_state *s;
uInt str, n; uInt str, n;
@ -329,7 +314,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL) if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
s = strm->state; s = (deflate_state*)strm->state;
wrap = s->wrap; wrap = s->wrap;
if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead) if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead)
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
@ -385,8 +370,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateResetKeep (strm) int ZEXPORT deflateResetKeep (z_streamp strm)
z_streamp strm;
{ {
deflate_state *s; deflate_state *s;
@ -420,21 +404,18 @@ int ZEXPORT deflateResetKeep (strm)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateReset (strm) int ZEXPORT deflateReset (z_streamp strm)
z_streamp strm;
{ {
int ret; int ret;
ret = deflateResetKeep(strm); ret = deflateResetKeep(strm);
if (ret == Z_OK) if (ret == Z_OK)
lm_init(strm->state); lm_init((deflate_state*)strm->state);
return ret; return ret;
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateSetHeader (strm, head) int ZEXPORT deflateSetHeader (z_streamp strm, gz_headerp head)
z_streamp strm;
gz_headerp head;
{ {
struct internal_state_deflate *state = (struct internal_state_deflate*)strm->state; struct internal_state_deflate *state = (struct internal_state_deflate*)strm->state;
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
@ -445,10 +426,7 @@ int ZEXPORT deflateSetHeader (strm, head)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflatePending (strm, pending, bits) int ZEXPORT deflatePending (z_streamp strm, unsigned *pending, int *bits)
unsigned *pending;
int *bits;
z_streamp strm;
{ {
struct internal_state_deflate *state = (struct internal_state_deflate*)strm->state; struct internal_state_deflate *state = (struct internal_state_deflate*)strm->state;
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
@ -460,16 +438,13 @@ int ZEXPORT deflatePending (strm, pending, bits)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflatePrime (strm, bits, value) int ZEXPORT deflatePrime (z_streamp strm, int bits, int value)
z_streamp strm;
int bits;
int value;
{ {
deflate_state *s; deflate_state *s;
int put; int put;
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
s = strm->state; s = (deflate_state*)strm->state;
if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
return Z_BUF_ERROR; return Z_BUF_ERROR;
do { do {
@ -486,17 +461,14 @@ int ZEXPORT deflatePrime (strm, bits, value)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateParams(strm, level, strategy) int ZEXPORT deflateParams(z_streamp strm, int level, int strategy)
z_streamp strm;
int level;
int strategy;
{ {
deflate_state *s; deflate_state *s;
compress_func func; compress_func func;
int err = Z_OK; int err = Z_OK;
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
s = strm->state; s = (deflate_state*)strm->state;
#ifdef FASTEST #ifdef FASTEST
if (level != 0) level = 1; if (level != 0) level = 1;
@ -527,17 +499,12 @@ int ZEXPORT deflateParams(strm, level, strategy)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) int ZEXPORT deflateTune(z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain)
z_streamp strm;
int good_length;
int max_lazy;
int nice_length;
int max_chain;
{ {
deflate_state *s; deflate_state *s;
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
s = strm->state; s = (deflate_state*)strm->state;
s->good_match = good_length; s->good_match = good_length;
s->max_lazy_match = max_lazy; s->max_lazy_match = max_lazy;
s->nice_match = nice_length; s->nice_match = nice_length;
@ -562,9 +529,7 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
* upper bound of about 14% expansion does not seem onerous for output buffer * upper bound of about 14% expansion does not seem onerous for output buffer
* allocation. * allocation.
*/ */
uLong ZEXPORT deflateBound(strm, sourceLen) uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen)
z_streamp strm;
uLong sourceLen;
{ {
deflate_state *s; deflate_state *s;
uLong complen, wraplen; uLong complen, wraplen;
@ -579,7 +544,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
return complen + 6; return complen + 6;
/* compute wrapper length */ /* compute wrapper length */
s = strm->state; s = (deflate_state*)strm->state;
switch (s->wrap) { switch (s->wrap) {
case 0: /* raw deflate */ case 0: /* raw deflate */
wraplen = 0; wraplen = 0;
@ -624,9 +589,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
* IN assertion: the stream state is correct and there is enough room in * IN assertion: the stream state is correct and there is enough room in
* pending_buf. * pending_buf.
*/ */
local void putShortMSB (s, b) local void putShortMSB (deflate_state *s, uInt b)
deflate_state *s;
uInt b;
{ {
put_byte(s, (Byte)(b >> 8)); put_byte(s, (Byte)(b >> 8));
put_byte(s, (Byte)(b & 0xff)); put_byte(s, (Byte)(b & 0xff));
@ -638,11 +601,10 @@ local void putShortMSB (s, b)
* to avoid allocating a large strm->next_out buffer and copying into it. * to avoid allocating a large strm->next_out buffer and copying into it.
* (See also read_buf()). * (See also read_buf()).
*/ */
local void flush_pending(strm) local void flush_pending(z_streamp strm)
z_streamp strm;
{ {
unsigned len; unsigned len;
deflate_state *s = strm->state; deflate_state *s = (deflate_state*)strm->state;
_tr_flush_bits(s); _tr_flush_bits(s);
len = s->pending; len = s->pending;
@ -661,9 +623,7 @@ local void flush_pending(strm)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflate (strm, flush) int ZEXPORT deflate (z_streamp strm, int flush)
z_streamp strm;
int flush;
{ {
int old_flush; /* value of flush param for previous deflate call */ int old_flush; /* value of flush param for previous deflate call */
deflate_state *s; deflate_state *s;
@ -672,7 +632,7 @@ int ZEXPORT deflate (strm, flush)
flush > Z_BLOCK || flush < 0) { flush > Z_BLOCK || flush < 0) {
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
} }
s = strm->state; s = (deflate_state*)strm->state;
if (strm->next_out == Z_NULL || if (strm->next_out == Z_NULL ||
(strm->next_in == Z_NULL && strm->avail_in != 0) || (strm->next_in == Z_NULL && strm->avail_in != 0) ||
@ -975,8 +935,7 @@ int ZEXPORT deflate (strm, flush)
} }
/* ========================================================================= */ /* ========================================================================= */
int ZEXPORT deflateEnd (strm) int ZEXPORT deflateEnd (z_streamp strm)
z_streamp strm;
{ {
struct internal_state_deflate *state; struct internal_state_deflate *state;
int status; int status;
@ -1012,9 +971,7 @@ int ZEXPORT deflateEnd (strm)
* To simplify the source, this is not supported for 16-bit MSDOS (which * To simplify the source, this is not supported for 16-bit MSDOS (which
* doesn't have enough memory anyway to duplicate compression states). * doesn't have enough memory anyway to duplicate compression states).
*/ */
int ZEXPORT deflateCopy (dest, source) int ZEXPORT deflateCopy (z_streamp dest, z_streamp source)
z_streamp dest;
z_streamp source;
{ {
#ifdef MAXSEG_64K #ifdef MAXSEG_64K
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
@ -1028,7 +985,7 @@ int ZEXPORT deflateCopy (dest, source)
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
} }
ss = source->state; ss = (deflate_state*)source->state;
zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
@ -1074,10 +1031,7 @@ int ZEXPORT deflateCopy (dest, source)
* allocating a large strm->next_in buffer and copying from it. * allocating a large strm->next_in buffer and copying from it.
* (See also flush_pending()). * (See also flush_pending()).
*/ */
local int read_buf(strm, buf, size) local int read_buf(z_streamp strm, Bytef *buf, unsigned size)
z_streamp strm;
Bytef *buf;
unsigned size;
{ {
struct internal_state_deflate *state = (struct internal_state_deflate*)strm->state; struct internal_state_deflate *state = (struct internal_state_deflate*)strm->state;
unsigned len = strm->avail_in; unsigned len = strm->avail_in;
@ -1105,8 +1059,7 @@ local int read_buf(strm, buf, size)
/* =========================================================================== /* ===========================================================================
* Initialize the "longest match" routines for a new zlib stream * Initialize the "longest match" routines for a new zlib stream
*/ */
local void lm_init (s) local void lm_init (deflate_state *s)
deflate_state *s;
{ {
s->window_size = (ulg)2L*s->w_size; s->window_size = (ulg)2L*s->w_size;
@ -1147,9 +1100,7 @@ local void lm_init (s)
/* For 80x86 and 680x0, an optimized version will be provided in match.asm or /* For 80x86 and 680x0, an optimized version will be provided in match.asm or
* match.S. The code will be functionally equivalent. * match.S. The code will be functionally equivalent.
*/ */
local uInt longest_match(s, cur_match) local uInt longest_match(deflate_state *s, IPos cur_match)
deflate_state *s;
IPos cur_match; /* current match */
{ {
unsigned chain_length = s->max_chain_length;/* max hash chain length */ unsigned chain_length = s->max_chain_length;/* max hash chain length */
register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *scan = s->window + s->strstart; /* current string */
@ -1389,8 +1340,7 @@ local void check_match(s, start, match, length)
* performed for at least two bytes (required for the zip translate_eol * performed for at least two bytes (required for the zip translate_eol
* option -- not supported here). * option -- not supported here).
*/ */
local void fill_window(s) local void fill_window(deflate_state *s)
deflate_state *s;
{ {
register unsigned n, m; register unsigned n, m;
register Posf *p; register Posf *p;
@ -1563,9 +1513,7 @@ local void fill_window(s)
* NOTE: this function should be optimized to avoid extra copying from * NOTE: this function should be optimized to avoid extra copying from
* window to pending_buf. * window to pending_buf.
*/ */
local block_state deflate_stored(s, flush) local block_state deflate_stored(deflate_state *s, int flush)
deflate_state *s;
int flush;
{ {
/* Stored blocks are limited to 0xffff bytes, pending_buf is limited /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
* to pending_buf_size, and each stored block has a 5 byte header: * to pending_buf_size, and each stored block has a 5 byte header:
@ -1627,9 +1575,7 @@ local block_state deflate_stored(s, flush)
* new strings in the dictionary only for unmatched strings or for short * new strings in the dictionary only for unmatched strings or for short
* matches. It is used only for the fast compression options. * matches. It is used only for the fast compression options.
*/ */
local block_state deflate_fast(s, flush) local block_state deflate_fast(deflate_state *s, int flush)
deflate_state *s;
int flush;
{ {
IPos hash_head; /* head of the hash chain */ IPos hash_head; /* head of the hash chain */
int bflush; /* set if current block must be flushed */ int bflush; /* set if current block must be flushed */
@ -1729,9 +1675,7 @@ local block_state deflate_fast(s, flush)
* evaluation for matches: a match is finally adopted only if there is * evaluation for matches: a match is finally adopted only if there is
* no better match at the next window position. * no better match at the next window position.
*/ */
local block_state deflate_slow(s, flush) local block_state deflate_slow(deflate_state *s, int flush)
deflate_state *s;
int flush;
{ {
IPos hash_head; /* head of hash chain */ IPos hash_head; /* head of hash chain */
int bflush; /* set if current block must be flushed */ int bflush; /* set if current block must be flushed */
@ -1860,9 +1804,7 @@ local block_state deflate_slow(s, flush)
* one. Do not maintain a hash table. (It will be regenerated if this run of * one. Do not maintain a hash table. (It will be regenerated if this run of
* deflate switches away from Z_RLE.) * deflate switches away from Z_RLE.)
*/ */
local block_state deflate_rle(s, flush) local block_state deflate_rle(deflate_state *s, int flush)
deflate_state *s;
int flush;
{ {
int bflush; /* set if current block must be flushed */ int bflush; /* set if current block must be flushed */
uInt prev; /* byte at distance one to match */ uInt prev; /* byte at distance one to match */
@ -1933,9 +1875,7 @@ local block_state deflate_rle(s, flush)
* For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. * 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.) * (It will be regenerated if this run of deflate switches away from Huffman.)
*/ */
local block_state deflate_huff(s, flush) local block_state deflate_huff(deflate_state *s, int flush)
deflate_state *s;
int flush;
{ {
int bflush; /* set if current block must be flushed */ int bflush; /* set if current block must be flushed */

View File

@ -8,8 +8,7 @@
/* gzclose() is in a separate file so that it is linked in only if it is used. /* gzclose() is in a separate file so that it is linked in only if it is used.
That way the other gzclose functions can be used instead to avoid linking in That way the other gzclose functions can be used instead to avoid linking in
unneeded compression or decompression routines. */ unneeded compression or decompression routines. */
int ZEXPORT gzclose(file) int ZEXPORT gzclose(gzFile file)
gzFile file;
{ {
#ifndef NO_GZCOMPRESS #ifndef NO_GZCOMPRESS
gz_statep state; gz_statep state;

74
deps/rzlib/gzlib.c vendored
View File

@ -72,8 +72,7 @@ char ZLIB_INTERNAL *gz_strwinerror (error)
#endif /* UNDER_CE */ #endif /* UNDER_CE */
/* Reset gzip file state */ /* Reset gzip file state */
local void gz_reset(state) local void gz_reset(gz_statep state)
gz_statep state;
{ {
state->x.have = 0; /* no output data available */ state->x.have = 0; /* no output data available */
if (state->mode == GZ_READ) { /* for reading ... */ if (state->mode == GZ_READ) { /* for reading ... */
@ -88,10 +87,7 @@ local void gz_reset(state)
} }
/* Open a gzip file either by name or file descriptor. */ /* Open a gzip file either by name or file descriptor. */
local gzFile gz_open(path, fd, mode) local gzFile gz_open(const void *path, int fd, const char *mode)
const void *path;
int fd;
const char *mode;
{ {
gz_statep state; gz_statep state;
size_t len; size_t len;
@ -190,7 +186,7 @@ local gzFile gz_open(path, fd, mode)
/* save the path name for error messages */ /* save the path name for error messages */
#ifdef _WIN32 #ifdef _WIN32
if (fd == -2) { if (fd == -2) {
len = wcstombs(NULL, path, 0); len = wcstombs(NULL, (const wchar_t*)path, 0);
if (len == (size_t)-1) if (len == (size_t)-1)
len = 0; len = 0;
} }
@ -205,7 +201,7 @@ local gzFile gz_open(path, fd, mode)
#ifdef _WIN32 #ifdef _WIN32
if (fd == -2) if (fd == -2)
if (len) if (len)
wcstombs(state->path, path, len + 1); wcstombs(state->path, (const wchar_t*)path, len + 1);
else else
*(state->path) = 0; *(state->path) = 0;
else else
@ -240,7 +236,7 @@ local gzFile gz_open(path, fd, mode)
/* open the file with the appropriate flags (or just use fd) */ /* open the file with the appropriate flags (or just use fd) */
state->fd = fd > -1 ? fd : ( state->fd = fd > -1 ? fd : (
#ifdef _WIN32 #ifdef _WIN32
fd == -2 ? _wopen(path, oflag, 0666) : fd == -2 ? _wopen((const wchar_t*)path, oflag, 0666) :
#endif #endif
open((const char *)path, oflag, 0666)); open((const char *)path, oflag, 0666));
if (state->fd == -1) { if (state->fd == -1) {
@ -265,25 +261,19 @@ local gzFile gz_open(path, fd, mode)
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
gzFile ZEXPORT gzopen(path, mode) gzFile ZEXPORT gzopen(const char *path, const char *mode)
const char *path;
const char *mode;
{ {
return gz_open(path, -1, mode); return gz_open(path, -1, mode);
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
gzFile ZEXPORT gzopen64(path, mode) gzFile ZEXPORT gzopen64(const char *path, const char *mode)
const char *path;
const char *mode;
{ {
return gz_open(path, -1, mode); return gz_open(path, -1, mode);
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
gzFile ZEXPORT gzdopen(fd, mode) gzFile ZEXPORT gzdopen(int fd, const char *mode)
int fd;
const char *mode;
{ {
char *path; /* identifier for error messages */ char *path; /* identifier for error messages */
gzFile gz; gzFile gz;
@ -302,18 +292,14 @@ gzFile ZEXPORT gzdopen(fd, mode)
/* -- see zlib.h -- */ /* -- see zlib.h -- */
#ifdef _WIN32 #ifdef _WIN32
gzFile ZEXPORT gzopen_w(path, mode) gzFile ZEXPORT gzopen_w(const wchar_t *path, const char *mode)
const wchar_t *path;
const char *mode;
{ {
return gz_open(path, -2, mode); return gz_open(path, -2, mode);
} }
#endif #endif
/* -- see zlib.h -- */ /* -- see zlib.h -- */
int ZEXPORT gzbuffer(file, size) int ZEXPORT gzbuffer(gzFile file, unsigned size)
gzFile file;
unsigned size;
{ {
gz_statep state; gz_statep state;
@ -336,8 +322,7 @@ int ZEXPORT gzbuffer(file, size)
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
int ZEXPORT gzrewind(file) int ZEXPORT gzrewind(gzFile file)
gzFile file;
{ {
gz_statep state; gz_statep state;
@ -359,10 +344,7 @@ int ZEXPORT gzrewind(file)
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
z_off64_t ZEXPORT gzseek64(file, offset, whence) z_off64_t ZEXPORT gzseek64(gzFile file, z_off64_t offset, int whence)
gzFile file;
z_off64_t offset;
int whence;
{ {
unsigned n; unsigned n;
z_off64_t ret; z_off64_t ret;
@ -436,10 +418,7 @@ z_off64_t ZEXPORT gzseek64(file, offset, whence)
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
z_off_t ZEXPORT gzseek(file, offset, whence) z_off_t ZEXPORT gzseek(gzFile file, z_off_t offset, int whence)
gzFile file;
z_off_t offset;
int whence;
{ {
z_off64_t ret; z_off64_t ret;
@ -448,8 +427,7 @@ z_off_t ZEXPORT gzseek(file, offset, whence)
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
z_off64_t ZEXPORT gztell64(file) z_off64_t ZEXPORT gztell64(gzFile file)
gzFile file;
{ {
gz_statep state; gz_statep state;
@ -465,8 +443,7 @@ z_off64_t ZEXPORT gztell64(file)
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
z_off_t ZEXPORT gztell(file) z_off_t ZEXPORT gztell(gzFile file)
gzFile file;
{ {
z_off64_t ret; z_off64_t ret;
@ -475,8 +452,7 @@ z_off_t ZEXPORT gztell(file)
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
z_off64_t ZEXPORT gzoffset64(file) z_off64_t ZEXPORT gzoffset64(gzFile file)
gzFile file;
{ {
z_off64_t offset; z_off64_t offset;
gz_statep state; gz_statep state;
@ -498,8 +474,7 @@ z_off64_t ZEXPORT gzoffset64(file)
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
z_off_t ZEXPORT gzoffset(file) z_off_t ZEXPORT gzoffset(gzFile file)
gzFile file;
{ {
z_off64_t ret; z_off64_t ret;
@ -508,8 +483,7 @@ z_off_t ZEXPORT gzoffset(file)
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
int ZEXPORT gzeof(file) int ZEXPORT gzeof(gzFile file)
gzFile file;
{ {
gz_statep state; gz_statep state;
@ -525,9 +499,7 @@ int ZEXPORT gzeof(file)
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
const char * ZEXPORT gzerror(file, errnum) const char * ZEXPORT gzerror(gzFile file, int *errnum)
gzFile file;
int *errnum;
{ {
gz_statep state; gz_statep state;
@ -546,8 +518,7 @@ const char * ZEXPORT gzerror(file, errnum)
} }
/* -- see zlib.h -- */ /* -- see zlib.h -- */
void ZEXPORT gzclearerr(file) void ZEXPORT gzclearerr(gzFile file)
gzFile file;
{ {
gz_statep state; gz_statep state;
@ -572,10 +543,7 @@ void ZEXPORT gzclearerr(file)
memory). Simply save the error message as a static string. If there is an memory). Simply save the error message as a static string. If there is an
allocation failure constructing the error message, then convert the error to allocation failure constructing the error message, then convert the error to
out of memory. */ out of memory. */
void ZLIB_INTERNAL gz_error(state, err, msg) void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg)
gz_statep state;
int err;
const char *msg;
{ {
/* free previously allocated message and clear */ /* free previously allocated message and clear */
if (state->msg != NULL) { if (state->msg != NULL) {

22
deps/rzlib/gzread.c vendored
View File

@ -17,11 +17,7 @@ local int gz_skip OF((gz_statep, z_off64_t));
state->fd, and update state->eof, state->err, and state->msg as appropriate. 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 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. */ read the number of bytes requested, depending on the type of descriptor. */
local int gz_load(state, buf, len, have) local int gz_load(gz_statep state, unsigned char *buf, unsigned len, unsigned *have)
gz_statep state;
unsigned char *buf;
unsigned len;
unsigned *have;
{ {
int ret; int ret;
@ -48,8 +44,7 @@ local int gz_load(state, buf, len, have)
If strm->avail_in != 0, then the current data is moved to the beginning of 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 the input buffer, and then the remainder of the buffer is loaded with the
available data from the input file. */ available data from the input file. */
local int gz_avail(state) local int gz_avail(gz_statep state)
gz_statep state;
{ {
unsigned got; unsigned got;
z_streamp strm = &(state->strm); z_streamp strm = &(state->strm);
@ -83,8 +78,7 @@ local int gz_avail(state)
case, all further file reads will be directly to either the output buffer or 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. a user buffer. If decompressing, the inflate state will be initialized.
gz_look() will return 0 on success or -1 on failure. */ gz_look() will return 0 on success or -1 on failure. */
local int gz_look(state) local int gz_look(gz_statep state)
gz_statep state;
{ {
z_streamp strm = &(state->strm); z_streamp strm = &(state->strm);
@ -169,8 +163,7 @@ local int gz_look(state)
data. If the gzip stream completes, state->how is reset to LOOK to look for 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 the next gzip stream or raw data, once state->x.have is depleted. Returns 0
on success, -1 on failure. */ on success, -1 on failure. */
local int gz_decomp(state) local int gz_decomp(gz_statep state)
gz_statep state;
{ {
int ret = Z_OK; int ret = Z_OK;
unsigned had; unsigned had;
@ -223,8 +216,7 @@ local int gz_decomp(state)
looked for to determine whether to copy or decompress. Returns -1 on error, 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 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. */ end of the input file has been reached and all data has been processed. */
local int gz_fetch(state) local int gz_fetch(gz_statep state)
gz_statep state;
{ {
z_streamp strm = &(state->strm); z_streamp strm = &(state->strm);
@ -253,9 +245,7 @@ local int gz_fetch(state)
} }
/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */ /* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
local int gz_skip(state, len) local int gz_skip(gz_statep state, z_off64_t len)
gz_statep state;
z_off64_t len;
{ {
unsigned n; unsigned n;

View File

@ -21,7 +21,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="3" Optimization="3"
OptimizeForProcessor="2" OptimizeForProcessor="2"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;" AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;;&quot;$(SolutionDir)\..\deps\rzlib&quot;"
PreprocessorDefinitions="_DEBUG;_XBOX;_XBOX1;HAVE_RMENU;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;HAVE_GRIFFIN;HAVE_LIBRETRO_MANAGEMENT;HAVE_RARCH_EXEC;HAVE_VID_CONTEXT;HAVE_DSOUND;HAVE_D3D8;RARCH_INTERNAL;WANT_MINIZ;SINC_LOWER_QUALITY;HAVE_OVERLAY" PreprocessorDefinitions="_DEBUG;_XBOX;_XBOX1;HAVE_RMENU;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;HAVE_GRIFFIN;HAVE_LIBRETRO_MANAGEMENT;HAVE_RARCH_EXEC;HAVE_VID_CONTEXT;HAVE_DSOUND;HAVE_D3D8;RARCH_INTERNAL;WANT_MINIZ;SINC_LOWER_QUALITY;HAVE_OVERLAY"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="0" BasicRuntimeChecks="0"
@ -71,7 +71,7 @@
Optimization="3" Optimization="3"
OmitFramePointers="TRUE" OmitFramePointers="TRUE"
OptimizeForProcessor="2" OptimizeForProcessor="2"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;" AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;;&quot;$(SolutionDir)\..\deps\rzlib&quot;"
PreprocessorDefinitions="NDEBUG;_XBOX;_XBOX1;HAVE_RMENU;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;PROFILE;HAVE_GRIFFIN;HAVE_LIBRETRO_MANAGEMENT;HAVE_RARCH_EXEC;HAVE_VID_CONTEXT;HAVE_DSOUND;HAVE_D3D8;RARCH_INTERNAL;WANT_MINIZ;SINC_LOWER_QUALITY;HAVE_OVERLAY" PreprocessorDefinitions="NDEBUG;_XBOX;_XBOX1;HAVE_RMENU;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;PROFILE;HAVE_GRIFFIN;HAVE_LIBRETRO_MANAGEMENT;HAVE_RARCH_EXEC;HAVE_VID_CONTEXT;HAVE_DSOUND;HAVE_D3D8;RARCH_INTERNAL;WANT_MINIZ;SINC_LOWER_QUALITY;HAVE_OVERLAY"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="0" RuntimeLibrary="0"
@ -126,7 +126,7 @@
Optimization="3" Optimization="3"
OmitFramePointers="TRUE" OmitFramePointers="TRUE"
OptimizeForProcessor="2" OptimizeForProcessor="2"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;" AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;;&quot;$(SolutionDir)\..\deps\rzlib&quot;"
PreprocessorDefinitions="NDEBUG;_XBOX;_XBOX1;HAVE_RMENU;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;PROFILE;FASTCAP;HAVE_GRIFFIN;HAVE_LIBRETRO_MANAGEMENT;HAVE_RARCH_EXEC;HAVE_VID_CONTEXT;HAVE_DSOUND;HAVE_D3D8;RARCH_INTERNAL;WANT_MINIZ;SINC_LOWER_QUALITY;HAVE_OVERLAY" PreprocessorDefinitions="NDEBUG;_XBOX;_XBOX1;HAVE_RMENU;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;PROFILE;FASTCAP;HAVE_GRIFFIN;HAVE_LIBRETRO_MANAGEMENT;HAVE_RARCH_EXEC;HAVE_VID_CONTEXT;HAVE_DSOUND;HAVE_D3D8;RARCH_INTERNAL;WANT_MINIZ;SINC_LOWER_QUALITY;HAVE_OVERLAY"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="0" RuntimeLibrary="0"
@ -187,7 +187,7 @@
OmitFramePointers="TRUE" OmitFramePointers="TRUE"
EnableFiberSafeOptimizations="TRUE" EnableFiberSafeOptimizations="TRUE"
OptimizeForProcessor="2" OptimizeForProcessor="2"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;" AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;;&quot;$(SolutionDir)\..\deps\rzlib&quot;"
PreprocessorDefinitions="NDEBUG;_XBOX;_XBOX1;HAVE_RMENU;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;HAVE_GRIFFIN;inline=_inline;HAVE_LIBRETRO_MANAGEMENT;HAVE_RARCH_EXEC;HAVE_VID_CONTEXT;HAVE_DSOUND;HAVE_D3D8;RARCH_INTERNAL;WANT_MINIZ;SINC_LOWER_QUALITY;HAVE_OVERLAY" PreprocessorDefinitions="NDEBUG;_XBOX;_XBOX1;HAVE_RMENU;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;HAVE_GRIFFIN;inline=_inline;HAVE_LIBRETRO_MANAGEMENT;HAVE_RARCH_EXEC;HAVE_VID_CONTEXT;HAVE_DSOUND;HAVE_D3D8;RARCH_INTERNAL;WANT_MINIZ;SINC_LOWER_QUALITY;HAVE_OVERLAY"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="0" RuntimeLibrary="0"
@ -240,7 +240,7 @@
Optimization="3" Optimization="3"
OmitFramePointers="TRUE" OmitFramePointers="TRUE"
OptimizeForProcessor="2" OptimizeForProcessor="2"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;" AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;;&quot;$(SolutionDir)\..\deps\rzlib&quot;"
PreprocessorDefinitions="NDEBUG;_XBOX;_XBOX1;HAVE_RMENU;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;LTCG;HAVE_GRIFFIN;HAVE_LIBRETRO_MANAGEMENT;HAVE_RARCH_EXEC;HAVE_VID_CONTEXT;HAVE_DSOUND;HAVE_D3D8;RARCH_INTERNAL;WANT_MINIZ;SINC_LOWER_QUALITY;HAVE_OVERLAY" PreprocessorDefinitions="NDEBUG;_XBOX;_XBOX1;HAVE_RMENU;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;LTCG;HAVE_GRIFFIN;HAVE_LIBRETRO_MANAGEMENT;HAVE_RARCH_EXEC;HAVE_VID_CONTEXT;HAVE_DSOUND;HAVE_D3D8;RARCH_INTERNAL;WANT_MINIZ;SINC_LOWER_QUALITY;HAVE_OVERLAY"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="0" RuntimeLibrary="0"
@ -299,7 +299,7 @@
OmitFramePointers="TRUE" OmitFramePointers="TRUE"
EnableFiberSafeOptimizations="TRUE" EnableFiberSafeOptimizations="TRUE"
OptimizeForProcessor="2" OptimizeForProcessor="2"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;" AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;;&quot;$(SolutionDir)\..\deps\rzlib&quot;"
PreprocessorDefinitions="NDEBUG;_XBOX;_XBOX1;HAVE_RMENU;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;HAVE_GRIFFIN;inline=_inline;HAVE_LIBRETRO_MANAGEMENT;HAVE_RARCH_EXEC;HAVE_VID_CONTEXT;HAVE_DSOUND;HAVE_D3D8;RARCH_INTERNAL;WANT_MINIZ;SINC_LOWER_QUALITY;HAVE_OVERLAY" PreprocessorDefinitions="NDEBUG;_XBOX;_XBOX1;HAVE_RMENU;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;HAVE_GRIFFIN;inline=_inline;HAVE_LIBRETRO_MANAGEMENT;HAVE_RARCH_EXEC;HAVE_VID_CONTEXT;HAVE_DSOUND;HAVE_D3D8;RARCH_INTERNAL;WANT_MINIZ;SINC_LOWER_QUALITY;HAVE_OVERLAY"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="0" RuntimeLibrary="0"
@ -352,7 +352,7 @@
Optimization="3" Optimization="3"
OmitFramePointers="TRUE" OmitFramePointers="TRUE"
OptimizeForProcessor="2" OptimizeForProcessor="2"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;" AdditionalIncludeDirectories="&quot;$(SolutionDir)\msvc-stdint&quot;;&quot;$(SolutionDir)\msvc-71&quot;;&quot;$(SolutionDir)\..\deps\rzlib&quot;"
PreprocessorDefinitions="NDEBUG;_XBOX;_XBOX1;HAVE_RMENU;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;LTCG;HAVE_GRIFFIN;HAVE_LIBRETRO_MANAGEMENT;HAVE_RARCH_EXEC;HAVE_VID_CONTEXT;HAVE_DSOUND;HAVE_D3D8;RARCH_INTERNAL;WANT_MINIZ;SINC_LOWER_QUALITY;HAVE_OVERLAY" PreprocessorDefinitions="NDEBUG;_XBOX;_XBOX1;HAVE_RMENU;HAVE_MENU;RARCH_CONSOLE;HAVE_XINPUT_XBOX1;__STDC_CONSTANT_MACROS;HAVE_ZLIB;LTCG;HAVE_GRIFFIN;HAVE_LIBRETRO_MANAGEMENT;HAVE_RARCH_EXEC;HAVE_VID_CONTEXT;HAVE_DSOUND;HAVE_D3D8;RARCH_INTERNAL;WANT_MINIZ;SINC_LOWER_QUALITY;HAVE_OVERLAY"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="0" RuntimeLibrary="0"