freetype-commit
[Top][All Lists]
Advanced

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

[freetype2-demos] master 0c3aa8c: [ftdump] Fix clang compiler warnings.


From: Werner LEMBERG
Subject: [freetype2-demos] master 0c3aa8c: [ftdump] Fix clang compiler warnings.
Date: Fri, 19 Aug 2016 12:08:48 +0000 (UTC)

branch: master
commit 0c3aa8cb2d40ea07baca5cb48748b16de7ed10d0
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [ftdump] Fix clang compiler warnings.
    
    * src/ftdump.c (Print_Bytecode): Use cast instead of printf length
    modifier – we would need `hh', which only glibc offers.
    (Print_Programs): Use proper casts for constant strings and 16bit
    integer types.
---
 ChangeLog    |    9 +++++++++
 src/ftdump.c |   20 ++++++++++----------
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e796136..1be2b11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2018-08-19  Werner Lemberg  <address@hidden>
 
+       [ftdump] Fix clang compiler warnings.
+
+       * src/ftdump.c (Print_Bytecode): Use cast instead of printf length
+       modifier – we would need `hh', which only glibc offers.
+       (Print_Programs): Use proper casts for constant strings and 16bit
+       integer types.
+
+2018-08-19  Werner Lemberg  <address@hidden>
+
        [ftgamma] Fix compiler warnings.
 
        * src/ftgamma.c (bit1, bit2, bit): Make them static.
diff --git a/src/ftdump.c b/src/ftdump.c
index 7394ac6..4c93c94 100644
--- a/src/ftdump.c
+++ b/src/ftdump.c
@@ -541,7 +541,7 @@
 
       if ( j == 0 )
       {
-        printf( " %02hx", buffer[i] );
+        printf( " %02x", (FT_UInt)buffer[i] );
 
         if ( buffer[i] == 0x40 )
           j = -1;
@@ -554,7 +554,7 @@
       }
       else
       {
-        printf( "_%02hx", buffer[i] );
+        printf( "_%02x", (FT_UInt)buffer[i] );
 
         if ( j == -1 )
           j = buffer[i];
@@ -593,7 +593,7 @@
       goto Exit;
 
     printf( "font program" );
-    Print_Bytecode( buffer, (FT_UShort)length, "fpgm" );
+    Print_Bytecode( buffer, (FT_UShort)length, (char*)"fpgm" );
 
   Prep:
     length = 0;
@@ -611,7 +611,7 @@
       goto Exit;
 
     printf( "\ncontrol value program" );
-    Print_Bytecode( buffer, (FT_UShort)length, "prep" );
+    Print_Bytecode( buffer, (FT_UShort)length, (char*)"prep" );
 
   Glyf:
     length = 0;
@@ -661,8 +661,8 @@
         loc = (FT_UInt32)offset[2 * i    ] << 9 |
               (FT_UInt32)offset[2 * i + 1] << 1;
 
-      len = (FT_UInt16)buffer[loc    ] << 8 |
-            (FT_UInt16)buffer[loc + 1];
+      len = (FT_UInt16)( (FT_UInt16)buffer[loc    ] << 8 |
+                         (FT_UInt16)buffer[loc + 1]      );
 
       loc += 10;
 
@@ -673,8 +673,8 @@
 
         do
         {
-          flags = (FT_UInt16)buffer[loc    ] << 8 |
-                  (FT_UInt16)buffer[loc + 1];
+          flags = (FT_UInt16)( (FT_UInt16)buffer[loc    ] << 8 |
+                               (FT_UInt16)buffer[loc + 1]      );
 
           loc += 4;
 
@@ -691,8 +691,8 @@
       else
         loc += 2 * len;
 
-      len = (FT_UInt16)buffer[loc    ] << 8 |
-            (FT_UInt16)buffer[loc + 1];
+      len = (FT_UInt16)( (FT_UInt16)buffer[loc    ] << 8 |
+                         (FT_UInt16)buffer[loc + 1]      );
 
       if ( len == 0 )
         continue;



reply via email to

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