From 3d5f053c02458ada47230963765efe2e09032f53 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Fri, 9 Jul 2004 15:37:31 +0000 Subject: [PATCH] ObjectInputStream.java (readFields): Use long datatype when shifting byte values more then 24 bits left. 2004-07-09 Michael Koch * java/io/ObjectInputStream.java (readFields): Use long datatype when shifting byte values more then 24 bits left. From-SVN: r84382 --- libjava/ChangeLog | 5 +++++ libjava/java/io/ObjectInputStream.java | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index d78d2734db7..b7eea9697b9 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2004-07-09 Michael Koch + + * java/io/ObjectInputStream.java (readFields): Use long datatype + when shifting byte values more then 24 bits left. + 2004-07-09 Michael Koch * java/util/zip/DeflaterOutputStream.java, diff --git a/libjava/java/io/ObjectInputStream.java b/libjava/java/io/ObjectInputStream.java index 292f841a657..809e9b1c941 100644 --- a/libjava/java/io/ObjectInputStream.java +++ b/libjava/java/io/ObjectInputStream.java @@ -1332,10 +1332,10 @@ public class ObjectInputStream extends InputStream int off = field.getOffset(); - return (long)(((prim_field_data[off++] & 0xFF) << 56) - | ((prim_field_data[off++] & 0xFF) << 48) - | ((prim_field_data[off++] & 0xFF) << 40) - | ((prim_field_data[off++] & 0xFF) << 32) + return (long)(((prim_field_data[off++] & 0xFFL) << 56) + | ((prim_field_data[off++] & 0xFFL) << 48) + | ((prim_field_data[off++] & 0xFFL) << 40) + | ((prim_field_data[off++] & 0xFFL) << 32) | ((prim_field_data[off++] & 0xFF) << 24) | ((prim_field_data[off++] & 0xFF) << 16) | ((prim_field_data[off++] & 0xFF) << 8) @@ -1369,10 +1369,10 @@ public class ObjectInputStream extends InputStream int off = field.getOffset(); return Double.longBitsToDouble - ( (long) (((prim_field_data[off++] & 0xFF) << 56) - | ((prim_field_data[off++] & 0xFF) << 48) - | ((prim_field_data[off++] & 0xFF) << 40) - | ((prim_field_data[off++] & 0xFF) << 32) + ( (long) (((prim_field_data[off++] & 0xFFL) << 56) + | ((prim_field_data[off++] & 0xFFL) << 48) + | ((prim_field_data[off++] & 0xFFL) << 40) + | ((prim_field_data[off++] & 0xFFL) << 32) | ((prim_field_data[off++] & 0xFF) << 24) | ((prim_field_data[off++] & 0xFF) << 16) | ((prim_field_data[off++] & 0xFF) << 8) -- 2.30.2