Mantis - Squeak
Viewing Issue Advanced Details
1606 System minor always 08-04-05 00:49 03-02-06 09:25
Russell Penney  
ned  
normal  
closed  
fixed  
none    
none 3.8  
0001606: [FIX] ZipArchive - Cant read from ReadWriteStreams
Fixes a problem I found with ZipArchive not being able to read from a
ReadWriteStream. Removes any dependence on String internally, which seemed
strange as it forces the input stream to binary before reading. FileStream
does something different to ReadWriteStreams.

 

Try:

| buffer |

 

s := StandardFileStream readOnlyFileNamed: 'somefile.zip'.

s binary.

buffer := s contents.

s close.

s := ReadWriteStream with: buffer.

s reset.

ZipArchive new readFrom: s.
 ZipArchiveChanges.1.cs.gz [^] (1,346 bytes) 08-04-05 00:49
 ZipArchiveChanges.3.cs.gz [^] (2,982 bytes) 08-04-05 00:52

Notes
(0002119)
KenCausey   
08-04-05 00:51   
=?ISO-8859-1?Q?st=E9phane_ducasse?= <ducasse@iam.unibe.ch>:

"thanks for your fix. (If I ask nicely may be this will work) would it
be possible to get one or two unit tests so that we can nicely document
your bug and in the same time create active documentation for squeak."
(0002120)
KenCausey   
08-04-05 00:51   
"Russell Penney" <russell.penney@tincanct.com>:

"Stef,
    Here you go. :)

The change set consists of the fix and the tests. They show the difference
between ReadWriteStream and StandardFileStream. Actually the bug is in the
next:into:startingAt: method in one of those two streams.
StandardFileStream's method only works on Strings while ReadWriteStream can
handle any array.

One of the tests leaves a zip file in your current directory."

(attaching ZipArchiveChanges.3.cs.gz)
(0002121)
KenCausey   
08-04-05 00:53   
I was able to load both changesets (separately) into a 3.8-6665-basic image without errors. The tests included with the second changeset ran succesfully. I did not test this further.
(0004057)
MarcusDenker   
02-24-06 21:15   
not reproducable in 3.9a: added the test, runs green.
(0004272)
ned   
03-01-06 21:34   
This is fixed in 3.8 and 3.9; there were a number of fixes needed due to the m18n effort.