RE: [cp-patches] RFC: StringIndexOutOfBoundsException fixes inString contructors

2005-12-06 Thread Christian Thalinger
On Wed, 2005-11-02 at 12:50 +0100, Jeroen Frijters wrote: > Christian Thalinger wrote: > > +if (offset + count < 0 || offset + count > ascii.length) > > You can write this more efficiently as: > > if (ascii.length - offset < count) > > (This assumes that offset and count have previously

Re: [cp-patches] RFC: StringIndexOutOfBoundsException fixes inString contructors

2005-11-02 Thread Christian Thalinger
On Wed, Nov 02, 2005 at 10:33:30AM -0500, Anthony Balkissoon wrote: > Uhm, I think that offset and count probably wouldn't have been checked > to be non-negative, otherwise why would they check that offset + count < > 0 ? That check is for overflow. But i'll make a patch for jeroen's suggestion.

RE: [cp-patches] RFC: StringIndexOutOfBoundsException fixes inString contructors

2005-11-02 Thread Anthony Balkissoon
On Wed, 2005-11-02 at 12:50 +0100, Jeroen Frijters wrote: > Christian Thalinger wrote: > > +if (offset + count < 0 || offset + count > ascii.length) > > You can write this more efficiently as: > > if (ascii.length - offset < count) > > (This assumes that offset and count have previously

RE: [cp-patches] RFC: StringIndexOutOfBoundsException fixes inString contructors

2005-11-02 Thread Jeroen Frijters
Christian Thalinger wrote: > +if (offset + count < 0 || offset + count > ascii.length) You can write this more efficiently as: if (ascii.length - offset < count) (This assumes that offset and count have previously been checked to be non-negative.) Regards, Jeroen _