tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ignacio J. Ortega" <na...@siapi.es>
Subject RE: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util/b uf ByteChunk.java
Date Sun, 03 Jun 2001 19:30:17 GMT
> perhaps i'm missing something, but it looks like the offset 
> returned by
> getOffset() should be the offset into the byte array contained in
> ByteChunk, which would be the start position in this case, rather than
> the end position.
> 

>From the point of view of the o.a.t.m.s.ajp13, now getOffset() has the
correct behavior, at least now for me works, prior to that change ajp13
was unusable.., take a look in o.a.t.m.s.Ajp13.Ajp13Packet.appendString,
There is some magic in the use of ob.setbyteOff and ob.getByteOff...as i
understand this code.. ob.getByteOff is requiered to return the end of
the last writed byte chunk ..perhaps a better aproach to this fix is to
change ob.getOffset to use  bb.getEnd instead os bb.getOffset..at least
this will make the intention clearer.., in a really obscure code..

> also, if you look at the append() and equals() methods that take
> ByteChunk's as arguments, if getOffset() returns the end 
> position rather
> than the start position, these methods won't work as intended.  for
> example, equals() will start comparing comparing bytes at the 
> end of the
> ByteChunk, rather than the start of it.
> 

I reviewed it, and your are right for equals..but not for append..append
is suppoused to use the end of the buffer not the start..so in append
getOffset is suppoused to return end not the start...

The better solution is to get rid of getOffset..and only use getStart or
getEnd where needed...

> just a sanity check...
> 

Well done, OSS is great because of this comments..and the possibility to
make them just-in-time..:)))

> -kevin.

Saludos ,
Ignacio J. Ortega


Mime
View raw message