You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ms...@apache.org on 2018/03/20 14:45:39 UTC

svn commit: r1827316 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java

Author: msahyoun
Date: Tue Mar 20 14:45:39 2018
New Revision: 1827316

URL: http://svn.apache.org/viewvc?rev=1827316&view=rev
Log:
PDFBOX-4071: fix Sonar warnings; move annotation to method declaration level

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java?rev=1827316&r1=1827315&r2=1827316&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java Tue Mar 20 14:45:39 2018
@@ -59,16 +59,17 @@ public class GlyphSubstitutionTable exte
     }
 
     @Override
+    @SuppressWarnings({"squid:S1854"})
     void read(TrueTypeFont ttf, TTFDataStream data) throws IOException
     {
         long start = data.getCurrentPosition();
-        @SuppressWarnings({"unused", "squid:S1854"})
+        @SuppressWarnings({"unused"})
         int majorVersion = data.readUnsignedShort();
         int minorVersion = data.readUnsignedShort();
         int scriptListOffset = data.readUnsignedShort();
         int featureListOffset = data.readUnsignedShort();
         int lookupListOffset = data.readUnsignedShort();
-        @SuppressWarnings({"unused", "squid:S1854"})
+        @SuppressWarnings({"unused"})
         long featureVariationsOffset = -1L;
         if (minorVersion == 1L)
         {
@@ -453,6 +454,7 @@ public class GlyphSubstitutionTable exte
 
     private int applyFeature(FeatureRecord featureRecord, int gid)
     {
+        int lookupResult = gid;
         for (int lookupListIndex : featureRecord.featureTable.lookupListIndices)
         {
             LookupTable lookupTable = lookupList[lookupListIndex];
@@ -462,9 +464,9 @@ public class GlyphSubstitutionTable exte
                         + "' because it requires unsupported lookup table type " + lookupTable.lookupType);
                 continue;
             }
-            gid = doLookup(lookupTable, gid);
+            lookupResult = doLookup(lookupTable, gid);
         }
-        return gid;
+        return lookupResult;
     }
 
     private int doLookup(LookupTable lookupTable, int gid)



Re: svn commit: r1827316 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
thanks for the review - commited in r1827338 - simply forgot to replace the parameter with the new one :-(
 
> Am 20.03.2018 um 17:46 schrieb Andreas Lehmkuehler <an...@lehmi.de>:
> 
> On 03/20/2018 05:23 PM, Tilman Hausherr wrote:
>> Am 20.03.2018 um 15:45 schrieb msahyoun@apache.org:
>>> -            gid = doLookup(lookupTable, gid);
>>> +            lookupResult = doLookup(lookupTable, gid);
>> I think that this changes the meaning. Because now gid is the original parameter, before the change gid was the current variable due to overwriting.
> I guess all occurences of gid have to be replaced, like the following:
> 
> lookupResult = doLookup(lookupTable, lookupResult);
> 
> 
> Andreas
>> Tilman
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: dev-help@pdfbox.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: dev-help@pdfbox.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Re: svn commit: r1827316 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java

Posted by Andreas Lehmkuehler <an...@lehmi.de>.
On 03/20/2018 05:23 PM, Tilman Hausherr wrote:
> Am 20.03.2018 um 15:45 schrieb msahyoun@apache.org:
>> -            gid = doLookup(lookupTable, gid);
>> +            lookupResult = doLookup(lookupTable, gid);
> 
> 
> I think that this changes the meaning. Because now gid is the original 
> parameter, before the change gid was the current variable due to overwriting.
I guess all occurences of gid have to be replaced, like the following:

lookupResult = doLookup(lookupTable, lookupResult);


Andreas
> 
> Tilman
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: dev-help@pdfbox.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Re: svn commit: r1827316 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/GlyphSubstitutionTable.java

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 20.03.2018 um 15:45 schrieb msahyoun@apache.org:
> -            gid = doLookup(lookupTable, gid);
> +            lookupResult = doLookup(lookupTable, gid);


I think that this changes the meaning. Because now gid is the original 
parameter, before the change gid was the current variable due to 
overwriting.

Tilman



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org