Nicolas Cellier uploaded a new version of Compression to project The Trunk:
http://source.squeak.org/trunk/Compression-nice.44.mcz==================== Summary ====================
Name: Compression-nice.44
Author: nice
Time: 17 July 2014, 10:22:38.863 pm
UUID: d4db1361-814f-4c5b-85f6-25d24c27fdbc
Ancestors: Compression-nice.43
Oops, I committed too fast.
ByteArray>>asWideString is a trap, it answers a ByteString whenever size \\ 4 ~= 0.
This version works better for WideString.
=============== Diff against Compression-nice.43 ===============
Item was changed:
----- Method: String>>unzipped (in category '*Compression-Streams') -----
unzipped
- | magic1 magic2 |
- magic1 := (self at: 1) asInteger.
- magic2 := (self at: 2) asInteger.
- (magic1 = 16r1F and:[magic2 = 16r8B]) ifFalse:[^self].
^self isByteString
ifTrue: [self asByteArray unzipped asString]
ifFalse: [self asByteArray unzipped asWideString]!
Item was changed:
----- Method: String>>zipped (in category '*Compression-Streams') -----
zipped
"This sounds questionnable for WideString but works - even if zipped size is not a multiple of 4"
+ | zipped |
+ zipped := self asByteArray zipped.
+ self isByteString ifTrue: [^zipped asString].
+ zipped size \\ 4 = 0 ifTrue: [^zipped asWideString].
+ ^(zipped , (ByteArray new: 4 - (zipped size \\ 4))) asWideString!
- ^self isByteString
- ifTrue: [self asByteArray zipped asString]
- ifFalse: [self asByteArray zipped asWideString]!