Fix `-Wformat' compiler warnings.

* src/*: Fix format specifiers.

* builds/unix/ftsystem.c (FT_Stream_Open): Ditto.
diff --git a/ChangeLog b/ChangeLog
index 677c0b0..899d54c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-07-28  Priyesh Kumar  <priyeshkkumar@gmail.com>
+
+	Fix `-Wformat' compiler warnings.
+
+	* src/*: Fix format specifiers.
+
+	* builds/unix/ftsystem.c (FT_Stream_Open): Ditto.
+
 2020-07-25  Werner Lemberg  <wl@gnu.org>
 
 	Fix `-Wformat' compiler warnings.
diff --git a/builds/unix/ftsystem.c b/builds/unix/ftsystem.c
index dc11dd1..8437a66 100644
--- a/builds/unix/ftsystem.c
+++ b/builds/unix/ftsystem.c
@@ -351,7 +351,7 @@
     stream->read = 0;
 
     FT_TRACE1(( "FT_Stream_Open:" ));
-    FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
+    FT_TRACE1(( " opened `%s' (%ld bytes) successfully\n",
                 filepathname, stream->size ));
 
     return FT_Err_Ok;
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index ed7a065..3b340cd 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -157,7 +157,7 @@
       if ( !glyph_index )
         goto Exit;
 
-      FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n",
+      FT_TRACE5(( "standard character: U+%04lX (glyph index %ld)\n",
                   ch, glyph_index ));
 
       error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
@@ -260,9 +260,9 @@
                       dim == AF_DIMENSION_VERT ? "horizontal"
                                                : "vertical" ));
 
-          FT_TRACE5(( "  %d (standard)", axis->standard_width ));
+          FT_TRACE5(( "  %ld (standard)", axis->standard_width ));
           for ( i = 1; i < axis->width_count; i++ )
-            FT_TRACE5(( " %d", axis->widths[i].org ));
+            FT_TRACE5(( " %ld", axis->widths[i].org ));
 
           FT_TRACE5(( "\n" ));
         }
@@ -727,7 +727,7 @@
 
         delta2 = FT_MulFix( delta2, scale );
 
-        FT_TRACE5(( "delta: %d", delta1 ));
+        FT_TRACE5(( "delta: %ld", delta1 ));
         if ( delta2 < 32 )
           delta2 = 0;
 #if 0
@@ -736,7 +736,7 @@
 #endif
         else
           delta2 = FT_PIX_ROUND( delta2 );
-        FT_TRACE5(( "/%d\n", delta2 ));
+        FT_TRACE5(( "/%ld\n", delta2 ));
 
         if ( delta1 < 0 )
           delta2 = -delta2;
@@ -1643,7 +1643,7 @@
 
     stem_edge->pos = base_edge->pos + fitted_width;
 
-    FT_TRACE5(( "  CJKLINK: edge %d @%d (opos=%.2f) linked to %.2f,"
+    FT_TRACE5(( "  CJKLINK: edge %ld @%d (opos=%.2f) linked to %.2f,"
                 " dist was %.2f, now %.2f\n",
                 stem_edge - hints->axis[dim].edges, stem_edge->fpos,
                 stem_edge->opos / 64.0, stem_edge->pos / 64.0,
@@ -1865,7 +1865,7 @@
           continue;
 
 #ifdef FT_DEBUG_LEVEL_TRACE
-        FT_TRACE5(( "  CJKBLUE: edge %d @%d (opos=%.2f) snapped to %.2f,"
+        FT_TRACE5(( "  CJKBLUE: edge %ld @%d (opos=%.2f) snapped to %.2f,"
                     " was %.2f\n",
                     edge1 - edges, edge1->fpos, edge1->opos / 64.0,
                     blue->fit / 64.0, edge1->pos / 64.0 ));
@@ -1929,7 +1929,7 @@
       /* this should not happen, but it's better to be safe */
       if ( edge2->blue_edge )
       {
-        FT_TRACE5(( "ASSERTION FAILED for edge %d\n", edge2-edges ));
+        FT_TRACE5(( "ASSERTION FAILED for edge %ld\n", edge2-edges ));
 
         af_cjk_align_linked_edge( hints, dim, edge2, edge );
         edge->flags |= AF_EDGE_DONE;
diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c
index 66aa2f1..d512942 100644
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -306,7 +306,7 @@
           if ( !( count % 10 ) )
             FT_TRACE4(( " " ));
 
-          FT_TRACE4(( " %d", idx ));
+          FT_TRACE4(( " %ld", idx ));
           count++;
 
           if ( !( count % 10 ) )
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 6e9f28c..21ec02e 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -154,7 +154,7 @@
         goto Exit;
       }
 
-      FT_TRACE5(( "standard character: U+%04lX (glyph index %d)\n",
+      FT_TRACE5(( "standard character: U+%04lX (glyph index %ld)\n",
                   ch, glyph_index ));
 
       error = FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE );
@@ -257,9 +257,9 @@
                       dim == AF_DIMENSION_VERT ? "horizontal"
                                                : "vertical" ));
 
-          FT_TRACE5(( "  %d (standard)", axis->standard_width ));
+          FT_TRACE5(( "  %ld (standard)", axis->standard_width ));
           for ( i = 1; i < axis->width_count; i++ )
-            FT_TRACE5(( " %d", axis->widths[i].org ));
+            FT_TRACE5(( " %ld", axis->widths[i].org ));
 
           FT_TRACE5(( "\n" ));
         }
@@ -1031,7 +1031,7 @@
         {
           *a = *b;
           FT_TRACE5(( "blue zone overlap:"
-                      " adjusting %s %d to %ld\n",
+                      " adjusting %s %ld to %ld\n",
                       a_is_top ? "overshoot" : "reference",
                       blue_sorted[i] - axis->blues,
                       *a ));
@@ -1279,7 +1279,7 @@
                 "af_latin_metrics_scale_dim:"
                 " x height alignment (style `%s'):\n"
                 "                           "
-                " vertical scaling changed from %.5f to %.5f (by %d%%)\n"
+                " vertical scaling changed from %.5f to %.5f (by %ld%%)\n"
                 "\n",
                 af_style_names[metrics->root.style_class->style],
                 scale / 65536.0,
@@ -1332,7 +1332,7 @@
       width->cur = FT_MulFix( width->org, scale );
       width->fit = width->cur;
 
-      FT_TRACE5(( "  %d scaled to %.2f\n",
+      FT_TRACE5(( "  %ld scaled to %.2f\n",
                   width->org,
                   width->cur / 64.0 ));
     }
@@ -1473,8 +1473,8 @@
         AF_LatinBlue  blue = &axis->blues[nn];
 
 
-        FT_TRACE5(( "  reference %d: %d scaled to %.2f%s\n"
-                    "  overshoot %d: %d scaled to %.2f%s\n",
+        FT_TRACE5(( "  reference %d: %ld scaled to %.2f%s\n"
+                    "  overshoot %d: %ld scaled to %.2f%s\n",
                     nn,
                     blue->ref.org,
                     blue->ref.fit / 64.0,
@@ -2944,7 +2944,7 @@
 
     stem_edge->pos = base_edge->pos + fitted_width;
 
-    FT_TRACE5(( "  LINK: edge %d (opos=%.2f) linked to %.2f,"
+    FT_TRACE5(( "  LINK: edge %ld (opos=%.2f) linked to %.2f,"
                 " dist was %.2f, now %.2f\n",
                 stem_edge - hints->axis[dim].edges, stem_edge->opos / 64.0,
                 stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 ));
@@ -3068,12 +3068,12 @@
 
 #ifdef FT_DEBUG_LEVEL_TRACE
         if ( !anchor )
-          FT_TRACE5(( "  BLUE_ANCHOR: edge %d (opos=%.2f) snapped to %.2f,"
-                      " was %.2f (anchor=edge %d)\n",
+          FT_TRACE5(( "  BLUE_ANCHOR: edge %ld (opos=%.2f) snapped to %.2f,"
+                      " was %.2f (anchor=edge %ld)\n",
                       edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0,
                       edge1->pos / 64.0, edge - edges ));
         else
-          FT_TRACE5(( "  BLUE: edge %d (opos=%.2f) snapped to %.2f,"
+          FT_TRACE5(( "  BLUE: edge %ld (opos=%.2f) snapped to %.2f,"
                       " was %.2f\n",
                       edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0,
                       edge1->pos / 64.0 ));
@@ -3122,7 +3122,7 @@
       /* this should not happen, but it's better to be safe */
       if ( edge2->blue_edge )
       {
-        FT_TRACE5(( "  ASSERTION FAILED for edge %d\n", edge2 - edges ));
+        FT_TRACE5(( "  ASSERTION FAILED for edge %ld\n", edge2 - edges ));
 
         af_latin_align_linked_edge( hints, dim, edge2, edge );
         edge->flags |= AF_EDGE_DONE;
@@ -3190,7 +3190,7 @@
         anchor       = edge;
         edge->flags |= AF_EDGE_DONE;
 
-        FT_TRACE5(( "  ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f)"
+        FT_TRACE5(( "  ANCHOR: edge %ld (opos=%.2f) and %ld (opos=%.2f)"
                     " snapped to %.2f and %.2f\n",
                     edge - edges, edge->opos / 64.0,
                     edge2 - edges, edge2->opos / 64.0,
@@ -3219,7 +3219,7 @@
 
         if ( edge2->flags & AF_EDGE_DONE )
         {
-          FT_TRACE5(( "  ADJUST: edge %d (pos=%.2f) moved to %.2f\n",
+          FT_TRACE5(( "  ADJUST: edge %ld (pos=%.2f) moved to %.2f\n",
                       edge - edges, edge->pos / 64.0,
                       ( edge2->pos - cur_len ) / 64.0 ));
 
@@ -3260,7 +3260,7 @@
           edge->pos  = cur_pos1 - cur_len / 2;
           edge2->pos = cur_pos1 + cur_len / 2;
 
-          FT_TRACE5(( "  STEM: edge %d (opos=%.2f) linked to %d (opos=%.2f)"
+          FT_TRACE5(( "  STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
                       " snapped to %.2f and %.2f\n",
                       edge - edges, edge->opos / 64.0,
                       edge2 - edges, edge2->opos / 64.0,
@@ -3291,7 +3291,7 @@
           edge->pos  = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2;
           edge2->pos = edge->pos + cur_len;
 
-          FT_TRACE5(( "  STEM: edge %d (opos=%.2f) linked to %d (opos=%.2f)"
+          FT_TRACE5(( "  STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
                       " snapped to %.2f and %.2f\n",
                       edge - edges, edge->opos / 64.0,
                       edge2 - edges, edge2->opos / 64.0,
@@ -3314,7 +3314,7 @@
           if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
           {
 #ifdef FT_DEBUG_LEVEL_TRACE
-            FT_TRACE5(( "  BOUND: edge %d (pos=%.2f) moved to %.2f\n",
+            FT_TRACE5(( "  BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
                         edge - edges,
                         edge->pos / 64.0,
                         edge[-1].pos / 64.0 ));
@@ -3416,7 +3416,7 @@
         if ( delta < 64 + 16 )
         {
           af_latin_align_serif_edge( hints, edge->serif, edge );
-          FT_TRACE5(( "  SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f)"
+          FT_TRACE5(( "  SERIF: edge %ld (opos=%.2f) serif to %ld (opos=%.2f)"
                       " aligned to %.2f\n",
                       edge - edges, edge->opos / 64.0,
                       edge->serif - edges, edge->serif->opos / 64.0,
@@ -3426,7 +3426,7 @@
         {
           edge->pos = FT_PIX_ROUND( edge->opos );
           anchor    = edge;
-          FT_TRACE5(( "  SERIF_ANCHOR: edge %d (opos=%.2f)"
+          FT_TRACE5(( "  SERIF_ANCHOR: edge %ld (opos=%.2f)"
                       " snapped to %.2f\n",
                       edge-edges, edge->opos / 64.0, edge->pos / 64.0 ));
         }
@@ -3454,8 +3454,8 @@
                                      after->pos - before->pos,
                                      after->opos - before->opos );
 
-            FT_TRACE5(( "  SERIF_LINK1: edge %d (opos=%.2f) snapped to %.2f"
-                        " from %d (opos=%.2f)\n",
+            FT_TRACE5(( "  SERIF_LINK1: edge %ld (opos=%.2f) snapped to %.2f"
+                        " from %ld (opos=%.2f)\n",
                         edge - edges, edge->opos / 64.0,
                         edge->pos / 64.0,
                         before - edges, before->opos / 64.0 ));
@@ -3464,7 +3464,7 @@
           {
             edge->pos = anchor->pos +
                         ( ( edge->opos - anchor->opos + 16 ) & ~31 );
-            FT_TRACE5(( "  SERIF_LINK2: edge %d (opos=%.2f)"
+            FT_TRACE5(( "  SERIF_LINK2: edge %ld (opos=%.2f)"
                         " snapped to %.2f\n",
                         edge - edges, edge->opos / 64.0, edge->pos / 64.0 ));
           }
@@ -3484,7 +3484,7 @@
           if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
           {
 #ifdef FT_DEBUG_LEVEL_TRACE
-            FT_TRACE5(( "  BOUND: edge %d (pos=%.2f) moved to %.2f\n",
+            FT_TRACE5(( "  BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
                         edge - edges,
                         edge->pos / 64.0,
                         edge[-1].pos / 64.0 ));
@@ -3505,7 +3505,7 @@
           if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
           {
 #ifdef FT_DEBUG_LEVEL_TRACE
-            FT_TRACE5(( "  BOUND: edge %d (pos=%.2f) moved to %.2f\n",
+            FT_TRACE5(( "  BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
                         edge - edges,
                         edge->pos / 64.0,
                         edge[1].pos / 64.0 ));
diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c
index f52b2b2..e164944 100644
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -149,7 +149,7 @@
       if ( !af_style_classes[ss] )
       {
         FT_TRACE0(( "af_property_set: Invalid value %d for property `%s'\n",
-                    fallback_script, property_name ));
+                    *fallback_script, property_name ));
         return FT_THROW( Invalid_Argument );
       }
 
diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c
index d109ee4..584213d 100644
--- a/src/base/ftbitmap.c
+++ b/src/base/ftbitmap.c
@@ -908,13 +908,13 @@
 
 #ifdef FT_DEBUG_LEVEL_TRACE
     FT_TRACE5(( "FT_Bitmap_Blend:\n"
-                "  source bitmap: (%d, %d) -- (%d, %d); %d x %d\n",
+                "  source bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n",
       source_llx / 64, source_lly / 64,
       source_urx / 64, source_ury / 64,
       source_->width, source_->rows ));
 
     if ( target->width && target->rows )
-      FT_TRACE5(( "  target bitmap: (%d, %d) -- (%d, %d); %d x %d\n",
+      FT_TRACE5(( "  target bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n",
         target_llx / 64, target_lly / 64,
         target_urx / 64, target_ury / 64,
         target->width, target->rows ));
@@ -922,7 +922,7 @@
       FT_TRACE5(( "  target bitmap: empty\n" ));
 
     if ( final_width && final_rows )
-      FT_TRACE5(( "  final bitmap: (%d, %d) -- (%d, %d); %d x %d\n",
+      FT_TRACE5(( "  final bitmap: (%ld, %ld) -- (%ld, %ld); %d x %d\n",
         final_llx / 64, final_lly / 64,
         final_urx / 64, final_ury / 64,
         final_width, final_rows ));
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 78164c8..8adfdff 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1841,15 +1841,15 @@
       /* FT2 allocator takes signed long buffer length,
        * too large value causing overflow should be checked
        */
-      FT_TRACE4(( "                 POST fragment #%d: length=0x%08x"
-                  " total pfb_len=0x%08x\n",
+      FT_TRACE4(( "                 POST fragment #%d: length=0x%08lx"
+                  " total pfb_len=0x%08lx\n",
                   i, temp, pfb_len + temp + 6 ));
 
       if ( FT_MAC_RFORK_MAX_LEN < temp               ||
            FT_MAC_RFORK_MAX_LEN - temp < pfb_len + 6 )
       {
         FT_TRACE2(( "             MacOS resource length cannot exceed"
-                    " 0x%08x\n",
+                    " 0x%08lx\n",
                     FT_MAC_RFORK_MAX_LEN ));
 
         error = FT_THROW( Invalid_Offset );
@@ -1860,13 +1860,13 @@
     }
 
     FT_TRACE2(( "             total buffer size to concatenate"
-                " %d POST fragments: 0x%08x\n",
+                " %ld POST fragments: 0x%08lx\n",
                  resource_cnt, pfb_len + 2 ));
 
     if ( pfb_len + 2 < 6 )
     {
       FT_TRACE2(( "             too long fragment length makes"
-                  " pfb_len confused: pfb_len=0x%08x\n",
+                  " pfb_len confused: pfb_len=0x%08lx\n",
                   pfb_len ));
 
       error = FT_THROW( Array_Too_Large );
@@ -1909,7 +1909,7 @@
         goto Exit2;
 
       FT_TRACE3(( "POST fragment[%d]:"
-                  " offsets=0x%08x, rlen=0x%08x, flags=0x%04x\n",
+                  " offsets=0x%08lx, rlen=0x%08lx, flags=0x%04x\n",
                   i, offsets[i], rlen, flags ));
 
       error = FT_ERR( Array_Too_Large );
@@ -1936,7 +1936,7 @@
       else
       {
         FT_TRACE3(( "    Write POST fragment #%d header (4-byte) to buffer"
-                    " %p + 0x%08x\n",
+                    " %p + 0x%08lx\n",
                     i, pfb_data, pfb_lenpos ));
 
         if ( pfb_lenpos + 3 > pfb_len + 2 )
@@ -1951,7 +1951,7 @@
           break;
 
         FT_TRACE3(( "    Write POST fragment #%d header (6-byte) to buffer"
-                    " %p + 0x%08x\n",
+                    " %p + 0x%08lx\n",
                     i, pfb_data, pfb_pos ));
 
         if ( pfb_pos + 6 > pfb_len + 2 )
@@ -1973,8 +1973,8 @@
       if ( pfb_pos > pfb_len || pfb_pos + rlen > pfb_len )
         goto Exit2;
 
-      FT_TRACE3(( "    Load POST fragment #%d (%d byte) to buffer"
-                  " %p + 0x%08x\n",
+      FT_TRACE3(( "    Load POST fragment #%d (%ld byte) to buffer"
+                  " %p + 0x%08lx\n",
                   i, rlen, pfb_data, pfb_pos ));
 
       error = FT_Stream_Read( stream, (FT_Byte *)pfb_data + pfb_pos, rlen );
@@ -2259,7 +2259,7 @@
       args2.flags    = FT_OPEN_PATHNAME;
       args2.pathname = file_names[i] ? file_names[i] : args->pathname;
 
-      FT_TRACE3(( "Try rule %d: %s (offset=%d) ...",
+      FT_TRACE3(( "Try rule %d: %s (offset=%ld) ...",
                   i, args2.pathname, offsets[i] ));
 
       error = FT_Stream_New( library, &args2, &stream2 );
@@ -3214,9 +3214,9 @@
       FT_Size_Metrics*  metrics = &face->size->metrics;
 
 
-      FT_TRACE5(( "  x scale: %d (%f)\n",
+      FT_TRACE5(( "  x scale: %ld (%f)\n",
                   metrics->x_scale, metrics->x_scale / 65536.0 ));
-      FT_TRACE5(( "  y scale: %d (%f)\n",
+      FT_TRACE5(( "  y scale: %ld (%f)\n",
                   metrics->y_scale, metrics->y_scale / 65536.0 ));
       FT_TRACE5(( "  ascender: %f\n",    metrics->ascender / 64.0 ));
       FT_TRACE5(( "  descender: %f\n",   metrics->descender / 64.0 ));
@@ -3289,9 +3289,9 @@
       FT_Size_Metrics*  metrics = &face->size->metrics;
 
 
-      FT_TRACE5(( "  x scale: %d (%f)\n",
+      FT_TRACE5(( "  x scale: %ld (%f)\n",
                   metrics->x_scale, metrics->x_scale / 65536.0 ));
-      FT_TRACE5(( "  y scale: %d (%f)\n",
+      FT_TRACE5(( "  y scale: %ld (%f)\n",
                   metrics->y_scale, metrics->y_scale / 65536.0 ));
       FT_TRACE5(( "  ascender: %f\n",    metrics->ascender / 64.0 ));
       FT_TRACE5(( "  descender: %f\n",   metrics->descender / 64.0 ));
@@ -3451,7 +3451,7 @@
               if ( akerning->x != orig_x_rounded ||
                    akerning->y != orig_y_rounded )
                 FT_TRACE5(( "FT_Get_Kerning: horizontal kerning"
-                            " (%d, %d) scaled down to (%d, %d) pixels\n",
+                            " (%ld, %ld) scaled down to (%ld, %ld) pixels\n",
                             orig_x_rounded / 64, orig_y_rounded / 64,
                             akerning->x / 64, akerning->y / 64 ));
             }
@@ -3723,7 +3723,7 @@
       if ( charcode > 0xFFFFFFFFUL )
       {
         FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
-        FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+        FT_TRACE1(( " 0x%lx is truncated\n", charcode ));
       }
 
       result = cmap->clazz->char_index( cmap, (FT_UInt32)charcode );
@@ -3899,13 +3899,13 @@
         {
           FT_TRACE1(( "FT_Face_GetCharVariantIndex:"
                       " too large charcode" ));
-          FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+          FT_TRACE1(( " 0x%lx is truncated\n", charcode ));
         }
         if ( variantSelector > 0xFFFFFFFFUL )
         {
           FT_TRACE1(( "FT_Face_GetCharVariantIndex:"
                       " too large variantSelector" ));
-          FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
+          FT_TRACE1(( " 0x%lx is truncated\n", variantSelector ));
         }
 
         result = vcmap->clazz->char_var_index( vcmap, ucmap,
@@ -3942,13 +3942,13 @@
         {
           FT_TRACE1(( "FT_Face_GetCharVariantIsDefault:"
                       " too large charcode" ));
-          FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+          FT_TRACE1(( " 0x%lx is truncated\n", charcode ));
         }
         if ( variantSelector > 0xFFFFFFFFUL )
         {
           FT_TRACE1(( "FT_Face_GetCharVariantIsDefault:"
                       " too large variantSelector" ));
-          FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
+          FT_TRACE1(( " 0x%lx is truncated\n", variantSelector ));
         }
 
         result = vcmap->clazz->char_var_default( vcmap,
@@ -4011,7 +4011,7 @@
         if ( charcode > 0xFFFFFFFFUL )
         {
           FT_TRACE1(( "FT_Face_GetVariantsOfChar: too large charcode" ));
-          FT_TRACE1(( " 0x%x is truncated\n", charcode ));
+          FT_TRACE1(( " 0x%lx is truncated\n", charcode ));
         }
 
         result = vcmap->clazz->charvariant_list( vcmap, memory,
@@ -4045,7 +4045,7 @@
         if ( variantSelector > 0xFFFFFFFFUL )
         {
           FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" ));
-          FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
+          FT_TRACE1(( " 0x%lx is truncated\n", variantSelector ));
         }
 
         result = vcmap->clazz->variantchar_list( vcmap, memory,
diff --git a/src/base/ftrfork.c b/src/base/ftrfork.c
index ea7e310..f989be4 100644
--- a/src/base/ftrfork.c
+++ b/src/base/ftrfork.c
@@ -239,7 +239,7 @@
                   (char)( 0xFF & ( tag_internal >> 16 ) ),
                   (char)( 0xFF & ( tag_internal >>  8 ) ),
                   (char)( 0xFF & ( tag_internal >>  0 ) ) ));
-      FT_TRACE3(( "             : subcount=%d, suboffset=0x%04x\n",
+      FT_TRACE3(( "             : subcount=%d, suboffset=0x%04lx\n",
                   subcnt, rpos ));
 
       if ( tag_internal == tag )
@@ -285,7 +285,7 @@
           ref[j].offset = temp & 0xFFFFFFL;
 
           FT_TRACE3(( "             [%d]:"
-                      " resource_id=0x%04x, offset=0x%08x\n",
+                      " resource_id=0x%04x, offset=0x%08lx\n",
                       j, (FT_UShort)ref[j].res_id, ref[j].offset ));
         }
 
@@ -301,7 +301,7 @@
 
           for ( j = 0; j < *count; j++ )
             FT_TRACE3(( "             [%d]:"
-                        " resource_id=0x%04x, offset=0x%08x\n",
+                        " resource_id=0x%04x, offset=0x%08lx\n",
                         j, ref[j].res_id, ref[j].offset ));
         }
 
diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c
index 3c96272..a9119e2 100644
--- a/src/base/ftsynth.c
+++ b/src/base/ftsynth.c
@@ -129,7 +129,7 @@
       if ( ( ystr >> 6 ) > FT_INT_MAX || ( ystr >> 6 ) < FT_INT_MIN )
       {
         FT_TRACE1(( "FT_GlyphSlot_Embolden:" ));
-        FT_TRACE1(( "too strong emboldening parameter ystr=%d\n", ystr ));
+        FT_TRACE1(( "too strong emboldening parameter ystr=%ld\n", ystr ));
         return;
       }
       error = FT_GlyphSlot_Own_Bitmap( slot );
diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c
index 1adf3eb..d29188b 100644
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -402,10 +402,10 @@
       bdf_property_t*  prop = NULL;
 
 
-      FT_TRACE4(( "  number of glyphs: allocated %d (used %d)\n",
+      FT_TRACE4(( "  number of glyphs: allocated %ld (used %ld)\n",
                   font->glyphs_size,
                   font->glyphs_used ));
-      FT_TRACE4(( "  number of unencoded glyphs: allocated %d (used %d)\n",
+      FT_TRACE4(( "  number of unencoded glyphs: allocated %ld (used %ld)\n",
                   font->unencoded_size,
                   font->unencoded_used ));
 
@@ -457,13 +457,13 @@
         if ( font->font_ascent > 0x7FFF || font->font_ascent < -0x7FFF )
         {
           font->font_ascent = font->font_ascent < 0 ? -0x7FFF : 0x7FFF;
-          FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %d\n",
+          FT_TRACE0(( "BDF_Face_Init: clamping font ascent to value %ld\n",
                       font->font_ascent ));
         }
         if ( font->font_descent > 0x7FFF || font->font_descent < -0x7FFF )
         {
           font->font_descent = font->font_descent < 0 ? -0x7FFF : 0x7FFF;
-          FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %d\n",
+          FT_TRACE0(( "BDF_Face_Init: clamping font descent to value %ld\n",
                       font->font_descent ));
         }
 
@@ -504,7 +504,7 @@
                prop->value.l < -0x504C2L )
           {
             bsize->size = 0x7FFF;
-            FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n",
+            FT_TRACE0(( "BDF_Face_Init: clamping point size to value %ld\n",
                         bsize->size ));
           }
           else
@@ -517,7 +517,7 @@
           if ( font->point_size > 0x7FFF )
           {
             bsize->size = 0x7FFF;
-            FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n",
+            FT_TRACE0(( "BDF_Face_Init: clamping point size to value %ld\n",
                         bsize->size ));
           }
           else
@@ -539,7 +539,7 @@
           if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF )
           {
             bsize->y_ppem = 0x7FFF << 6;
-            FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %d\n",
+            FT_TRACE0(( "BDF_Face_Init: clamping pixel size to value %ld\n",
                         bsize->y_ppem ));
           }
           else
@@ -615,7 +615,7 @@
         for ( n = 0; n < font->glyphs_size; n++ )
         {
           (face->en_table[n]).enc = cur[n].encoding;
-          FT_TRACE4(( "  idx %d, val 0x%lX\n", n, cur[n].encoding ));
+          FT_TRACE4(( "  idx %ld, val 0x%lX\n", n, cur[n].encoding ));
           (face->en_table[n]).glyph = (FT_UShort)n;
 
           if ( cur[n].encoding == font->default_char )
@@ -624,7 +624,7 @@
               face->default_glyph = (FT_UInt)n;
             else
               FT_TRACE1(( "BDF_Face_Init:"
-                          " idx %d is too large for this system\n", n ));
+                          " idx %ld is too large for this system\n", n ));
           }
         }
       }
@@ -825,7 +825,7 @@
     bitmap->rows  = glyph.bbx.height;
     bitmap->width = glyph.bbx.width;
     if ( glyph.bpr > FT_INT_MAX )
-      FT_TRACE1(( "BDF_Glyph_Load: too large pitch %d is truncated\n",
+      FT_TRACE1(( "BDF_Glyph_Load: too large pitch %ld is truncated\n",
                    glyph.bpr ));
     bitmap->pitch = (int)glyph.bpr; /* same as FT_Bitmap.pitch */
 
diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c
index aa6e6a7..43ea314 100644
--- a/src/cache/ftcbasic.c
+++ b/src/cache/ftcbasic.c
@@ -395,7 +395,7 @@
 #if FT_ULONG_MAX > FT_UINT_MAX
     if ( load_flags > FT_UINT_MAX )
       FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
-                  " higher bits in load_flags 0x%x are dropped\n",
+                  " higher bits in load_flags 0x%lx are dropped\n",
                   load_flags & ~((FT_ULong)FT_UINT_MAX) ));
 #endif
 
@@ -595,7 +595,7 @@
 #if FT_ULONG_MAX > FT_UINT_MAX
     if ( load_flags > FT_UINT_MAX )
       FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
-                  " higher bits in load_flags 0x%x are dropped\n",
+                  " higher bits in load_flags 0x%lx are dropped\n",
                   load_flags & ~((FT_ULong)FT_UINT_MAX) ));
 #endif
 
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index af0ec71..486ab24 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -737,7 +737,7 @@
       {
         if ( dict->cid_supplement < FT_INT_MIN ||
              dict->cid_supplement > FT_INT_MAX )
-          FT_TRACE1(( "cff_get_ros: too large supplement %d is truncated\n",
+          FT_TRACE1(( "cff_get_ros: too large supplement %ld is truncated\n",
                       dict->cid_supplement ));
         *supplement = (FT_Int)dict->cid_supplement;
       }
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index 5386f49..73d3eec 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -442,7 +442,7 @@
       if ( cur_offset != 0 )
       {
         FT_TRACE0(( "cff_index_get_pointers:"
-                    " invalid first offset value %d set to zero\n",
+                    " invalid first offset value %ld set to zero\n",
                     cur_offset ));
         cur_offset = 0;
       }
@@ -559,8 +559,8 @@
            idx->data_offset > stream->size - off2 + 1 )
       {
         FT_ERROR(( "cff_index_access_element:"
-                   " offset to next entry (%d)"
-                   " exceeds the end of stream (%d)\n",
+                   " offset to next entry (%ld)"
+                   " exceeds the end of stream (%ld)\n",
                    off2, stream->size - idx->data_offset + 1 ));
         off2 = stream->size - idx->data_offset + 1;
       }
@@ -984,7 +984,7 @@
             if ( glyph_sid > 0xFFFFL - nleft )
             {
               FT_ERROR(( "cff_charset_load: invalid SID range trimmed"
-                         " nleft=%d -> %d\n", nleft, 0xFFFFL - glyph_sid ));
+                         " nleft=%d -> %ld\n", nleft, 0xFFFFL - glyph_sid ));
               nleft = ( FT_UInt )( 0xFFFFL - glyph_sid );
             }
 
@@ -1951,7 +1951,7 @@
     if ( priv->blue_shift > 1000 || priv->blue_shift < 0 )
     {
       FT_TRACE2(( "cff_load_private_dict:"
-                  " setting unlikely BlueShift value %d to default (7)\n",
+                  " setting unlikely BlueShift value %ld to default (7)\n",
                   priv->blue_shift ));
       priv->blue_shift = 7;
     }
@@ -1959,7 +1959,7 @@
     if ( priv->blue_fuzz > 1000 || priv->blue_fuzz < 0 )
     {
       FT_TRACE2(( "cff_load_private_dict:"
-                  " setting unlikely BlueFuzz value %d to default (1)\n",
+                  " setting unlikely BlueFuzz value %ld to default (1)\n",
                   priv->blue_fuzz ));
       priv->blue_fuzz = 1;
     }
diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c
index 758788e..69bcd5d 100644
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -713,7 +713,7 @@
            ( max_scaling - min_scaling ) > 9 )
       {
         FT_TRACE1(( "cff_parse_font_matrix:"
-                    " strange scaling values (minimum %d, maximum %d),\n"
+                    " strange scaling values (minimum %ld, maximum %ld),\n"
                     "                      "
                     " using default matrix\n", min_scaling, max_scaling ));
         goto Unlikely;
@@ -810,7 +810,7 @@
       bbox->yMax = FT_RoundFix( cff_parse_fixed( parser, data   ) );
       error = FT_Err_Ok;
 
-      FT_TRACE4(( " [%d %d %d %d]\n",
+      FT_TRACE4(( " [%ld %ld %ld %ld]\n",
                   bbox->xMin / 65536,
                   bbox->yMin / 65536,
                   bbox->xMax / 65536,
@@ -933,11 +933,11 @@
         FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" ));
       dict->cid_supplement = cff_parse_num( parser, data );
       if ( dict->cid_supplement < 0 )
-        FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n",
+        FT_TRACE1(( "cff_parse_cid_ros: negative supplement %ld is found\n",
                    dict->cid_supplement ));
       error = FT_Err_Ok;
 
-      FT_TRACE4(( " %d %d %d\n",
+      FT_TRACE4(( " %d %d %ld\n",
                   dict->cid_registry,
                   dict->cid_ordering,
                   dict->cid_supplement ));
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index 0f41605..bb9136a 100644
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -254,7 +254,7 @@
       goto Exit;
     }
 
-    FT_TRACE4(( " %d\n", num_dicts ));
+    FT_TRACE4(( " %ld\n", num_dicts ));
 
     /*
      * A single entry in the FDArray must (at least) contain the following
@@ -275,7 +275,7 @@
     if ( (FT_ULong)num_dicts > stream->size / 100 )
     {
       FT_TRACE0(( "parse_fd_array: adjusting FDArray size"
-                  " (from %d to %d)\n",
+                  " (from %ld to %ld)\n",
                   num_dicts,
                   stream->size / 100 ));
       num_dicts = (FT_Long)( stream->size / 100 );
@@ -329,7 +329,7 @@
       dict->expansion_factor              = cid_parser_to_fixed( parser, 0 );
       dict->private_dict.expansion_factor = dict->expansion_factor;
 
-      FT_TRACE4(( "%d\n", dict->expansion_factor ));
+      FT_TRACE4(( "%ld\n", dict->expansion_factor ));
     }
 
     return;
@@ -804,7 +804,7 @@
              face->root.stream->size - parser->data_offset )
       {
         FT_TRACE0(( "cid_face_open: adjusting length of binary data\n"
-                    "               (from %d to %d bytes)\n",
+                    "               (from %ld to %ld bytes)\n",
                     parser->binary_length,
                     face->root.stream->size - parser->data_offset ));
         parser->binary_length = face->root.stream->size -
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
index 08878a2..8817682 100644
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -121,7 +121,7 @@
          toc->count > 9                     )
     {
       FT_TRACE0(( "pcf_read_TOC: adjusting number of tables"
-                  " (from %d to %d)\n",
+                  " (from %ld to %ld)\n",
                   toc->count,
                   FT_MIN( stream->size >> 4, 9 ) ));
       toc->count = FT_MIN( stream->size >> 4, 9 );
@@ -241,7 +241,7 @@
           if ( tables[i].type == (FT_UInt)( 1 << j ) )
             name = tableNames[j];
 
-        FT_TRACE4(( "  %d: type=%s, format=0x%X,"
+        FT_TRACE4(( "  %d: type=%s, format=0x%lX,"
                     " size=%ld (0x%lX), offset=%ld (0x%lX)\n",
                     i, name,
                     tables[i].format,
@@ -660,7 +660,7 @@
       {
         properties[i].value.l = props[i].value;
 
-        FT_TRACE4(( " %d\n", properties[i].value.l ));
+        FT_TRACE4(( " %ld\n", properties[i].value.l ));
       }
     }
 
@@ -797,7 +797,7 @@
         metrics->descent          = 0;
 
         FT_TRACE0(( "pcf_get_metrics:"
-                    " invalid metrics for glyph %d\n", i ));
+                    " invalid metrics for glyph %ld\n", i ));
       }
     }
 
@@ -917,11 +917,11 @@
 
       sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX( format )];
 
-      FT_TRACE4(( "  %ld-bit padding implies a size of %lu\n",
+      FT_TRACE4(( "  %d-bit padding implies a size of %lu\n",
                   8 << i, bitmapSizes[i] ));
     }
 
-    FT_TRACE4(( "  %lu bitmaps, using %ld-bit padding\n",
+    FT_TRACE4(( "  %lu bitmaps, using %d-bit padding\n",
                 nbitmaps,
                 8 << PCF_GLYPH_PAD_INDEX( format ) ));
     FT_TRACE4(( "  bitmap size: %lu\n", sizebitmaps ));
@@ -1251,13 +1251,13 @@
     if ( FT_ABS( accel->fontAscent ) > 0x7FFF )
     {
       accel->fontAscent = accel->fontAscent < 0 ? -0x7FFF : 0x7FFF;
-      FT_TRACE0(( "pfc_get_accel: clamping font ascent to value %d\n",
+      FT_TRACE0(( "pfc_get_accel: clamping font ascent to value %ld\n",
                   accel->fontAscent ));
     }
     if ( FT_ABS( accel->fontDescent ) > 0x7FFF )
     {
       accel->fontDescent = accel->fontDescent < 0 ? -0x7FFF : 0x7FFF;
-      FT_TRACE0(( "pfc_get_accel: clamping font descent to value %d\n",
+      FT_TRACE0(( "pfc_get_accel: clamping font descent to value %ld\n",
                   accel->fontDescent ));
     }
 
@@ -1630,7 +1630,7 @@
           if ( FT_ABS( prop->value.l ) > 0x504C2L ) /* 0x7FFF * 72270/7200 */
           {
             bsize->size = 0x7FFF;
-            FT_TRACE0(( "pcf_load_font: clamping point size to value %d\n",
+            FT_TRACE0(( "pcf_load_font: clamping point size to value %ld\n",
                         bsize->size ));
           }
           else
@@ -1649,7 +1649,7 @@
           if ( FT_ABS( prop->value.l ) > 0x7FFF )
           {
             bsize->y_ppem = 0x7FFF << 6;
-            FT_TRACE0(( "pcf_load_font: clamping pixel size to value %d\n",
+            FT_TRACE0(( "pcf_load_font: clamping pixel size to value %ld\n",
                         bsize->y_ppem ));
           }
           else
diff --git a/src/pfr/pfrgload.c b/src/pfr/pfrgload.c
index a651342..aa640c3 100644
--- a/src/pfr/pfrgload.c
+++ b/src/pfr/pfrgload.c
@@ -451,7 +451,7 @@
           case 1:                           /* 16-bit absolute value */
             PFR_CHECK( 2 );
             cur->x = PFR_NEXT_SHORT( p );
-            FT_TRACE7(( " x.%d", cur->x ));
+            FT_TRACE7(( " x.%ld", cur->x ));
             break;
 
           case 2:                           /* 8-bit delta */
@@ -481,7 +481,7 @@
           case 1:                           /* 16-bit absolute value */
             PFR_CHECK( 2 );
             cur->y = PFR_NEXT_SHORT( p );
-            FT_TRACE7(( " y.%d", cur->y ));
+            FT_TRACE7(( " y.%ld", cur->y ));
             break;
 
           case 2:                           /* 8-bit delta */
diff --git a/src/pfr/pfrsbit.c b/src/pfr/pfrsbit.c
index 9c1d31d..a6691e6 100644
--- a/src/pfr/pfrsbit.c
+++ b/src/pfr/pfrsbit.c
@@ -745,7 +745,7 @@
            ypos + (FT_Long)ysize < FT_INT_MIN )
       {
         FT_TRACE1(( "pfr_slot_load_bitmap:" ));
-        FT_TRACE1(( "huge bitmap glyph %dx%d over FT_GlyphSlot\n",
+        FT_TRACE1(( "huge bitmap glyph %ldx%ld over FT_GlyphSlot\n",
                      xpos, ypos ));
         error = FT_THROW( Invalid_Pixel_Size );
       }
diff --git a/src/psaux/pshints.c b/src/psaux/pshints.c
index 6d63903..ce8cfca 100644
--- a/src/psaux/pshints.c
+++ b/src/psaux/pshints.c
@@ -310,7 +310,7 @@
       CF2_Hint  hint = &hintmap->edge[i];
 
 
-      FT_TRACE6(( "  %3d    %7.2f  %7.2f  %5d  %s%s%s%s\n",
+      FT_TRACE6(( "  %3ld    %7.2f  %7.2f  %5d  %s%s%s%s\n",
                   hint->index,
                   hint->csCoord / 65536.0,
                   hint->dsCoord / ( hint->scale * 1.0 ),
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index 4b8f58c..defc4d4 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -1232,7 +1232,7 @@
           bbox->xMax = FT_RoundFix( temp[2] );
           bbox->yMax = FT_RoundFix( temp[3] );
 
-          FT_TRACE4(( " [%d %d %d %d]",
+          FT_TRACE4(( " [%ld %ld %ld %ld]",
                       bbox->xMin / 65536,
                       bbox->yMin / 65536,
                       bbox->xMax / 65536,
@@ -1286,7 +1286,7 @@
             bbox->xMax = FT_RoundFix( temp[i + 2 * max_objects] );
             bbox->yMax = FT_RoundFix( temp[i + 3 * max_objects] );
 
-            FT_TRACE4(( " [%d %d %d %d]",
+            FT_TRACE4(( " [%ld %ld %ld %ld]",
                         bbox->xMin / 65536,
                         bbox->yMin / 65536,
                         bbox->xMax / 65536,
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index 3ec8b32..2ed27ca 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -1727,7 +1727,7 @@
 #ifdef FT_DEBUG_LEVEL_TRACE
       if ( bol )
       {
-        FT_TRACE5(( " (%d)", decoder->top - decoder->stack ));
+        FT_TRACE5(( " (%ld)", decoder->top - decoder->stack ));
         bol = FALSE;
       }
 #endif
@@ -1914,7 +1914,7 @@
           if ( top - decoder->stack != num_args )
             FT_TRACE0(( "t1_decoder_parse_metrics:"
                         " too much operands on the stack"
-                        " (seen %d, expected %d)\n",
+                        " (seen %ld, expected %d)\n",
                         top - decoder->stack, num_args ));
           break;
         }
diff --git a/src/pshinter/pshrec.c b/src/pshinter/pshrec.c
index 36debf1..bddccf2 100644
--- a/src/pshinter/pshrec.c
+++ b/src/pshinter/pshrec.c
@@ -874,7 +874,7 @@
       if ( error )
       {
         FT_ERROR(( "ps_hints_stem: could not add stem"
-                   " (%d,%d) to hints table\n", stems[0], stems[1] ));
+                   " (%ld,%ld) to hints table\n", stems[0], stems[1] ));
 
         hints->error = error;
         return;
diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c
index 6a85f25..9dd55cb 100644
--- a/src/raster/ftraster.c
+++ b/src/raster/ftraster.c
@@ -673,13 +673,13 @@
       if ( overshoot )
         ras.cProfile->flags |= Overshoot_Bottom;
 
-      FT_TRACE6(( "  new ascending profile = %p\n", ras.cProfile ));
+      FT_TRACE6(( "  new ascending profile = %p\n", (void *)ras.cProfile ));
       break;
 
     case Descending_State:
       if ( overshoot )
         ras.cProfile->flags |= Overshoot_Top;
-      FT_TRACE6(( "  new descending profile = %p\n", ras.cProfile ));
+      FT_TRACE6(( "  new descending profile = %p\n", (void *)ras.cProfile ));
       break;
 
     default:
@@ -736,7 +736,7 @@
 
 
       FT_TRACE6(( "  ending profile %p, start = %ld, height = %ld\n",
-                  ras.cProfile, ras.cProfile->start, h ));
+                  (void *)ras.cProfile, ras.cProfile->start, h ));
 
       ras.cProfile->height = h;
       if ( overshoot )
@@ -2273,7 +2273,7 @@
       if ( e2 >= ras.bWidth )
         e2 = ras.bWidth - 1;
 
-      FT_TRACE7(( " -> x=[%d;%d]", e1, e2 ));
+      FT_TRACE7(( " -> x=[%ld;%ld]", e1, e2 ));
 
       c1 = (Short)( e1 >> 3 );
       c2 = (Short)( e2 >> 3 );
@@ -2447,7 +2447,7 @@
 
     if ( e1 >= 0 && e1 < ras.bWidth )
     {
-      FT_TRACE7(( " -> x=%d (drop-out)", e1 ));
+      FT_TRACE7(( " -> x=%ld (drop-out)", e1 ));
 
       c1 = (Short)( e1 >> 3 );
       f1 = (Short)( e1 & 7 );
@@ -2521,7 +2521,7 @@
           PByte  bits;
 
 
-          FT_TRACE7(( " -> y=%d (drop-out)", e1 ));
+          FT_TRACE7(( " -> y=%ld (drop-out)", e1 ));
 
           bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
           f1   = (Byte)( 0x80 >> ( y & 7 ) );
@@ -2644,7 +2644,7 @@
 
     if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
     {
-      FT_TRACE7(( " -> y=%d (drop-out)", e1 ));
+      FT_TRACE7(( " -> y=%ld (drop-out)", e1 ));
 
       bits  = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
       f1    = (Byte)( 0x80 >> ( y & 7 ) );
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index 0f463a3..0460339 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -194,7 +194,7 @@
     else if ( (FT_ULong)face->num_glyphs < FT_UINT_MAX )
       max_gid = (FT_UInt)face->num_glyphs;
     else
-      FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08x\n",
+      FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08lx\n",
                   FT_UINT_MAX, face->num_glyphs ));
 
     for ( i = 0; i < max_gid; i++ )
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 22da061..39460be 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -546,8 +546,8 @@
     /* Stream may have changed in sfnt_open_font. */
     stream = face->root.stream;
 
-    FT_TRACE2(( "sfnt_init_face: %08p (index %d)\n",
-                face,
+    FT_TRACE2(( "sfnt_init_face: %p (index %d)\n",
+                (void *)face,
                 face_instance_index ));
 
     face_index = FT_ABS( face_instance_index ) & 0xFFFF;
@@ -820,7 +820,7 @@
     /* it doesn't contain outlines.                                */
     /*                                                             */
 
-    FT_TRACE2(( "sfnt_load_face: %08p\n\n", face ));
+    FT_TRACE2(( "sfnt_load_face: %p\n\n", (void *)face ));
 
     /* do we have outlines in there? */
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
diff --git a/src/sfnt/sfwoff2.c b/src/sfnt/sfwoff2.c
index a26c711..73d19f5 100644
--- a/src/sfnt/sfwoff2.c
+++ b/src/sfnt/sfwoff2.c
@@ -1222,7 +1222,7 @@
     FT_TRACE4(( "  loca table info:\n" ));
     FT_TRACE4(( "    dst_offset = %lu\n", info->loca_table->dst_offset ));
     FT_TRACE4(( "    dst_length = %lu\n", info->loca_table->dst_length ));
-    FT_TRACE4(( "    checksum = %09x\n", *loca_checksum ));
+    FT_TRACE4(( "    checksum = %09lx\n", *loca_checksum ));
 
     /* Set pointer `sfnt_bytes' to its correct value. */
     *sfnt_bytes = sfnt;
@@ -1573,7 +1573,7 @@
       WOFF2_TableRec  table = *( indices[nn] );
 
 
-      FT_TRACE3(( "Seeking to %d with table size %d.\n",
+      FT_TRACE3(( "Seeking to %ld with table size %ld.\n",
                   table.src_offset, table.src_length ));
       FT_TRACE3(( "Table tag: %c%c%c%c.\n",
                   (FT_Char)( table.Tag >> 24 ),
@@ -1614,7 +1614,7 @@
 
         checksum = compute_ULong_sum( transformed_buf + table.src_offset,
                                       table.src_length );
-        FT_TRACE4(( "Checksum = %09x.\n", checksum ));
+        FT_TRACE4(( "Checksum = %09lx.\n", checksum ));
 
         if ( WRITE_SFNT_BUF( transformed_buf + table.src_offset,
                              table.src_length ) )
@@ -1639,7 +1639,7 @@
                                  memory ) )
             goto Fail;
 
-          FT_TRACE4(( "Checksum = %09x.\n", checksum ));
+          FT_TRACE4(( "Checksum = %09lx.\n", checksum ));
         }
 
         else if ( table.Tag == TTAG_loca )
@@ -1715,7 +1715,7 @@
 
     WRITE_ULONG( buf_cursor, font_checksum );
 
-    FT_TRACE2(( "Final checksum = %09x.\n", font_checksum ));
+    FT_TRACE2(( "Final checksum = %09lx.\n", font_checksum ));
 
     woff2->actual_sfnt_size = dest_offset;
 
@@ -1812,15 +1812,15 @@
     if ( FT_STREAM_READ_FIELDS( woff2_header_fields, &woff2 ) )
       return error;
 
-    FT_TRACE4(( "signature     -> 0x%X\n", woff2.signature ));
+    FT_TRACE4(( "signature     -> 0x%lX\n", woff2.signature ));
     FT_TRACE2(( "flavor        -> 0x%08lx\n", woff2.flavor ));
     FT_TRACE4(( "length        -> %lu\n", woff2.length ));
     FT_TRACE2(( "num_tables    -> %hu\n", woff2.num_tables ));
     FT_TRACE4(( "totalSfntSize -> %lu\n", woff2.totalSfntSize ));
-    FT_TRACE4(( "metaOffset    -> %hu\n", woff2.metaOffset ));
-    FT_TRACE4(( "metaLength    -> %hu\n", woff2.metaLength ));
-    FT_TRACE4(( "privOffset    -> %hu\n", woff2.privOffset ));
-    FT_TRACE4(( "privLength    -> %hu\n", woff2.privLength ));
+    FT_TRACE4(( "metaOffset    -> %lu\n", woff2.metaOffset ));
+    FT_TRACE4(( "metaLength    -> %lu\n", woff2.metaLength ));
+    FT_TRACE4(( "privOffset    -> %lu\n", woff2.privOffset ));
+    FT_TRACE4(( "privLength    -> %lu\n", woff2.privLength ));
 
     /* Make sure we don't recurse back here. */
     if ( woff2.flavor == TTAG_wOF2 )
@@ -1980,7 +1980,7 @@
         goto Exit;
       }
 
-      FT_TRACE4(( "Number of fonts in TTC: %ld\n", woff2.num_fonts ));
+      FT_TRACE4(( "Number of fonts in TTC: %d\n", woff2.num_fonts ));
 
       if ( FT_NEW_ARRAY( woff2.ttc_fonts, woff2.num_fonts ) )
         goto Exit;
@@ -1998,7 +1998,7 @@
         if ( FT_NEW_ARRAY( ttc_font->table_indices, ttc_font->num_tables ) )
           goto Exit;
 
-        FT_TRACE5(( "Number of tables in font %d: %ld\n",
+        FT_TRACE5(( "Number of tables in font %d: %d\n",
                     nn, ttc_font->num_tables ));
 
 #ifdef FT_DEBUG_LEVEL_TRACE
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index 8e9591b..4b46f41 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -64,8 +64,8 @@
 #endif
 
 
-    FT_TRACE4(( "tt_face_lookup_table: %08p, `%c%c%c%c' -- ",
-                face,
+    FT_TRACE4(( "tt_face_lookup_table: %p, `%c%c%c%c' -- ",
+                (void *)face,
                 (FT_Char)( tag >> 24 ),
                 (FT_Char)( tag >> 16 ),
                 (FT_Char)( tag >> 8  ),
@@ -362,7 +362,7 @@
     };
 
 
-    FT_TRACE2(( "tt_face_load_font_dir: %08p\n", face ));
+    FT_TRACE2(( "tt_face_load_font_dir: %p\n", (void *)face ));
 
     /* read the offset table */
 
@@ -1314,7 +1314,7 @@
     /* we don't load the glyph names, we do that in another */
     /* module (ttpost).                                     */
 
-    FT_TRACE3(( "FormatType:   0x%x\n", post->FormatType ));
+    FT_TRACE3(( "FormatType:   0x%lx\n", post->FormatType ));
     FT_TRACE3(( "isFixedPitch:   %s\n", post->isFixedPitch
                                         ? "  yes" : "   no" ));
 
diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c
index ffc90b6..e93a4bf 100644
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -239,7 +239,7 @@
           break;
         else
         {
-          FT_TRACE6(( "load_format_20: %d byte left in post table\n",
+          FT_TRACE6(( "load_format_20: %ld byte left in post table\n",
                       post_limit - FT_STREAM_POS() ));
 
           if ( FT_READ_BYTE( len ) )
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index 293c6fd..9dd4419 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -347,7 +347,7 @@
             FT_TRACE2(( "tt_face_load_strike_metrics:"
                         " sanitizing invalid ascender and descender\n"
                         "                            "
-                        " values for strike %d (%dppem, %dppem)\n",
+                        " values for strike %ld (%dppem, %dppem)\n",
                         strike_index,
                         metrics->x_ppem, metrics->y_ppem ));
 
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index fd64548..681900f 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1648,7 +1648,7 @@
       if ( !ras.invalid )
         gray_record_cell( RAS_VAR );
 
-      FT_TRACE7(( "band [%d..%d]: %d cell%s\n",
+      FT_TRACE7(( "band [%d..%d]: %ld cell%s\n",
                   ras.min_ey,
                   ras.max_ey,
                   ras.num_cells,
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index d76ce43..6710613 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -333,9 +333,9 @@
     loader->bbox.yMax = FT_NEXT_SHORT( p );
 
     FT_TRACE5(( "  # of contours: %d\n", loader->n_contours ));
-    FT_TRACE5(( "  xMin: %4d  xMax: %4d\n", loader->bbox.xMin,
+    FT_TRACE5(( "  xMin: %4ld  xMax: %4ld\n", loader->bbox.xMin,
                                             loader->bbox.xMax ));
-    FT_TRACE5(( "  yMin: %4d  yMax: %4d\n", loader->bbox.yMin,
+    FT_TRACE5(( "  yMin: %4ld  yMax: %4ld\n", loader->bbox.yMin,
                                             loader->bbox.yMax ));
     loader->cursor = p;
 
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 41b174e..2c6fc05 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -293,7 +293,7 @@
     FT_Error  error;
 
 
-    FT_TRACE1(( "Init_Context: new object at 0x%08p\n", exec ));
+    FT_TRACE1(( "Init_Context: new object at %p\n", (void *)exec ));
 
     exec->memory   = memory;
     exec->callSize = 32;
@@ -318,7 +318,7 @@
     return FT_Err_Ok;
 
   Fail_Memory:
-    FT_ERROR(( "Init_Context: not enough memory for %p\n", exec ));
+    FT_ERROR(( "Init_Context: not enough memory for %p\n", (void *)exec ));
     TT_Done_Context( exec );
 
     return error;
@@ -7845,7 +7845,7 @@
         num_twilight_points = 0xFFFFU;
 
       FT_TRACE5(( "TT_RunIns: Resetting number of twilight points\n"
-                  "           from %d to the more reasonable value %d\n",
+                  "           from %d to the more reasonable value %ld\n",
                   exc->twilight.n_points,
                   num_twilight_points ));
       exc->twilight.n_points = (FT_UShort)num_twilight_points;
@@ -7880,11 +7880,11 @@
       exc->loopcall_counter_max = 100 * (FT_ULong)exc->face->root.num_glyphs;
 
     FT_TRACE5(( "TT_RunIns: Limiting total number of loops in LOOPCALL"
-                " to %d\n", exc->loopcall_counter_max ));
+                " to %ld\n", exc->loopcall_counter_max ));
 
     exc->neg_jump_counter_max = exc->loopcall_counter_max;
     FT_TRACE5(( "TT_RunIns: Limiting total number of backward jumps"
-                " to %d\n", exc->neg_jump_counter_max ));
+                " to %ld\n", exc->neg_jump_counter_max ));
 
     /* set PPEM and CVT functions */
     exc->tt_metrics.ratio = 0;
@@ -7921,14 +7921,14 @@
         /* if tracing level is 7, show current code position */
         /* and the first few stack elements also             */
         FT_TRACE6(( "  " ));
-        FT_TRACE7(( "%06d ", exc->IP ));
+        FT_TRACE7(( "%06ld ", exc->IP ));
         FT_TRACE6(( "%s", opcode_name[exc->opcode] + 2 ));
         FT_TRACE7(( "%*s", *opcode_name[exc->opcode] == 'A'
                               ? 2
                               : 12 - ( *opcode_name[exc->opcode] - '0' ),
                               "#" ));
         for ( n = 1; n <= cnt; n++ )
-          FT_TRACE7(( " %d", exc->stack[exc->top - n] ));
+          FT_TRACE7(( " %ld", exc->stack[exc->top - n] ));
         FT_TRACE6(( "\n" ));
       }
 #endif /* FT_DEBUG_LEVEL_TRACE */
@@ -8646,7 +8646,7 @@
     } while ( !exc->instruction_trap );
 
   LNo_Error_:
-    FT_TRACE4(( "  %d instruction%s executed\n",
+    FT_TRACE4(( "  %ld instruction%s executed\n",
                 ins_counter,
                 ins_counter == 1 ? "" : "s" ));
     return FT_Err_Ok;
diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c
index bf0f99f..b1255b8 100644
--- a/src/truetype/ttpload.c
+++ b/src/truetype/ttpload.c
@@ -123,7 +123,7 @@
 
     if ( face->num_locations != (FT_ULong)face->root.num_glyphs + 1 )
     {
-      FT_TRACE2(( "glyph count mismatch!  loca: %d, maxp: %d\n",
+      FT_TRACE2(( "glyph count mismatch!  loca: %ld, maxp: %ld\n",
                   face->num_locations - 1, face->root.num_glyphs ));
 
       /* we only handle the case where `maxp' gives a larger value */
@@ -164,7 +164,7 @@
           face->num_locations = (FT_ULong)face->root.num_glyphs + 1;
           table_len           = new_loca_len;
 
-          FT_TRACE2(( "adjusting num_locations to %d\n",
+          FT_TRACE2(( "adjusting num_locations to %ld\n",
                       face->num_locations ));
         }
         else
@@ -172,7 +172,7 @@
           face->root.num_glyphs = face->num_locations
                                     ? (FT_Long)face->num_locations - 1 : 0;
 
-          FT_TRACE2(( "adjusting num_glyphs to %d\n",
+          FT_TRACE2(( "adjusting num_glyphs to %ld\n",
                       face->root.num_glyphs ));
         }
       }
@@ -237,7 +237,7 @@
     if ( pos1 > face->glyf_len )
     {
       FT_TRACE1(( "tt_face_get_location:"
-                  " too large offset (0x%08lx) found for glyph index %ld,\n"
+                  " too large offset (0x%08lx) found for glyph index %d,\n"
                   "                     "
                   " exceeding the end of `glyf' table (0x%08lx)\n",
                   pos1, gindex, face->glyf_len ));
@@ -251,7 +251,7 @@
       if ( gindex == face->num_locations - 2 )
       {
         FT_TRACE1(( "tt_face_get_location:"
-                    " too large size (%ld bytes) found for glyph index %ld,\n"
+                    " too large size (%ld bytes) found for glyph index %d,\n"
                     "                     "
                     " truncating at the end of `glyf' table to %ld bytes\n",
                     pos2 - pos1, gindex, face->glyf_len - pos1 ));
@@ -260,7 +260,7 @@
       else
       {
         FT_TRACE1(( "tt_face_get_location:"
-                    " too large offset (0x%08lx) found for glyph index %ld,\n"
+                    " too large offset (0x%08lx) found for glyph index %d,\n"
                     "                     "
                     " exceeding the end of `glyf' table (0x%08lx)\n",
                     pos2, gindex + 1, face->glyf_len ));
@@ -428,7 +428,7 @@
       if ( FT_FRAME_EXTRACT( table_len, face->font_program ) )
         goto Exit;
 
-      FT_TRACE2(( "loaded, %12d bytes\n", face->font_program_size ));
+      FT_TRACE2(( "loaded, %12ld bytes\n", face->font_program_size ));
     }
 
   Exit:
@@ -491,7 +491,7 @@
       if ( FT_FRAME_EXTRACT( table_len, face->cvt_program ) )
         goto Exit;
 
-      FT_TRACE2(( "loaded, %12d bytes\n", face->cvt_program_size ));
+      FT_TRACE2(( "loaded, %12ld bytes\n", face->cvt_program_size ));
     }
 
   Exit:
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index 9d04bd2..d16b81f 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -333,7 +333,7 @@
       else
         advances[nn] = 0;
 
-      FT_TRACE5(( "  idx %d: advance width %d font unit%s\n",
+      FT_TRACE5(( "  idx %d: advance width %ld font unit%s\n",
                   first + nn,
                   advances[nn],
                   advances[nn] == 1 ? "" : "s" ));
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 08a36d1..8498600 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -1063,7 +1063,7 @@
         map->design_points[p] = T1_ToInt( parser );
         map->blend_points [p] = T1_ToFixed( parser, 0 );
 
-        FT_TRACE4(( " [%d %f]",
+        FT_TRACE4(( " [%ld %f]",
                     map->design_points[p],
                     (double)map->blend_points[p] / 65536 ));
       }
@@ -1755,7 +1755,7 @@
        */
 
       FT_TRACE0(( "parse_subrs: adjusting number of subroutines"
-                  " (from %d to %d)\n",
+                  " (from %d to %ld)\n",
                   num_subrs,
                   ( parser->root.limit - parser->root.cursor ) >> 3 ));
       num_subrs = ( parser->root.limit - parser->root.cursor ) >> 3;
@@ -1926,7 +1926,7 @@
     if ( num_glyphs > ( limit - cur ) >> 3 )
     {
       FT_TRACE0(( "parse_charstrings: adjusting number of glyphs"
-                  " (from %d to %d)\n",
+                  " (from %d to %ld)\n",
                   num_glyphs, ( limit - cur ) >> 3 ));
       num_glyphs = ( limit - cur ) >> 3;
     }
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 9defdfc..3b918b7 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -346,8 +346,8 @@
     if ( error )
       goto Exit;
 
-    FT_TRACE2(( "T1_Face_Init: %08p (index %d)\n",
-                face,
+    FT_TRACE2(( "T1_Face_Init: %p (index %d)\n",
+                (void *)face,
                 face_index ));
 
     /* if we just wanted to check the format, leave successfully now */
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index 75c07dc..9850769 100644
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -826,7 +826,7 @@
       if ( loader->num_glyphs > ( limit - parser->root.cursor ) >> 2 )
       {
         FT_TRACE0(( "t42_parse_charstrings: adjusting number of glyphs"
-                    " (from %d to %d)\n",
+                    " (from %d to %ld)\n",
                     loader->num_glyphs,
                     ( limit - parser->root.cursor ) >> 2 ));
         loader->num_glyphs = ( limit - parser->root.cursor ) >> 2;