freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] Implicit conversion between FT_UInt* and FT_UInt32* in ttcmap


From: mpsuzuki
Subject: [ft-devel] Implicit conversion between FT_UInt* and FT_UInt32* in ttcmap.c
Date: Thu, 9 Oct 2008 13:50:23 +0900

Hi all,

Recently I've got a still-sealed copy of Metrowerks
CodeWarrior Gold 10 for Macintosh, which was released
on 1994 (before C99), and trying to build FreeType2 by
this very very legacy IDE. Soon I will summarize how
to build.

The legacy metrowerks C compiler finds several implicit
type conversions between FT_UInt* and FT_UInt32* in
src/sfnt/ttcmap.c. Attached is a patch to fix them.

I guess, the implicit conversions are caused by the wrong
usage of "FT_UInt" to interchange 32bit character code
point. As include/freetype/internal/ftobjs.h defines
the prototype of such functions as:

  typedef FT_UInt
  (*FT_CMap_CharIndexFunc)( FT_CMap    cmap,
                            FT_UInt32  char_code );

the most appropriate type to interchange the character code
point might be "FT_UInt32", I think. If it's correct, following
patch will cause no problem. Werner, please give me comment.

Regards,
mpsuzuki


Index: src/sfnt/ttcmap.c
===================================================================
RCS file: /sources/freetype/freetype2/src/sfnt/ttcmap.c,v
retrieving revision 1.79
diff -u -r1.79 ttcmap.c
--- src/sfnt/ttcmap.c   19 Aug 2008 04:53:02 -0000      1.79
+++ src/sfnt/ttcmap.c   9 Oct 2008 04:22:54 -0000
@@ -973,9 +973,9 @@
 
 
   static FT_UInt
-  tt_cmap4_char_map_linear( TT_CMap   cmap,
-                            FT_UInt*  pcharcode,
-                            FT_Bool   next )
+  tt_cmap4_char_map_linear( TT_CMap     cmap,
+                            FT_UInt32*  pcharcode,
+                            FT_Bool     next )
   {
     FT_UInt    num_segs2, start, end, offset;
     FT_Int     delta;
@@ -1052,9 +1052,9 @@
 
 
   static FT_UInt
-  tt_cmap4_char_map_binary( TT_CMap   cmap,
-                            FT_UInt*  pcharcode,
-                            FT_Bool   next )
+  tt_cmap4_char_map_binary( TT_CMap     cmap,
+                            FT_UInt32*  pcharcode,
+                            FT_Bool     next )
   {
     FT_UInt   num_segs2, start, end, offset;
     FT_Int    delta;
@@ -2794,7 +2794,7 @@
   }
 
 
-  static FT_UInt*
+  static FT_UInt32*
   tt_cmap14_get_nondef_chars( TT_CMap     cmap,
                               FT_Byte    *p,
                               FT_Memory   memory )




reply via email to

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