[squeak-dev] [Cuis] Bug in StandardFileStream upTo:
keith_hodges at yahoo.co.uk
Sat Feb 13 23:55:07 UTC 2010
On 13 Feb 2010, at 23:13, Juan Vuletich wrote:
> keith wrote:
>> I just found a bug in StandardFileStream upTo: that seems to be
> Could you post a script that shows the incorrect behavior? I test
> would be even better.
> Juan Vuletich
Ok, it was not as obvious as I thought. peek messes things up.
(FileStream newFileNamed: 'test') nextPutAll: 'hello*world'; close.
(FileStream concreteStream readOnlyFileNamed: 'test') position: 0;
peek; upTo: $*.
peek appears to set readLimit, and then the following part of upTo: is
collection ifNotNil: [
(position < readLimit and: [
(count := collection indexOf: delim startingAt: position + 1) <=
readLimit and: [
count > 0 ] ]) ifTrue: [
^collection copyFrom: position + 1 to: (position := position +
count) ] ].
this gets it wrong, I think it should be something like, to:
(position := position + count -1) - 1
More information about the Squeak-dev