[squeak-dev] The Trunk: Compression-ct.57.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jan 3 18:17:34 UTC 2022

Christoph Thiede uploaded a new version of Compression to project The Trunk:

==================== Summary ====================

Name: Compression-ct.57
Author: ct
Time: 3 January 2022, 7:17:31.519703 pm
UUID: 32eabe2a-30cb-9e45-9820-3f00c262870f
Ancestors: Compression-dtl.55

Fixes ZipWriteStream regression tests. The file stream under test, and thus FastInflateStream, streams bytes rather than chracters, so provide ByteArrays rather than strings as target buffers.

=============== Diff against Compression-dtl.55 ===============

Item was changed:
  ----- Method: ZipWriteStream class>>regressionDecompress:from:notifying:stats: (in category 'regression test') -----
  regressionDecompress: aFile from: tempFile notifying: progressBar stats: stats
  	"Validate aFile as decompressed from tempFile"
  	| unzip rawSize compressedSize buffer1 buffer2 |
  	rawSize := aFile size.
  	compressedSize := tempFile size.
  	aFile ascii.
  	aFile position: 0.
  	tempFile ascii.
  	tempFile position: 0.
+ 	buffer1 := ByteArray new: 4096.
- 	buffer1 := String new: 4096.
  	buffer2 := buffer1 copy.
  	unzip := FastInflateStream on: tempFile.
  	[aFile atEnd] whileFalse:[
  		progressBar value: aFile position.
  		buffer1 := aFile nextInto: buffer1.
  		buffer2 := unzip nextInto: buffer2.
  		buffer1 = buffer2
  			ifFalse:[^self logProblem: 'contents ' for: aFile].
  	unzip next = nil ifFalse:[^self logProblem: 'EOF' for: aFile].
  	stats at: #rawSize put:
  		(stats at: #rawSize ifAbsent:[0]) + rawSize.
  	stats at: #compressedSize put:
  		(stats at: #compressedSize ifAbsent:[0]) + compressedSize.
  	^compressedSize asFloat / rawSize asFloat.!

More information about the Squeak-dev mailing list