author | Claus Gittinger <cg@exept.de> |
Wed, 21 Oct 1998 21:49:48 +0200 | |
changeset 701 | 90faf30c20eb |
parent 700 | b1c6920cfef6 |
child 717 | 9fc99fadc545 |
permissions | -rw-r--r-- |
624 | 1 |
" |
2 |
COPYRIGHT (c) 1998 by eXept Software AG |
|
636 | 3 |
All Rights Reserved |
624 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
622 | 13 |
|
14 |
Object subclass:#ZipArchive |
|
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
15 |
instanceVariableNames:'file mode archiveName firstEntry lastEntry |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
16 |
recentlyExtractedEntries' |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
17 |
classVariableNames:'RecentlyUsedZipArchives FlushBlock ECREC_SIZE LREC_SIZE CREC_SIZE |
628
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
18 |
SIZE_CENTRAL_DIRECTORY TOTAL_ENTRIES_CENTRAL_DIR |
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
19 |
C_COMPRESSED_SIZE C_RELATIVE_OFFSET_LOCAL_HEADER |
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
20 |
C_FILENAME_LENGTH C_UNCOMPRESSED_SIZE ZipFileFormatErrorSignal |
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
21 |
COMPR_STORED COMPR_SHRUNK COMPR_REDUCED1 COMPR_REDUCED2 |
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
22 |
COMPR_REDUCED3 COMPR_REDUCED4 COMPR_IMPLODED COMPR_TOKENIZED |
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
23 |
COMPR_DEFLATED' |
622 | 24 |
poolDictionaries:'' |
25 |
category:'System-Support-FileFormats' |
|
26 |
! |
|
27 |
||
28 |
Object subclass:#ZipMember |
|
29 |
instanceVariableNames:'next relative_offset_local_header compressed_size |
|
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
30 |
uncompressed_size name crc32 compression_method data' |
622 | 31 |
classVariableNames:'' |
32 |
poolDictionaries:'' |
|
33 |
privateIn:ZipArchive |
|
34 |
! |
|
35 |
||
636 | 36 |
!ZipArchive primitiveDefinitions! |
37 |
%{ |
|
38 |
||
39 |
#include <stdio.h> |
|
40 |
||
41 |
#define uchar unsigned char |
|
42 |
#define ushort unsigned short |
|
43 |
#define ulong unsigned long |
|
44 |
||
45 |
/* |
|
46 |
* inflate definitions |
|
47 |
*/ |
|
48 |
#define PKZIP_BUG_WORKAROUND /* PKZIP 1.93a problem--live with it */ |
|
49 |
#ifndef WSIZE /* default is 32K */ |
|
50 |
# define WSIZE 0x8000 /* window size--must be a power of two, and at least */ |
|
51 |
#endif /* 32K for zip's deflate method */ |
|
52 |
||
53 |
#define NEXTBYTE (*inPtr++) |
|
637 | 54 |
#define XXXFLUSH(n) slide += (n) |
55 |
#define FLUSH(n) { bcopy(slide, outPtr, (n)); outPtr += (n); } |
|
639 | 56 |
#if 0 |
636 | 57 |
# define Trace(x) fprintf x |
58 |
#else |
|
59 |
# define Trace(x) /* nothing */ |
|
60 |
#endif |
|
61 |
||
62 |
/* Huffman code lookup table entry--this entry is four bytes for machines |
|
63 |
that have 16-bit pointers (e.g. PC's in the small or medium model). |
|
64 |
Valid extra bits are 0..13. e == 15 is EOB (end of block), e == 16 |
|
65 |
means that v is a literal, 16 < e < 32 means that v is a pointer to |
|
66 |
the next table, which codes e - 16 bits, and lastly e == 99 indicates |
|
67 |
an unused code. If a code with e == 99 is looked up, this implies an |
|
68 |
error in the data. */ |
|
69 |
struct huft { |
|
70 |
uchar e; /* number of extra bits or operation */ |
|
71 |
uchar b; /* number of bits in this code or subcode */ |
|
72 |
union { |
|
73 |
ushort n; /* literal, length base, or distance base */ |
|
74 |
struct huft *t; /* pointer to next level of table */ |
|
75 |
} v; |
|
76 |
}; |
|
77 |
||
78 |
%} |
|
79 |
! ! |
|
80 |
||
81 |
!ZipArchive primitiveVariables! |
|
82 |
%{ |
|
83 |
||
84 |
/* |
|
85 |
* inflate variables |
|
86 |
*/ |
|
87 |
||
88 |
static unsigned char *inPtr; |
|
89 |
static unsigned char *outPtr; |
|
90 |
static unsigned char *slide; |
|
91 |
||
92 |
static int qflag = 0; |
|
93 |
||
94 |
/* The inflate algorithm uses a sliding 32K byte window on the uncompressed |
|
95 |
stream to find repeated byte strings. This is implemented here as a |
|
96 |
circular buffer. The index is updated simply by incrementing and then |
|
97 |
and'ing with 0x7fff (32K-1). */ |
|
98 |
/* It is left to other modules to supply the 32K area. It is assumed |
|
99 |
to be usable as if it were declared "uchar slide[32768];" or as just |
|
100 |
"uchar *slide;" and then malloc'ed in the latter case. The definition |
|
101 |
must be in unzip.h, included above. */ |
|
102 |
static unsigned wp; /* current position in slide */ |
|
103 |
||
104 |
||
105 |
/* Tables for deflate from PKZIP's appnote.txt. */ |
|
106 |
static unsigned border[] = { /* Order of the bit length code lengths */ |
|
107 |
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; |
|
108 |
||
109 |
static ushort cplens[] = { /* Copy lengths for literal codes 257..285 */ |
|
110 |
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, |
|
111 |
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; |
|
112 |
/* note: see note #13 above about the 258 in this list. */ |
|
113 |
||
114 |
static ushort cplext[] = { /* Extra bits for literal codes 257..285 */ |
|
115 |
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, |
|
116 |
3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */ |
|
117 |
||
118 |
static ushort cpdist[] = { /* Copy offsets for distance codes 0..29 */ |
|
119 |
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, |
|
120 |
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, |
|
121 |
8193, 12289, 16385, 24577}; |
|
122 |
static ushort cpdext[] = { /* Extra bits for distance codes */ |
|
123 |
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, |
|
124 |
7, 7, 8, 8, 9, 9, 10, 10, 11, 11, |
|
125 |
12, 12, 13, 13}; |
|
126 |
||
127 |
/* And'ing with mask[n] masks the lower n bits */ |
|
128 |
static ushort mask[] = { |
|
129 |
0x0000, |
|
130 |
0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, |
|
131 |
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff |
|
132 |
}; |
|
133 |
||
134 |
||
135 |
/* Macros for inflate() bit peeking and grabbing. |
|
136 |
The usage is: |
|
137 |
||
138 |
NEEDBITS(j) |
|
139 |
x = b & mask[j]; |
|
140 |
DUMPBITS(j) |
|
141 |
||
142 |
where NEEDBITS makes sure that b has at least j bits in it, and |
|
143 |
DUMPBITS removes the bits from b. The macros use the variable k |
|
144 |
for the number of bits in b. Normally, b and k are register |
|
145 |
variables for speed, and are initialized at the begining of a |
|
146 |
routine that uses these macros from a global bit buffer and count. |
|
147 |
||
148 |
In order to not ask for more bits than there are in the compressed |
|
149 |
stream, the Huffman tables are constructed to only ask for just |
|
150 |
enough bits to make up the end-of-block code (value 256). Then no |
|
151 |
bytes need to be "returned" to the buffer at the end of the last |
|
152 |
block. See the huft_build() routine. |
|
153 |
*/ |
|
154 |
||
155 |
static ulong bb; /* bit buffer */ |
|
156 |
static unsigned bk; /* bits in bit buffer */ |
|
157 |
||
637 | 158 |
#define NEEDBITS(n) { while(k<(n)){ b |= ((ulong)NEXTBYTE)<<k; k+=8; } } |
159 |
#define DUMPBITS(n) { b>>=(n); k-=(n); } |
|
636 | 160 |
|
161 |
||
162 |
/* |
|
163 |
Huffman code decoding is performed using a multi-level table lookup. |
|
164 |
The fastest way to decode is to simply build a lookup table whose |
|
165 |
size is determined by the longest code. However, the time it takes |
|
166 |
to build this table can also be a factor if the data being decoded |
|
167 |
is not very long. The most common codes are necessarily the |
|
168 |
shortest codes, so those codes dominate the decoding time, and hence |
|
169 |
the speed. The idea is you can have a shorter table that decodes the |
|
170 |
shorter, more probable codes, and then point to subsidiary tables for |
|
171 |
the longer codes. The time it costs to decode the longer codes is |
|
172 |
then traded against the time it takes to make longer tables. |
|
173 |
||
174 |
This results of this trade are in the variables lbits and dbits |
|
175 |
below. lbits is the number of bits the first level table for literal/ |
|
176 |
length codes can decode in one step, and dbits is the same thing for |
|
177 |
the distance codes. Subsequent tables are also less than or equal to |
|
178 |
those sizes. These values may be adjusted either when all of the |
|
179 |
codes are shorter than that, in which case the longest code length in |
|
180 |
bits is used, or when the shortest code is *longer* than the requested |
|
181 |
table size, in which case the length of the shortest code in bits is |
|
182 |
used. |
|
183 |
||
184 |
There are two different values for the two tables, since they code a |
|
185 |
different number of possibilities each. The literal/length table |
|
186 |
codes 286 possible values, or in a flat code, a little over eight |
|
187 |
bits. The distance table codes 30 possible values, or a little less |
|
188 |
than five bits, flat. The optimum values for speed end up being |
|
189 |
about one bit more than those, so lbits is 8+1 and dbits is 5+1. |
|
190 |
The optimum values may differ though from machine to machine, and |
|
191 |
possibly even between compilers. Your mileage may vary. |
|
192 |
*/ |
|
193 |
||
194 |
||
195 |
static int lbits = 9; /* bits in base literal/length lookup table */ |
|
196 |
static int dbits = 6; /* bits in base distance lookup table */ |
|
197 |
||
198 |
||
199 |
/* If BMAX needs to be larger than 16, then h and x[] should be ulong. */ |
|
200 |
#define BMAX 16 /* maximum bit length of any code (16 for explode) */ |
|
201 |
#define N_MAX 288 /* maximum number of codes in any set */ |
|
202 |
||
203 |
||
204 |
static unsigned hufts; /* track memory usage */ |
|
205 |
||
206 |
%} |
|
207 |
! ! |
|
208 |
||
209 |
!ZipArchive primitiveFunctions! |
|
210 |
%{ |
|
211 |
||
212 |
/* |
|
213 |
* inflate algorithm |
|
214 |
*/ |
|
215 |
||
216 |
/* Free the malloc'ed tables built by huft_build(), which makes a linked |
|
217 |
list of the tables it made, with the links in a dummy first entry of |
|
218 |
each table. */ |
|
219 |
static int |
|
220 |
huft_free(t) |
|
221 |
struct huft *t; /* table to free */ |
|
222 |
{ |
|
223 |
register struct huft *p, *q; |
|
224 |
||
225 |
||
226 |
/* Go through linked list, freeing from the malloced (t[-1]) address. */ |
|
227 |
p = t; |
|
228 |
while (p != (struct huft *)NULL) |
|
229 |
{ |
|
230 |
q = (--p)->v.t; |
|
231 |
free(p); |
|
232 |
p = q; |
|
233 |
} |
|
234 |
return 0; |
|
235 |
} |
|
236 |
||
237 |
||
238 |
||
239 |
||
240 |
/* Given a list of code lengths and a maximum table size, make a set of |
|
241 |
tables to decode that set of codes. Return zero on success, one if |
|
242 |
the given code set is incomplete (the tables are still built in this |
|
243 |
case), two if the input is invalid (all zero length codes or an |
|
244 |
oversubscribed set of lengths), and three if not enough memory. |
|
245 |
The code with value 256 is special, and the tables are constructed |
|
246 |
so that no bits beyond that code are fetched when that code is |
|
247 |
decoded. */ |
|
248 |
static int |
|
249 |
huft_build(b, n, s, d, e, t, m) |
|
250 |
unsigned *b; /* code lengths in bits (all assumed <= BMAX) */ |
|
251 |
unsigned n; /* number of codes (assumed <= N_MAX) */ |
|
252 |
unsigned s; /* number of simple-valued codes (0..s-1) */ |
|
253 |
ushort *d; /* list of base values for non-simple codes */ |
|
254 |
ushort *e; /* list of extra bits for non-simple codes */ |
|
255 |
struct huft **t; /* result: starting table */ |
|
256 |
int *m; /* maximum lookup bits, returns actual */ |
|
257 |
{ |
|
258 |
unsigned a; /* counter for codes of length k */ |
|
259 |
unsigned c[BMAX+1]; /* bit length count table */ |
|
260 |
unsigned el; /* length of EOB code (value 256) */ |
|
261 |
unsigned f; /* i repeats in table every f entries */ |
|
262 |
int g; /* maximum code length */ |
|
263 |
int h; /* table level */ |
|
264 |
register unsigned i; /* counter, current code */ |
|
265 |
register unsigned j; /* counter */ |
|
266 |
register int k; /* number of bits in current code */ |
|
267 |
int lx[BMAX+1]; /* memory for l[-1..BMAX-1] */ |
|
268 |
int *l = lx+1; /* stack of bits per table */ |
|
269 |
register unsigned *p; /* pointer into c[], b[], or v[] */ |
|
270 |
register struct huft *q; /* points to current table */ |
|
271 |
struct huft r; /* table entry for structure assignment */ |
|
272 |
struct huft *u[BMAX]; /* table stack */ |
|
273 |
static unsigned v[N_MAX]; /* values in order of bit length */ |
|
274 |
register int w; /* bits before this table == (l * h) */ |
|
275 |
unsigned x[BMAX+1]; /* bit offsets, then code stack */ |
|
276 |
unsigned *xp; /* pointer into x */ |
|
277 |
int y; /* number of dummy codes added */ |
|
278 |
unsigned z; /* number of entries in current table */ |
|
279 |
||
280 |
||
281 |
/* Generate counts for each bit length */ |
|
282 |
el = n > 256 ? b[256] : BMAX; /* set length of EOB code, if any */ |
|
283 |
bzero((char *)c, sizeof(c)); |
|
284 |
p = b; i = n; |
|
285 |
do { |
|
286 |
c[*p]++; p++; /* assume all entries <= BMAX */ |
|
287 |
} while (--i); |
|
288 |
if (c[0] == n) /* null input--all zero length codes */ |
|
289 |
{ |
|
290 |
*t = (struct huft *)NULL; |
|
291 |
*m = 0; |
|
292 |
return 0; |
|
293 |
} |
|
294 |
||
295 |
||
296 |
/* Find minimum and maximum length, bound *m by those */ |
|
297 |
for (j = 1; j <= BMAX; j++) |
|
298 |
if (c[j]) |
|
299 |
break; |
|
300 |
k = j; /* minimum code length */ |
|
301 |
if ((unsigned)*m < j) |
|
302 |
*m = j; |
|
303 |
for (i = BMAX; i; i--) |
|
304 |
if (c[i]) |
|
305 |
break; |
|
306 |
g = i; /* maximum code length */ |
|
307 |
if ((unsigned)*m > i) |
|
308 |
*m = i; |
|
309 |
||
310 |
||
311 |
/* Adjust last length count to fill out codes, if needed */ |
|
312 |
for (y = 1 << j; j < i; j++, y <<= 1) |
|
313 |
if ((y -= c[j]) < 0) |
|
314 |
return 2; /* bad input: more codes than bits */ |
|
315 |
if ((y -= c[i]) < 0) |
|
316 |
return 2; |
|
317 |
c[i] += y; |
|
318 |
||
319 |
||
320 |
/* Generate starting offsets into the value table for each length */ |
|
321 |
x[1] = j = 0; |
|
322 |
p = c + 1; xp = x + 2; |
|
323 |
while (--i) { /* note that i == g from above */ |
|
324 |
*xp++ = (j += *p++); |
|
325 |
} |
|
326 |
||
327 |
||
328 |
/* Make a table of values in order of bit lengths */ |
|
329 |
p = b; i = 0; |
|
330 |
do { |
|
331 |
if ((j = *p++) != 0) |
|
332 |
v[x[j]++] = i; |
|
333 |
} while (++i < n); |
|
334 |
||
335 |
||
336 |
/* Generate the Huffman codes and for each, make the table entries */ |
|
337 |
x[0] = i = 0; /* first Huffman code is zero */ |
|
338 |
p = v; /* grab values in bit order */ |
|
339 |
h = -1; /* no tables yet--level -1 */ |
|
340 |
w = l[-1] = 0; /* no bits decoded yet */ |
|
341 |
u[0] = (struct huft *)NULL; /* just to keep compilers happy */ |
|
342 |
q = (struct huft *)NULL; /* ditto */ |
|
343 |
z = 0; /* ditto */ |
|
344 |
||
345 |
/* go through the bit lengths (k already is bits in shortest code) */ |
|
346 |
for (; k <= g; k++) |
|
347 |
{ |
|
348 |
a = c[k]; |
|
349 |
while (a--) |
|
350 |
{ |
|
351 |
/* here i is the Huffman code of length k bits for value *p */ |
|
352 |
/* make tables up to required level */ |
|
353 |
while (k > w + l[h]) |
|
354 |
{ |
|
355 |
w += l[h++]; /* add bits already decoded */ |
|
356 |
||
357 |
/* compute minimum size table less than or equal to *m bits */ |
|
358 |
z = (z = g - w) > (unsigned)*m ? *m : z; /* upper limit */ |
|
359 |
if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ |
|
360 |
{ /* too few codes for k-w bit table */ |
|
361 |
f -= a + 1; /* deduct codes from patterns left */ |
|
362 |
xp = c + k; |
|
363 |
while (++j < z) /* try smaller tables up to z bits */ |
|
364 |
{ |
|
365 |
if ((f <<= 1) <= *++xp) |
|
366 |
break; /* enough codes to use up j bits */ |
|
367 |
f -= *xp; /* else deduct codes from patterns */ |
|
368 |
} |
|
369 |
} |
|
370 |
if ((unsigned)w + j > el && (unsigned)w < el) |
|
371 |
j = el - w; /* make EOB code end at table */ |
|
372 |
z = 1 << j; /* table entries for j-bit table */ |
|
373 |
l[h] = j; /* set table size in stack */ |
|
374 |
||
375 |
/* allocate and link in new table */ |
|
376 |
if ((q = (struct huft *)malloc((z + 1)*sizeof(struct huft))) == |
|
377 |
(struct huft *)NULL) |
|
378 |
{ |
|
379 |
if (h) |
|
380 |
huft_free(u[0]); |
|
381 |
return 3; /* not enough memory */ |
|
382 |
} |
|
383 |
hufts += z + 1; /* track memory usage */ |
|
384 |
*t = q + 1; /* link to list for huft_free() */ |
|
385 |
*(t = &(q->v.t)) = (struct huft *)NULL; |
|
386 |
u[h] = ++q; /* table starts after link */ |
|
387 |
||
388 |
/* connect to last table, if there is one */ |
|
389 |
if (h) |
|
390 |
{ |
|
391 |
x[h] = i; /* save pattern for backing up */ |
|
392 |
r.b = (uchar)l[h-1]; /* bits to dump before this table */ |
|
393 |
r.e = (uchar)(16 + j); /* bits in this table */ |
|
394 |
r.v.t = q; /* pointer to this table */ |
|
395 |
j = (i & ((1 << w) - 1)) >> (w - l[h-1]); |
|
396 |
u[h-1][j] = r; /* connect to last table */ |
|
397 |
} |
|
398 |
} |
|
399 |
||
400 |
/* set up table entry in r */ |
|
401 |
r.b = (uchar)(k - w); |
|
402 |
if (p >= v + n) |
|
403 |
r.e = 99; /* out of values--invalid code */ |
|
404 |
else if (*p < s) |
|
405 |
{ |
|
406 |
r.e = (uchar)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */ |
|
407 |
r.v.n = *p++; /* simple code is just the value */ |
|
408 |
} |
|
409 |
else |
|
410 |
{ |
|
411 |
r.e = (uchar)e[*p - s]; /* non-simple--look up in lists */ |
|
412 |
r.v.n = d[*p++ - s]; |
|
413 |
} |
|
414 |
||
415 |
/* fill code-like entries with r */ |
|
416 |
f = 1 << (k - w); |
|
417 |
for (j = i >> w; j < z; j += f) |
|
418 |
q[j] = r; |
|
419 |
||
420 |
/* backwards increment the k-bit code i */ |
|
421 |
for (j = 1 << (k - 1); i & j; j >>= 1) |
|
422 |
i ^= j; |
|
423 |
i ^= j; |
|
424 |
||
425 |
/* backup over finished tables */ |
|
426 |
while ((i & ((1 << w) - 1)) != x[h]) |
|
427 |
w -= l[--h]; /* don't need to update q */ |
|
428 |
} |
|
429 |
} |
|
430 |
||
431 |
||
432 |
/* return actual size of base table */ |
|
433 |
*m = l[0]; |
|
434 |
||
435 |
||
436 |
/* Return true (1) if we were given an incomplete table */ |
|
437 |
return y != 0 && g != 1; |
|
438 |
} |
|
439 |
||
440 |
||
441 |
||
442 |
#ifdef ASM_INFLATECODES |
|
443 |
# define inflate_codes(tl,td,bl,bd) flate_codes(tl,td,bl,bd,(uchar *)slide) |
|
444 |
int flate_codes OF((struct huft *, struct huft *, int, int, uchar *)); |
|
445 |
||
446 |
#else |
|
447 |
||
448 |
/* inflate (decompress) the codes in a deflated (compressed) block. |
|
449 |
Return an error code or zero if it all goes ok. */ |
|
450 |
static int |
|
451 |
inflate_codes(tl, td, bl, bd) |
|
452 |
struct huft *tl, *td; /* literal/length and distance decoder tables */ |
|
453 |
int bl, bd; /* number of bits decoded by tl[] and td[] */ |
|
454 |
{ |
|
455 |
register unsigned e; /* table entry flag/number of extra bits */ |
|
456 |
unsigned n, d; /* length and index for copy */ |
|
457 |
unsigned w; /* current window position */ |
|
458 |
struct huft *t; /* pointer to table entry */ |
|
459 |
unsigned ml, md; /* masks for bl and bd bits */ |
|
460 |
register ulong b; /* bit buffer */ |
|
461 |
register unsigned k; /* number of bits in bit buffer */ |
|
462 |
||
463 |
||
464 |
/* make local copies of globals */ |
|
465 |
b = bb; /* initialize bit buffer */ |
|
466 |
k = bk; |
|
467 |
w = wp; /* initialize window position */ |
|
468 |
||
469 |
||
470 |
/* inflate the coded data */ |
|
471 |
ml = mask[bl]; /* precompute masks for speed */ |
|
472 |
md = mask[bd]; |
|
473 |
while (1) /* do until end of block */ |
|
474 |
{ |
|
475 |
NEEDBITS((unsigned)bl) |
|
476 |
if ((e = (t = tl + ((unsigned)b & ml))->e) > 16) |
|
477 |
do { |
|
478 |
if (e == 99) |
|
479 |
return 1; |
|
480 |
DUMPBITS(t->b) |
|
481 |
e -= 16; |
|
482 |
NEEDBITS(e) |
|
483 |
} while ((e = (t = t->v.t + ((unsigned)b & mask[e]))->e) > 16); |
|
484 |
DUMPBITS(t->b) |
|
485 |
if (e == 16) /* then it's a literal */ |
|
486 |
{ |
|
487 |
slide[w++] = (uchar)t->v.n; |
|
488 |
if (w == WSIZE) |
|
489 |
{ |
|
490 |
FLUSH(w); |
|
491 |
w = 0; |
|
492 |
} |
|
493 |
} |
|
494 |
else /* it's an EOB or a length */ |
|
495 |
{ |
|
496 |
/* exit if end of block */ |
|
497 |
if (e == 15) |
|
498 |
break; |
|
499 |
||
500 |
/* get length of block to copy */ |
|
501 |
NEEDBITS(e) |
|
502 |
n = t->v.n + ((unsigned)b & mask[e]); |
|
503 |
DUMPBITS(e); |
|
504 |
||
505 |
/* decode distance of block to copy */ |
|
506 |
NEEDBITS((unsigned)bd) |
|
507 |
if ((e = (t = td + ((unsigned)b & md))->e) > 16) |
|
508 |
do { |
|
509 |
if (e == 99) |
|
510 |
return 1; |
|
511 |
DUMPBITS(t->b) |
|
512 |
e -= 16; |
|
513 |
NEEDBITS(e) |
|
514 |
} while ((e = (t = t->v.t + ((unsigned)b & mask[e]))->e) > 16); |
|
515 |
DUMPBITS(t->b) |
|
516 |
NEEDBITS(e) |
|
517 |
d = w - t->v.n - ((unsigned)b & mask[e]); |
|
518 |
DUMPBITS(e) |
|
519 |
||
520 |
/* do the copy */ |
|
521 |
do { |
|
522 |
n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e); |
|
523 |
#ifndef NOMEMCPY |
|
524 |
if (w - d >= e) /* (this test assumes unsigned comparison) */ |
|
525 |
{ |
|
526 |
# ifdef USE_MEMCPY |
|
527 |
memcpy(slide + w, slide + d, e); |
|
528 |
# else |
|
529 |
bcopy(slide + d, slide + w, e); |
|
530 |
# endif |
|
531 |
w += e; |
|
532 |
d += e; |
|
533 |
} |
|
534 |
else /* do it slow to avoid memcpy() overlap */ |
|
535 |
#endif /* !NOMEMCPY */ |
|
536 |
do { |
|
537 |
slide[w++] = slide[d++]; |
|
538 |
} while (--e); |
|
539 |
if (w == WSIZE) |
|
540 |
{ |
|
541 |
FLUSH(w); |
|
542 |
w = 0; |
|
543 |
} |
|
544 |
} while (n); |
|
545 |
} |
|
546 |
} |
|
547 |
||
548 |
||
549 |
/* restore the globals from the locals */ |
|
550 |
wp = w; /* restore global window pointer */ |
|
551 |
bb = b; /* restore global bit buffer */ |
|
552 |
bk = k; |
|
553 |
||
554 |
||
555 |
/* done */ |
|
556 |
return 0; |
|
557 |
} |
|
558 |
||
559 |
#endif /* ASM_INFLATECODES */ |
|
560 |
||
561 |
||
562 |
||
563 |
/* "decompress" an inflated type 0 (stored) block. */ |
|
564 |
static int |
|
565 |
inflate_stored() |
|
566 |
{ |
|
567 |
unsigned n; /* number of bytes in block */ |
|
568 |
unsigned w; /* current window position */ |
|
569 |
register ulong b; /* bit buffer */ |
|
570 |
register unsigned k; /* number of bits in bit buffer */ |
|
571 |
||
572 |
||
573 |
/* make local copies of globals */ |
|
574 |
Trace((stderr, "stored block\n")); |
|
575 |
b = bb; /* initialize bit buffer */ |
|
576 |
k = bk; |
|
577 |
w = wp; /* initialize window position */ |
|
578 |
||
579 |
||
580 |
/* go to byte boundary */ |
|
581 |
n = k & 7; |
|
582 |
DUMPBITS(n); |
|
583 |
||
584 |
||
585 |
/* get the length and its complement */ |
|
586 |
NEEDBITS(16) |
|
587 |
n = ((unsigned)b & 0xffff); |
|
588 |
DUMPBITS(16) |
|
589 |
NEEDBITS(16) |
|
590 |
if (n != (unsigned)((~b) & 0xffff)) |
|
591 |
return 1; /* error in compressed data */ |
|
592 |
DUMPBITS(16) |
|
593 |
||
594 |
||
595 |
/* read and output the compressed data */ |
|
596 |
while (n--) |
|
597 |
{ |
|
598 |
NEEDBITS(8) |
|
599 |
slide[w++] = (uchar)b; |
|
600 |
if (w == WSIZE) |
|
601 |
{ |
|
602 |
FLUSH(w); |
|
603 |
w = 0; |
|
604 |
} |
|
605 |
DUMPBITS(8) |
|
606 |
} |
|
607 |
||
608 |
||
609 |
/* restore the globals from the locals */ |
|
610 |
wp = w; /* restore global window pointer */ |
|
611 |
bb = b; /* restore global bit buffer */ |
|
612 |
bk = k; |
|
613 |
return 0; |
|
614 |
} |
|
615 |
||
616 |
||
617 |
/* Globals for literal tables (built once) */ |
|
618 |
static struct huft *fixed_tl = (struct huft *)NULL; |
|
619 |
static struct huft *fixed_td = (struct huft *)NULL; |
|
620 |
static int fixed_bl, fixed_bd; |
|
621 |
||
622 |
/* decompress an inflated type 1 (fixed Huffman codes) block. We should |
|
623 |
either replace this with a custom decoder, or at least precompute the |
|
624 |
Huffman tables. */ |
|
625 |
static int |
|
626 |
inflate_fixed() |
|
627 |
{ |
|
628 |
/* if first time, set up tables for fixed blocks */ |
|
629 |
Trace((stderr, "fixed block\n")); |
|
630 |
if (fixed_tl == (struct huft *)NULL) |
|
631 |
{ |
|
632 |
int i; /* temporary variable */ |
|
633 |
static unsigned l[288]; /* length list for huft_build */ |
|
634 |
||
635 |
/* literal table */ |
|
636 |
for (i = 0; i < 144; i++) |
|
637 |
l[i] = 8; |
|
638 |
for (; i < 256; i++) |
|
639 |
l[i] = 9; |
|
640 |
for (; i < 280; i++) |
|
641 |
l[i] = 7; |
|
642 |
for (; i < 288; i++) /* make a complete, but wrong code set */ |
|
643 |
l[i] = 8; |
|
644 |
fixed_bl = 7; |
|
645 |
if ((i = huft_build(l, 288, 257, cplens, cplext, |
|
646 |
&fixed_tl, &fixed_bl)) != 0) |
|
647 |
{ |
|
648 |
Trace((stderr, "incomplete code set 1\n")); |
|
649 |
fixed_tl = (struct huft *)NULL; |
|
650 |
return i; |
|
651 |
} |
|
652 |
||
653 |
/* distance table */ |
|
654 |
for (i = 0; i < 30; i++) /* make an incomplete code set */ |
|
655 |
l[i] = 5; |
|
656 |
fixed_bd = 5; |
|
657 |
if ((i = huft_build(l, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd)) > 1) |
|
658 |
{ |
|
659 |
Trace((stderr, "incomplete code set 2\n")); |
|
660 |
huft_free(fixed_tl); |
|
661 |
fixed_tl = (struct huft *)NULL; |
|
662 |
return i; |
|
663 |
} |
|
664 |
} |
|
665 |
||
666 |
||
667 |
/* decompress until an end-of-block code */ |
|
668 |
return inflate_codes(fixed_tl, fixed_td, fixed_bl, fixed_bd) != 0; |
|
669 |
} |
|
670 |
||
671 |
||
672 |
||
673 |
/* decompress an inflated type 2 (dynamic Huffman codes) block. */ |
|
674 |
static int |
|
675 |
inflate_dynamic() |
|
676 |
{ |
|
677 |
int i; /* temporary variables */ |
|
678 |
unsigned j; |
|
679 |
unsigned l; /* last length */ |
|
680 |
unsigned m; /* mask for bit lengths table */ |
|
681 |
unsigned n; /* number of lengths to get */ |
|
682 |
struct huft *tl; /* literal/length code table */ |
|
683 |
struct huft *td; /* distance code table */ |
|
684 |
int bl; /* lookup bits for tl */ |
|
685 |
int bd; /* lookup bits for td */ |
|
686 |
unsigned nb; /* number of bit length codes */ |
|
687 |
unsigned nl; /* number of literal/length codes */ |
|
688 |
unsigned nd; /* number of distance codes */ |
|
689 |
#ifdef PKZIP_BUG_WORKAROUND |
|
690 |
static unsigned ll[288+32]; /* literal/length and distance code lengths */ |
|
691 |
#else |
|
692 |
static unsigned ll[286+30]; /* literal/length and distance code lengths */ |
|
693 |
#endif |
|
694 |
register ulong b; /* bit buffer */ |
|
695 |
register unsigned k; /* number of bits in bit buffer */ |
|
696 |
||
697 |
||
698 |
/* make local bit buffer */ |
|
699 |
Trace((stderr, "dynamic block\n")); |
|
700 |
b = bb; |
|
701 |
k = bk; |
|
702 |
||
703 |
||
704 |
/* read in table lengths */ |
|
705 |
NEEDBITS(5) |
|
706 |
nl = 257 + ((unsigned)b & 0x1f); /* number of literal/length codes */ |
|
707 |
DUMPBITS(5) |
|
708 |
NEEDBITS(5) |
|
709 |
nd = 1 + ((unsigned)b & 0x1f); /* number of distance codes */ |
|
710 |
DUMPBITS(5) |
|
711 |
NEEDBITS(4) |
|
712 |
nb = 4 + ((unsigned)b & 0xf); /* number of bit length codes */ |
|
713 |
DUMPBITS(4) |
|
714 |
#ifdef PKZIP_BUG_WORKAROUND |
|
715 |
if (nl > 288 || nd > 32) |
|
716 |
#else |
|
717 |
if (nl > 286 || nd > 30) |
|
718 |
#endif |
|
719 |
{ |
|
720 |
Trace((stderr, "bad length\n")); |
|
721 |
return 1; /* bad lengths */ |
|
722 |
} |
|
723 |
||
724 |
||
725 |
/* read in bit-length-code lengths */ |
|
726 |
for (j = 0; j < nb; j++) |
|
727 |
{ |
|
728 |
NEEDBITS(3) |
|
729 |
ll[border[j]] = (unsigned)b & 7; |
|
730 |
DUMPBITS(3) |
|
731 |
} |
|
732 |
for (; j < 19; j++) |
|
733 |
ll[border[j]] = 0; |
|
734 |
||
735 |
||
736 |
/* build decoding table for trees--single level, 7 bit lookup */ |
|
737 |
bl = 7; |
|
738 |
if ((i = huft_build(ll, 19, 19, NULL, NULL, &tl, &bl)) != 0) |
|
739 |
{ |
|
740 |
if (i == 1) |
|
741 |
huft_free(tl); |
|
742 |
Trace((stderr, "incomplete code set 3\n")); |
|
743 |
return i; /* incomplete code set */ |
|
744 |
} |
|
745 |
||
746 |
||
747 |
/* read in literal and distance code lengths */ |
|
748 |
n = nl + nd; |
|
749 |
m = mask[bl]; |
|
750 |
i = l = 0; |
|
751 |
while ((unsigned)i < n) |
|
752 |
{ |
|
753 |
NEEDBITS((unsigned)bl) |
|
754 |
j = (td = tl + ((unsigned)b & m))->b; |
|
755 |
DUMPBITS(j) |
|
756 |
j = td->v.n; |
|
757 |
if (j < 16) /* length of code in bits (0..15) */ |
|
758 |
ll[i++] = l = j; /* save last length in l */ |
|
759 |
else if (j == 16) /* repeat last length 3 to 6 times */ |
|
760 |
{ |
|
761 |
NEEDBITS(2) |
|
762 |
j = 3 + ((unsigned)b & 3); |
|
763 |
DUMPBITS(2) |
|
764 |
if ((unsigned)i + j > n) |
|
765 |
return 1; |
|
766 |
while (j--) |
|
767 |
ll[i++] = l; |
|
768 |
} |
|
769 |
else if (j == 17) /* 3 to 10 zero length codes */ |
|
770 |
{ |
|
771 |
NEEDBITS(3) |
|
772 |
j = 3 + ((unsigned)b & 7); |
|
773 |
DUMPBITS(3) |
|
774 |
if ((unsigned)i + j > n) |
|
775 |
return 1; |
|
776 |
while (j--) |
|
777 |
ll[i++] = 0; |
|
778 |
l = 0; |
|
779 |
} |
|
780 |
else /* j == 18: 11 to 138 zero length codes */ |
|
781 |
{ |
|
782 |
NEEDBITS(7) |
|
783 |
j = 11 + ((unsigned)b & 0x7f); |
|
784 |
DUMPBITS(7) |
|
785 |
if ((unsigned)i + j > n) |
|
786 |
return 1; |
|
787 |
while (j--) |
|
788 |
ll[i++] = 0; |
|
789 |
l = 0; |
|
790 |
} |
|
791 |
} |
|
792 |
||
793 |
||
794 |
/* free decoding table for trees */ |
|
795 |
huft_free(tl); |
|
796 |
||
797 |
||
798 |
/* restore the global bit buffer */ |
|
799 |
bb = b; |
|
800 |
bk = k; |
|
801 |
||
802 |
||
803 |
/* build the decoding tables for literal/length and distance codes */ |
|
804 |
bl = lbits; |
|
805 |
if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) |
|
806 |
{ |
|
807 |
Trace((stderr, "incomplete code set 4\n")); |
|
808 |
if (i == 1 && !qflag) { |
|
809 |
Trace((stderr, "incomplete l-tree\n")); |
|
810 |
huft_free(tl); |
|
811 |
} |
|
812 |
return i; /* incomplete code set */ |
|
813 |
} |
|
814 |
bd = dbits; |
|
815 |
if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) |
|
816 |
{ |
|
817 |
Trace((stderr, "huft_build err\n")); |
|
818 |
if (i == 1 && !qflag) { |
|
819 |
Trace((stderr, "incomplete d-tree\n")); |
|
820 |
#ifdef PKZIP_BUG_WORKAROUND |
|
821 |
i = 0; |
|
822 |
} |
|
823 |
#else |
|
824 |
huft_free(td); |
|
825 |
} |
|
826 |
huft_free(tl); |
|
827 |
return i; /* incomplete code set */ |
|
828 |
#endif |
|
829 |
} |
|
830 |
||
831 |
||
832 |
/* decompress until an end-of-block code */ |
|
833 |
if (inflate_codes(tl, td, bl, bd)) { |
|
834 |
Trace((stderr, "inflate_codes error\n")); |
|
835 |
return 1; |
|
836 |
} |
|
837 |
||
838 |
||
839 |
/* free the decoding tables, return */ |
|
840 |
huft_free(tl); |
|
841 |
huft_free(td); |
|
842 |
Trace((stderr, "block ok\n")); |
|
843 |
return 0; |
|
844 |
} |
|
845 |
||
846 |
||
847 |
||
848 |
/* decompress an inflated block */ |
|
849 |
static int |
|
637 | 850 |
inflate_block(endPtr) |
851 |
int *endPtr; /* last block flag */ |
|
636 | 852 |
{ |
853 |
unsigned t; /* block type */ |
|
854 |
register ulong b; /* bit buffer */ |
|
855 |
register unsigned k; /* number of bits in bit buffer */ |
|
856 |
||
857 |
||
637 | 858 |
Trace((stderr, "inflate_block\n")); |
859 |
||
636 | 860 |
/* make local bit buffer */ |
861 |
b = bb; |
|
862 |
k = bk; |
|
863 |
||
864 |
||
865 |
/* read in last block bit */ |
|
866 |
NEEDBITS(1) |
|
637 | 867 |
*endPtr = (int)b & 1; |
868 |
Trace((stderr, " end = %d\n", (int)b & 1)); |
|
869 |
||
636 | 870 |
DUMPBITS(1) |
871 |
||
872 |
||
873 |
/* read in block type */ |
|
874 |
NEEDBITS(2) |
|
875 |
t = (unsigned)b & 3; |
|
876 |
DUMPBITS(2) |
|
637 | 877 |
Trace((stderr, " type = %d\n", t)); |
636 | 878 |
|
879 |
||
880 |
/* restore the global bit buffer */ |
|
881 |
bb = b; |
|
882 |
bk = k; |
|
883 |
||
884 |
||
885 |
/* inflate that block type */ |
|
637 | 886 |
if (t == 2) { |
636 | 887 |
return inflate_dynamic(); |
637 | 888 |
} |
889 |
if (t == 0) { |
|
636 | 890 |
return inflate_stored(); |
637 | 891 |
} |
892 |
if (t == 1) { |
|
636 | 893 |
return inflate_fixed(); |
637 | 894 |
} |
636 | 895 |
|
896 |
Trace((stderr, "bad block type\n")); |
|
897 |
/* bad block type */ |
|
898 |
return 2; |
|
899 |
} |
|
900 |
||
901 |
||
902 |
||
903 |
/* decompress an inflated entry */ |
|
904 |
static int |
|
905 |
inflate() |
|
906 |
{ |
|
637 | 907 |
int endFlag; /* last block flag */ |
636 | 908 |
int r; /* result code */ |
909 |
unsigned h; /* maximum struct huft's malloc'ed */ |
|
910 |
||
911 |
/* initialize window, bit buffer */ |
|
912 |
wp = 0; |
|
913 |
bk = 0; |
|
914 |
bb = 0; |
|
915 |
||
637 | 916 |
endFlag = 0; |
636 | 917 |
|
918 |
/* decompress until the last block */ |
|
919 |
h = 0; |
|
920 |
do { |
|
921 |
hufts = 0; |
|
637 | 922 |
if ((r = inflate_block(&endFlag)) != 0) { |
923 |
Trace((stderr, "inflate_block -> %d\n", r)); |
|
636 | 924 |
return r; |
637 | 925 |
} |
636 | 926 |
if (hufts > h) |
927 |
h = hufts; |
|
637 | 928 |
} while (!endFlag); |
636 | 929 |
|
930 |
||
931 |
/* flush out slide */ |
|
932 |
FLUSH(wp); |
|
933 |
||
934 |
||
935 |
/* return success */ |
|
936 |
Trace((stderr, "%u bytes in Huffman tables (%d/entry)\n", |
|
937 |
h * sizeof(struct huft), sizeof(struct huft))); |
|
938 |
return 0; |
|
939 |
} |
|
940 |
||
941 |
||
942 |
||
943 |
static int |
|
944 |
inflate_free() |
|
945 |
{ |
|
946 |
if (fixed_td != (struct huft *)NULL) |
|
947 |
{ |
|
948 |
huft_free(fixed_td); |
|
949 |
fixed_td = (struct huft *)NULL; |
|
950 |
} |
|
951 |
||
952 |
if (fixed_tl != (struct huft *)NULL) |
|
953 |
{ |
|
954 |
huft_free(fixed_tl); |
|
955 |
fixed_tl = (struct huft *)NULL; |
|
956 |
} |
|
957 |
return 0; |
|
958 |
} |
|
959 |
||
960 |
||
961 |
static int |
|
962 |
stx_inflate(in, out) |
|
963 |
char *in, *out; |
|
964 |
{ |
|
965 |
int rslt; |
|
966 |
||
967 |
inPtr = in; |
|
968 |
outPtr = out; |
|
640 | 969 |
slide = (char *)malloc(WSIZE+2); |
637 | 970 |
if (! slide) return 1; |
636 | 971 |
|
972 |
rslt = inflate(); |
|
973 |
inflate_free(); |
|
637 | 974 |
free(slide); |
636 | 975 |
return rslt; |
976 |
} |
|
977 |
||
978 |
%} |
|
979 |
! ! |
|
980 |
||
622 | 981 |
!ZipArchive class methodsFor:'documentation'! |
982 |
||
624 | 983 |
copyright |
984 |
" |
|
985 |
COPYRIGHT (c) 1998 by eXept Software AG |
|
636 | 986 |
All Rights Reserved |
624 | 987 |
|
988 |
This software is furnished under a license and may be used |
|
989 |
only in accordance with the terms of that license and with the |
|
990 |
inclusion of the above copyright notice. This software may not |
|
991 |
be provided or otherwise made available to, or used by, any |
|
992 |
other person. No title to or ownership of the software is |
|
993 |
hereby transferred. |
|
994 |
" |
|
995 |
||
996 |
! |
|
622 | 997 |
|
624 | 998 |
documentation |
999 |
" |
|
1000 |
provides access to a zip archive. |
|
1001 |
Caveat: only uncompressed archives are supported (for now). |
|
651 | 1002 |
|
1003 |
[author:] |
|
1004 |
Claus Gittinger |
|
624 | 1005 |
" |
1006 |
! |
|
1007 |
||
1008 |
examples |
|
1009 |
" |
|
636 | 1010 |
[exBegin] |
624 | 1011 |
|zip bytes| |
1012 |
||
1013 |
zip := ZipArchive oldFileNamed:'foo.zip'. |
|
1014 |
bytes := zip extract:'bar'. |
|
636 | 1015 |
[exEnd] |
1016 |
||
1017 |
[exBegin] |
|
1018 |
|zip bytes| |
|
1019 |
||
1020 |
zip := ZipArchive oldFileNamed:'source/stx/libbasic2.zip'. |
|
1021 |
zip entries do:[:entry | |
|
1022 |
Transcript showCR:entry |
|
1023 |
]. |
|
1024 |
[exEnd] |
|
1025 |
||
1026 |
[exBegin] |
|
1027 |
|zip bytes| |
|
1028 |
||
1029 |
zip := ZipArchive oldFileNamed:'source/stx/libbasic2.zip'. |
|
1030 |
bytes := zip extract:'TwoByteStr.st'. |
|
1031 |
Transcript showCR:(bytes asString). |
|
1032 |
[exEnd] |
|
624 | 1033 |
" |
622 | 1034 |
! ! |
1035 |
||
1036 |
!ZipArchive class methodsFor:'instance creation'! |
|
1037 |
||
1038 |
newFileNamed:name |
|
1039 |
^ self new name:name mode:#write |
|
1040 |
||
1041 |
"Created: / 29.3.1998 / 17:46:16 / cg" |
|
1042 |
! |
|
1043 |
||
1044 |
oldFileNamed:name |
|
635 | 1045 |
|zar f fn| |
628
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1046 |
|
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1047 |
RecentlyUsedZipArchives isNil ifTrue:[ |
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1048 |
RecentlyUsedZipArchives := OrderedCollection new |
628
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1049 |
]. |
635 | 1050 |
f := name asFilename. |
1051 |
fn := f pathName. |
|
628
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1052 |
RecentlyUsedZipArchives keysAndValuesDo:[:i :z | |
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1053 |
z name = fn ifTrue:[ |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1054 |
RecentlyUsedZipArchives removeIndex:i. |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1055 |
RecentlyUsedZipArchives addLast:z. |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1056 |
self installFlushBlock. |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1057 |
^ z |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1058 |
]. |
628
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1059 |
]. |
635 | 1060 |
zar := self new name:fn mode:#read. |
628
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1061 |
RecentlyUsedZipArchives add:zar. |
701
90faf30c20eb
increased number of cached zipFiles
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1062 |
[RecentlyUsedZipArchives size > 15] whileTrue:[ |
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1063 |
RecentlyUsedZipArchives removeFirst |
628
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1064 |
]. |
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1065 |
self installFlushBlock. |
628
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1066 |
^ zar |
622 | 1067 |
|
1068 |
"Created: / 29.3.1998 / 17:46:09 / cg" |
|
701
90faf30c20eb
increased number of cached zipFiles
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1069 |
"Modified: / 20.10.1998 / 00:30:02 / cg" |
622 | 1070 |
! ! |
1071 |
||
1072 |
!ZipArchive class methodsFor:'class initialization'! |
|
1073 |
||
1074 |
initialize |
|
1075 |
ECREC_SIZE := 18. |
|
1076 |
LREC_SIZE := 26. |
|
1077 |
CREC_SIZE := 42. |
|
1078 |
||
1079 |
TOTAL_ENTRIES_CENTRAL_DIR := 10. |
|
1080 |
SIZE_CENTRAL_DIRECTORY := 12. |
|
1081 |
||
1082 |
C_COMPRESSED_SIZE := 16. |
|
1083 |
C_UNCOMPRESSED_SIZE := 20. |
|
1084 |
C_FILENAME_LENGTH := 24. |
|
1085 |
C_RELATIVE_OFFSET_LOCAL_HEADER := 38. |
|
1086 |
||
1087 |
"/ compression methods |
|
1088 |
COMPR_STORED := 0. |
|
1089 |
COMPR_SHRUNK := 1. |
|
1090 |
COMPR_REDUCED1 := 2. |
|
1091 |
COMPR_REDUCED2 := 3. |
|
1092 |
COMPR_REDUCED3 := 4. |
|
1093 |
COMPR_REDUCED4 := 5. |
|
1094 |
COMPR_IMPLODED := 6. |
|
1095 |
COMPR_TOKENIZED := 7. |
|
1096 |
COMPR_DEFLATED := 8. |
|
1097 |
||
1098 |
ZipFileFormatErrorSignal := Signal new. |
|
1099 |
||
1100 |
" |
|
1101 |
self initialize |
|
1102 |
" |
|
1103 |
||
1104 |
"Modified: / 29.3.1998 / 20:17:18 / cg" |
|
1105 |
! ! |
|
1106 |
||
629
33fcaf60afa3
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1107 |
!ZipArchive class methodsFor:'cleanup'! |
33fcaf60afa3
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1108 |
|
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1109 |
installFlushBlock |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1110 |
"forget about cached zipArchives" |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1111 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1112 |
FlushBlock isNil ifTrue:[ |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1113 |
FlushBlock := [ RecentlyUsedZipArchives := nil. FlushBlock := nil. ]. |
700
b1c6920cfef6
keep more zipArchive-dirs cached.
Claus Gittinger <cg@exept.de>
parents:
694
diff
changeset
|
1114 |
] ifFalse:[ |
b1c6920cfef6
keep more zipArchive-dirs cached.
Claus Gittinger <cg@exept.de>
parents:
694
diff
changeset
|
1115 |
Processor removeTimedBlock:FlushBlock. |
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1116 |
]. |
641 | 1117 |
Processor addTimedBlock:FlushBlock for:nil afterSeconds:60. |
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1118 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1119 |
" |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1120 |
self installFlushBlock |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1121 |
" |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1122 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1123 |
"Created: / 9.4.1998 / 13:17:07 / cg" |
700
b1c6920cfef6
keep more zipArchive-dirs cached.
Claus Gittinger <cg@exept.de>
parents:
694
diff
changeset
|
1124 |
"Modified: / 19.10.1998 / 21:02:22 / cg" |
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1125 |
! |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1126 |
|
629
33fcaf60afa3
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1127 |
lowSpaceCleanup |
635 | 1128 |
"forget about cached zipArchives" |
1129 |
||
629
33fcaf60afa3
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1130 |
RecentlyUsedZipArchives := nil |
33fcaf60afa3
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1131 |
|
635 | 1132 |
" |
1133 |
self lowSpaceCleanup |
|
1134 |
" |
|
1135 |
||
1136 |
"Modified: / 7.4.1998 / 17:58:57 / cg" |
|
629
33fcaf60afa3
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1137 |
! ! |
33fcaf60afa3
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
628
diff
changeset
|
1138 |
|
622 | 1139 |
!ZipArchive class methodsFor:'constants'! |
1140 |
||
1141 |
LREC_SIZE |
|
1142 |
^ LREC_SIZE |
|
1143 |
||
1144 |
"Created: / 29.3.1998 / 19:11:20 / cg" |
|
1145 |
! ! |
|
1146 |
||
1147 |
!ZipArchive methodsFor:'accessing'! |
|
1148 |
||
1149 |
entries |
|
1150 |
"return a collection of fileName entries" |
|
1151 |
||
1152 |
|names| |
|
1153 |
||
1154 |
names := OrderedCollection new. |
|
1155 |
||
1156 |
self zipMembersDo:[:zipd | |
|
636 | 1157 |
names add:(zipd name) |
622 | 1158 |
]. |
1159 |
^ names |
|
1160 |
||
1161 |
" |
|
1162 |
(ZipArchive oldFileNamed:'/usr/lib/java/lib/classes.zip') entries |
|
1163 |
" |
|
1164 |
||
1165 |
"Modified: / 29.3.1998 / 20:08:38 / cg" |
|
1166 |
! |
|
1167 |
||
1168 |
extract:fileName |
|
636 | 1169 |
"extract a filename entry as a byteArray" |
1170 |
||
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1171 |
|zmemb rawContents data| |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1172 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1173 |
recentlyExtractedEntries isNil ifTrue:[ |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1174 |
recentlyExtractedEntries := OrderedCollection new |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1175 |
]. |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1176 |
recentlyExtractedEntries keysAndValuesDo:[:index :entry | |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1177 |
entry name = fileName ifTrue:[ |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1178 |
recentlyExtractedEntries removeIndex:index. |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1179 |
recentlyExtractedEntries addLast:entry. |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1180 |
^ entry data |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1181 |
] |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1182 |
]. |
622 | 1183 |
|
1184 |
zmemb := self findMember:fileName. |
|
625 | 1185 |
zmemb isNil ifTrue:[^ nil]. |
1186 |
||
1187 |
self openFile. |
|
622 | 1188 |
file position:(zmemb fileStart + 1). |
1189 |
rawContents := file nextBytes:(zmemb compressed_size). |
|
625 | 1190 |
self closeFile. |
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1191 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1192 |
data := self |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1193 |
decode:rawContents |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1194 |
method:(zmemb compression_method) |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1195 |
size:(zmemb uncompressed_size). |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1196 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1197 |
zmemb data:data. |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1198 |
recentlyExtractedEntries addLast:zmemb. |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1199 |
[recentlyExtractedEntries size > 5] whileTrue:[ |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1200 |
recentlyExtractedEntries removeFirst |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1201 |
]. |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1202 |
^ data. |
622 | 1203 |
|
1204 |
" |
|
1205 |
(ZipArchive oldFileNamed:'/usr/lib/java/lib/classes.zip') extract:'java/io/UTFDataFormatException.class' |
|
1206 |
" |
|
1207 |
||
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1208 |
"Modified: / 9.4.1998 / 13:14:35 / cg" |
622 | 1209 |
! |
1210 |
||
1211 |
members |
|
1212 |
"return a collection of members" |
|
1213 |
||
1214 |
|members| |
|
1215 |
||
1216 |
members := OrderedCollection new. |
|
1217 |
||
1218 |
self zipMembersDo:[:zipd | |
|
636 | 1219 |
members add:zipd |
622 | 1220 |
]. |
1221 |
^ members |
|
1222 |
||
1223 |
" |
|
1224 |
(ZipArchive oldFileNamed:'/usr/lib/java/lib/classes.zip') members |
|
1225 |
" |
|
1226 |
||
1227 |
"Created: / 29.3.1998 / 20:09:27 / cg" |
|
1228 |
"Modified: / 29.3.1998 / 20:10:21 / cg" |
|
628
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1229 |
! |
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1230 |
|
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1231 |
name |
636 | 1232 |
"return the (file-)name of this zipArchive" |
1233 |
||
628
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1234 |
^ archiveName |
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1235 |
|
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1236 |
"Created: / 6.4.1998 / 10:47:11 / cg" |
622 | 1237 |
! ! |
1238 |
||
1239 |
!ZipArchive methodsFor:'private'! |
|
1240 |
||
625 | 1241 |
closeFile |
1242 |
file close. |
|
1243 |
file := nil. |
|
1244 |
||
1245 |
"Created: / 30.3.1998 / 18:18:10 / cg" |
|
1246 |
! |
|
1247 |
||
624 | 1248 |
name:nm mode:m |
625 | 1249 |
archiveName := nm asFilename name. |
624 | 1250 |
mode := m. |
1251 |
||
622 | 1252 |
mode == #read ifTrue:[ |
636 | 1253 |
self openFile. |
1254 |
self readDirectory. |
|
1255 |
self closeFile. |
|
622 | 1256 |
] ifFalse:[ |
636 | 1257 |
"/ self openFile. |
622 | 1258 |
] |
1259 |
||
1260 |
" |
|
1261 |
ZipArchive oldFileNamed:'/usr/lib/java/lib/classes.zip' |
|
1262 |
(ZipArchive oldFileNamed:'/usr/lib/java/lib/classes.zip') entries |
|
1263 |
(ZipArchive oldFileNamed:'/usr/lib/java/lib/classes.zip') extract:'java/io/UTFDataFormatException.class' |
|
1264 |
" |
|
1265 |
||
625 | 1266 |
"Modified: / 30.3.1998 / 18:19:48 / cg" |
1267 |
! |
|
1268 |
||
1269 |
openFile |
|
1270 |
file isNil ifTrue:[ |
|
636 | 1271 |
mode == #read ifTrue:[ |
1272 |
file := archiveName asFilename readStream binary. |
|
1273 |
] ifFalse:[ |
|
1274 |
file := archiveName asFilename writeStream binary |
|
1275 |
] |
|
625 | 1276 |
]. |
1277 |
||
1278 |
"Created: / 30.3.1998 / 18:18:48 / cg" |
|
1279 |
"Modified: / 30.3.1998 / 18:19:26 / cg" |
|
622 | 1280 |
! ! |
1281 |
||
1282 |
!ZipArchive methodsFor:'private - decompression'! |
|
1283 |
||
636 | 1284 |
decode:rawBytes method:compressionMethod size:uncompressedSize |
1285 |
|outBytes| |
|
1286 |
||
622 | 1287 |
compressionMethod == COMPR_STORED ifTrue:[ |
636 | 1288 |
"/ |
1289 |
"/ uncompressed |
|
1290 |
"/ |
|
1291 |
^ rawBytes |
|
622 | 1292 |
]. |
1293 |
||
636 | 1294 |
compressionMethod == COMPR_DEFLATED ifTrue:[ |
1295 |
"/ |
|
1296 |
"/ deflate/inflate algorithm |
|
1297 |
"/ |
|
1298 |
outBytes := ByteArray new:uncompressedSize. |
|
1299 |
^ self inflate:rawBytes to:outBytes |
|
1300 |
]. |
|
1301 |
||
1302 |
"/ |
|
1303 |
"/ the other algorithms are not (yet) supported |
|
1304 |
"/ |
|
622 | 1305 |
compressionMethod == COMPR_SHRUNK ifTrue:[ |
636 | 1306 |
self error:'unsupported compression method: SHRUNK'. |
1307 |
^ nil |
|
622 | 1308 |
]. |
1309 |
compressionMethod == COMPR_REDUCED1 ifTrue:[ |
|
636 | 1310 |
self error:'unsupported compression method: REDUCED1'. |
1311 |
^ nil |
|
622 | 1312 |
]. |
1313 |
compressionMethod == COMPR_REDUCED2 ifTrue:[ |
|
636 | 1314 |
self error:'unsupported compression method: REDUCED2'. |
1315 |
^ nil |
|
622 | 1316 |
]. |
1317 |
compressionMethod == COMPR_REDUCED3 ifTrue:[ |
|
636 | 1318 |
self error:'unsupported compression method: REDUCED3'. |
1319 |
^ nil |
|
622 | 1320 |
]. |
1321 |
compressionMethod == COMPR_REDUCED4 ifTrue:[ |
|
636 | 1322 |
self error:'unsupported compression method: REDUCED4'. |
1323 |
^ nil |
|
622 | 1324 |
]. |
1325 |
compressionMethod == COMPR_IMPLODED ifTrue:[ |
|
636 | 1326 |
self error:'unsupported compression method: IMPLODED'. |
1327 |
^ nil |
|
622 | 1328 |
]. |
1329 |
compressionMethod == COMPR_TOKENIZED ifTrue:[ |
|
636 | 1330 |
self error:'unsupported compression method: TOKENIZED'. |
1331 |
^ nil |
|
622 | 1332 |
]. |
1333 |
||
1334 |
self error:'unsupported compression method'. |
|
1335 |
^ nil |
|
1336 |
||
1337 |
"Created: / 29.3.1998 / 20:14:45 / cg" |
|
636 | 1338 |
"Modified: / 8.4.1998 / 10:31:34 / cg" |
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1339 |
! |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1340 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1341 |
inflate:inBytes to:outBytes |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1342 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1343 |
%{ /* STACK:32768 */ |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1344 |
if (__isByteArray(inBytes) |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1345 |
&& __isByteArray(outBytes)) { |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1346 |
char *in, *out; |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1347 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1348 |
in = __ByteArrayInstPtr(inBytes)->ba_element; |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1349 |
out = __ByteArrayInstPtr(outBytes)->ba_element; |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1350 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1351 |
if (stx_inflate(in, out) != 0) { |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1352 |
RETURN (nil); |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1353 |
} |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1354 |
RETURN (outBytes); |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1355 |
} |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1356 |
%}. |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1357 |
^ nil. |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1358 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1359 |
"Created: / 8.4.1998 / 10:31:27 / cg" |
622 | 1360 |
! ! |
1361 |
||
1362 |
!ZipArchive methodsFor:'private - directory stuff'! |
|
1363 |
||
1364 |
addMember |
|
624 | 1365 |
"add a zipMember" |
1366 |
||
622 | 1367 |
|zmemb | |
1368 |
||
691
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1369 |
self addMember:(zmemb := ZipMember new). |
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1370 |
^ zmemb. |
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1371 |
|
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1372 |
"Created: / 29.3.1998 / 18:22:25 / cg" |
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1373 |
"Modified: / 9.9.1998 / 20:33:32 / cg" |
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1374 |
! |
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1375 |
|
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1376 |
addMember:zmemb |
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1377 |
"add a zipMember" |
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1378 |
|
622 | 1379 |
(firstEntry == nil) ifTrue:[ |
691
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1380 |
firstEntry := zmemb |
622 | 1381 |
] ifFalse:[ |
691
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1382 |
lastEntry next:zmemb. |
622 | 1383 |
]. |
1384 |
lastEntry := zmemb. |
|
1385 |
^ zmemb. |
|
1386 |
||
624 | 1387 |
"Modified: / 30.3.1998 / 17:13:20 / cg" |
691
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1388 |
"Created: / 9.9.1998 / 20:33:06 / cg" |
622 | 1389 |
! |
1390 |
||
1391 |
findMember:name |
|
624 | 1392 |
"find a zipMember by name" |
1393 |
||
622 | 1394 |
self zipMembersDo:[:zipd | |
636 | 1395 |
(zipd name = name) ifTrue:[^ zipd]. |
622 | 1396 |
]. |
1397 |
^ nil |
|
1398 |
||
624 | 1399 |
"Modified: / 30.3.1998 / 17:13:30 / cg" |
622 | 1400 |
! |
1401 |
||
1402 |
readDirectory |
|
624 | 1403 |
"read the zip directory into a linked-list of zipMembers" |
1404 |
||
681
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1405 |
|size count_in dir_size foundPK pos0| |
622 | 1406 |
|
1407 |
size := file fileSize. |
|
1408 |
(size == 0) ifTrue:[ |
|
681
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1409 |
count_in := 0. |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1410 |
^ self |
622 | 1411 |
]. |
1412 |
||
1413 |
(size < (ECREC_SIZE+4)) ifTrue:[ |
|
681
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1414 |
^ ZipFileFormatErrorSignal raiseWith:'zipfile too short'. |
622 | 1415 |
]. |
1416 |
||
681
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1417 |
file position:(pos0 := size - ECREC_SIZE - 4 + 1). |
625 | 1418 |
((file next ~~ ($P asciiValue)) |
1419 |
or:[file next ~~ ($K asciiValue) |
|
1420 |
or:[file next ~~ 8r005 |
|
1421 |
or:[file next ~~ 8r006]]]) ifTrue:[ |
|
681
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1422 |
"/ search for PK ... |
694
a656535a3795
if no PK-magic was found at the standard position,
Claus Gittinger <cg@exept.de>
parents:
691
diff
changeset
|
1423 |
file position:1. "/(pos0 - 100). |
681
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1424 |
[file atEnd not and:[foundPK not]] whileTrue:[ |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1425 |
(file next == ($P asciiValue) |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1426 |
and:[file next == ($K asciiValue) |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1427 |
and:[file next == 8r005 |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1428 |
and:[file next == 8r006]]]) ifTrue:[ |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1429 |
foundPK := true. |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1430 |
pos0 := file position - 4. |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1431 |
] |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1432 |
]. |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1433 |
foundPK ifTrue:[ |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1434 |
'ZipArchive [warning]: funny format; resynchronized'. |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1435 |
] ifFalse:[ |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1436 |
^ ZipFileFormatErrorSignal raiseWith:'not a valid zipfile'. |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1437 |
] |
622 | 1438 |
]. |
1439 |
||
1440 |
file skip: (TOTAL_ENTRIES_CENTRAL_DIR - 4). |
|
1441 |
||
700
b1c6920cfef6
keep more zipArchive-dirs cached.
Claus Gittinger <cg@exept.de>
parents:
694
diff
changeset
|
1442 |
count_in := file nextUnsignedShortMSB:false. "/ Get TOTAL_ENTRIES_CENTRAL_DIR |
624 | 1443 |
dir_size := file nextLongMSB:false. "/ Get SIZE_CENTRAL_DIRECTORY |
681
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1444 |
file position:(pos0 - dir_size ). |
622 | 1445 |
|
691
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1446 |
file signalAtEnd:true. |
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1447 |
|
622 | 1448 |
0 to:(count_in-1) do:[:i | |
700
b1c6920cfef6
keep more zipArchive-dirs cached.
Claus Gittinger <cg@exept.de>
parents:
694
diff
changeset
|
1449 |
|zipd filename_length s| |
622 | 1450 |
|
691
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1451 |
zipd := ZipMember new. |
681
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1452 |
file skip:(4+C_COMPRESSED_SIZE-4-2-2-2). |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1453 |
zipd compression_method:(file nextUnsignedShortMSB:false). "/ Get compression method |
691
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1454 |
(file nextUnsignedShortMSB:false) isNil ifTrue:[ "/ skip last_mod_file_time |
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1455 |
self warn:'file format error or short file'. |
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1456 |
^ self. |
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1457 |
]. |
681
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1458 |
(file nextUnsignedShortMSB:false). "/ skip last_mod_file_date |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1459 |
zipd crc32:(file nextLongMSB:false). "/ Get crc32 |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1460 |
zipd compressed_size:(file nextLongMSB:false). "/ Get C_COMPRESSED_SIZE |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1461 |
zipd uncompressed_size:(file nextLongMSB:false). "/ Get C_UNCOMPRESSED_SIZE |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1462 |
filename_length := (file nextUnsignedShortMSB:false). "/ Get C_FILENAME_LENGTH |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1463 |
file skip:(C_RELATIVE_OFFSET_LOCAL_HEADER-(C_FILENAME_LENGTH+2)). |
58fcd6034921
search for, if PK-magic is not found at expected file position.
Claus Gittinger <cg@exept.de>
parents:
651
diff
changeset
|
1464 |
zipd relative_offset_local_header:(file nextLongMSB:false). |
700
b1c6920cfef6
keep more zipArchive-dirs cached.
Claus Gittinger <cg@exept.de>
parents:
694
diff
changeset
|
1465 |
zipd name:(s := String new:filename_length). |
b1c6920cfef6
keep more zipArchive-dirs cached.
Claus Gittinger <cg@exept.de>
parents:
694
diff
changeset
|
1466 |
file nextBytes:filename_length into:s. |
b1c6920cfef6
keep more zipArchive-dirs cached.
Claus Gittinger <cg@exept.de>
parents:
694
diff
changeset
|
1467 |
|
691
5c5cf54ead71
handle errors more gracefully
Claus Gittinger <cg@exept.de>
parents:
681
diff
changeset
|
1468 |
self addMember:zipd. |
622 | 1469 |
] |
1470 |
||
700
b1c6920cfef6
keep more zipArchive-dirs cached.
Claus Gittinger <cg@exept.de>
parents:
694
diff
changeset
|
1471 |
"Modified: / 19.10.1998 / 21:27:32 / cg" |
622 | 1472 |
! |
1473 |
||
1474 |
zipMembersDo:aBlock |
|
624 | 1475 |
"evaluate aBlock for all zipMembers" |
1476 |
||
622 | 1477 |
|zipd| |
1478 |
||
1479 |
zipd := firstEntry. |
|
1480 |
[zipd notNil] whileTrue:[ |
|
636 | 1481 |
aBlock value:zipd. |
1482 |
zipd := zipd next |
|
622 | 1483 |
]. |
1484 |
||
1485 |
"Created: / 29.3.1998 / 19:15:15 / cg" |
|
624 | 1486 |
"Modified: / 30.3.1998 / 17:13:47 / cg" |
622 | 1487 |
! ! |
1488 |
||
651 | 1489 |
!ZipArchive::ZipMember class methodsFor:'documentation'! |
1490 |
||
1491 |
documentation |
|
1492 |
" |
|
1493 |
keeps some information for a single entry in a zipFile. |
|
1494 |
" |
|
1495 |
||
1496 |
||
1497 |
! ! |
|
1498 |
||
622 | 1499 |
!ZipArchive::ZipMember methodsFor:'accessing'! |
1500 |
||
1501 |
compressed_size |
|
1502 |
"return the value of the instance variable 'compressed_size' (automatically generated)" |
|
1503 |
||
1504 |
^ compressed_size |
|
1505 |
||
1506 |
"Created: / 29.3.1998 / 18:28:03 / cg" |
|
1507 |
! |
|
1508 |
||
1509 |
compressed_size:something |
|
1510 |
"set the value of the instance variable 'compressed_size' (automatically generated)" |
|
1511 |
||
1512 |
compressed_size := something. |
|
1513 |
||
1514 |
"Created: / 29.3.1998 / 18:28:03 / cg" |
|
1515 |
! |
|
1516 |
||
1517 |
compression_method |
|
1518 |
"return the value of the instance variable 'compression_method' (automatically generated)" |
|
1519 |
||
1520 |
^ compression_method |
|
1521 |
||
1522 |
"Created: / 29.3.1998 / 20:02:57 / cg" |
|
1523 |
! |
|
1524 |
||
1525 |
compression_method:something |
|
1526 |
"set the value of the instance variable 'compression_method' (automatically generated)" |
|
1527 |
||
1528 |
compression_method := something. |
|
1529 |
||
1530 |
"Created: / 29.3.1998 / 20:02:57 / cg" |
|
1531 |
! |
|
1532 |
||
1533 |
crc32 |
|
1534 |
"return the value of the instance variable 'crc32' (automatically generated)" |
|
1535 |
||
1536 |
^ crc32 |
|
1537 |
||
1538 |
"Created: / 29.3.1998 / 20:03:00 / cg" |
|
1539 |
! |
|
1540 |
||
1541 |
crc32:something |
|
1542 |
"set the value of the instance variable 'crc32' (automatically generated)" |
|
1543 |
||
1544 |
crc32 := something. |
|
1545 |
||
1546 |
"Created: / 29.3.1998 / 20:03:00 / cg" |
|
1547 |
! |
|
1548 |
||
638
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1549 |
data |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1550 |
"return the value of the instance variable 'data' (automatically generated)" |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1551 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1552 |
^ data |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1553 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1554 |
"Created: / 9.4.1998 / 13:05:03 / cg" |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1555 |
! |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1556 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1557 |
data:something |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1558 |
"set the value of the instance variable 'data' (automatically generated)" |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1559 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1560 |
data := something. |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1561 |
|
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1562 |
"Created: / 9.4.1998 / 13:05:03 / cg" |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1563 |
! |
ff61e852f5c3
flush cached data after some time (1 minute)
Claus Gittinger <cg@exept.de>
parents:
637
diff
changeset
|
1564 |
|
622 | 1565 |
name |
1566 |
"return the value of the instance variable 'name' (automatically generated)" |
|
1567 |
||
1568 |
^ name |
|
1569 |
||
1570 |
"Created: / 29.3.1998 / 18:29:22 / cg" |
|
1571 |
! |
|
1572 |
||
1573 |
name:something |
|
1574 |
"set the value of the instance variable 'name' (automatically generated)" |
|
1575 |
||
1576 |
name := something. |
|
1577 |
||
1578 |
"Created: / 29.3.1998 / 18:29:22 / cg" |
|
1579 |
! |
|
1580 |
||
1581 |
next |
|
1582 |
"return the value of the instance variable 'next' (automatically generated)" |
|
1583 |
||
1584 |
^ next |
|
1585 |
||
1586 |
"Created: / 29.3.1998 / 18:29:42 / cg" |
|
1587 |
! |
|
1588 |
||
1589 |
next:something |
|
1590 |
"set the value of the instance variable 'next' (automatically generated)" |
|
1591 |
||
1592 |
next := something. |
|
1593 |
||
1594 |
"Created: / 29.3.1998 / 18:29:42 / cg" |
|
1595 |
! |
|
1596 |
||
1597 |
relative_offset_local_header |
|
1598 |
"return the value of the instance variable 'relative_offset_local_header' (automatically generated)" |
|
1599 |
||
1600 |
^ relative_offset_local_header |
|
1601 |
||
1602 |
"Created: / 29.3.1998 / 18:28:40 / cg" |
|
1603 |
! |
|
1604 |
||
1605 |
relative_offset_local_header:something |
|
1606 |
"set the value of the instance variable 'relative_offset_local_header' (automatically generated)" |
|
1607 |
||
1608 |
relative_offset_local_header := something. |
|
1609 |
||
1610 |
"Created: / 29.3.1998 / 18:28:40 / cg" |
|
1611 |
! |
|
1612 |
||
1613 |
uncompressed_size |
|
1614 |
"return the value of the instance variable 'uncompressed_size' (automatically generated)" |
|
1615 |
||
1616 |
^ uncompressed_size |
|
1617 |
||
1618 |
"Created: / 29.3.1998 / 18:28:21 / cg" |
|
1619 |
! |
|
1620 |
||
1621 |
uncompressed_size:something |
|
1622 |
"set the value of the instance variable 'uncompressed_size' (automatically generated)" |
|
1623 |
||
1624 |
uncompressed_size := something. |
|
1625 |
||
1626 |
"Created: / 29.3.1998 / 18:28:21 / cg" |
|
1627 |
! ! |
|
1628 |
||
1629 |
!ZipArchive::ZipMember methodsFor:'printing & storing'! |
|
1630 |
||
1631 |
displayString |
|
634 | 1632 |
^ 'ZipMember(' , (name ? '*nil*') , ')' |
622 | 1633 |
|
1634 |
"Created: / 29.3.1998 / 20:10:07 / cg" |
|
634 | 1635 |
"Modified: / 2.4.1998 / 15:10:08 / cg" |
622 | 1636 |
! ! |
1637 |
||
1638 |
!ZipArchive::ZipMember methodsFor:'queries'! |
|
1639 |
||
1640 |
fileStart |
|
1641 |
^ relative_offset_local_header + ZipArchive LREC_SIZE + 4 + name size |
|
1642 |
||
1643 |
"Created: / 29.3.1998 / 19:10:57 / cg" |
|
1644 |
! ! |
|
1645 |
||
628
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1646 |
!ZipArchive class methodsFor:'documentation'! |
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1647 |
|
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1648 |
version |
701
90faf30c20eb
increased number of cached zipFiles
Claus Gittinger <cg@exept.de>
parents:
700
diff
changeset
|
1649 |
^ '$Header: /cvs/stx/stx/libbasic2/ZipArchive.st,v 1.20 1998-10-21 19:49:48 cg Exp $' |
628
27102a6bd3f7
remember recently visited zipArchives for faster access
Claus Gittinger <cg@exept.de>
parents:
625
diff
changeset
|
1650 |
! ! |
622 | 1651 |
ZipArchive initialize! |