commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1308079 - in /commons/proper/sanselan/trunk/src: main/java/org/apache/commons/sanselan/formats/jpeg/ main/java/org/apache/commons/sanselan/formats/png/ main/java/org/apache/commons/sanselan/formats/tiff/ main/java/org/apache/commons/sansel...
Date Sun, 01 Apr 2012 11:28:24 GMT
Author: sebb
Date: Sun Apr  1 11:28:24 2012
New Revision: 1308079

URL: http://svn.apache.org/viewvc?rev=1308079&view=rev
Log:
Unnecessary casts

Modified:
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/JpegImageParser.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/JpegPhotoshopMetadata.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/png/PngWriter.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffField.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageParser.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffImageWriterLossless.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputDirectory.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputSet.java
    commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/jpeg/decoder/DctTest.java

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/JpegImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/JpegImageParser.java?rev=1308079&r1=1308078&r2=1308079&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/JpegImageParser.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/JpegImageParser.java
Sun Apr  1 11:28:24 2012
@@ -230,7 +230,7 @@ public class JpegImageParser extends Ima
         int total = 0;
         for (int i = 0; i < v.size(); i++)
         {
-            App2Segment segment = (App2Segment) v.get(i);
+            App2Segment segment = v.get(i);
 
             if ((i + offset) != segment.cur_marker)
             {
@@ -258,7 +258,7 @@ public class JpegImageParser extends Ima
 
         for (int i = 0; i < v.size(); i++)
         {
-            App2Segment segment = (App2Segment) v.get(i);
+            App2Segment segment = v.get(i);
 
             System.arraycopy(segment.icc_bytes, 0, result, progress,
                     segment.icc_bytes.length);
@@ -1041,7 +1041,7 @@ public class JpegImageParser extends Ima
             for (int d = 0; d < segments.size(); d++)
             {
 
-                Segment segment = (Segment) segments.get(d);
+                Segment segment = segments.get(d);
 
                 NumberFormat nf = NumberFormat.getIntegerInstance();
                 // this.debugNumber("found, marker: ", marker, 4);

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/JpegPhotoshopMetadata.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/JpegPhotoshopMetadata.java?rev=1308079&r1=1308078&r2=1308079&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/JpegPhotoshopMetadata.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/jpeg/JpegPhotoshopMetadata.java
Sun Apr  1 11:28:24 2012
@@ -40,7 +40,7 @@ public class JpegPhotoshopMetadata exten
         Collections.sort(records, IptcRecord.COMPARATOR);
         for (int j = 0; j < records.size(); j++)
         {
-            IptcRecord element = (IptcRecord) records.get(j);
+            IptcRecord element = records.get(j);
             if (element.iptcType != IptcTypes.RECORD_VERSION)
                 add(element.getIptcTypeName(), element.getValue());
         }

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/png/PngWriter.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/png/PngWriter.java?rev=1308079&r1=1308078&r2=1308079&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/png/PngWriter.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/png/PngWriter.java
Sun Apr  1 11:28:24 2012
@@ -297,7 +297,7 @@ public class PngWriter implements PngCon
         bytes[5] = (byte) (0xff & (yPPU >> 16));
         bytes[6] = (byte) (0xff & (yPPU >> 8));
         bytes[7] = (byte) (0xff & (yPPU >> 0));
-        bytes[8] = (byte) units;
+        bytes[8] = units;
         writeChunk(os, IPHYS_CHUNK_TYPE.toByteArray(), bytes);
     }
 
@@ -521,7 +521,7 @@ public class PngWriter implements PngCon
             List<PngText> outputTexts = (List<PngText>) params.get(PARAM_KEY_PNG_TEXT_CHUNKS);
             for (int i = 0; i < outputTexts.size(); i++)
             {
-                PngText text = (PngText) outputTexts.get(i);
+                PngText text = outputTexts.get(i);
                 if (text instanceof PngText.tEXt)
                     writeChunktEXt(os, (PngText.tEXt) text);
                 else if (text instanceof PngText.zTXt)

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffField.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffField.java?rev=1308079&r1=1308078&r2=1308079&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffField.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffField.java
Sun Apr  1 11:28:24 2012
@@ -290,7 +290,7 @@ public class TiffField implements TiffCo
         // Debug.debug("fillInValue valueLength", valueLength);
 
         if (valueOffset < 0 ||
-            ((long)valueOffset) + valueLengthLong > byteSource.getLength()) {
+            valueOffset + valueLengthLong > byteSource.getLength()) {
             throw new TiffValueOutsideFileBoundsException(
                 "Attempt to read byte range starting from " + valueOffset + " " +
                 "of length " + valueLength + " " +

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageParser.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageParser.java?rev=1308079&r1=1308078&r2=1308079&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageParser.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffImageParser.java
Sun Apr  1 11:28:24 2012
@@ -440,8 +440,7 @@ public class TiffImageParser extends Ima
             List<ImageDataElement> dataElements = directory.getTiffRawImageDataElements();
             for (int j = 0; j < dataElements.size(); j++)
             {
-                TiffDirectory.ImageDataElement element = (TiffDirectory.ImageDataElement)
dataElements
-                        .get(j);
+                TiffDirectory.ImageDataElement element = dataElements.get(j);
                 byte bytes[] = byteSource.getBlock(element.offset,
                         element.length);
                 result.add(bytes);

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffImageWriterLossless.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffImageWriterLossless.java?rev=1308079&r1=1308078&r2=1308079&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffImageWriterLossless.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffImageWriterLossless.java
Sun Apr  1 11:28:24 2012
@@ -188,7 +188,7 @@ public class TiffImageWriterLossless ext
                 int index = -1;
                 for (int i = 0; i < elements.size(); i++)
                 {
-                    TiffElement element = (TiffElement) elements.get(i);
+                    TiffElement element = elements.get(i);
                     int lastElementByte = element.offset + element.length;
                     if (start == null)
                     {
@@ -232,7 +232,7 @@ public class TiffImageWriterLossless ext
             throw new ImageWriteException("Couldn't analyze old tiff data.");
         else if (analysis.size() == 1)
         {
-            TiffElement onlyElement = (TiffElement) analysis.get(0);
+            TiffElement onlyElement = analysis.get(0);
             //            Debug.debug("onlyElement", onlyElement.getElementDescription());
             if (onlyElement.offset == TIFF_HEADER_SIZE
                     && onlyElement.offset + onlyElement.length
@@ -292,7 +292,7 @@ public class TiffImageWriterLossless ext
         // any items that represent a gap at the end of the exif segment, can be discarded.
         while (unusedElements.size() > 0)
         {
-            TiffElement element = (TiffElement) unusedElements.get(0);
+            TiffElement element = unusedElements.get(0);
             int elementEnd = element.offset + element.length;
             if (elementEnd == overflowIndex)
             {
@@ -318,8 +318,7 @@ public class TiffImageWriterLossless ext
         while (unplacedItems.size() > 0)
         {
             // pop off largest unplaced item.
-            TiffOutputItem outputItem = (TiffOutputItem) unplacedItems
-                    .remove(0);
+            TiffOutputItem outputItem = unplacedItems.remove(0);
             int outputItemLength = outputItem.getItemLength();
             //            Debug.debug("largest unplaced item: "
             //                    + outputItem.getItemDescription() + " (" + outputItemLength
@@ -329,7 +328,7 @@ public class TiffImageWriterLossless ext
             TiffElement bestFit = null;
             for (int i = 0; i < unusedElements.size(); i++)
             {
-                TiffElement element = (TiffElement) unusedElements.get(i);
+                TiffElement element = unusedElements.get(i);
                 if (element.length >= outputItemLength)
                     bestFit = element;
                 else
@@ -434,7 +433,7 @@ public class TiffImageWriterLossless ext
         // zero out the parsed pieces of old exif segment, in case we don't overwrite them.
         for (int i = 0; i < analysis.size(); i++)
         {
-            TiffElement element = (TiffElement) analysis.get(i);
+            TiffElement element = analysis.get(i);
             for (int j = 0; j < element.length; j++)
             {
                 int index = element.offset + j;
@@ -446,7 +445,7 @@ public class TiffImageWriterLossless ext
         // write in the new items
         for (int i = 0; i < outputItems.size(); i++)
         {
-            TiffOutputItem outputItem = (TiffOutputItem) outputItems.get(i);
+            TiffOutputItem outputItem = outputItems.get(i);
 
             BufferOutputStream tos = new BufferOutputStream(output, outputItem
                     .getOffset());

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputDirectory.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputDirectory.java?rev=1308079&r1=1308078&r2=1308079&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputDirectory.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputDirectory.java
Sun Apr  1 11:28:24 2012
@@ -373,7 +373,7 @@ public final class TiffOutputDirectory e
         List<TiffOutputField> matches = new ArrayList<TiffOutputField>();
         for (int i = 0; i < fields.size(); i++)
         {
-            TiffOutputField field = (TiffOutputField) fields.get(i);
+            TiffOutputField field = fields.get(i);
             if (field.tag == tag)
                 matches.add(field);
         }
@@ -389,7 +389,7 @@ public final class TiffOutputDirectory e
     {
         for (int i = 0; i < fields.size(); i++)
         {
-            TiffOutputField field = (TiffOutputField) fields.get(i);
+            TiffOutputField field = fields.get(i);
             if (field.tag == tag)
                 return field;
         }
@@ -424,7 +424,7 @@ public final class TiffOutputDirectory e
         // Write Fields
         for (int i = 0; i < fields.size(); i++)
         {
-            TiffOutputField field = (TiffOutputField) fields.get(i);
+            TiffOutputField field = fields.get(i);
             field.writeField(bos);
 
 //             Debug.debug("\t" + "writing field (" + field.tag + ", 0x" +

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputSet.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputSet.java?rev=1308079&r1=1308078&r2=1308079&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputSet.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/write/TiffOutputSet.java
Sun Apr  1 11:28:24 2012
@@ -299,7 +299,7 @@ public final class TiffOutputSet impleme
             List<TiffOutputField> fields = directory.getFields();
             for (int j = 0; j < fields.size(); j++)
             {
-                TiffOutputField field = (TiffOutputField) fields.get(j);
+                TiffOutputField field = fields.get(j);
                 result.append(prefix);
                 result.append("\t\t" + "field " + i + ": " + field.tagInfo);
                 result.append(newline);

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/jpeg/decoder/DctTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/jpeg/decoder/DctTest.java?rev=1308079&r1=1308078&r2=1308079&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/jpeg/decoder/DctTest.java
(original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/commons/sanselan/formats/jpeg/decoder/DctTest.java
Sun Apr  1 11:28:24 2012
@@ -36,7 +36,7 @@ public class DctTest extends TestCase
             assertEquals("Reference transforms broken, at x=" + i, originalData[i], reversed[i],
0.001);
         }
 
-        float[] data = (float[]) originalData.clone();
+        float[] data = originalData.clone();
         Dct.forwardDCT8(data);
         Dct.scaleQuantizationVector(data);
         for (int i = 0; i < 8; i++)
@@ -76,7 +76,7 @@ public class DctTest extends TestCase
             }
         }
 
-        float[] data = (float[]) originalData.clone();
+        float[] data = originalData.clone();
         Dct.forwardDCT8x8(data);
         Dct.scaleQuantizationMatrix(data);
         for (int y = 0; y < 8; y++)



Mime
View raw message