This is an automated email from the ASF dual-hosted git repository.

pjfanning pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 720b6321d3 remove info losing int casts (#1099)
720b6321d3 is described below

commit 720b6321d36fa736357b2d6b15e189683e3e7aac
Author: PJ Fanning <[email protected]>
AuthorDate: Mon Jun 1 19:35:16 2026 +0100

    remove info losing int casts (#1099)
---
 .../java/org/apache/poi/hemf/record/emfplus/HemfPlusBrush.java    | 2 +-
 .../java/org/apache/poi/hemf/record/emfplus/HemfPlusObject.java   | 2 +-
 .../src/main/java/org/apache/poi/hwmf/record/HwmfEscape.java      | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusBrush.java
 
b/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusBrush.java
index b787b6f427..337a77b9de 100644
--- 
a/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusBrush.java
+++ 
b/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusBrush.java
@@ -356,7 +356,7 @@ public class HemfPlusBrush {
                 size += LittleEndianConsts.INT_SIZE;
             }
 
-            brushBytes = IOUtils.toByteArray(leis, 
Math.toIntExact(dataSize-size), MAX_OBJECT_SIZE);
+            brushBytes = IOUtils.toByteArray(leis, dataSize-size, 
MAX_OBJECT_SIZE);
 
             return dataSize;
         }
diff --git 
a/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusObject.java
 
b/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusObject.java
index ebeb0f1d0f..4db5dedb92 100644
--- 
a/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusObject.java
+++ 
b/poi-scratchpad/src/main/java/org/apache/poi/hemf/record/emfplus/HemfPlusObject.java
@@ -265,7 +265,7 @@ public class HemfPlusObject {
 
             long size = graphicsVersion.init(leis);
 
-            objectDataBytes = IOUtils.toByteArray(leis, (int)(dataSize - 
size), MAX_OBJECT_SIZE);
+            objectDataBytes = IOUtils.toByteArray(leis, dataSize - size, 
MAX_OBJECT_SIZE);
 
             return dataSize;
         }
diff --git 
a/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfEscape.java 
b/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfEscape.java
index 909d1c4f06..a38539b782 100644
--- a/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfEscape.java
+++ b/poi-scratchpad/src/main/java/org/apache/poi/hwmf/record/HwmfEscape.java
@@ -260,8 +260,8 @@ public class HwmfEscape implements HwmfRecord {
         @Override
         public int init(LittleEndianInputStream leis, long recordSize, 
EscapeFunction escapeFunction) throws IOException {
             this.escapeFunction = escapeFunction;
-            escapeDataBytes = 
IOUtils.toByteArray(leis,(int)recordSize,MAX_OBJECT_SIZE);
-            return (int)recordSize;
+            escapeDataBytes = IOUtils.toByteArray(leis, recordSize, 
MAX_OBJECT_SIZE);
+            return Math.toIntExact(recordSize);
         }
 
         @Override
@@ -303,9 +303,9 @@ public class HwmfEscape implements HwmfRecord {
             if (commentIdentifier != EMF_COMMENT_IDENTIFIER) {
                 // there are some WMF implementation using this record as a 
MFCOMMENT or similar
                 // if the commentIdentifier doesn't match, then return 
immediately
-                emfData = IOUtils.toByteArray(leis, 
(int)(recordSize-LittleEndianConsts.INT_SIZE), MAX_OBJECT_SIZE);
+                emfData = IOUtils.toByteArray(leis, 
recordSize-LittleEndianConsts.INT_SIZE, MAX_OBJECT_SIZE);
                 remainingBytes = emfData.length;
-                return (int)recordSize;
+                return Math.toIntExact(recordSize);
             }
 
             // A 32-bit unsigned integer that identifies the type of comment 
in this record.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to