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 6f28b09  PDFBOX-5660: Sonar fix
6f28b09 is described below

commit 6f28b09f0ca647c3ec97367d9f67993d2a22452a
Author: Tilman Hausherr <[email protected]>
AuthorDate: Thu May 14 21:10:26 2026 +0200

    PDFBOX-5660: Sonar fix
---
 .../java/org/apache/pdfbox/jbig2/image/BitmapScanline.java     |  5 +++--
 src/main/java/org/apache/pdfbox/jbig2/image/Scanline.java      | 10 ++++++----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/pdfbox/jbig2/image/BitmapScanline.java 
b/src/main/java/org/apache/pdfbox/jbig2/image/BitmapScanline.java
index e8b68f3..1df473f 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/image/BitmapScanline.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/image/BitmapScanline.java
@@ -75,9 +75,10 @@ final class BitmapScanline extends Scanline
         // the next two blocks are duplicated except for the missing shift 
operation if preShift == 0.
         final int preShift0 = preShift[0];
         final int postShift0 = postShift[0];
+        int dstIndex = 0;
         if (preShift0 != 0)
         {
-            for (int dstIndex = 0, tab = 0; tab < dstLength; tab++)
+            for (int tab = 0; tab < dstLength; tab++)
             {
                 final Weighttab weightTab = tabs[tab];
                 final int weights = weightTab.weights.length;
@@ -95,7 +96,7 @@ final class BitmapScanline extends Scanline
         }
         else
         {
-            for (int dstIndex = 0, tab = 0; tab < dstLength; tab++)
+            for (int tab = 0; tab < dstLength; tab++)
             {
                 final Weighttab weightTab = tabs[tab];
                 final int weights = weightTab.weights.length;
diff --git a/src/main/java/org/apache/pdfbox/jbig2/image/Scanline.java 
b/src/main/java/org/apache/pdfbox/jbig2/image/Scanline.java
index de55abe..faea2c0 100644
--- a/src/main/java/org/apache/pdfbox/jbig2/image/Scanline.java
+++ b/src/main/java/org/apache/pdfbox/jbig2/image/Scanline.java
@@ -91,8 +91,9 @@ abstract class Scanline
 
             // the next two blocks are duplicated except for the missing shift
             // operation if preShift==0.
+            int bp = 0;
             if (preShift[0] != 0 || preShift[1] != 0 || preShift[2] != 0)
-                for (int bp = 0, b = 0; b < nx; b++)
+                for (int b = 0; b < nx; b++)
                 {
                     final Weighttab wtab = tabs[b];
                     final int an = wtab.weights.length;
@@ -116,7 +117,7 @@ abstract class Scanline
                     bbuf[bp++] = t < 0 ? 0 : t > 255 ? 255 : t;
                 }
             else
-                for (int bp = 0, b = 0; b < nx; b++)
+                for (int b = 0; b < nx; b++)
                 {
                     final Weighttab wtab = tabs[b];
                     final int an = wtab.weights.length;
@@ -245,8 +246,9 @@ abstract class Scanline
             boolean hasPreShift = false;
             for (int c = 0; c < componentCount && !hasPreShift; c++)
                 hasPreShift |= preShift[c] != 0;
+            int bp = 0;
             if (hasPreShift)
-                for (int bp = 0, b = 0; b < nx; b++)
+                for (int b = 0; b < nx; b++)
                 {
                     final Weighttab wtab = tabs[b];
                     final int an = wtab.weights.length;
@@ -263,7 +265,7 @@ abstract class Scanline
                     }
                 }
             else
-                for (int bp = 0, b = 0; b < nx; b++)
+                for (int b = 0; b < nx; b++)
                 {
                     final Weighttab wtab = tabs[b];
                     final int an = wtab.weights.length;

Reply via email to