> On 15 Mar 2018, at 12:28, Alistair Grant <[email protected]> wrote:
> 
> Hi Guille & Pavel,
> 
> On 6 Feb Guille changed Base64MimeConverter class>>mimeDecodeToBytes:
> so that it doesn't reset the dataStream position back to the start of
> the stream.  This breaks Pavel's PlayingCard, part of FreeCell (you
> can see that I only load important stuff :-)).
> 
> PlayingCard class>>initialize
> "PlayingCard initialize"
> | forms f |
> "Read the stored forms from mime-encoded data in imageData."
> f := Base64MimeConverter mimeDecodeToBytes: (ReadStream on: self imageData).
> forms := OrderedCollection new.
> f next = 2 ifFalse: [self error: 'corrupted imageData'].
> [f atEnd] whileFalse: [forms add: (Form new readFrom: f)].
> ...
> 
> 
> Previously, f would be at the start of the stream (which makes sense
> given this usage), but now it is at the end of the stream, so returns
> nil and "f next = 2" fails.
> 
> Guille, can you explain the change.  The commit log just says "make tests 
> run".
> 
> Note that a lot of users of this won't fail as they just call
> #contents of the stream after #mimeDecodeToBytes:, which works
> regardless of the current position.

So doing

  f reset

at the caller site would fix it then ?

Note that there is the newer ZnBase64Encoder that can be used as follows:

  f := (ZnBase64Encoder new decode: self imageData) readStream.

Sven




Reply via email to