mirror of
https://github.com/libretro/RetroArch
synced 2025-03-21 13:20:52 +00:00
(deps/libz) Cleanups
This commit is contained in:
parent
b3d12c3dc9
commit
937396d784
6
deps/libz/deflate.c
vendored
6
deps/libz/deflate.c
vendored
@ -1510,7 +1510,6 @@ static void fill_window(deflate_state *s)
|
||||
(last)); \
|
||||
s->block_start = s->strstart; \
|
||||
flush_pending(s->strm); \
|
||||
Tracev((stderr,"[FLUSH]")); \
|
||||
}
|
||||
|
||||
/* Same but force premature exit if necessary. */
|
||||
@ -1676,7 +1675,6 @@ static block_state deflate_fast(deflate_state *s, int flush)
|
||||
else
|
||||
{
|
||||
/* No match, output a literal byte */
|
||||
Tracevv((stderr,"%c", s->window[s->strstart]));
|
||||
_tr_tally_lit (s, s->window[s->strstart], bflush);
|
||||
s->lookahead--;
|
||||
s->strstart++;
|
||||
@ -1796,7 +1794,6 @@ static block_state deflate_slow(deflate_state *s, int flush)
|
||||
* single literal. If there was a match but the current match
|
||||
* is longer, truncate the previous match to a single literal.
|
||||
*/
|
||||
Tracevv((stderr,"%c", s->window[s->strstart-1]));
|
||||
_tr_tally_lit(s, s->window[s->strstart-1], bflush);
|
||||
if (bflush) {
|
||||
FLUSH_BLOCK_ONLY(s, 0);
|
||||
@ -1818,7 +1815,6 @@ static block_state deflate_slow(deflate_state *s, int flush)
|
||||
Assert (flush != Z_NO_FLUSH, "no flush?");
|
||||
if (s->match_available)
|
||||
{
|
||||
Tracevv((stderr,"%c", s->window[s->strstart-1]));
|
||||
_tr_tally_lit(s, s->window[s->strstart-1], bflush);
|
||||
s->match_available = 0;
|
||||
}
|
||||
@ -1894,7 +1890,6 @@ static block_state deflate_rle(deflate_state *s, int flush)
|
||||
else
|
||||
{
|
||||
/* No match, output a literal byte */
|
||||
Tracevv((stderr,"%c", s->window[s->strstart]));
|
||||
_tr_tally_lit (s, s->window[s->strstart], bflush);
|
||||
s->lookahead--;
|
||||
s->strstart++;
|
||||
@ -1936,7 +1931,6 @@ static block_state deflate_huff(deflate_state *s, int flush)
|
||||
|
||||
/* Output a literal byte */
|
||||
s->match_length = 0;
|
||||
Tracevv((stderr,"%c", s->window[s->strstart]));
|
||||
_tr_tally_lit (s, s->window[s->strstart], bflush);
|
||||
s->lookahead--;
|
||||
s->strstart++;
|
||||
|
6
deps/libz/inffast.c
vendored
6
deps/libz/inffast.c
vendored
@ -104,9 +104,6 @@ dolen:
|
||||
bits -= op;
|
||||
op = (unsigned)(here.op);
|
||||
if (op == 0) { /* literal */
|
||||
Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
||||
"inflate: literal '%c'\n" :
|
||||
"inflate: literal 0x%02x\n", here.val));
|
||||
*out++ = (unsigned char)(here.val);
|
||||
}
|
||||
else if (op & 16) { /* length base */
|
||||
@ -121,7 +118,6 @@ dolen:
|
||||
hold >>= op;
|
||||
bits -= op;
|
||||
}
|
||||
Tracevv((stderr, "inflate: length %u\n", len));
|
||||
if (bits < 15) {
|
||||
hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
@ -148,7 +144,6 @@ dodist:
|
||||
dist += (unsigned)hold & ((1U << op) - 1);
|
||||
hold >>= op;
|
||||
bits -= op;
|
||||
Tracevv((stderr, "inflate: distance %u\n", dist));
|
||||
op = (unsigned)(out - beg); /* max distance in output */
|
||||
if (dist > op) { /* see if copy from window */
|
||||
op = dist - op; /* distance back in window */
|
||||
@ -261,7 +256,6 @@ dodist:
|
||||
goto dolen;
|
||||
}
|
||||
else if (op & 32) { /* end-of-block */
|
||||
Tracevv((stderr, "inflate: end of block\n"));
|
||||
state->mode = TYPE;
|
||||
break;
|
||||
}
|
||||
|
25
deps/libz/inflate.c
vendored
25
deps/libz/inflate.c
vendored
@ -133,7 +133,6 @@ int inflateResetKeep(z_streamp strm)
|
||||
state->lencode = state->distcode = state->next = state->codes;
|
||||
state->sane = 1;
|
||||
state->back = -1;
|
||||
Tracev((stderr, "inflate: reset\n"));
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
@ -213,7 +212,6 @@ int inflateInit2_(z_streamp strm, int windowBits, const char *version, int strea
|
||||
state = (struct inflate_state FAR *)
|
||||
ZALLOC(strm, 1, sizeof(struct inflate_state));
|
||||
if (state == Z_NULL) return Z_MEM_ERROR;
|
||||
Tracev((stderr, "inflate: allocated\n"));
|
||||
strm->state = (struct internal_state FAR *)state;
|
||||
state->window = Z_NULL;
|
||||
ret = inflateReset2(strm, windowBits);
|
||||
@ -670,7 +668,6 @@ int inflate(z_streamp strm, int flush)
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
Tracev((stderr, "inflate: zlib header ok\n"));
|
||||
strm->adler = state->check = adler32(0L, Z_NULL, 0);
|
||||
state->mode = hold & 0x200 ? DICTID : TYPE;
|
||||
INITBITS();
|
||||
@ -828,14 +825,10 @@ int inflate(z_streamp strm, int flush)
|
||||
DROPBITS(1);
|
||||
switch (BITS(2)) {
|
||||
case 0: /* stored block */
|
||||
Tracev((stderr, "inflate: stored block%s\n",
|
||||
state->last ? " (last)" : ""));
|
||||
state->mode = STORED;
|
||||
break;
|
||||
case 1: /* fixed block */
|
||||
fixedtables(state);
|
||||
Tracev((stderr, "inflate: fixed codes block%s\n",
|
||||
state->last ? " (last)" : ""));
|
||||
state->mode = LEN_; /* decode codes */
|
||||
if (flush == Z_TREES) {
|
||||
DROPBITS(2);
|
||||
@ -843,8 +836,6 @@ int inflate(z_streamp strm, int flush)
|
||||
}
|
||||
break;
|
||||
case 2: /* dynamic block */
|
||||
Tracev((stderr, "inflate: dynamic codes block%s\n",
|
||||
state->last ? " (last)" : ""));
|
||||
state->mode = TABLE;
|
||||
break;
|
||||
case 3:
|
||||
@ -862,8 +853,6 @@ int inflate(z_streamp strm, int flush)
|
||||
break;
|
||||
}
|
||||
state->length = (unsigned)hold & 0xffff;
|
||||
Tracev((stderr, "inflate: stored length %u\n",
|
||||
state->length));
|
||||
INITBITS();
|
||||
state->mode = COPY_;
|
||||
if (flush == Z_TREES) goto inf_leave;
|
||||
@ -883,7 +872,6 @@ int inflate(z_streamp strm, int flush)
|
||||
state->length -= copy;
|
||||
break;
|
||||
}
|
||||
Tracev((stderr, "inflate: stored end\n"));
|
||||
state->mode = TYPE;
|
||||
break;
|
||||
case TABLE:
|
||||
@ -901,7 +889,6 @@ int inflate(z_streamp strm, int flush)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
Tracev((stderr, "inflate: table sizes ok\n"));
|
||||
state->have = 0;
|
||||
state->mode = LENLENS;
|
||||
case LENLENS:
|
||||
@ -922,7 +909,6 @@ int inflate(z_streamp strm, int flush)
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
Tracev((stderr, "inflate: code lengths ok\n"));
|
||||
state->have = 0;
|
||||
state->mode = CODELENS;
|
||||
case CODELENS:
|
||||
@ -1005,7 +991,6 @@ int inflate(z_streamp strm, int flush)
|
||||
state->mode = BAD;
|
||||
break;
|
||||
}
|
||||
Tracev((stderr, "inflate: codes ok\n"));
|
||||
state->mode = LEN_;
|
||||
if (flush == Z_TREES) goto inf_leave;
|
||||
case LEN_:
|
||||
@ -1040,14 +1025,10 @@ int inflate(z_streamp strm, int flush)
|
||||
state->back += here.bits;
|
||||
state->length = (unsigned)here.val;
|
||||
if ((int)(here.op) == 0) {
|
||||
Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
||||
"inflate: literal '%c'\n" :
|
||||
"inflate: literal 0x%02x\n", here.val));
|
||||
state->mode = LIT;
|
||||
break;
|
||||
}
|
||||
if (here.op & 32) {
|
||||
Tracevv((stderr, "inflate: end of block\n"));
|
||||
state->back = -1;
|
||||
state->mode = TYPE;
|
||||
break;
|
||||
@ -1066,7 +1047,6 @@ int inflate(z_streamp strm, int flush)
|
||||
DROPBITS(state->extra);
|
||||
state->back += state->extra;
|
||||
}
|
||||
Tracevv((stderr, "inflate: length %u\n", state->length));
|
||||
state->was = state->length;
|
||||
state->mode = DIST;
|
||||
case DIST:
|
||||
@ -1103,7 +1083,6 @@ int inflate(z_streamp strm, int flush)
|
||||
DROPBITS(state->extra);
|
||||
state->back += state->extra;
|
||||
}
|
||||
Tracevv((stderr, "inflate: distance %u\n", state->offset));
|
||||
state->mode = MATCH;
|
||||
case MATCH:
|
||||
if (left == 0) goto inf_leave;
|
||||
@ -1176,7 +1155,6 @@ int inflate(z_streamp strm, int flush)
|
||||
break;
|
||||
}
|
||||
INITBITS();
|
||||
Tracev((stderr, "inflate: check matches trailer\n"));
|
||||
}
|
||||
#ifdef GUNZIP
|
||||
state->mode = LENGTH;
|
||||
@ -1189,7 +1167,6 @@ int inflate(z_streamp strm, int flush)
|
||||
break;
|
||||
}
|
||||
INITBITS();
|
||||
Tracev((stderr, "inflate: length matches trailer\n"));
|
||||
}
|
||||
#endif
|
||||
state->mode = DONE;
|
||||
@ -1245,7 +1222,6 @@ int inflateEnd(z_streamp strm)
|
||||
if (state->window != Z_NULL) ZFREE(strm, state->window);
|
||||
ZFREE(strm, strm->state);
|
||||
strm->state = Z_NULL;
|
||||
Tracev((stderr, "inflate: end\n"));
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
@ -1297,7 +1273,6 @@ int inflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLengt
|
||||
return Z_MEM_ERROR;
|
||||
}
|
||||
state->havedict = 1;
|
||||
Tracev((stderr, "inflate: dictionary set\n"));
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
|
22
deps/libz/trees.c
vendored
22
deps/libz/trees.c
vendored
@ -180,7 +180,6 @@ static 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");
|
||||
s->bits_sent += (ulg)length;
|
||||
|
||||
@ -573,7 +572,6 @@ static void gen_codes (ct_data *tree, int max_code, ushf *bl_count)
|
||||
*/
|
||||
Assert (codes + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
|
||||
"inconsistent bit counts");
|
||||
Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
|
||||
|
||||
for (n = 0; n <= max_code; n++) {
|
||||
int len = tree[n].Len;
|
||||
@ -793,8 +791,6 @@ static int build_bl_tree(deflate_state *s)
|
||||
}
|
||||
/* Update opt_len to include the bit length tree and counts */
|
||||
s->opt_len += 3*(max_blindex+1) + 5+5+4;
|
||||
Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
|
||||
s->opt_len, s->static_len));
|
||||
|
||||
return max_blindex;
|
||||
}
|
||||
@ -811,21 +807,16 @@ static void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes
|
||||
Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
|
||||
Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
|
||||
"too many codes");
|
||||
Tracev((stderr, "\nbl counts: "));
|
||||
send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
|
||||
send_bits(s, dcodes-1, 5);
|
||||
send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
|
||||
for (rank = 0; rank < blcodes; rank++) {
|
||||
Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
|
||||
send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
|
||||
}
|
||||
Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
|
||||
|
||||
send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
|
||||
Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
|
||||
|
||||
send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
|
||||
Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
@ -881,12 +872,8 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len,
|
||||
|
||||
/* Construct the literal and distance trees */
|
||||
build_tree(s, (tree_desc *)(&(s->l_desc)));
|
||||
Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
|
||||
s->static_len));
|
||||
|
||||
build_tree(s, (tree_desc *)(&(s->d_desc)));
|
||||
Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
|
||||
s->static_len));
|
||||
/* At this point, opt_len and static_len are the total bit lengths of
|
||||
* the compressed block data, excluding the tree representations.
|
||||
*/
|
||||
@ -900,10 +887,6 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len,
|
||||
opt_lenb = (s->opt_len+3+7)>>3;
|
||||
static_lenb = (s->static_len+3+7)>>3;
|
||||
|
||||
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
||||
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
||||
s->last_lit));
|
||||
|
||||
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
|
||||
|
||||
} else {
|
||||
@ -958,8 +941,6 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len,
|
||||
s->compressed_len += 7; /* align on byte boundary */
|
||||
#endif
|
||||
}
|
||||
Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
|
||||
s->compressed_len-7*last));
|
||||
}
|
||||
|
||||
/* ===========================================================================
|
||||
@ -997,9 +978,6 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, ulg stored_len,
|
||||
(5L+extra_dbits[dcode]);
|
||||
}
|
||||
out_length >>= 3;
|
||||
Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
|
||||
s->last_lit, in_length, out_length,
|
||||
100L - out_length*100L/in_length));
|
||||
if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user