[squeak-dev] The Trunk: Collections-nice.243.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Dec 9 11:59:59 UTC 2009


Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.243.mcz

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

Name: Collections-nice.243
Author: nice
Time: 9 December 2009, 12:59:56 pm
UUID: 307de818-7b7f-ea49-b30b-e342e4caeeef
Ancestors: Collections-ul.242

Correct ReadStream #upToEnd and #upTo: with respect to readLimit

=============== Diff against Collections-ul.242 ===============

Item was changed:
  ----- Method: ReadStream>>upToEnd (in category 'accessing') -----
  upToEnd
  	| start |
+ 	start := 1 + position.
+ 	position := readLimit.
- 
- 	start := position+1.
- 	position := collection size.
  	^collection copyFrom: start to: position!

Item was changed:
  ----- Method: ReadStream>>upTo: (in category 'accessing') -----
  upTo: anObject
  	"fast version using indexOf:"
  	| start end |
  
  	start := position+1.
  	end := collection indexOf: anObject startingAt: start ifAbsent: [ 0 ].
  
  	"not present--return rest of the collection"	
+ 	(end = 0 or: [end > readLimit]) ifTrue: [ ^self upToEnd ].
- 	end = 0 ifTrue: [ ^self upToEnd ].
  
  	"skip to the end and return the data passed over"
  	position := end.
  	^collection copyFrom: start to: (end-1)!




More information about the Squeak-dev mailing list