From ece6bc06189836b1d6a51282c1739e858d223558 Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Tue, 9 Aug 2011 12:53:05 +0000 Subject: [PATCH] fix unsigned int to long conversion git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1155340 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/poi/util/LittleEndian.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/java/org/apache/poi/util/LittleEndian.java b/src/java/org/apache/poi/util/LittleEndian.java index abc494c3dc..f13fbf6a8e 100644 --- a/src/java/org/apache/poi/util/LittleEndian.java +++ b/src/java/org/apache/poi/util/LittleEndian.java @@ -118,7 +118,7 @@ public class LittleEndian implements LittleEndianConsts { */ public static long getUInt(byte[] data, int offset) { long retNum = getInt(data, offset); - return retNum & 0x00FFFFFFFF; + return retNum & 0x00FFFFFFFFl; } /** @@ -140,7 +140,7 @@ public class LittleEndian implements LittleEndianConsts { */ public static long getLong(byte[] data, int offset) { long result = 0; - + for (int j = offset + LONG_SIZE - 1; j >= offset; j--) { result <<= 8; result |= 0xff & data[j]; @@ -248,7 +248,7 @@ public class LittleEndian implements LittleEndianConsts { public static void putLong(byte[] data, int offset, long value) { int limit = LONG_SIZE + offset; long v = value; - + for (int j = offset; j < limit; j++) { data[j] = (byte) (v & 0xFF); v >>= 8; @@ -303,7 +303,7 @@ public class LittleEndian implements LittleEndianConsts { } return (ch2 << 8) + (ch1 << 0); } - + /** * get an int value from an InputStream @@ -347,8 +347,8 @@ public class LittleEndian implements LittleEndianConsts { if ((ch1 | ch2 | ch3 | ch4 | ch5 | ch6 | ch7 | ch8) < 0) { throw new BufferUnderrunException(); } - - return + + return ((long)ch8 << 56) + ((long)ch7 << 48) + ((long)ch6 << 40) + -- 2.39.5