shithub: freetype+ttf2subf

Download patch

ref: a632b5f4064873ab7f21b749f93332387bc47f76
parent: 16188ebfac8f179bfeb32a6a3147b4264516bc79
author: Werner Lemberg <[email protected]>
date: Wed Dec 3 14:30:44 EST 2014

[autofit] Better fix for conversion specifiers in debug messages.

Using `%ld' for pointer differences causes warnings on 32bit
platforms.  The correct type would be (the relatively new) `%td',
however, this is missing on some important platforms.

This patch improves the change from 2014-11-28.

* src/autofit/afhints.c (AF_INDEX_NUM): Use `int' typecast.  Our
pointer differences are always sufficiently small.
(af_glyph_hints_dump_points, af_glyph_hints_dump_segments,
af_glyph_hints_dump_edge): Revert to `%d' and use `AF_INDEX_NUM'.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
 2014-12-03  Werner Lemberg  <[email protected]>
 
+	[autofit] Better fix for conversion specifiers in debug messages.
+
+	Using `%ld' for pointer differences causes warnings on 32bit
+	platforms.  The correct type would be (the relatively new) `%td',
+	however, this is missing on some important platforms.
+
+	This patch improves the change from 2014-11-28.
+
+	* src/autofit/afhints.c (AF_INDEX_NUM): Use `int' typecast.  Our
+	pointer differences are always sufficiently small.
+	(af_glyph_hints_dump_points, af_glyph_hints_dump_segments,
+	af_glyph_hints_dump_edge): Revert to `%d' and use `AF_INDEX_NUM'.
+
+2014-12-03  Werner Lemberg  <[email protected]>
+
 	FT_Sfnt_Tag: s/ft_sfnt_xxx/FT_SFNT_XXX/ for orthogonality.
 
 	All public FreeType enumeration and flag values are uppercase...
@@ -202,8 +217,8 @@
 	Fix compiler warning to conversion specifiers in debug messages.
 
 	* src/autofit/afhints.c (af_glyph_hints_dump_points): Add length
-	modifier to dump long integers.  (af_glyph_hints_dump_segments,
-	af_glyph_hints_dump_edges): Ditto.
+	modifier to dump long integers.
+	(af_glyph_hints_dump_segments, af_glyph_hints_dump_edges): Ditto.
 
 2014-11-27  Werner Lemberg  <[email protected]>
 
--- a/src/autofit/afhints.c
+++ b/src/autofit/afhints.c
@@ -180,7 +180,7 @@
   }
 
 
-#define AF_INDEX_NUM( ptr, base )  ( (ptr) ? ( (ptr) - (base) ) : -1 )
+#define AF_INDEX_NUM( ptr, base )  (int)( (ptr) ? ( (ptr) - (base) ) : -1 )
 
 
 #ifdef __cplusplus
@@ -200,9 +200,9 @@
               " |  xfit |  yfit |  flags ]\n" ));
 
     for ( point = points; point < limit; point++ )
-      AF_DUMP(( "  [ %5ld | %5d | %5d | %6.2f | %6.2f"
+      AF_DUMP(( "  [ %5d | %5d | %5d | %6.2f | %6.2f"
                 " | %5.2f | %5.2f | %c ]\n",
-                point - points,
+                AF_INDEX_NUM( point, points ),
                 point->fx,
                 point->fy,
                 point->ox / 64.0,
@@ -278,10 +278,10 @@
         AF_DUMP(( "  (none)\n" ));
 
       for ( seg = segments; seg < limit; seg++ )
-        AF_DUMP(( "  [ %5ld | %5.2g | %5s | %4ld"
-                  " | %4ld | %4ld | %5ld | %4ld"
+        AF_DUMP(( "  [ %5d | %5.2g | %5s | %4d"
+                  " | %4d | %4d | %5d | %4d"
                   " | %6d | %5d | %11s ]\n",
-                  seg - segments,
+                  AF_INDEX_NUM( seg, segments ),
                   dimension == AF_DIMENSION_HORZ
                                ? (int)seg->first->ox / 64.0
                                : (int)seg->first->oy / 64.0,
@@ -410,9 +410,9 @@
         AF_DUMP(( "  (none)\n" ));
 
       for ( edge = edges; edge < limit; edge++ )
-        AF_DUMP(( "  [ %5ld | %5.2g | %5s | %4ld"
-                  " | %5ld |   %c  | %5.2f | %5.2f | %11s ]\n",
-                  edge - edges,
+        AF_DUMP(( "  [ %5d | %5.2g | %5s | %4d"
+                  " | %5d |   %c  | %5.2f | %5.2f | %11s ]\n",
+                  AF_INDEX_NUM( edge, edges ),
                   (int)edge->opos / 64.0,
                   af_dir_str( (AF_Direction)edge->dir ),
                   AF_INDEX_NUM( edge->link, edges ),