aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2022-07-17 09:30:21 +0000
committerPJ Fanning <fanningpj@apache.org>2022-07-17 09:30:21 +0000
commitad6af709b8bba90512f51319f63966fdc9619592 (patch)
tree5c0cf7f2d06fe19fc848aeefab88399f00bfdde3
parent32069e6f5adab1f19f0571483d9afb562e212389 (diff)
downloadpoi-ad6af709b8bba90512f51319f63966fdc9619592.tar.gz
poi-ad6af709b8bba90512f51319f63966fdc9619592.zip
[github-348] tidy up number casting
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1902803 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xssf/binary/XSSFBParser.java4
-rw-r--r--poi/src/main/java/org/apache/poi/hssf/record/cont/ContinuableRecordInput.java4
-rw-r--r--poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java4
3 files changed, 6 insertions, 6 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/binary/XSSFBParser.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/binary/XSSFBParser.java
index 7786b22663..8822053180 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/binary/XSSFBParser.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/binary/XSSFBParser.java
@@ -92,7 +92,7 @@ public abstract class XSSFBParser {
b2 &= ~(1<<7); //unset highest bit (if it exists?)
recordId = ((int)b2 << 7)+(int)b1;
} else {
- recordId = (int)b1;
+ recordId = b1;
}
long recordLength = 0;
@@ -102,7 +102,7 @@ public abstract class XSSFBParser {
byte b = is.readByte();
halt = (b >> 7 & 1) == 0; //if highest bit !=1 then continue
b &= ~(1<<7);
- recordLength += (int)b << (i*7); //multiply by 128^i
+ recordLength += (long) (int)b << (i*7); //multiply by 128^i
i++;
}
diff --git a/poi/src/main/java/org/apache/poi/hssf/record/cont/ContinuableRecordInput.java b/poi/src/main/java/org/apache/poi/hssf/record/cont/ContinuableRecordInput.java
index 5f50b584bc..401143b987 100644
--- a/poi/src/main/java/org/apache/poi/hssf/record/cont/ContinuableRecordInput.java
+++ b/poi/src/main/java/org/apache/poi/hssf/record/cont/ContinuableRecordInput.java
@@ -101,8 +101,8 @@ public class ContinuableRecordInput implements LittleEndianInput {
((long)b5 << 40) +
((long)b4 << 32) +
((long)b3 << 24) +
- (b2 << 16) +
- (b1 << 8) +
+ ((long)b2 << 16) +
+ ((long)b1 << 8) +
(b0));
}
diff --git a/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java b/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
index a1c7cd4984..ea3159c911 100644
--- a/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
+++ b/poi/src/main/java/org/apache/poi/poifs/crypt/ChunkedCipherInputStream.java
@@ -172,11 +172,11 @@ public abstract class ChunkedCipherInputStream extends LittleEndianInputStream {
private void nextChunk() throws GeneralSecurityException, IOException {
if (chunkSize != -1) {
- int index = (int)(pos >> chunkBits);
+ int index = (int) (pos >> chunkBits);
initCipherForBlock(cipher, index);
if (lastIndex != index) {
- long skipN = (index - lastIndex) << chunkBits;
+ long skipN = ((long) index - lastIndex) << chunkBits;
if (super.skip(skipN) < skipN) {
throw new EOFException("buffer underrun");
}