GIFReader.st
changeset 755 f1135dda53b1
parent 749 49c372aaf613
child 757 094c6c7c4ce6
--- a/GIFReader.st	Wed Jan 14 17:44:52 1998 +0100
+++ b/GIFReader.st	Thu Jan 15 16:38:47 1998 +0100
@@ -433,12 +433,26 @@
                 "get codelen for decompression"
                 codeLen := aStream nextByte.
 
-                compressedData := ByteArray uninitializedNew:(aStream fileSize).
+                (aStream respondsTo:#fileSize) ifTrue:[
+                    "get hint about length of compressed data"
+                    count := aStream fileSize.
+                ] ifFalse:[
+                    count := 512.
+                ].
+                compressedData := ByteArray uninitializedNew:count.
 
                 "get compressed data"
                 index := 1.
                 count := aStream nextByte.
                 [count notNil and:[count ~~ 0]] whileTrue:[
+                    (compressedData size < (index+count)) ifTrue:[
+                        |c|
+                        c := ByteArray uninitializedNew:(index+count*3//2).
+                        c replaceBytesFrom:1 to:index-1 
+                          with:compressedData startingAt:1.
+                        
+                        compressedData := c.
+                    ].
                     aStream nextBytes:count into:compressedData startingAt:index blockSize:4096.
                     index := index + count.
                     count := aStream nextByte
@@ -526,8 +540,8 @@
      GIFReader new fromStream:('/home2/cg/.misc/circum.gif' asFilename readStream)
     "
 
-    "Modified: / 5.7.1996 / 17:32:01 / stefan"
     "Modified: / 18.12.1997 / 10:23:38 / cg"
+    "Modified: / 15.1.1998 / 15:42:19 / stefan"
 !
 
 makeGreyscale
@@ -921,6 +935,6 @@
 !GIFReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.64 1997-12-18 10:47:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/GIFReader.st,v 1.65 1998-01-15 15:38:47 stefan Exp $'
 ! !
 GIFReader initialize!