[kaffe] Odd Jython/jar behaviour
Archie Cobbs
archie@dellroad.org
Tue Jan 7 09:00:02 2003
Dalibor Topic wrote:
> > Ok, I got the bug now, though I don't know if my fix
> > is the correct one.
> >
> > from DataInputStream.java:
> >
> > public final int readInt() throws IOException {
> > int v1 = readUnsignedByte() << 24;
> > v1 |= readUnsignedByte() << 16;
> > v1 |= readUnsignedByte() << 8;
> > v1 |= readUnsignedByte();
> > return v1;
> > }
> >
> > In 1.07's version, this was s/UnsignedByte//g (if
> > you pardon the expression)
> > -- the bug disappears also with "readByte()" instead
> > of "readUnsignedByte()".
> >
> > I'm guessing readByte() is the correct one -- if it
> > is, attached patch will
> > fix this.
>
> When I switch from using readUnsignedByte() to using
> readByte() I get a ton of failures whan I run make
> check. Could you run make check yourself and see if
> your patch breaks regressions tests?
Clearly, whatever function you use can't return have return type
"byte", because if it did the upper 24 bits of the result will
always be 1 due to sign-extension from integral promotion.
Alternately, add "& 0xff" to all the read*() function calls.
-Archie
__________________________________________________________________________
Archie Cobbs * Packet Design * http://www.packetdesign.com