mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 02:30:35 +00:00
(rzlib) Indenting nits
This commit is contained in:
parent
69ca7995b4
commit
29dfac645d
38
deps/rzlib/adler32.c
vendored
38
deps/rzlib/adler32.c
vendored
@ -22,25 +22,25 @@
|
||||
|
||||
#ifdef NO_DIVIDE
|
||||
# define MOD(a) \
|
||||
do { \
|
||||
if (a >= (BASE << 16)) a -= (BASE << 16); \
|
||||
if (a >= (BASE << 15)) a -= (BASE << 15); \
|
||||
if (a >= (BASE << 14)) a -= (BASE << 14); \
|
||||
if (a >= (BASE << 13)) a -= (BASE << 13); \
|
||||
if (a >= (BASE << 12)) a -= (BASE << 12); \
|
||||
if (a >= (BASE << 11)) a -= (BASE << 11); \
|
||||
if (a >= (BASE << 10)) a -= (BASE << 10); \
|
||||
if (a >= (BASE << 9)) a -= (BASE << 9); \
|
||||
if (a >= (BASE << 8)) a -= (BASE << 8); \
|
||||
if (a >= (BASE << 7)) a -= (BASE << 7); \
|
||||
if (a >= (BASE << 6)) a -= (BASE << 6); \
|
||||
if (a >= (BASE << 5)) a -= (BASE << 5); \
|
||||
if (a >= (BASE << 4)) a -= (BASE << 4); \
|
||||
if (a >= (BASE << 3)) a -= (BASE << 3); \
|
||||
if (a >= (BASE << 2)) a -= (BASE << 2); \
|
||||
if (a >= (BASE << 1)) a -= (BASE << 1); \
|
||||
if (a >= BASE) a -= BASE; \
|
||||
} while (0)
|
||||
do { \
|
||||
if (a >= (BASE << 16)) a -= (BASE << 16); \
|
||||
if (a >= (BASE << 15)) a -= (BASE << 15); \
|
||||
if (a >= (BASE << 14)) a -= (BASE << 14); \
|
||||
if (a >= (BASE << 13)) a -= (BASE << 13); \
|
||||
if (a >= (BASE << 12)) a -= (BASE << 12); \
|
||||
if (a >= (BASE << 11)) a -= (BASE << 11); \
|
||||
if (a >= (BASE << 10)) a -= (BASE << 10); \
|
||||
if (a >= (BASE << 9)) a -= (BASE << 9); \
|
||||
if (a >= (BASE << 8)) a -= (BASE << 8); \
|
||||
if (a >= (BASE << 7)) a -= (BASE << 7); \
|
||||
if (a >= (BASE << 6)) a -= (BASE << 6); \
|
||||
if (a >= (BASE << 5)) a -= (BASE << 5); \
|
||||
if (a >= (BASE << 4)) a -= (BASE << 4); \
|
||||
if (a >= (BASE << 3)) a -= (BASE << 3); \
|
||||
if (a >= (BASE << 2)) a -= (BASE << 2); \
|
||||
if (a >= (BASE << 1)) a -= (BASE << 1); \
|
||||
if (a >= BASE) a -= BASE; \
|
||||
} while (0)
|
||||
#else
|
||||
# define MOD(a) a %= BASE
|
||||
#endif
|
||||
|
4
deps/rzlib/compress.c
vendored
4
deps/rzlib/compress.c
vendored
@ -18,7 +18,7 @@
|
||||
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
||||
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)
|
||||
{
|
||||
z_stream stream;
|
||||
@ -53,7 +53,7 @@ int ZEXPORT compress2 (Bytef *dest, uLongf *destLen, const Bytef *source, uLong
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
*/
|
||||
*/
|
||||
int ZEXPORT compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
|
||||
{
|
||||
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
|
||||
|
10
deps/rzlib/crc32.c
vendored
10
deps/rzlib/crc32.c
vendored
@ -5,7 +5,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static const unsigned long crc_table[256] = {
|
||||
static const unsigned long crc_table[256] = {
|
||||
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
|
||||
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
|
||||
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
|
||||
@ -58,15 +58,15 @@ static const unsigned long crc_table[256] = {
|
||||
0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
|
||||
0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
|
||||
0x2d02ef8dL
|
||||
};
|
||||
};
|
||||
|
||||
#define DO1_CRC32(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
|
||||
#define DO2_CRC32(buf) DO1_CRC32(buf); DO1_CRC32(buf);
|
||||
#define DO4_CRC32(buf) DO2_CRC32(buf); DO2_CRC32(buf);
|
||||
#define DO8_CRC32(buf) DO4_CRC32(buf); DO4_CRC32(buf);
|
||||
|
||||
unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned int len)
|
||||
{
|
||||
unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned int len)
|
||||
{
|
||||
if (buf == 0) return 0L;
|
||||
crc = crc ^ 0xffffffffL;
|
||||
while (len >= 8)
|
||||
@ -78,7 +78,7 @@ unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned int le
|
||||
DO1_CRC32(buf);
|
||||
} while (--len);
|
||||
return crc ^ 0xffffffffL;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
36
deps/rzlib/deflate.c
vendored
36
deps/rzlib/deflate.c
vendored
@ -52,7 +52,7 @@
|
||||
#include "deflate.h"
|
||||
|
||||
const char deflate_copyright[] =
|
||||
" deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
|
||||
" deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler ";
|
||||
/*
|
||||
If you use the zlib library in a product, an acknowledgment is welcome
|
||||
in the documentation of your product. If for some reason you cannot
|
||||
@ -86,8 +86,8 @@ 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));
|
||||
#ifdef ASMV
|
||||
void match_init OF((void)); /* asm code initialization */
|
||||
uInt longest_match OF((deflate_state *s, IPos cur_match));
|
||||
void match_init OF((void)); /* asm code initialization */
|
||||
uInt longest_match OF((deflate_state *s, IPos cur_match));
|
||||
#else
|
||||
local uInt longest_match OF((deflate_state *s, IPos cur_match));
|
||||
#endif
|
||||
@ -124,23 +124,23 @@ typedef struct config_s {
|
||||
|
||||
#ifdef FASTEST
|
||||
local 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 */
|
||||
/* 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] = {
|
||||
/* 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 */
|
||||
/* 2 */ {4, 5, 16, 8, deflate_fast},
|
||||
/* 3 */ {4, 6, 32, 32, deflate_fast},
|
||||
/* 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 */
|
||||
/* 2 */ {4, 5, 16, 8, deflate_fast},
|
||||
/* 3 */ {4, 6, 32, 32, deflate_fast},
|
||||
|
||||
/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */
|
||||
/* 5 */ {8, 16, 32, 32, deflate_slow},
|
||||
/* 6 */ {8, 16, 128, 128, deflate_slow},
|
||||
/* 7 */ {8, 32, 128, 256, deflate_slow},
|
||||
/* 8 */ {32, 128, 258, 1024, deflate_slow},
|
||||
/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */
|
||||
/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */
|
||||
/* 5 */ {8, 16, 32, 32, deflate_slow},
|
||||
/* 6 */ {8, 16, 128, 128, deflate_slow},
|
||||
/* 7 */ {8, 32, 128, 256, deflate_slow},
|
||||
/* 8 */ {32, 128, 258, 1024, deflate_slow},
|
||||
/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */
|
||||
#endif
|
||||
|
||||
/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
|
||||
@ -191,7 +191,7 @@ local const config configuration_table[10] = {
|
||||
*/
|
||||
#define CLEAR_HASH(s) \
|
||||
s->head[s->hash_size-1] = NIL; \
|
||||
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 deflateResetKeep (z_streamp strm);
|
||||
|
||||
|
2
deps/rzlib/infback.c
vendored
2
deps/rzlib/infback.c
vendored
@ -611,7 +611,7 @@ int ZEXPORT inflateBack(z_streamp strm, in_func in, void FAR *in_desc, out_func
|
||||
}
|
||||
|
||||
/* Return unused input */
|
||||
inf_leave:
|
||||
inf_leave:
|
||||
strm->next_in = next;
|
||||
strm->avail_in = have;
|
||||
return ret;
|
||||
|
26
deps/rzlib/inffast.c
vendored
26
deps/rzlib/inffast.c
vendored
@ -51,19 +51,19 @@
|
||||
TYPE -- reached end of block code, inflate() to interpret next block
|
||||
BAD -- error in block data
|
||||
|
||||
Notes:
|
||||
Notes:
|
||||
|
||||
- The maximum input bits used by a length/distance pair is 15 bits for the
|
||||
length code, 5 bits for the length extra, 15 bits for the distance code,
|
||||
and 13 bits for the distance extra. This totals 48 bits, or six bytes.
|
||||
Therefore if strm->avail_in >= 6, then there is enough input to avoid
|
||||
checking for available input while decoding.
|
||||
- The maximum input bits used by a length/distance pair is 15 bits for the
|
||||
length code, 5 bits for the length extra, 15 bits for the distance code,
|
||||
and 13 bits for the distance extra. This totals 48 bits, or six bytes.
|
||||
Therefore if strm->avail_in >= 6, then there is enough input to avoid
|
||||
checking for available input while decoding.
|
||||
|
||||
- The maximum bytes that a single length/distance pair can output is 258
|
||||
bytes, which is the maximum length that can be coded. inflate_fast()
|
||||
requires strm->avail_out >= 258 for each loop to avoid checking for
|
||||
output space.
|
||||
*/
|
||||
- The maximum bytes that a single length/distance pair can output is 258
|
||||
bytes, which is the maximum length that can be coded. inflate_fast()
|
||||
requires strm->avail_out >= 258 for each loop to avoid checking for
|
||||
output space.
|
||||
*/
|
||||
void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start)
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
@ -123,7 +123,7 @@ void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start)
|
||||
bits += 8;
|
||||
}
|
||||
here = lcode[hold & lmask];
|
||||
dolen:
|
||||
dolen:
|
||||
op = (unsigned)(here.bits);
|
||||
hold >>= op;
|
||||
bits -= op;
|
||||
@ -154,7 +154,7 @@ void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start)
|
||||
bits += 8;
|
||||
}
|
||||
here = dcode[hold & dmask];
|
||||
dodist:
|
||||
dodist:
|
||||
op = (unsigned)(here.bits);
|
||||
hold >>= op;
|
||||
bits -= op;
|
||||
|
118
deps/rzlib/inflate.c
vendored
118
deps/rzlib/inflate.c
vendored
@ -75,7 +75,7 @@
|
||||
* for the in() and out() functions
|
||||
* - Changed inflateBack() argument and in_func typedef to swap the length
|
||||
* and buffer address return values for the input function
|
||||
* - Check next_in and next_out for Z_NULL on entry to inflate()
|
||||
* - Check next_in and next_out for Z_NULL on entry to inflate()
|
||||
*
|
||||
* The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
|
||||
*/
|
||||
@ -95,12 +95,12 @@
|
||||
#define Z_TREES 6
|
||||
#endif
|
||||
|
||||
/* function prototypes */
|
||||
local void fixedtables OF((struct inflate_state FAR *state));
|
||||
local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
|
||||
/* function prototypes */
|
||||
local void fixedtables OF((struct inflate_state FAR *state));
|
||||
local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
|
||||
unsigned copy));
|
||||
#ifdef BUILDFIXED
|
||||
void makefixed OF((void));
|
||||
void makefixed OF((void));
|
||||
#endif
|
||||
local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
|
||||
unsigned len));
|
||||
@ -531,66 +531,66 @@ local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy)
|
||||
next state. The NEEDBITS() macro is usually the way the state evaluates
|
||||
whether it can proceed or should return. NEEDBITS() does the return if
|
||||
the requested bits are not available. The typical use of the BITS macros
|
||||
is:
|
||||
is:
|
||||
|
||||
NEEDBITS(n);
|
||||
... do something with BITS(n) ...
|
||||
DROPBITS(n);
|
||||
NEEDBITS(n);
|
||||
... do something with BITS(n) ...
|
||||
DROPBITS(n);
|
||||
|
||||
where NEEDBITS(n) either returns from inflate() if there isn't enough
|
||||
input left to load n bits into the accumulator, or it continues. BITS(n)
|
||||
gives the low n bits in the accumulator. When done, DROPBITS(n) drops
|
||||
the low n bits off the accumulator. INITBITS() clears the accumulator
|
||||
and sets the number of available bits to zero. BYTEBITS() discards just
|
||||
enough bits to put the accumulator on a byte boundary. After BYTEBITS()
|
||||
and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.
|
||||
where NEEDBITS(n) either returns from inflate() if there isn't enough
|
||||
input left to load n bits into the accumulator, or it continues. BITS(n)
|
||||
gives the low n bits in the accumulator. When done, DROPBITS(n) drops
|
||||
the low n bits off the accumulator. INITBITS() clears the accumulator
|
||||
and sets the number of available bits to zero. BYTEBITS() discards just
|
||||
enough bits to put the accumulator on a byte boundary. After BYTEBITS()
|
||||
and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.
|
||||
|
||||
NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return
|
||||
if there is no input available. The decoding of variable length codes uses
|
||||
PULLBYTE() directly in order to pull just enough bytes to decode the next
|
||||
code, and no more.
|
||||
NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return
|
||||
if there is no input available. The decoding of variable length codes uses
|
||||
PULLBYTE() directly in order to pull just enough bytes to decode the next
|
||||
code, and no more.
|
||||
|
||||
Some states loop until they get enough input, making sure that enough
|
||||
state information is maintained to continue the loop where it left off
|
||||
if NEEDBITS() returns in the loop. For example, want, need, and keep
|
||||
would all have to actually be part of the saved state in case NEEDBITS()
|
||||
returns:
|
||||
Some states loop until they get enough input, making sure that enough
|
||||
state information is maintained to continue the loop where it left off
|
||||
if NEEDBITS() returns in the loop. For example, want, need, and keep
|
||||
would all have to actually be part of the saved state in case NEEDBITS()
|
||||
returns:
|
||||
|
||||
case STATEw:
|
||||
while (want < need) {
|
||||
NEEDBITS(n);
|
||||
keep[want++] = BITS(n);
|
||||
DROPBITS(n);
|
||||
}
|
||||
state = STATEx;
|
||||
case STATEx:
|
||||
case STATEw:
|
||||
while (want < need) {
|
||||
NEEDBITS(n);
|
||||
keep[want++] = BITS(n);
|
||||
DROPBITS(n);
|
||||
}
|
||||
state = STATEx;
|
||||
case STATEx:
|
||||
|
||||
As shown above, if the next state is also the next case, then the break
|
||||
is omitted.
|
||||
As shown above, if the next state is also the next case, then the break
|
||||
is omitted.
|
||||
|
||||
A state may also return if there is not enough output space available to
|
||||
complete that state. Those states are copying stored data, writing a
|
||||
literal byte, and copying a matching string.
|
||||
A state may also return if there is not enough output space available to
|
||||
complete that state. Those states are copying stored data, writing a
|
||||
literal byte, and copying a matching string.
|
||||
|
||||
When returning, a "goto inf_leave" is used to update the total counters,
|
||||
update the check value, and determine whether any progress has been made
|
||||
during that inflate() call in order to return the proper return code.
|
||||
Progress is defined as a change in either strm->avail_in or strm->avail_out.
|
||||
When there is a window, goto inf_leave will update the window with the last
|
||||
output written. If a goto inf_leave occurs in the middle of decompression
|
||||
and there is no window currently, goto inf_leave will create one and copy
|
||||
output to the window for the next call of inflate().
|
||||
When returning, a "goto inf_leave" is used to update the total counters,
|
||||
update the check value, and determine whether any progress has been made
|
||||
during that inflate() call in order to return the proper return code.
|
||||
Progress is defined as a change in either strm->avail_in or strm->avail_out.
|
||||
When there is a window, goto inf_leave will update the window with the last
|
||||
output written. If a goto inf_leave occurs in the middle of decompression
|
||||
and there is no window currently, goto inf_leave will create one and copy
|
||||
output to the window for the next call of inflate().
|
||||
|
||||
In this implementation, the flush parameter of inflate() only affects the
|
||||
return code (per zlib.h). inflate() always writes as much as possible to
|
||||
strm->next_out, given the space available and the provided input--the effect
|
||||
documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers
|
||||
the allocation of and copying into a sliding window until necessary, which
|
||||
provides the effect documented in zlib.h for Z_FINISH when the entire input
|
||||
stream available. So the only thing the flush parameter actually does is:
|
||||
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.
|
||||
*/
|
||||
In this implementation, the flush parameter of inflate() only affects the
|
||||
return code (per zlib.h). inflate() always writes as much as possible to
|
||||
strm->next_out, given the space available and the provided input--the effect
|
||||
documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers
|
||||
the allocation of and copying into a sliding window until necessary, which
|
||||
provides the effect documented in zlib.h for Z_FINISH when the entire input
|
||||
stream available. So the only thing the flush parameter actually does is:
|
||||
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)
|
||||
{
|
||||
@ -1213,9 +1213,9 @@ int ZEXPORT inflate(z_streamp strm, int flush)
|
||||
Return from inflate(), updating the total counts and the check value.
|
||||
If there was no progress during the inflate() call, return a buffer
|
||||
error. Call updatewindow() to create and/or update the window state.
|
||||
Note: a memory error from inflate() is non-recoverable.
|
||||
*/
|
||||
inf_leave:
|
||||
Note: a memory error from inflate() is non-recoverable.
|
||||
*/
|
||||
inf_leave:
|
||||
RESTORE();
|
||||
if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
|
||||
(state->mode < CHECK || flush != Z_FINISH)))
|
||||
|
2
deps/rzlib/inftrees.c
vendored
2
deps/rzlib/inftrees.c
vendored
@ -9,7 +9,7 @@
|
||||
#define MAXBITS 15
|
||||
|
||||
const char inflate_copyright[] =
|
||||
" inflate 1.2.8 Copyright 1995-2013 Mark Adler ";
|
||||
" inflate 1.2.8 Copyright 1995-2013 Mark Adler ";
|
||||
/*
|
||||
If you use the zlib library in a product, an acknowledgment is welcome
|
||||
in the documentation of your product. If for some reason you cannot
|
||||
|
70
deps/rzlib/trees.c
vendored
70
deps/rzlib/trees.c
vendored
@ -60,16 +60,16 @@
|
||||
/* 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 */
|
||||
= {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};
|
||||
= {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 */
|
||||
= {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};
|
||||
= {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 */
|
||||
= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
|
||||
= {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]
|
||||
= {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
|
||||
= {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.
|
||||
*/
|
||||
@ -161,11 +161,11 @@ local void gen_trees_header OF((void));
|
||||
|
||||
#ifndef DEBUG
|
||||
# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
|
||||
/* Send a code of the given tree. c and tree must not have side effects */
|
||||
/* Send a code of the given tree. c and tree must not have side effects */
|
||||
|
||||
#else /* DEBUG */
|
||||
# define send_code(s, c, tree) \
|
||||
{ if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
|
||||
{ if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
|
||||
send_bits(s, tree[c].Code, tree[c].Len); }
|
||||
#endif
|
||||
|
||||
@ -967,14 +967,14 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len,
|
||||
}
|
||||
Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
|
||||
s->compressed_len-7*last));
|
||||
}
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
/* ===========================================================================
|
||||
* Save the match info and tally the frequency counts. Return true if
|
||||
* the current block must be flushed.
|
||||
*/
|
||||
int ZLIB_INTERNAL _tr_tally (deflate_state *s, unsigned dist, unsigned lc)
|
||||
{
|
||||
int ZLIB_INTERNAL _tr_tally (deflate_state *s, unsigned dist, unsigned lc)
|
||||
{
|
||||
s->d_buf[s->last_lit] = (ush)dist;
|
||||
s->l_buf[s->last_lit++] = (uch)lc;
|
||||
if (dist == 0) {
|
||||
@ -1015,13 +1015,13 @@ int ZLIB_INTERNAL _tr_tally (deflate_state *s, unsigned dist, unsigned lc)
|
||||
* on 16 bit machines and because stored blocks are restricted to
|
||||
* 64K-1 bytes.
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
/* ===========================================================================
|
||||
* 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)
|
||||
{
|
||||
local 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) */
|
||||
unsigned lx = 0; /* running index in l_buf */
|
||||
@ -1062,9 +1062,9 @@ local void compress_block(deflate_state *s, const ct_data *ltree, const ct_data
|
||||
} while (lx < s->last_lit);
|
||||
|
||||
send_code(s, END_BLOCK, ltree);
|
||||
}
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
/* ===========================================================================
|
||||
* Check if the data type is TEXT or BINARY, using the following algorithm:
|
||||
* - TEXT if the two conditions below are satisfied:
|
||||
* a) There are no non-portable control characters belonging to the
|
||||
@ -1077,8 +1077,8 @@ local void compress_block(deflate_state *s, const ct_data *ltree, const ct_data
|
||||
* (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)
|
||||
{
|
||||
local 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
|
||||
* 0xf3ffc07f = binary 11110011111111111100000001111111
|
||||
@ -1103,28 +1103,28 @@ local int detect_data_type(deflate_state *s)
|
||||
* this stream either is empty or has tolerated ("gray-listed") bytes only.
|
||||
*/
|
||||
return Z_BINARY;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
/* ===========================================================================
|
||||
* Reverse the first len bits of a code, using straightforward code (a faster
|
||||
* method would use a table)
|
||||
* IN assertion: 1 <= len <= 15
|
||||
*/
|
||||
local unsigned bi_reverse(unsigned code, int len)
|
||||
{
|
||||
local unsigned bi_reverse(unsigned code, int len)
|
||||
{
|
||||
register unsigned res = 0;
|
||||
do {
|
||||
res |= code & 1;
|
||||
code >>= 1, res <<= 1;
|
||||
} while (--len > 0);
|
||||
return res >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
/* ===========================================================================
|
||||
* Flush the bit buffer, keeping at most 7 bits in it.
|
||||
*/
|
||||
local void bi_flush(deflate_state *s)
|
||||
{
|
||||
local void bi_flush(deflate_state *s)
|
||||
{
|
||||
if (s->bi_valid == 16) {
|
||||
put_short(s, s->bi_buf);
|
||||
s->bi_buf = 0;
|
||||
@ -1134,13 +1134,13 @@ local void bi_flush(deflate_state *s)
|
||||
s->bi_buf >>= 8;
|
||||
s->bi_valid -= 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
/* ===========================================================================
|
||||
* Flush the bit buffer and align the output on a byte boundary
|
||||
*/
|
||||
local void bi_windup(deflate_state *s)
|
||||
{
|
||||
local void bi_windup(deflate_state *s)
|
||||
{
|
||||
if (s->bi_valid > 8) {
|
||||
put_short(s, s->bi_buf);
|
||||
} else if (s->bi_valid > 0) {
|
||||
@ -1151,14 +1151,14 @@ local void bi_windup(deflate_state *s)
|
||||
#ifdef DEBUG
|
||||
s->bits_sent = (s->bits_sent+7) & ~7;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
/* ===========================================================================
|
||||
* 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)
|
||||
{
|
||||
local void copy_block(deflate_state *s, charf *buf, unsigned len, int header)
|
||||
{
|
||||
bi_windup(s); /* align on byte boundary */
|
||||
|
||||
if (header) {
|
||||
@ -1174,4 +1174,4 @@ local void copy_block(deflate_state *s, charf *buf, unsigned len, int header)
|
||||
while (len--) {
|
||||
put_byte(s, *buf++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
deps/rzlib/uncompr.c
vendored
2
deps/rzlib/uncompr.c
vendored
@ -20,7 +20,7 @@
|
||||
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
|
||||
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)
|
||||
{
|
||||
z_stream stream;
|
||||
|
70
deps/rzlib/unzip.c
vendored
70
deps/rzlib/unzip.c
vendored
@ -69,7 +69,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifndef NOUNCRYPT
|
||||
#define NOUNCRYPT
|
||||
#define NOUNCRYPT
|
||||
#endif
|
||||
|
||||
#include "zlib.h"
|
||||
@ -81,7 +81,7 @@
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#ifdef NO_ERRNO_H
|
||||
extern int errno;
|
||||
extern int errno;
|
||||
#else
|
||||
# include <errno.h>
|
||||
#endif
|
||||
@ -120,7 +120,7 @@
|
||||
|
||||
|
||||
const char unz_copyright[] =
|
||||
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
|
||||
" unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll";
|
||||
|
||||
/* unz_file_info_interntal contain internal info about a file in zipfile*/
|
||||
typedef struct unz_file_info64_internal_s
|
||||
@ -201,7 +201,7 @@ typedef struct
|
||||
Read a byte from a gz_stream; update next_in and avail_in. Return EOF
|
||||
for end of file.
|
||||
IN assertion: the stream s has been sucessfully opened for reading.
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
local int unz64local_getByte OF((
|
||||
@ -230,7 +230,7 @@ local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, v
|
||||
|
||||
/* ===========================================================================
|
||||
Reads a long in LSB order from the given gz_stream. Sets
|
||||
*/
|
||||
*/
|
||||
local int unz64local_getShort OF((
|
||||
const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||
voidpf filestream,
|
||||
@ -408,7 +408,7 @@ extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
|
||||
/*
|
||||
Locate the Central directory of a zipfile (at the end, just before
|
||||
the global comment)
|
||||
*/
|
||||
*/
|
||||
local ZPOS64_T unz64local_SearchCentralDir OF((const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream));
|
||||
local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream)
|
||||
{
|
||||
@ -470,7 +470,7 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f
|
||||
/*
|
||||
Locate the Central directory 64 of a zipfile (at the end, just before
|
||||
the global comment)
|
||||
*/
|
||||
*/
|
||||
local ZPOS64_T unz64local_SearchCentralDir64 OF((
|
||||
const zlib_filefunc64_32_def* pzlib_filefunc_def,
|
||||
voidpf filestream));
|
||||
@ -580,7 +580,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
|
||||
return value is NULL.
|
||||
Else, the return value is a unzFile Handle, usable with other function
|
||||
of this unzip package.
|
||||
*/
|
||||
*/
|
||||
local unzFile unzOpenInternal (const void *path,
|
||||
zlib_filefunc64_32_def* pzlib_filefunc64_32_def,
|
||||
int is64bitOpenFunction)
|
||||
@ -848,7 +848,7 @@ extern int ZEXPORT unzGetGlobalInfo (unzFile file, unz_global_info* pglobal_info
|
||||
}
|
||||
/*
|
||||
Translate date/time from Dos format to tm_unz (readable more easilty)
|
||||
*/
|
||||
*/
|
||||
local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)
|
||||
{
|
||||
ZPOS64_T uDate;
|
||||
@ -864,7 +864,7 @@ local void unz64local_DosDateToTmuDate (ZPOS64_T ulDosDate, tm_unz* ptm)
|
||||
|
||||
/*
|
||||
Get Info about the current file in the zipfile, with internal only info
|
||||
*/
|
||||
*/
|
||||
local int unz64local_GetCurrentFileInfoInternal OF((unzFile file,
|
||||
unz_file_info64 *pfile_info,
|
||||
unz_file_info64_internal
|
||||
@ -1120,7 +1120,7 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file,
|
||||
Write info about the ZipFile in the *pglobal_info structure.
|
||||
No preparation of the structure is needed
|
||||
return UNZ_OK if there is no problem.
|
||||
*/
|
||||
*/
|
||||
extern int ZEXPORT unzGetCurrentFileInfo64 (unzFile file,
|
||||
unz_file_info64 * pfile_info,
|
||||
char * szFileName, uLong fileNameBufferSize,
|
||||
@ -1174,7 +1174,7 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
|
||||
/*
|
||||
Set the current file of the zipfile to the first file.
|
||||
return UNZ_OK if there is no problem
|
||||
*/
|
||||
*/
|
||||
extern int ZEXPORT unzGoToFirstFile (unzFile file)
|
||||
{
|
||||
int err=UNZ_OK;
|
||||
@ -1195,7 +1195,7 @@ extern int ZEXPORT unzGoToFirstFile (unzFile file)
|
||||
Set the current file of the zipfile to the next file.
|
||||
return UNZ_OK if there is no problem
|
||||
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
||||
*/
|
||||
*/
|
||||
extern int ZEXPORT unzGoToNextFile (unzFile file)
|
||||
{
|
||||
unz64_s* s;
|
||||
@ -1228,7 +1228,7 @@ extern int ZEXPORT unzGoToNextFile (unzFile file)
|
||||
return value :
|
||||
UNZ_OK if the file is found. It becomes the current file.
|
||||
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
||||
*/
|
||||
*/
|
||||
extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCaseSensitivity)
|
||||
{
|
||||
unz64_s* s;
|
||||
@ -1298,12 +1298,12 @@ extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCas
|
||||
*/
|
||||
|
||||
/*
|
||||
typedef struct unz_file_pos_s
|
||||
{
|
||||
typedef struct unz_file_pos_s
|
||||
{
|
||||
ZPOS64_T pos_in_zip_directory; // offset in file
|
||||
ZPOS64_T num_of_file; // # of file
|
||||
} unz_file_pos;
|
||||
*/
|
||||
} unz_file_pos;
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzGetFilePos64(unzFile file, unz64_file_pos* file_pos)
|
||||
{
|
||||
@ -1381,7 +1381,7 @@ extern int ZEXPORT unzGoToFilePos(
|
||||
directory about this file
|
||||
store in *piSizeVar the size of extra info in local header
|
||||
(filename and size of extra field data)
|
||||
*/
|
||||
*/
|
||||
local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVar,
|
||||
ZPOS64_T * poffset_local_extrafield,
|
||||
uInt * psize_local_extrafield)
|
||||
@ -1410,10 +1410,10 @@ local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVa
|
||||
|
||||
if (unz64local_getShort(&s->z_filefunc, s->filestream,&uData) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
/*
|
||||
/*
|
||||
else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
|
||||
err=UNZ_BADZIPFILE;
|
||||
*/
|
||||
*/
|
||||
if (unz64local_getShort(&s->z_filefunc, s->filestream,&uFlags) != UNZ_OK)
|
||||
err=UNZ_ERRNO;
|
||||
|
||||
@ -1423,9 +1423,9 @@ local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVa
|
||||
err=UNZ_BADZIPFILE;
|
||||
|
||||
if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
|
||||
/* #ifdef HAVE_BZIP2 */
|
||||
/* #ifdef HAVE_BZIP2 */
|
||||
(s->cur_file_info.compression_method!=Z_BZIP2ED) &&
|
||||
/* #endif */
|
||||
/* #endif */
|
||||
(s->cur_file_info.compression_method!=Z_DEFLATED))
|
||||
err=UNZ_BADZIPFILE;
|
||||
|
||||
@ -1468,7 +1468,7 @@ local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVa
|
||||
/*
|
||||
Open for reading data the current file in the zipfile.
|
||||
If there is no error and the file is opened, the return value is UNZ_OK.
|
||||
*/
|
||||
*/
|
||||
extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
||||
int* level, int raw, const char* password)
|
||||
{
|
||||
@ -1530,9 +1530,9 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method,
|
||||
}
|
||||
|
||||
if ((s->cur_file_info.compression_method!=0) &&
|
||||
/* #ifdef HAVE_BZIP2 */
|
||||
/* #ifdef HAVE_BZIP2 */
|
||||
(s->cur_file_info.compression_method!=Z_BZIP2ED) &&
|
||||
/* #endif */
|
||||
/* #endif */
|
||||
(s->cur_file_info.compression_method!=Z_DEFLATED))
|
||||
|
||||
err=UNZ_BADZIPFILE;
|
||||
@ -1680,7 +1680,7 @@ extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64( unzFile file)
|
||||
return 0 if the end of file was reached
|
||||
return <0 with error code if there is an error
|
||||
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||
*/
|
||||
*/
|
||||
extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
|
||||
{
|
||||
int err=UNZ_OK;
|
||||
@ -1885,7 +1885,7 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len)
|
||||
|
||||
/*
|
||||
Give the current position in uncompressed data
|
||||
*/
|
||||
*/
|
||||
extern z_off_t ZEXPORT unztell (unzFile file)
|
||||
{
|
||||
unz64_s* s;
|
||||
@ -1920,7 +1920,7 @@ extern ZPOS64_T ZEXPORT unztell64 (unzFile file)
|
||||
|
||||
/*
|
||||
return 1 if the end of file was reached, 0 elsewhere
|
||||
*/
|
||||
*/
|
||||
extern int ZEXPORT unzeof (unzFile file)
|
||||
{
|
||||
unz64_s* s;
|
||||
@ -1942,9 +1942,9 @@ extern int ZEXPORT unzeof (unzFile file)
|
||||
|
||||
|
||||
/*
|
||||
Read extra field from the current file (opened by unzOpenCurrentFile)
|
||||
This is the local-header version of the extra field (sometimes, there is
|
||||
more info in the local-header version than in the central-header)
|
||||
Read extra field from the current file (opened by unzOpenCurrentFile)
|
||||
This is the local-header version of the extra field (sometimes, there is
|
||||
more info in the local-header version than in the central-header)
|
||||
|
||||
if buf==NULL, it return the size of the local extra field that can be read
|
||||
|
||||
@ -1952,7 +1952,7 @@ more info in the local-header version than in the central-header)
|
||||
buf.
|
||||
the return value is the number of bytes copied in buf, or (if <0)
|
||||
the error code
|
||||
*/
|
||||
*/
|
||||
extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)
|
||||
{
|
||||
unz64_s* s;
|
||||
@ -2000,7 +2000,7 @@ extern int ZEXPORT unzGetLocalExtrafield (unzFile file, voidp buf, unsigned len)
|
||||
/*
|
||||
Close the file in zip opened with unzipOpenCurrentFile
|
||||
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
||||
*/
|
||||
*/
|
||||
extern int ZEXPORT unzCloseCurrentFile (unzFile file)
|
||||
{
|
||||
int err=UNZ_OK;
|
||||
@ -2047,7 +2047,7 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file)
|
||||
Get the global comment string of the ZipFile, in the szComment buffer.
|
||||
uSizeBuf is the size of the szComment buffer.
|
||||
return the number of byte copied or an error code <0
|
||||
*/
|
||||
*/
|
||||
extern int ZEXPORT unzGetGlobalComment (unzFile file, char * szComment, uLong uSizeBuf)
|
||||
{
|
||||
unz64_s* s;
|
||||
|
24
deps/rzlib/zutil.c
vendored
24
deps/rzlib/zutil.c
vendored
@ -11,16 +11,16 @@
|
||||
#endif
|
||||
|
||||
char * const z_errmsg[10] = {
|
||||
"need dictionary", /* Z_NEED_DICT 2 */
|
||||
"stream end", /* Z_STREAM_END 1 */
|
||||
"", /* Z_OK 0 */
|
||||
"file error", /* Z_ERRNO (-1) */
|
||||
"stream error", /* Z_STREAM_ERROR (-2) */
|
||||
"data error", /* Z_DATA_ERROR (-3) */
|
||||
"insufficient memory", /* Z_MEM_ERROR (-4) */
|
||||
"buffer error", /* Z_BUF_ERROR (-5) */
|
||||
"incompatible version",/* Z_VERSION_ERROR (-6) */
|
||||
""};
|
||||
"need dictionary", /* Z_NEED_DICT 2 */
|
||||
"stream end", /* Z_STREAM_END 1 */
|
||||
"", /* Z_OK 0 */
|
||||
"file error", /* Z_ERRNO (-1) */
|
||||
"stream error", /* Z_STREAM_ERROR (-2) */
|
||||
"data error", /* Z_DATA_ERROR (-3) */
|
||||
"insufficient memory", /* Z_MEM_ERROR (-4) */
|
||||
"buffer error", /* Z_BUF_ERROR (-5) */
|
||||
"incompatible version",/* Z_VERSION_ERROR (-6) */
|
||||
""};
|
||||
|
||||
|
||||
const char * ZEXPORT zlibVersion(void)
|
||||
@ -134,11 +134,11 @@ const char * ZEXPORT zError(int err)
|
||||
}
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
/* The Microsoft C Run-Time Library for Windows CE doesn't have
|
||||
/* The Microsoft C Run-Time Library for Windows CE doesn't have
|
||||
* errno. We define it as a global variable to simplify porting.
|
||||
* Its value is always 0 and should not be used.
|
||||
*/
|
||||
int errno = 0;
|
||||
int errno = 0;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_MEMCPY
|
||||
|
Loading…
Reference in New Issue
Block a user