Hi Sven, On 15 March 2018 at 12:47, Sven Van Caekenberghe <[email protected]> wrote: > > >> 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 ?
Yes, but I was thinking more about whether it was intended to put this responsibility on the caller (changing behaviour). > Note that there is the newer ZnBase64Encoder that can be used as follows: > > f := (ZnBase64Encoder new decode: self imageData) readStream. That works too. Thanks, Alistair
