[squeak-dev] The Trunk: Compression-ul.31.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Dec 9 11:23:43 UTC 2011
Levente Uzonyi uploaded a new version of Compression to project The Trunk:
http://source.squeak.org/trunk/Compression-ul.31.mcz
==================== Summary ====================
Name: Compression-ul.31
Author: ul
Time: 6 December 2011, 12:23:31.156 pm
UUID: 0fc814a0-b8d5-9847-b67b-ee8efcbbe6db
Ancestors: Compression-nice.30
Allow reading zero bytes in InflateStream >> #next:into:startingAt: and InflateStream >> #readInto:startingAt:count:.
=============== Diff against Compression-nice.30 ===============
Item was changed:
----- Method: InflateStream>>next:into:startingAt: (in category 'accessing') -----
next: n into: buffer startingAt: startIndex
"Read n objects into the given collection.
Return aCollection or a partial copy if less than
n elements have been read."
| c numRead count |
+ n = 0 ifTrue: [ ^buffer ].
numRead := 0.
["Force decompression if necessary"
(c := self next) == nil
ifTrue:[^buffer copyFrom: 1 to: startIndex+numRead-1].
"Store the first value which provoked decompression"
buffer at: startIndex + numRead put: c.
numRead := numRead + 1.
"After collection has been filled copy as many objects as possible"
count := (readLimit - position) min: (n - numRead).
buffer
replaceFrom: startIndex + numRead
to: startIndex + numRead + count - 1
with: collection
startingAt: position+1.
position := position + count.
numRead := numRead + count.
numRead = n] whileFalse.
^buffer!
Item was changed:
----- Method: InflateStream>>readInto:startingAt:count: (in category 'accessing') -----
readInto: buffer startingAt: startIndex count: n
"Read n objects into the given collection.
Return number of elements that have been read."
| c numRead count |
+ n = 0 ifTrue: [ ^n ].
numRead := 0.
["Force decompression if necessary"
(c := self next) == nil
ifTrue: [^numRead].
"Store the first value which provoked decompression"
buffer at: startIndex + numRead put: c.
numRead := numRead + 1.
"After collection has been filled copy as many objects as possible"
count := (readLimit - position) min: (n - numRead).
buffer
replaceFrom: startIndex + numRead
to: startIndex + numRead + count - 1
with: collection
startingAt: position+1.
position := position + count.
numRead := numRead + count.
numRead = n] whileFalse.
^n!
More information about the Squeak-dev
mailing list
|