This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pdfbox-jbig2.git
The following commit(s) were added to refs/heads/master by this push:
new 56b026b PDFBOX-5660: Sonar - Extract duplicate log calculation and
fix int promotion
56b026b is described below
commit 56b026b182c602ab73e5447cb7af674b5ebed929
Author: Maruan Sahyoun <[email protected]>
AuthorDate: Wed May 13 21:23:25 2026 +0200
PDFBOX-5660: Sonar - Extract duplicate log calculation and fix int promotion
---
.../org/apache/pdfbox/jbig2/segments/SymbolDictionary.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git
a/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java
b/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java
index 64d000e..2f0b78a 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/segments/SymbolDictionary.java
@@ -975,17 +975,17 @@ public class SymbolDictionary implements Dictionary
*/
private int getSbSymCodeLen() throws IOException
{
+
+ final int sbSymCodeLen = (int) Math.ceil(
+ Math.log((double) amountOfImportedSymbols + amountOfNewSymbols) /
Math.log(2));
+
if (isHuffmanEncoded)
{
- return Math.max(
- (int) (Math.ceil(
- Math.log(amountOfImportedSymbols +
amountOfNewSymbols) / Math.log(2))),
- 1);
+ return Math.max(sbSymCodeLen, 1);
}
else
{
- return (int) (Math
- .ceil(Math.log(amountOfImportedSymbols +
amountOfNewSymbols) / Math.log(2)));
+ return sbSymCodeLen;
}
}