libarchive-static 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/Makefile +6 -0
- data/ext/extconf.rb +61 -0
- data/ext/libarchive-0.1.1/COPYING.libarchive +60 -0
- data/ext/libarchive-0.1.1/LICENSE.libbzip2 +42 -0
- data/ext/libarchive-0.1.1/README.txt +143 -0
- data/ext/libarchive-0.1.1/ext/Makefile.in +0 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.c +31 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_format.c +32 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_format.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.c +29 -0
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.h +6 -0
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.c +32 -0
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.h +6 -0
- data/ext/libarchive-0.1.1/ext/config.h.in +22 -0
- data/ext/libarchive-0.1.1/ext/configure +3904 -0
- data/ext/libarchive-0.1.1/ext/configure.in +11 -0
- data/ext/libarchive-0.1.1/ext/depend +19 -0
- data/ext/libarchive-0.1.1/ext/extconf.rb +6 -0
- data/ext/libarchive-0.1.1/ext/install-sh +250 -0
- data/ext/libarchive-0.1.1/ext/libarchive.c +89 -0
- data/ext/libarchive-0.1.1/ext/libarchive_archive.c +84 -0
- data/ext/libarchive-0.1.1/ext/libarchive_entry.c +1015 -0
- data/ext/libarchive-0.1.1/ext/libarchive_internal.h +155 -0
- data/ext/libarchive-0.1.1/ext/libarchive_reader.c +328 -0
- data/ext/libarchive-0.1.1/ext/libarchive_win32.h +52 -0
- data/ext/libarchive-0.1.1/ext/libarchive_writer.c +246 -0
- data/ext/libarchive-0.1.1/libarchive.c +1762 -0
- data/ext/libarchive-2.8.4/Makefile.in +7076 -0
- data/ext/libarchive-2.8.4/build/autoconf/check_stdcall_func.m4 +51 -0
- data/ext/libarchive-2.8.4/build/autoconf/compile +143 -0
- data/ext/libarchive-2.8.4/build/autoconf/config.guess +1502 -0
- data/ext/libarchive-2.8.4/build/autoconf/config.sub +1708 -0
- data/ext/libarchive-2.8.4/build/autoconf/depcomp +630 -0
- data/ext/libarchive-2.8.4/build/autoconf/install-sh +291 -0
- data/ext/libarchive-2.8.4/build/autoconf/la_uid_t.m4 +20 -0
- data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +8406 -0
- data/ext/libarchive-2.8.4/build/autoconf/missing +376 -0
- data/ext/libarchive-2.8.4/build/pkgconfig/libarchive.pc.in +10 -0
- data/ext/libarchive-2.8.4/config.h.in +772 -0
- data/ext/libarchive-2.8.4/configure +17916 -0
- data/ext/libarchive-2.8.4/libarchive/archive.h +741 -0
- data/ext/libarchive-2.8.4/libarchive/archive_check_magic.c +134 -0
- data/ext/libarchive-2.8.4/libarchive/archive_crc32.h +66 -0
- data/ext/libarchive-2.8.4/libarchive/archive_endian.h +162 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry.c +2202 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry.h +524 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_copy_bhfi.c +74 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_copy_stat.c +77 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_link_resolver.c +405 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_private.h +184 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_stat.c +118 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_strmode.c +87 -0
- data/ext/libarchive-2.8.4/libarchive/archive_entry_xattr.c +158 -0
- data/ext/libarchive-2.8.4/libarchive/archive_hash.h +281 -0
- data/ext/libarchive-2.8.4/libarchive/archive_platform.h +165 -0
- data/ext/libarchive-2.8.4/libarchive/archive_private.h +124 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read.c +1249 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_data_into_fd.c +93 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +198 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +570 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_private.h +62 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_set_standard_lookup.c +303 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_extract.c +182 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_fd.c +190 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_file.c +165 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +272 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_memory.c +156 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_private.h +199 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_all.c +60 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_bzip2.c +353 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_compress.c +444 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_gzip.c +465 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_none.c +40 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_program.c +459 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_rpm.c +287 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_uu.c +627 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_compression_xz.c +708 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_all.c +43 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_ar.c +584 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +777 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_empty.c +93 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_iso9660.c +2830 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +1304 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_raw.c +185 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_tar.c +2418 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_xar.c +3151 -0
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +903 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string.c +453 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string.h +148 -0
- data/ext/libarchive-2.8.4/libarchive/archive_string_sprintf.c +164 -0
- data/ext/libarchive-2.8.4/libarchive/archive_util.c +391 -0
- data/ext/libarchive-2.8.4/libarchive/archive_virtual.c +94 -0
- data/ext/libarchive-2.8.4/libarchive/archive_windows.c +1236 -0
- data/ext/libarchive-2.8.4/libarchive/archive_windows.h +347 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write.c +466 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +2628 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk_private.h +38 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk_set_standard_lookup.c +262 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_fd.c +141 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_file.c +105 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_filename.c +162 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_open_memory.c +126 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_private.h +122 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +408 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_compress.c +492 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +477 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +257 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +347 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +438 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format.c +72 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_ar.c +550 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_by_name.c +76 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +344 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +295 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +1050 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_pax.c +1386 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_shar.c +626 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_ustar.c +587 -0
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +667 -0
- data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +154 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork.c +161 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork.h +41 -0
- data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +113 -0
- data/ext/libarchive-static-makefile +80 -0
- data/ext/libarchive-static-wrapper-makefile +22 -0
- data/ext/zlib-1.2.5/Makefile.in +257 -0
- data/ext/zlib-1.2.5/adler32.c +169 -0
- data/ext/zlib-1.2.5/compress.c +80 -0
- data/ext/zlib-1.2.5/configure +596 -0
- data/ext/zlib-1.2.5/crc32.c +442 -0
- data/ext/zlib-1.2.5/crc32.h +441 -0
- data/ext/zlib-1.2.5/deflate.c +1834 -0
- data/ext/zlib-1.2.5/deflate.h +342 -0
- data/ext/zlib-1.2.5/example.c +565 -0
- data/ext/zlib-1.2.5/gzclose.c +25 -0
- data/ext/zlib-1.2.5/gzguts.h +132 -0
- data/ext/zlib-1.2.5/gzlib.c +537 -0
- data/ext/zlib-1.2.5/gzread.c +653 -0
- data/ext/zlib-1.2.5/gzwrite.c +531 -0
- data/ext/zlib-1.2.5/infback.c +632 -0
- data/ext/zlib-1.2.5/inffast.c +340 -0
- data/ext/zlib-1.2.5/inffast.h +11 -0
- data/ext/zlib-1.2.5/inffixed.h +94 -0
- data/ext/zlib-1.2.5/inflate.c +1480 -0
- data/ext/zlib-1.2.5/inflate.h +122 -0
- data/ext/zlib-1.2.5/inftrees.c +330 -0
- data/ext/zlib-1.2.5/inftrees.h +62 -0
- data/ext/zlib-1.2.5/minigzip.c +440 -0
- data/ext/zlib-1.2.5/trees.c +1244 -0
- data/ext/zlib-1.2.5/trees.h +128 -0
- data/ext/zlib-1.2.5/uncompr.c +59 -0
- data/ext/zlib-1.2.5/zconf.h +428 -0
- data/ext/zlib-1.2.5/zlib.h +1613 -0
- data/ext/zlib-1.2.5/zutil.c +318 -0
- data/ext/zlib-1.2.5/zutil.h +274 -0
- metadata +211 -0
@@ -0,0 +1,340 @@
|
|
1
|
+
/* inffast.c -- fast decoding
|
2
|
+
* Copyright (C) 1995-2008, 2010 Mark Adler
|
3
|
+
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
|
+
*/
|
5
|
+
|
6
|
+
#include "zutil.h"
|
7
|
+
#include "inftrees.h"
|
8
|
+
#include "inflate.h"
|
9
|
+
#include "inffast.h"
|
10
|
+
|
11
|
+
#ifndef ASMINF
|
12
|
+
|
13
|
+
/* Allow machine dependent optimization for post-increment or pre-increment.
|
14
|
+
Based on testing to date,
|
15
|
+
Pre-increment preferred for:
|
16
|
+
- PowerPC G3 (Adler)
|
17
|
+
- MIPS R5000 (Randers-Pehrson)
|
18
|
+
Post-increment preferred for:
|
19
|
+
- none
|
20
|
+
No measurable difference:
|
21
|
+
- Pentium III (Anderson)
|
22
|
+
- M68060 (Nikl)
|
23
|
+
*/
|
24
|
+
#ifdef POSTINC
|
25
|
+
# define OFF 0
|
26
|
+
# define PUP(a) *(a)++
|
27
|
+
#else
|
28
|
+
# define OFF 1
|
29
|
+
# define PUP(a) *++(a)
|
30
|
+
#endif
|
31
|
+
|
32
|
+
/*
|
33
|
+
Decode literal, length, and distance codes and write out the resulting
|
34
|
+
literal and match bytes until either not enough input or output is
|
35
|
+
available, an end-of-block is encountered, or a data error is encountered.
|
36
|
+
When large enough input and output buffers are supplied to inflate(), for
|
37
|
+
example, a 16K input buffer and a 64K output buffer, more than 95% of the
|
38
|
+
inflate execution time is spent in this routine.
|
39
|
+
|
40
|
+
Entry assumptions:
|
41
|
+
|
42
|
+
state->mode == LEN
|
43
|
+
strm->avail_in >= 6
|
44
|
+
strm->avail_out >= 258
|
45
|
+
start >= strm->avail_out
|
46
|
+
state->bits < 8
|
47
|
+
|
48
|
+
On return, state->mode is one of:
|
49
|
+
|
50
|
+
LEN -- ran out of enough output space or enough available input
|
51
|
+
TYPE -- reached end of block code, inflate() to interpret next block
|
52
|
+
BAD -- error in block data
|
53
|
+
|
54
|
+
Notes:
|
55
|
+
|
56
|
+
- The maximum input bits used by a length/distance pair is 15 bits for the
|
57
|
+
length code, 5 bits for the length extra, 15 bits for the distance code,
|
58
|
+
and 13 bits for the distance extra. This totals 48 bits, or six bytes.
|
59
|
+
Therefore if strm->avail_in >= 6, then there is enough input to avoid
|
60
|
+
checking for available input while decoding.
|
61
|
+
|
62
|
+
- The maximum bytes that a single length/distance pair can output is 258
|
63
|
+
bytes, which is the maximum length that can be coded. inflate_fast()
|
64
|
+
requires strm->avail_out >= 258 for each loop to avoid checking for
|
65
|
+
output space.
|
66
|
+
*/
|
67
|
+
void ZLIB_INTERNAL inflate_fast(strm, start)
|
68
|
+
z_streamp strm;
|
69
|
+
unsigned start; /* inflate()'s starting value for strm->avail_out */
|
70
|
+
{
|
71
|
+
struct inflate_state FAR *state;
|
72
|
+
unsigned char FAR *in; /* local strm->next_in */
|
73
|
+
unsigned char FAR *last; /* while in < last, enough input available */
|
74
|
+
unsigned char FAR *out; /* local strm->next_out */
|
75
|
+
unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
|
76
|
+
unsigned char FAR *end; /* while out < end, enough space available */
|
77
|
+
#ifdef INFLATE_STRICT
|
78
|
+
unsigned dmax; /* maximum distance from zlib header */
|
79
|
+
#endif
|
80
|
+
unsigned wsize; /* window size or zero if not using window */
|
81
|
+
unsigned whave; /* valid bytes in the window */
|
82
|
+
unsigned wnext; /* window write index */
|
83
|
+
unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
|
84
|
+
unsigned long hold; /* local strm->hold */
|
85
|
+
unsigned bits; /* local strm->bits */
|
86
|
+
code const FAR *lcode; /* local strm->lencode */
|
87
|
+
code const FAR *dcode; /* local strm->distcode */
|
88
|
+
unsigned lmask; /* mask for first level of length codes */
|
89
|
+
unsigned dmask; /* mask for first level of distance codes */
|
90
|
+
code here; /* retrieved table entry */
|
91
|
+
unsigned op; /* code bits, operation, extra bits, or */
|
92
|
+
/* window position, window bytes to copy */
|
93
|
+
unsigned len; /* match length, unused bytes */
|
94
|
+
unsigned dist; /* match distance */
|
95
|
+
unsigned char FAR *from; /* where to copy match from */
|
96
|
+
|
97
|
+
/* copy state to local variables */
|
98
|
+
state = (struct inflate_state FAR *)strm->state;
|
99
|
+
in = strm->next_in - OFF;
|
100
|
+
last = in + (strm->avail_in - 5);
|
101
|
+
out = strm->next_out - OFF;
|
102
|
+
beg = out - (start - strm->avail_out);
|
103
|
+
end = out + (strm->avail_out - 257);
|
104
|
+
#ifdef INFLATE_STRICT
|
105
|
+
dmax = state->dmax;
|
106
|
+
#endif
|
107
|
+
wsize = state->wsize;
|
108
|
+
whave = state->whave;
|
109
|
+
wnext = state->wnext;
|
110
|
+
window = state->window;
|
111
|
+
hold = state->hold;
|
112
|
+
bits = state->bits;
|
113
|
+
lcode = state->lencode;
|
114
|
+
dcode = state->distcode;
|
115
|
+
lmask = (1U << state->lenbits) - 1;
|
116
|
+
dmask = (1U << state->distbits) - 1;
|
117
|
+
|
118
|
+
/* decode literals and length/distances until end-of-block or not enough
|
119
|
+
input data or output space */
|
120
|
+
do {
|
121
|
+
if (bits < 15) {
|
122
|
+
hold += (unsigned long)(PUP(in)) << bits;
|
123
|
+
bits += 8;
|
124
|
+
hold += (unsigned long)(PUP(in)) << bits;
|
125
|
+
bits += 8;
|
126
|
+
}
|
127
|
+
here = lcode[hold & lmask];
|
128
|
+
dolen:
|
129
|
+
op = (unsigned)(here.bits);
|
130
|
+
hold >>= op;
|
131
|
+
bits -= op;
|
132
|
+
op = (unsigned)(here.op);
|
133
|
+
if (op == 0) { /* literal */
|
134
|
+
Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
135
|
+
"inflate: literal '%c'\n" :
|
136
|
+
"inflate: literal 0x%02x\n", here.val));
|
137
|
+
PUP(out) = (unsigned char)(here.val);
|
138
|
+
}
|
139
|
+
else if (op & 16) { /* length base */
|
140
|
+
len = (unsigned)(here.val);
|
141
|
+
op &= 15; /* number of extra bits */
|
142
|
+
if (op) {
|
143
|
+
if (bits < op) {
|
144
|
+
hold += (unsigned long)(PUP(in)) << bits;
|
145
|
+
bits += 8;
|
146
|
+
}
|
147
|
+
len += (unsigned)hold & ((1U << op) - 1);
|
148
|
+
hold >>= op;
|
149
|
+
bits -= op;
|
150
|
+
}
|
151
|
+
Tracevv((stderr, "inflate: length %u\n", len));
|
152
|
+
if (bits < 15) {
|
153
|
+
hold += (unsigned long)(PUP(in)) << bits;
|
154
|
+
bits += 8;
|
155
|
+
hold += (unsigned long)(PUP(in)) << bits;
|
156
|
+
bits += 8;
|
157
|
+
}
|
158
|
+
here = dcode[hold & dmask];
|
159
|
+
dodist:
|
160
|
+
op = (unsigned)(here.bits);
|
161
|
+
hold >>= op;
|
162
|
+
bits -= op;
|
163
|
+
op = (unsigned)(here.op);
|
164
|
+
if (op & 16) { /* distance base */
|
165
|
+
dist = (unsigned)(here.val);
|
166
|
+
op &= 15; /* number of extra bits */
|
167
|
+
if (bits < op) {
|
168
|
+
hold += (unsigned long)(PUP(in)) << bits;
|
169
|
+
bits += 8;
|
170
|
+
if (bits < op) {
|
171
|
+
hold += (unsigned long)(PUP(in)) << bits;
|
172
|
+
bits += 8;
|
173
|
+
}
|
174
|
+
}
|
175
|
+
dist += (unsigned)hold & ((1U << op) - 1);
|
176
|
+
#ifdef INFLATE_STRICT
|
177
|
+
if (dist > dmax) {
|
178
|
+
strm->msg = (char *)"invalid distance too far back";
|
179
|
+
state->mode = BAD;
|
180
|
+
break;
|
181
|
+
}
|
182
|
+
#endif
|
183
|
+
hold >>= op;
|
184
|
+
bits -= op;
|
185
|
+
Tracevv((stderr, "inflate: distance %u\n", dist));
|
186
|
+
op = (unsigned)(out - beg); /* max distance in output */
|
187
|
+
if (dist > op) { /* see if copy from window */
|
188
|
+
op = dist - op; /* distance back in window */
|
189
|
+
if (op > whave) {
|
190
|
+
if (state->sane) {
|
191
|
+
strm->msg =
|
192
|
+
(char *)"invalid distance too far back";
|
193
|
+
state->mode = BAD;
|
194
|
+
break;
|
195
|
+
}
|
196
|
+
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
197
|
+
if (len <= op - whave) {
|
198
|
+
do {
|
199
|
+
PUP(out) = 0;
|
200
|
+
} while (--len);
|
201
|
+
continue;
|
202
|
+
}
|
203
|
+
len -= op - whave;
|
204
|
+
do {
|
205
|
+
PUP(out) = 0;
|
206
|
+
} while (--op > whave);
|
207
|
+
if (op == 0) {
|
208
|
+
from = out - dist;
|
209
|
+
do {
|
210
|
+
PUP(out) = PUP(from);
|
211
|
+
} while (--len);
|
212
|
+
continue;
|
213
|
+
}
|
214
|
+
#endif
|
215
|
+
}
|
216
|
+
from = window - OFF;
|
217
|
+
if (wnext == 0) { /* very common case */
|
218
|
+
from += wsize - op;
|
219
|
+
if (op < len) { /* some from window */
|
220
|
+
len -= op;
|
221
|
+
do {
|
222
|
+
PUP(out) = PUP(from);
|
223
|
+
} while (--op);
|
224
|
+
from = out - dist; /* rest from output */
|
225
|
+
}
|
226
|
+
}
|
227
|
+
else if (wnext < op) { /* wrap around window */
|
228
|
+
from += wsize + wnext - op;
|
229
|
+
op -= wnext;
|
230
|
+
if (op < len) { /* some from end of window */
|
231
|
+
len -= op;
|
232
|
+
do {
|
233
|
+
PUP(out) = PUP(from);
|
234
|
+
} while (--op);
|
235
|
+
from = window - OFF;
|
236
|
+
if (wnext < len) { /* some from start of window */
|
237
|
+
op = wnext;
|
238
|
+
len -= op;
|
239
|
+
do {
|
240
|
+
PUP(out) = PUP(from);
|
241
|
+
} while (--op);
|
242
|
+
from = out - dist; /* rest from output */
|
243
|
+
}
|
244
|
+
}
|
245
|
+
}
|
246
|
+
else { /* contiguous in window */
|
247
|
+
from += wnext - op;
|
248
|
+
if (op < len) { /* some from window */
|
249
|
+
len -= op;
|
250
|
+
do {
|
251
|
+
PUP(out) = PUP(from);
|
252
|
+
} while (--op);
|
253
|
+
from = out - dist; /* rest from output */
|
254
|
+
}
|
255
|
+
}
|
256
|
+
while (len > 2) {
|
257
|
+
PUP(out) = PUP(from);
|
258
|
+
PUP(out) = PUP(from);
|
259
|
+
PUP(out) = PUP(from);
|
260
|
+
len -= 3;
|
261
|
+
}
|
262
|
+
if (len) {
|
263
|
+
PUP(out) = PUP(from);
|
264
|
+
if (len > 1)
|
265
|
+
PUP(out) = PUP(from);
|
266
|
+
}
|
267
|
+
}
|
268
|
+
else {
|
269
|
+
from = out - dist; /* copy direct from output */
|
270
|
+
do { /* minimum length is three */
|
271
|
+
PUP(out) = PUP(from);
|
272
|
+
PUP(out) = PUP(from);
|
273
|
+
PUP(out) = PUP(from);
|
274
|
+
len -= 3;
|
275
|
+
} while (len > 2);
|
276
|
+
if (len) {
|
277
|
+
PUP(out) = PUP(from);
|
278
|
+
if (len > 1)
|
279
|
+
PUP(out) = PUP(from);
|
280
|
+
}
|
281
|
+
}
|
282
|
+
}
|
283
|
+
else if ((op & 64) == 0) { /* 2nd level distance code */
|
284
|
+
here = dcode[here.val + (hold & ((1U << op) - 1))];
|
285
|
+
goto dodist;
|
286
|
+
}
|
287
|
+
else {
|
288
|
+
strm->msg = (char *)"invalid distance code";
|
289
|
+
state->mode = BAD;
|
290
|
+
break;
|
291
|
+
}
|
292
|
+
}
|
293
|
+
else if ((op & 64) == 0) { /* 2nd level length code */
|
294
|
+
here = lcode[here.val + (hold & ((1U << op) - 1))];
|
295
|
+
goto dolen;
|
296
|
+
}
|
297
|
+
else if (op & 32) { /* end-of-block */
|
298
|
+
Tracevv((stderr, "inflate: end of block\n"));
|
299
|
+
state->mode = TYPE;
|
300
|
+
break;
|
301
|
+
}
|
302
|
+
else {
|
303
|
+
strm->msg = (char *)"invalid literal/length code";
|
304
|
+
state->mode = BAD;
|
305
|
+
break;
|
306
|
+
}
|
307
|
+
} while (in < last && out < end);
|
308
|
+
|
309
|
+
/* return unused bytes (on entry, bits < 8, so in won't go too far back) */
|
310
|
+
len = bits >> 3;
|
311
|
+
in -= len;
|
312
|
+
bits -= len << 3;
|
313
|
+
hold &= (1U << bits) - 1;
|
314
|
+
|
315
|
+
/* update state and return */
|
316
|
+
strm->next_in = in + OFF;
|
317
|
+
strm->next_out = out + OFF;
|
318
|
+
strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
|
319
|
+
strm->avail_out = (unsigned)(out < end ?
|
320
|
+
257 + (end - out) : 257 - (out - end));
|
321
|
+
state->hold = hold;
|
322
|
+
state->bits = bits;
|
323
|
+
return;
|
324
|
+
}
|
325
|
+
|
326
|
+
/*
|
327
|
+
inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
|
328
|
+
- Using bit fields for code structure
|
329
|
+
- Different op definition to avoid & for extra bits (do & for table bits)
|
330
|
+
- Three separate decoding do-loops for direct, window, and wnext == 0
|
331
|
+
- Special case for distance > 1 copies to do overlapped load and store copy
|
332
|
+
- Explicit branch predictions (based on measured branch probabilities)
|
333
|
+
- Deferring match copy and interspersed it with decoding subsequent codes
|
334
|
+
- Swapping literal/length else
|
335
|
+
- Swapping window/direct else
|
336
|
+
- Larger unrolled copy loops (three is about right)
|
337
|
+
- Moving len -= 3 statement into middle of loop
|
338
|
+
*/
|
339
|
+
|
340
|
+
#endif /* !ASMINF */
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/* inffast.h -- header to use inffast.c
|
2
|
+
* Copyright (C) 1995-2003, 2010 Mark Adler
|
3
|
+
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
|
+
*/
|
5
|
+
|
6
|
+
/* WARNING: this file should *not* be used by applications. It is
|
7
|
+
part of the implementation of the compression library and is
|
8
|
+
subject to change. Applications should only use zlib.h.
|
9
|
+
*/
|
10
|
+
|
11
|
+
void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
|
@@ -0,0 +1,94 @@
|
|
1
|
+
/* inffixed.h -- table for decoding fixed codes
|
2
|
+
* Generated automatically by makefixed().
|
3
|
+
*/
|
4
|
+
|
5
|
+
/* WARNING: this file should *not* be used by applications. It
|
6
|
+
is part of the implementation of the compression library and
|
7
|
+
is subject to change. Applications should only use zlib.h.
|
8
|
+
*/
|
9
|
+
|
10
|
+
static const code lenfix[512] = {
|
11
|
+
{96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
|
12
|
+
{0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
|
13
|
+
{0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
|
14
|
+
{0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
|
15
|
+
{0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
|
16
|
+
{21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
|
17
|
+
{0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
|
18
|
+
{0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
|
19
|
+
{18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
|
20
|
+
{0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
|
21
|
+
{0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
|
22
|
+
{0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
|
23
|
+
{20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
|
24
|
+
{0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
|
25
|
+
{0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
|
26
|
+
{0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
|
27
|
+
{16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
|
28
|
+
{0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
|
29
|
+
{0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
|
30
|
+
{0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
|
31
|
+
{0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
|
32
|
+
{0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
|
33
|
+
{0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
|
34
|
+
{0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
|
35
|
+
{17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
|
36
|
+
{0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
|
37
|
+
{0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
|
38
|
+
{0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
|
39
|
+
{19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
|
40
|
+
{0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
|
41
|
+
{0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
|
42
|
+
{0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
|
43
|
+
{16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
|
44
|
+
{0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
|
45
|
+
{0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
|
46
|
+
{0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
|
47
|
+
{0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
|
48
|
+
{20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
|
49
|
+
{0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
|
50
|
+
{0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
|
51
|
+
{17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
|
52
|
+
{0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
|
53
|
+
{0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
|
54
|
+
{0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
|
55
|
+
{20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
|
56
|
+
{0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
|
57
|
+
{0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
|
58
|
+
{0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
|
59
|
+
{16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
|
60
|
+
{0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
|
61
|
+
{0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
|
62
|
+
{0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
|
63
|
+
{0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
|
64
|
+
{0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
|
65
|
+
{0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
|
66
|
+
{0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
|
67
|
+
{16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
|
68
|
+
{0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
|
69
|
+
{0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
|
70
|
+
{0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
|
71
|
+
{19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
|
72
|
+
{0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
|
73
|
+
{0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
|
74
|
+
{0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
|
75
|
+
{16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
|
76
|
+
{0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
|
77
|
+
{0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
|
78
|
+
{0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
|
79
|
+
{0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
|
80
|
+
{64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
|
81
|
+
{0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
|
82
|
+
{0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
|
83
|
+
{18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
|
84
|
+
{0,9,255}
|
85
|
+
};
|
86
|
+
|
87
|
+
static const code distfix[32] = {
|
88
|
+
{16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
|
89
|
+
{21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
|
90
|
+
{18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
|
91
|
+
{19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
|
92
|
+
{16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
|
93
|
+
{22,5,193},{64,5,0}
|
94
|
+
};
|