freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master f53bab9: [cff] Fix usage of `|' operator.


From: Werner LEMBERG
Subject: [freetype2] master f53bab9: [cff] Fix usage of `|' operator.
Date: Sun, 10 Jan 2016 11:04:29 +0000

branch: master
commit f53bab9381a5e2ea4e90fa78c60bad6d732283b5
Author: Jered Gray <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [cff] Fix usage of `|' operator.
    
    * src/cff/cf2intrp.c (cf2_interpT2CharString) [cf2_cmdEXTENDEDNMBR,
    default]: `|' is not guaranteed to be processed from left to right
    by the compiler.  However, the code repeatedly calls
    `cf2_buf_readByte' to get the arguments to `|' ...  Fix this.
---
 ChangeLog          |    9 +++++++++
 src/cff/cf2intrp.c |   21 ++++++++++++++-------
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7b51780..158c5c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-01-10  Jered Gray  <address@hidden>
+
+       [cff] Fix usage of `|' operator.
+
+       * src/cff/cf2intrp.c (cf2_interpT2CharString) [cf2_cmdEXTENDEDNMBR,
+       default]: `|' is not guaranteed to be processed from left to right
+       by the compiler.  However, the code repeatedly calls
+       `cf2_buf_readByte' to get the arguments to `|' ...  Fix this.
+
 2015-12-25  Werner Lemberg  <address@hidden>
 
        [autofit] Make top-to-bottom hinting work in latin auto-hinter.
diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c
index 1910f1b..eb99208 100644
--- a/src/cff/cf2intrp.c
+++ b/src/cff/cf2intrp.c
@@ -1463,9 +1463,12 @@
         {
           CF2_Int  v;
 
+          CF2_Int  byte1 = cf2_buf_readByte( charstring );
+          CF2_Int  byte2 = cf2_buf_readByte( charstring );
 
-          v = (FT_Short)( ( cf2_buf_readByte( charstring ) << 8 ) |
-                            cf2_buf_readByte( charstring )        );
+
+          v = (FT_Short)( ( byte1 << 8 ) |
+                            byte2        );
 
           FT_TRACE4(( " %d", v ));
 
@@ -1527,12 +1530,16 @@
           {
             CF2_Fixed  v;
 
+            FT_UInt32  byte1 = (FT_UInt32)cf2_buf_readByte( charstring );
+            FT_UInt32  byte2 = (FT_UInt32)cf2_buf_readByte( charstring );
+            FT_UInt32  byte3 = (FT_UInt32)cf2_buf_readByte( charstring );
+            FT_UInt32  byte4 = (FT_UInt32)cf2_buf_readByte( charstring );
+
 
-            v = (CF2_Fixed)
-                  ( ( (FT_UInt32)cf2_buf_readByte( charstring ) << 24 ) |
-                    ( (FT_UInt32)cf2_buf_readByte( charstring ) << 16 ) |
-                    ( (FT_UInt32)cf2_buf_readByte( charstring ) <<  8 ) |
-                      (FT_UInt32)cf2_buf_readByte( charstring )         );
+            v = (CF2_Fixed)( ( byte1 << 24 ) |
+                             ( byte2 << 16 ) |
+                             ( byte3 <<  8 ) |
+                               byte4         );
 
             FT_TRACE4(( " %.2f", v / 65536.0 ));
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]