pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1760107 - in /pdfbox/branches/2.0: fontbox/src/main/java/org/apache/fontbox/cff/ fontbox/src/main/java/org/apache/fontbox/ttf/ pdfbox/src/main/java/org/apache/pdfbox/pdfparser/ pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/
Date Fri, 09 Sep 2016 19:50:23 GMT
Author: tilman
Date: Fri Sep  9 19:50:23 2016
New Revision: 1760107

URL: http://svn.apache.org/viewvc?rev=1760107&view=rev
Log:
PDFBOX-2852: user foreach loop, as suggested by Simon Steiner

Modified:
    pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java
    pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/cff/Type1FontUtil.java
    pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyfCompositeDescript.java
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFXRefStream.java
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java

Modified: pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java?rev=1760107&r1=1760106&r2=1760107&view=diff
==============================================================================
--- pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java (original)
+++ pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/cff/CFFParser.java Fri Sep
 9 19:50:23 2016
@@ -545,9 +545,8 @@ public class CFFParser
         List<Map<String, Object>> privateDictionaries = new LinkedList<Map<String,
Object>>();
         List<Map<String, Object>> fontDictionaries = new LinkedList<Map<String,
Object>>();
 
-        for (int i = 0; i < fdIndex.length; ++i)
+        for (byte[] bytes : fdIndex)
         {
-            byte[] bytes = fdIndex[i];
             CFFDataInput fontDictInput = new CFFDataInput(bytes);
             DictData fontDict = readDictData(fontDictInput);
 

Modified: pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/cff/Type1FontUtil.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/cff/Type1FontUtil.java?rev=1760107&r1=1760106&r2=1760107&view=diff
==============================================================================
--- pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/cff/Type1FontUtil.java (original)
+++ pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/cff/Type1FontUtil.java Fri
Sep  9 19:50:23 2016
@@ -36,9 +36,9 @@ public final class Type1FontUtil
     public static String hexEncode(byte[] bytes)
     {
         StringBuilder sb = new StringBuilder();
-        for (int i = 0; i < bytes.length; i++)
+        for (byte aByte : bytes)
         {
-            String string = Integer.toHexString(bytes[i] & 0xff);
+            String string = Integer.toHexString(aByte & 0xff);
             if (string.length() == 1)
             {
                 sb.append("0");

Modified: pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyfCompositeDescript.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyfCompositeDescript.java?rev=1760107&r1=1760106&r2=1760107&view=diff
==============================================================================
--- pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyfCompositeDescript.java
(original)
+++ pdfbox/branches/2.0/fontbox/src/main/java/org/apache/fontbox/ttf/GlyfCompositeDescript.java
Fri Sep  9 19:50:23 2016
@@ -101,10 +101,8 @@ public class GlyfCompositeDescript exten
         int firstIndex = 0;
         int firstContour = 0;
 
-        Iterator<GlyfCompositeComp> i = components.iterator();
-        while (i.hasNext())
+        for (GlyfCompositeComp comp : components)
         {
-            GlyfCompositeComp comp = i.next();
             comp.setFirstIndex(firstIndex);
             comp.setFirstContour(firstContour);
 

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFXRefStream.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFXRefStream.java?rev=1760107&r1=1760106&r2=1760107&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFXRefStream.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFXRefStream.java
Fri Sep  9 19:50:23 2016
@@ -89,9 +89,8 @@ public class PDFXRefStream implements PD
 
         int[] wEntry = getWEntry();
         COSArray wAsArray = new COSArray();
-        for ( int i = 0; i < wEntry.length; i++ )
+        for (int j : wEntry)
         {
-            int j = wEntry[i];
             wAsArray.add(COSInteger.get(j));
         }
         stream.setItem(COSName.W, wAsArray);

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java?rev=1760107&r1=1760106&r2=1760107&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfwriter/COSWriter.java Fri
Sep  9 19:50:23 2016
@@ -1379,10 +1379,9 @@ public class COSWriter implements ICOSVi
             COSDictionary info = (COSDictionary)trailer.getDictionaryObject( COSName.INFO
);
             if( info != null )
             {
-                Iterator<COSBase> values = info.getValues().iterator();
-                while( values.hasNext() )
+                for (COSBase cosBase : info.getValues())
                 {
-                    md5.update(values.next().toString().getBytes(Charsets.ISO_8859_1));
+                    md5.update(cosBase.toString().getBytes(Charsets.ISO_8859_1));
                 }
             }
             // reuse origin documentID if available as first value



Mime
View raw message