You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by se...@apache.org on 2011/08/09 14:53:05 UTC
svn commit: r1155340 -
/poi/trunk/src/java/org/apache/poi/util/LittleEndian.java
Author: sergey
Date: Tue Aug 9 12:53:05 2011
New Revision: 1155340
URL: http://svn.apache.org/viewvc?rev=1155340&view=rev
Log:
fix unsigned int to long conversion
Modified:
poi/trunk/src/java/org/apache/poi/util/LittleEndian.java
Modified: poi/trunk/src/java/org/apache/poi/util/LittleEndian.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/LittleEndian.java?rev=1155340&r1=1155339&r2=1155340&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/LittleEndian.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/LittleEndian.java Tue Aug 9 12:53:05 2011
@@ -118,7 +118,7 @@ public class LittleEndian implements Lit
*/
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 Lit
*/
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 Lit
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 Lit
}
return (ch2 << 8) + (ch1 << 0);
}
-
+
/**
* get an int value from an InputStream
@@ -347,8 +347,8 @@ public class LittleEndian implements Lit
if ((ch1 | ch2 | ch3 | ch4 | ch5 | ch6 | ch7 | ch8) < 0) {
throw new BufferUnderrunException();
}
-
- return
+
+ return
((long)ch8 << 56) +
((long)ch7 << 48) +
((long)ch6 << 40) +
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org