checkin from browser
authorClaus Gittinger <cg@exept.de>
Wed, 24 Jan 2001 15:17:50 +0100
changeset 953 1ecbac9ced0c
parent 952 79b938f990d1
child 954 198756c1e030
checkin from browser
ZipArchive.st
--- a/ZipArchive.st	Wed Jan 24 13:39:32 2001 +0100
+++ b/ZipArchive.st	Wed Jan 24 15:17:50 2001 +0100
@@ -1,6 +1,6 @@
 "
  COPYRIGHT (c) 1998 by eXept Software AG
-	      All Rights Reserved
+              All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -14,26 +14,26 @@
 "{ Package: 'stx:libbasic2' }"
 
 Object subclass:#ZipArchive
-	instanceVariableNames:'file mode archiveName firstEntry lastEntry
-		recentlyExtractedEntries'
-	classVariableNames:'RecentlyUsedZipArchives FlushBlock ECREC_SIZE LREC_SIZE CREC_SIZE
-		SIZE_CENTRAL_DIRECTORY TOTAL_ENTRIES_CENTRAL_DIR
-		C_COMPRESSED_SIZE C_RELATIVE_OFFSET_LOCAL_HEADER
-		C_FILENAME_LENGTH C_UNCOMPRESSED_SIZE C_CENTRALHEADERSIGNATURE
-		C_LOCALHEADERSIGNATURE C_CENTRALENDSIGNATURE
-		ZipFileFormatErrorSignal COMPR_STORED COMPR_SHRUNK COMPR_REDUCED1
-		COMPR_REDUCED2 COMPR_REDUCED3 COMPR_REDUCED4 COMPR_IMPLODED
-		COMPR_TOKENIZED COMPR_DEFLATED'
-	poolDictionaries:''
-	category:'System-Support-FileFormats'
+        instanceVariableNames:'file mode archiveName firstEntry lastEntry
+                recentlyExtractedEntries'
+        classVariableNames:'RecentlyUsedZipArchives FlushBlock ECREC_SIZE LREC_SIZE CREC_SIZE
+                SIZE_CENTRAL_DIRECTORY TOTAL_ENTRIES_CENTRAL_DIR
+                C_COMPRESSED_SIZE C_RELATIVE_OFFSET_LOCAL_HEADER
+                C_FILENAME_LENGTH C_UNCOMPRESSED_SIZE C_CENTRALHEADERSIGNATURE
+                C_LOCALHEADERSIGNATURE C_CENTRALENDSIGNATURE
+                ZipFileFormatErrorSignal COMPR_STORED COMPR_SHRUNK COMPR_REDUCED1
+                COMPR_REDUCED2 COMPR_REDUCED3 COMPR_REDUCED4 COMPR_IMPLODED
+                COMPR_TOKENIZED COMPR_DEFLATED'
+        poolDictionaries:''
+        category:'System-Support-FileFormats'
 !
 
 Object subclass:#ZipMember
-	instanceVariableNames:'next dataStart compressed_size uncompressed_size name crc32
-		compression_method data'
-	classVariableNames:''
-	poolDictionaries:''
-	privateIn:ZipArchive
+        instanceVariableNames:'next dataStart compressed_size uncompressed_size name crc32
+                compression_method data'
+        classVariableNames:''
+        poolDictionaries:''
+        privateIn:ZipArchive
 !
 
 !ZipArchive primitiveDefinitions!
@@ -111,25 +111,25 @@
 
 /* Tables for deflate from PKZIP's appnote.txt. */
 static unsigned border[] = {    /* Order of the bit length code lengths */
-	16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
+        16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
 
 static ushort cplens[] = {         /* Copy lengths for literal codes 257..285 */
-	3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
-	35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
-	/* note: see note #13 above about the 258 in this list. */
+        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
+        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
+        /* note: see note #13 above about the 258 in this list. */
 
 static ushort cplext[] = {         /* Extra bits for literal codes 257..285 */
-	0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
-	3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */
+        0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
+        3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99}; /* 99==invalid */
 
 static ushort cpdist[] = {         /* Copy offsets for distance codes 0..29 */
-	1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
-	257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
-	8193, 12289, 16385, 24577};
+        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
+        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
+        8193, 12289, 16385, 24577};
 static ushort cpdext[] = {         /* Extra bits for distance codes */
-	0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
-	7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
-	12, 12, 13, 13};
+        0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
+        7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
+        12, 12, 13, 13};
 
 /* And'ing with mask[n] masks the lower n bits */
 static ushort mask[] = {
@@ -142,9 +142,9 @@
 /* Macros for inflate() bit peeking and grabbing.
    The usage is:
 
-	NEEDBITS(j)
-	x = b & mask[j];
-	DUMPBITS(j)
+        NEEDBITS(j)
+        x = b & mask[j];
+        DUMPBITS(j)
 
    where NEEDBITS makes sure that b has at least j bits in it, and
    DUMPBITS removes the bits from b.  The macros use the variable k
@@ -359,79 +359,79 @@
       /* make tables up to required level */
       while (k > w + l[h])
       {
-	w += l[h++];            /* add bits already decoded */
+        w += l[h++];            /* add bits already decoded */
 
-	/* compute minimum size table less than or equal to *m bits */
-	z = (z = g - w) > (unsigned)*m ? *m : z;        /* upper limit */
-	if ((f = 1 << (j = k - w)) > a + 1)     /* try a k-w bit table */
-	{                       /* too few codes for k-w bit table */
-	  f -= a + 1;           /* deduct codes from patterns left */
-	  xp = c + k;
-	  while (++j < z)       /* try smaller tables up to z bits */
-	  {
-	    if ((f <<= 1) <= *++xp)
-	      break;            /* enough codes to use up j bits */
-	    f -= *xp;           /* else deduct codes from patterns */
-	  }
-	}
-	if ((unsigned)w + j > el && (unsigned)w < el)
-	  j = el - w;           /* make EOB code end at table */
-	z = 1 << j;             /* table entries for j-bit table */
-	l[h] = j;               /* set table size in stack */
+        /* compute minimum size table less than or equal to *m bits */
+        z = (z = g - w) > (unsigned)*m ? *m : z;        /* upper limit */
+        if ((f = 1 << (j = k - w)) > a + 1)     /* try a k-w bit table */
+        {                       /* too few codes for k-w bit table */
+          f -= a + 1;           /* deduct codes from patterns left */
+          xp = c + k;
+          while (++j < z)       /* try smaller tables up to z bits */
+          {
+            if ((f <<= 1) <= *++xp)
+              break;            /* enough codes to use up j bits */
+            f -= *xp;           /* else deduct codes from patterns */
+          }
+        }
+        if ((unsigned)w + j > el && (unsigned)w < el)
+          j = el - w;           /* make EOB code end at table */
+        z = 1 << j;             /* table entries for j-bit table */
+        l[h] = j;               /* set table size in stack */
 
-	/* allocate and link in new table */
-	if ((q = (struct huft *)malloc((z + 1)*sizeof(struct huft))) ==
-	    (struct huft *)NULL)
-	{
-	  if (h)
-	    huft_free(u[0]);
-	  return 3;             /* not enough memory */
-	}
-	hufts += z + 1;         /* track memory usage */
-	*t = q + 1;             /* link to list for huft_free() */
-	*(t = &(q->v.t)) = (struct huft *)NULL;
-	u[h] = ++q;             /* table starts after link */
+        /* allocate and link in new table */
+        if ((q = (struct huft *)malloc((z + 1)*sizeof(struct huft))) ==
+            (struct huft *)NULL)
+        {
+          if (h)
+            huft_free(u[0]);
+          return 3;             /* not enough memory */
+        }
+        hufts += z + 1;         /* track memory usage */
+        *t = q + 1;             /* link to list for huft_free() */
+        *(t = &(q->v.t)) = (struct huft *)NULL;
+        u[h] = ++q;             /* table starts after link */
 
-	/* connect to last table, if there is one */
-	if (h)
-	{
-	  x[h] = i;             /* save pattern for backing up */
-	  r.b = (uchar)l[h-1];    /* bits to dump before this table */
-	  r.e = (uchar)(16 + j);  /* bits in this table */
-	  r.v.t = q;            /* pointer to this table */
-	  j = (i & ((1 << w) - 1)) >> (w - l[h-1]);
-	  u[h-1][j] = r;        /* connect to last table */
-	}
+        /* connect to last table, if there is one */
+        if (h)
+        {
+          x[h] = i;             /* save pattern for backing up */
+          r.b = (uchar)l[h-1];    /* bits to dump before this table */
+          r.e = (uchar)(16 + j);  /* bits in this table */
+          r.v.t = q;            /* pointer to this table */
+          j = (i & ((1 << w) - 1)) >> (w - l[h-1]);
+          u[h-1][j] = r;        /* connect to last table */
+        }
       }
 
       /* set up table entry in r */
       r.b = (uchar)(k - w);
       if (p >= v + n)
-	r.e = 99;               /* out of values--invalid code */
+        r.e = 99;               /* out of values--invalid code */
       else if (*p < s)
       {
-	r.e = (uchar)(*p < 256 ? 16 : 15);    /* 256 is end-of-block code */
-	r.v.n = *p++;           /* simple code is just the value */
+        r.e = (uchar)(*p < 256 ? 16 : 15);    /* 256 is end-of-block code */
+        r.v.n = *p++;           /* simple code is just the value */
       }
       else
       {
-	r.e = (uchar)e[*p - s];   /* non-simple--look up in lists */
-	r.v.n = d[*p++ - s];
+        r.e = (uchar)e[*p - s];   /* non-simple--look up in lists */
+        r.v.n = d[*p++ - s];
       }
 
       /* fill code-like entries with r */
       f = 1 << (k - w);
       for (j = i >> w; j < z; j += f)
-	q[j] = r;
+        q[j] = r;
 
       /* backwards increment the k-bit code i */
       for (j = 1 << (k - 1); i & j; j >>= 1)
-	i ^= j;
+        i ^= j;
       i ^= j;
 
       /* backup over finished tables */
       while ((i & ((1 << w) - 1)) != x[h])
-	w -= l[--h];            /* don't need to update q */
+        w -= l[--h];            /* don't need to update q */
     }
   }
 
@@ -482,11 +482,11 @@
     NEEDBITS((unsigned)bl)
     if ((e = (t = tl + ((unsigned)b & ml))->e) > 16)
       do {
-	if (e == 99)
-	  return 1;
-	DUMPBITS(t->b)
-	e -= 16;
-	NEEDBITS(e)
+        if (e == 99)
+          return 1;
+        DUMPBITS(t->b)
+        e -= 16;
+        NEEDBITS(e)
       } while ((e = (t = t->v.t + ((unsigned)b & mask[e]))->e) > 16);
     DUMPBITS(t->b)
     if (e == 16)                /* then it's a literal */
@@ -494,15 +494,15 @@
       slide[w++] = (uchar)t->v.n;
       if (w == WSIZE)
       {
-	FLUSH(w);
-	w = 0;
+        FLUSH(w);
+        w = 0;
       }
     }
     else                        /* it's an EOB or a length */
     {
       /* exit if end of block */
       if (e == 15)
-	break;
+        break;
 
       /* get length of block to copy */
       NEEDBITS(e)
@@ -512,13 +512,13 @@
       /* decode distance of block to copy */
       NEEDBITS((unsigned)bd)
       if ((e = (t = td + ((unsigned)b & md))->e) > 16)
-	do {
-	  if (e == 99)
-	    return 1;
-	  DUMPBITS(t->b)
-	  e -= 16;
-	  NEEDBITS(e)
-	} while ((e = (t = t->v.t + ((unsigned)b & mask[e]))->e) > 16);
+        do {
+          if (e == 99)
+            return 1;
+          DUMPBITS(t->b)
+          e -= 16;
+          NEEDBITS(e)
+        } while ((e = (t = t->v.t + ((unsigned)b & mask[e]))->e) > 16);
       DUMPBITS(t->b)
       NEEDBITS(e)
       d = w - t->v.n - ((unsigned)b & mask[e]);
@@ -526,28 +526,28 @@
 
       /* do the copy */
       do {
-	n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e);
+        n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e);
 #ifndef NOMEMCPY
-	if (w - d >= e)         /* (this test assumes unsigned comparison) */
-	{
+        if (w - d >= e)         /* (this test assumes unsigned comparison) */
+        {
 # ifdef USE_MEMCPY
-	  memcpy(slide + w, slide + d, e);
+          memcpy(slide + w, slide + d, e);
 # else
-	  bcopy(slide + d, slide + w, e);
+          bcopy(slide + d, slide + w, e);
 # endif
-	  w += e;
-	  d += e;
-	}
-	else                      /* do it slow to avoid memcpy() overlap */
+          w += e;
+          d += e;
+        }
+        else                      /* do it slow to avoid memcpy() overlap */
 #endif /* !NOMEMCPY */
-	  do {
-	    slide[w++] = slide[d++];
-	  } while (--e);
-	if (w == WSIZE)
-	{
-	  FLUSH(w);
-	  w = 0;
-	}
+          do {
+            slide[w++] = slide[d++];
+          } while (--e);
+        if (w == WSIZE)
+        {
+          FLUSH(w);
+          w = 0;
+        }
       } while (n);
     }
   }
@@ -650,7 +650,7 @@
       l[i] = 8;
     fixed_bl = 7;
     if ((i = huft_build(l, 288, 257, cplens, cplext,
-			&fixed_tl, &fixed_bl)) != 0)
+                        &fixed_tl, &fixed_bl)) != 0)
     {
       Trace((stderr, "incomplete code set 1\n"));
       fixed_tl = (struct huft *)NULL;
@@ -769,9 +769,9 @@
       j = 3 + ((unsigned)b & 3);
       DUMPBITS(2)
       if ((unsigned)i + j > n)
-	return 1;
+        return 1;
       while (j--)
-	ll[i++] = l;
+        ll[i++] = l;
     }
     else if (j == 17)           /* 3 to 10 zero length codes */
     {
@@ -779,9 +779,9 @@
       j = 3 + ((unsigned)b & 7);
       DUMPBITS(3)
       if ((unsigned)i + j > n)
-	return 1;
+        return 1;
       while (j--)
-	ll[i++] = 0;
+        ll[i++] = 0;
       l = 0;
     }
     else                        /* j == 18: 11 to 138 zero length codes */
@@ -790,9 +790,9 @@
       j = 11 + ((unsigned)b & 0x7f);
       DUMPBITS(7)
       if ((unsigned)i + j > n)
-	return 1;
+        return 1;
       while (j--)
-	ll[i++] = 0;
+        ll[i++] = 0;
       l = 0;
     }
   }
@@ -941,7 +941,7 @@
 
   /* return success */
   Trace((stderr, "%u bytes in Huffman tables (%d/entry)\n",
-	 h * sizeof(struct huft), sizeof(struct huft)));
+         h * sizeof(struct huft), sizeof(struct huft)));
   return 0;
 }
 
@@ -990,7 +990,7 @@
 copyright 
 "
  COPYRIGHT (c) 1998 by eXept Software AG
-	      All Rights Reserved
+              All Rights Reserved
 
  This software is furnished under a license and may be used
  only in accordance with the terms of that license and with the
@@ -1008,35 +1008,35 @@
     Caveat: only uncompressed archives are supported (for now).
 
     [author:]
-	Claus Gittinger
+        Claus Gittinger
 "
 !
 
 examples
 "
-							[exBegin]
+                                                        [exBegin]
     |zip bytes|
 
     zip := ZipArchive oldFileNamed:'foo.zip'.
     bytes := zip extract:'bar'.
-							[exEnd]
+                                                        [exEnd]
 
-							[exBegin]
+                                                        [exBegin]
     |zip bytes|
 
     zip := ZipArchive oldFileNamed:'source/stx/libbasic2.zip'.
     zip entries do:[:entry |
-	Transcript showCR:entry
+        Transcript showCR:entry
     ].
-							[exEnd]
+                                                        [exEnd]
 
-							[exBegin]
+                                                        [exBegin]
     |zip bytes|
 
     zip := ZipArchive oldFileNamed:'source/stx/libbasic2.zip'.
     bytes := zip extract:'TwoByteStr.st'.
     Transcript showCR:(bytes asString).
-							[exEnd]
+                                                        [exEnd]
 "
 ! !
 
@@ -1052,22 +1052,24 @@
     |zar f fn|
 
     RecentlyUsedZipArchives isNil ifTrue:[
-	RecentlyUsedZipArchives := OrderedCollection new
+        RecentlyUsedZipArchives := OrderedCollection new
     ].
     f := name asFilename.
+    f exists ifFalse:[^ nil].
+
     fn := f pathName.
     RecentlyUsedZipArchives keysAndValuesDo:[:i :z |
-	z name = fn ifTrue:[
-	    RecentlyUsedZipArchives removeIndex:i.
-	    RecentlyUsedZipArchives addLast:z.
-	    self installFlushBlock.
-	    ^ z
-	].
+        z name = fn ifTrue:[
+            RecentlyUsedZipArchives removeIndex:i.
+            RecentlyUsedZipArchives addLast:z.
+            self installFlushBlock.
+            ^ z
+        ].
     ].
     zar := self new name:fn mode:#read.
     RecentlyUsedZipArchives add:zar.
     [RecentlyUsedZipArchives size > 15] whileTrue:[
-	RecentlyUsedZipArchives removeFirst
+        RecentlyUsedZipArchives removeFirst
     ].
     self installFlushBlock.
     ^ zar
@@ -1135,9 +1137,9 @@
     "forget about cached zipArchives"
 
     FlushBlock isNil ifTrue:[
-	FlushBlock := [ RecentlyUsedZipArchives := nil. FlushBlock := nil. ].
+        FlushBlock := [ RecentlyUsedZipArchives := nil. FlushBlock := nil. ].
     ] ifFalse:[
-	Processor removeTimedBlock:FlushBlock.
+        Processor removeTimedBlock:FlushBlock.
     ].
     Processor addTimedBlock:FlushBlock for:nil afterSeconds:60.
 
@@ -1174,9 +1176,9 @@
 debugTrace:aBoolean
 %{
     if (aBoolean == true) {
-	debugTrace = 1;
+        debugTrace = 1;
     } else {
-	debugTrace = 0;
+        debugTrace = 0;
     }
 %}
 ! !
@@ -1191,7 +1193,7 @@
     names := OrderedCollection new.
 
     self zipMembersDo:[:zipd |
-	names add:(zipd name)
+        names add:(zipd name)
     ].
     ^ names
 
@@ -1260,7 +1262,7 @@
     members := OrderedCollection new.
 
     self zipMembersDo:[:zipd |
-	members add:zipd
+        members add:zipd
     ].
     ^ members
 
@@ -1284,8 +1286,8 @@
 
 closeFile
     file notNil ifTrue:[
-	file close.
-	file := nil.
+        file close.
+        file := nil.
     ]
 
     "Created: / 30.3.1998 / 18:18:10 / cg"
@@ -1297,11 +1299,11 @@
     mode := m.
 
     mode ~~ #write ifTrue:[
-	self openFile.
-	self readDirectory.
-	self closeFile.
+        self openFile.
+        self readDirectory.
+        self closeFile.
     ] ifFalse:[
-	"/ self openFile.
+        "/ self openFile.
     ]
 
     "
@@ -1315,12 +1317,12 @@
 
 openFile
     file isNil ifTrue:[
-	mode ~~ #write ifTrue:[
-	    file := archiveName asFilename readStream.
-	] ifFalse:[
-	    file := archiveName asFilename writeStream
-	].
-	file binary
+        mode ~~ #write ifTrue:[
+            file := archiveName asFilename readStream.
+        ] ifFalse:[
+            file := archiveName asFilename writeStream
+        ].
+        file binary
     ].
 
     "Created: / 30.3.1998 / 18:18:48 / cg"
@@ -1333,50 +1335,50 @@
     |outBytes|
 
     compressionMethod == COMPR_STORED ifTrue:[
-	"/
-	"/ uncompressed
-	"/
-	^ rawBytes
+        "/
+        "/ uncompressed
+        "/
+        ^ rawBytes
     ].
 
     compressionMethod == COMPR_DEFLATED ifTrue:[
-	"/
-	"/ deflate/inflate algorithm
-	"/
-	outBytes := ByteArray new:uncompressedSize.
-	^ self inflate:rawBytes to:outBytes
+        "/
+        "/ deflate/inflate algorithm
+        "/
+        outBytes := ByteArray new:uncompressedSize.
+        ^ self inflate:rawBytes to:outBytes
     ].
 
     "/
     "/ the other algorithms are not (yet) supported
     "/
     compressionMethod == COMPR_SHRUNK ifTrue:[
-	self error:'unsupported compression method: SHRUNK'.
-	^ nil
+        self error:'unsupported compression method: SHRUNK'.
+        ^ nil
     ].
     compressionMethod == COMPR_REDUCED1 ifTrue:[
-	self error:'unsupported compression method: REDUCED1'.
-	^ nil
+        self error:'unsupported compression method: REDUCED1'.
+        ^ nil
     ].
     compressionMethod == COMPR_REDUCED2 ifTrue:[
-	self error:'unsupported compression method: REDUCED2'.
-	^ nil
+        self error:'unsupported compression method: REDUCED2'.
+        ^ nil
     ].
     compressionMethod == COMPR_REDUCED3 ifTrue:[
-	self error:'unsupported compression method: REDUCED3'.
-	^ nil
+        self error:'unsupported compression method: REDUCED3'.
+        ^ nil
     ].
     compressionMethod == COMPR_REDUCED4 ifTrue:[
-	self error:'unsupported compression method: REDUCED4'.
-	^ nil
+        self error:'unsupported compression method: REDUCED4'.
+        ^ nil
     ].
     compressionMethod == COMPR_IMPLODED ifTrue:[
-	self error:'unsupported compression method: IMPLODED'.
-	^ nil
+        self error:'unsupported compression method: IMPLODED'.
+        ^ nil
     ].
     compressionMethod == COMPR_TOKENIZED ifTrue:[
-	self error:'unsupported compression method: TOKENIZED'.
-	^ nil
+        self error:'unsupported compression method: TOKENIZED'.
+        ^ nil
     ].
 
     self error:'unsupported compression method'.
@@ -1392,21 +1394,21 @@
 %{  /* STACK:32768 */
     if (__isByteArray(inBytes)
      && __isByteArray(outBytes)) {
-	char *in, *out;
-	int rc;
+        char *in, *out;
+        int rc;
 
-	in = __ByteArrayInstPtr(inBytes)->ba_element;
-	out = __ByteArrayInstPtr(outBytes)->ba_element;
+        in = __ByteArrayInstPtr(inBytes)->ba_element;
+        out = __ByteArrayInstPtr(outBytes)->ba_element;
 
-	if ((rc = stx_inflate(in, out)) == 0) {
-	    RETURN (outBytes);
-	}
-	inflateReturnCode = __MKSMALLINT(rc);
+        if ((rc = stx_inflate(in, out)) == 0) {
+            RETURN (outBytes);
+        }
+        inflateReturnCode = __MKSMALLINT(rc);
     }
 %}.
     inflateReturnCode notNil ifTrue:[
-	"/ bad blockType 2
-	self error:'inflate error: ' , inflateReturnCode printString
+        "/ bad blockType 2
+        self error:'inflate error: ' , inflateReturnCode printString
     ].
     ^ nil.
 
@@ -1431,9 +1433,9 @@
     "add a zipMember"
 
     (firstEntry == nil) ifTrue:[
-	firstEntry := zmemb
+        firstEntry := zmemb
     ] ifFalse:[ 
-	lastEntry next:zmemb.
+        lastEntry next:zmemb.
     ].
     lastEntry := zmemb.
     ^ zmemb.
@@ -1446,7 +1448,7 @@
     "find a zipMember by name"
 
     self zipMembersDo:[:zipd |
-	(zipd name = name) ifTrue:[^ zipd].
+        (zipd name = name) ifTrue:[^ zipd].
     ].
     ^ nil
 
@@ -1563,8 +1565,8 @@
 
     zipd := firstEntry.
     [zipd notNil] whileTrue:[
-	aBlock value:zipd.
-	zipd := zipd next
+        aBlock value:zipd.
+        zipd := zipd next
     ].
 
     "Created: / 29.3.1998 / 19:15:15 / cg"
@@ -1732,6 +1734,6 @@
 !ZipArchive class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/ZipArchive.st,v 1.32 2001-01-24 12:39:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/ZipArchive.st,v 1.33 2001-01-24 14:17:50 cg Exp $'
 ! !
 ZipArchive initialize!