Fw: [BUG][FIX] inspect element index ( please unapprove )

Boris.Gaertner at gmx.net Boris.Gaertner at gmx.net
Sun Mar 14 18:56:03 UTC 2004


At times reviewing is hard. My review was a bit carelessly given for an
earlier version.
At Mar 9, Yoshiki san sent this improved version. Regrettably, it
contains a subtle
bug that we discussed off list (We had both problems to understand that
the BFAV server
looks for an 'X-squeak-bugfix-archive' attribute in the mail header)
Attached is a
version that we think is better.
The problem with the version that is currently approved is that the
following
piece of code runs into a failure:

String streamContents: [:s | 39 timesRepeat: [s nextPutAll: '12345'].
   s nextPutAll: '1234'.
   s nextPut: $*;
    nextPut: $*; nextPut:$*.
   s nextPutAll: '--'
   ] limitedTo: 200   

The  nextPut: increases the position beyond limit and
the next  nextPutAll:  tries to evaluate a
copyFrom:to: with a negative value for (limit - position).

We have, in my opinion, two options:
1. We can write:


super nextPutAll: 
   (aCollection copyFrom: 1 to: (limit - position max: 0)).

which reliably avoids a negative value where it is not allowed.

2. Alternatively (or additionally), we can redefine
nextPut: in LimitedWriteStream to do this:

nextPut: anObject 
 position >= limit ifTrue: [limitBlock value]
    ifFalse: [super nextPut: anObject].
This ensures the strict observation of the limit value.


The attached change set contains Yoshikis changes and both of
my proposals.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: InspectElementFix.cs.gz
Type: application/octet-stream
Size: 1119 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040314/1497d538/InspectElementFix.cs.obj


More information about the Squeak-dev mailing list