pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1851031 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
Date Fri, 11 Jan 2019 12:36:10 GMT
Author: tilman
Date: Fri Jan 11 12:36:09 2019
New Revision: 1851031

URL: http://svn.apache.org/viewvc?rev=1851031&view=rev
Log:
PDFBOX-4071: minor code cleanup

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java?rev=1851031&r1=1851030&r2=1851031&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java Fri Jan 11
12:36:09 2019
@@ -1609,8 +1609,6 @@ public class COSParser extends BaseParse
     private long bfSearchForXRef(long xrefOffset) throws IOException
     {
         long newOffset = -1;
-        long newOffsetTable;
-        long newOffsetStream;
 
         // initialize bfSearchXRefTablesOffsets -> not null
         bfSearchForXRefTables();
@@ -1618,10 +1616,10 @@ public class COSParser extends BaseParse
         bfSearchForXRefStreams();
 
         // TODO to be optimized, this won't work in every case
-        newOffsetTable = searchNearestValue(bfSearchXRefTablesOffsets, xrefOffset);
+        long newOffsetTable = searchNearestValue(bfSearchXRefTablesOffsets, xrefOffset);
         
         // TODO to be optimized, this won't work in every case
-        newOffsetStream = searchNearestValue(bfSearchXRefStreamsOffsets, xrefOffset);
+        long newOffsetStream = searchNearestValue(bfSearchXRefStreamsOffsets, xrefOffset);
 
         // choose the nearest value
         if (newOffsetTable > -1 && newOffsetStream > -1)
@@ -1873,7 +1871,6 @@ public class COSParser extends BaseParse
                 long currentPosition = source.getPosition();
                 // search backwards for the beginning of the object
                 long newOffset = -1;
-                COSObjectKey streamObjectKey = null;
                 boolean objFound = false;
                 for (int i = 1; i < 40 && !objFound; i++)
                 {
@@ -1908,7 +1905,7 @@ public class COSParser extends BaseParse
                                             newOffset = source.getPosition();
                                             long objNumber = readObjectNumber();
                                             int genNumber = readGenerationNumber();
-                                            streamObjectKey = new COSObjectKey(objNumber,
+                                            COSObjectKey streamObjectKey = new COSObjectKey(objNumber,
                                                     genNumber);
                                             bfSearchObjStreamsOffsets.put(newOffset,
                                                     streamObjectKey);
@@ -2228,7 +2225,7 @@ public class COSParser extends BaseParse
 
     private COSDictionary retrieveCOSDictionary(COSObject object) throws IOException
     {
-        COSObjectKey key = new COSObjectKey((COSObject) object);
+        COSObjectKey key = new COSObjectKey(object);
         Long offset = bfSearchCOSObjectKeyOffsets.get(key);
         if (offset != null)
         {
@@ -2668,7 +2665,7 @@ public class COSParser extends BaseParse
                 return false;
             }
             // first obj id
-            long currObjID = 0;
+            long currObjID;
             try
             {
                 currObjID = Long.parseLong(splitString[0]);



Mime
View raw message