From 33a1542335c3314aa1686d192f9b5b55785658d2 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 abc494c3d..f13fbf6a8 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) +