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

kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git

commit f8a6e83174962681c1adb56404c28d592db38405
Author: Arturo Bernal <arturobern...@gmail.com>
AuthorDate: Tue Jun 15 18:34:22 2021 +0200

    [IMAGING-315] Remove redundant local variable.
---
 .../imaging/formats/jpeg/decoder/JpegDecoder.java        |  6 ++----
 .../commons/imaging/formats/png/PngImageParser.java      |  3 +--
 .../commons/imaging/formats/rgbe/RgbeImageParser.java    |  3 +--
 .../formats/tiff/datareaders/DataReaderTiled.java        | 16 +++++++---------
 4 files changed, 11 insertions(+), 17 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
 
b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
index 21ff0d3..1956625 100644
--- 
a/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
+++ 
b/src/main/java/org/apache/commons/imaging/formats/jpeg/decoder/JpegDecoder.java
@@ -241,8 +241,7 @@ public class JpegDecoder extends BinaryFileParser 
implements JpegUtils.Visitor {
             sofnSegment = new SofnSegment(marker, segmentData);
         } else if (marker == JpegConstants.DQT_MARKER) {
             final DqtSegment dqtSegment = new DqtSegment(marker, segmentData);
-            for (final QuantizationTable element : 
dqtSegment.quantizationTables) {
-                final DqtSegment.QuantizationTable table = element;
+            for (final QuantizationTable table : 
dqtSegment.quantizationTables) {
                 if (0 > table.destinationIdentifier
                         || table.destinationIdentifier >= 
quantizationTables.length) {
                     throw new ImageReadException(
@@ -261,8 +260,7 @@ public class JpegDecoder extends BinaryFileParser 
implements JpegUtils.Visitor {
             }
         } else if (marker == JpegConstants.DHT_MARKER) {
             final DhtSegment dhtSegment = new DhtSegment(marker, segmentData);
-            for (final HuffmanTable element : dhtSegment.huffmanTables) {
-                final DhtSegment.HuffmanTable table = element;
+            for (final HuffmanTable table : dhtSegment.huffmanTables) {
                 DhtSegment.HuffmanTable[] tables;
                 if (table.tableClass == 0) {
                     tables = huffmanDCTables;
diff --git 
a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java 
b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
index efacb59..62709a8 100644
--- a/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/png/PngImageParser.java
@@ -253,9 +253,8 @@ public class PngImageParser extends ImageParser  implements 
XmpEmbeddable {
         }
 
         final PngChunkIccp pngChunkiCCP = (PngChunkIccp) chunks.get(0);
-        final byte[] bytes = pngChunkiCCP.getUncompressedProfile(); // TODO 
should this be a clone?
 
-        return (bytes);
+        return (pngChunkiCCP.getUncompressedProfile());// TODO should this be 
a clone?
     }
 
     @Override
diff --git 
a/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java 
b/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
index c171625..b7a6a77 100644
--- a/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
+++ b/src/main/java/org/apache/commons/imaging/formats/rgbe/RgbeImageParser.java
@@ -102,7 +102,7 @@ public class RgbeImageParser extends ImageParser {
             final DataBuffer buffer = new DataBufferFloat(info.getPixelData(),
                     info.getWidth() * info.getHeight());
 
-            final BufferedImage ret = new BufferedImage(new 
ComponentColorModel(
+            return new BufferedImage(new ComponentColorModel(
                     ColorSpace.getInstance(ColorSpace.CS_sRGB), false, false,
                     Transparency.OPAQUE, buffer.getDataType()),
                     Raster.createWritableRaster(
@@ -110,7 +110,6 @@ public class RgbeImageParser extends ImageParser {
                                     info.getWidth(), info.getHeight(), 3),
                             buffer,
                             new Point()), false, null);
-            return ret;
         }
     }
 
diff --git 
a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
 
b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
index f7c8ef1..4da6284 100644
--- 
a/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
+++ 
b/src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderTiled.java
@@ -129,13 +129,11 @@ public final class DataReaderTiled extends 
ImageDataReader {
 
         if ((bitsPerPixel == 24 || bitsPerPixel == 32) && allSamplesAreOneByte
             && photometricInterpreter instanceof PhotometricInterpreterRgb) {
-            final int i0 = startY;
             int i1 = startY + tileLength;
             if (i1 > yLimit) {
                 // the tile is padded past bottom of image
                 i1 = yLimit;
             }
-            final int j0 = startX;
             int j1 = startX + tileWidth;
             if (j1 > xLimit) {
                 // the tile is padded to beyond the tile width
@@ -143,15 +141,15 @@ public final class DataReaderTiled extends 
ImageDataReader {
             }
 
             if (predictor == 
TiffTagConstants.PREDICTOR_VALUE_HORIZONTAL_DIFFERENCING) {
-                applyPredictorToBlock(tileWidth, i1 - i0, samplesPerPixel, 
bytes);
+                applyPredictorToBlock(tileWidth, i1 - startY, samplesPerPixel, 
bytes);
             }
 
             if (bitsPerPixel == 24) {
                 // 24 bit case, we don't mask the red byte because any
                 // sign-extended bits get covered by opacity mask
-                for (int i = i0; i < i1; i++) {
-                    int k = (i - i0) * tileWidth * 3;
-                    for (int j = j0; j < j1; j++, k += 3) {
+                for (int i = startY; i < i1; i++) {
+                    int k = (i - startY) * tileWidth * 3;
+                    for (int j = startX; j < j1; j++, k += 3) {
                         final int rgb = 0xff000000
                             | (bytes[k] << 16)
                             | ((bytes[k + 1] & 0xff) << 8)
@@ -162,9 +160,9 @@ public final class DataReaderTiled extends ImageDataReader {
             } else if (bitsPerPixel == 32) {
                 // 32 bit case, we don't mask the high byte because any
                 // sign-extended bits get shifted up and out of result.
-                for (int i = i0; i < i1; i++) {
-                    int k = (i - i0) * tileWidth * 4;
-                    for (int j = j0; j < j1; j++, k += 4) {
+                for (int i = startY; i < i1; i++) {
+                    int k = (i - startY) * tileWidth * 4;
+                    for (int j = startX; j < j1; j++, k += 4) {
                         final int rgb
                             = ((bytes[k] & 0xff) << 16)
                             | ((bytes[k + 1] & 0xff) << 8)

Reply via email to