Commit 7893501c3ead6a8c2e401d8e7de52796937679b9

Suzuki, Toshiya (鈴木俊哉) 2007-06-19T03:27:05

* fix compiler warnings of src/base/ftmac.c, drop unnecessary part for Mac OS X.

diff --git a/ChangeLog b/ChangeLog
index 14e391b..357b11f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,25 @@
-2006-06-18  Werner Lemberg  <wl@gnu.org>
+2007-07-19  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+	* src/base/ftmac.c: Apply patches proposed by Sean McBride.
+	(FT_GetFile_From_Mac_Name): Insert FT_UNUSED macros to fix
+	the compiler warnings against unused arguments.
+	(FT_ATSFontGetFileReference): Ditto.
+	(FT_GetFile_From_Mac_ATS_Name): Ditto.
+	(FT_New_Face_From_FSSpec): Ditto.
+	(lookup_lwfn_by_fond): Fix wrong comment.
+	Replace `const StringPtr' by more appropriate type
+	`ConstStr255Param'.
+	FSRefMakePathPath always returns UTF8 POSIX pathname in
+	Mach-O, thus HFS pathname support is dropped.
+	(count_faces): Remove HLock and HUnlock which is not
+	required on Mac OS X anymore.
+	(FT_New_Face_From_SFNT): Ditto.
+	(FT_New_Face_From_FOND): Ditto.
+	* builds/mac/ftmac.c: Synchronize to src/base/ftmac.c,
+	except of HFS pathname support and HLock/HUnlock.
+	They are required on classic CFM environment.
+
+2007-06-18  Werner Lemberg  <wl@gnu.org>
 
 	* src/psaux/psobjs.c (ps_parser_skip_PS_token): Remove incorrect
 	assertion.
@@ -10,7 +31,7 @@
 	Handle zero string_size == 0 and string_buf == 0.
 	(t42_parse_encoding): Handle one more error.
 
-2006-06-18  Werner Lemberg  <wl@gnu.org>
+2007-06-18  Werner Lemberg  <wl@gnu.org>
 
 	* src/psaux/psobjs.c (ps_tofixedarray, ps_tocoordarray): Fix exit
 	logic.
@@ -22,7 +43,7 @@
 	* src/cff/cffgload.c (cff_decoder_prepare): Fix change from
 	2007-06-06.
 
-2006-06-17  Werner Lemberg  <wl@gnu.org>
+2007-06-17  Werner Lemberg  <wl@gnu.org>
 
 	* src/tools/ftrandom.c (font_size): New global variable.
 	(TestFace): Use it.
@@ -33,7 +54,7 @@
 	invalid font.
 	(FNT_Load_Glyph): Protect against invalid bitmap width.
 
-2006-06-16  David Turner  <david@freetype.org>
+2007-06-16  David Turner  <david@freetype.org>
 
 	* src/smooth/ftgrays.c (gray_find_cell, gray_set_cell, gray_hline):
 	Prevent integer overflows when rendering very large outlines.
@@ -48,7 +69,7 @@
 	(_iup_worker_interpolate): Check argument ranges.
 	(Ins_IUP): Ignore empty outlines.
 
-2006-06-16  Dmitry Timoshkov  <dmitry@codeweavers.com>
+2007-06-16  Dmitry Timoshkov  <dmitry@codeweavers.com>
 
 	* src/winfonts/winfnt.h: Add necessary structures for PE resource
 	parsing.
@@ -62,17 +83,17 @@
 	* src/winfonts/winfnt.c (fnt_face_get_dll_font): Add support for
 	loading bitmap .fon files in PE format.
 
-2006-06-15  Dmitry Timoshkov  <dmitry@codeweavers.com>
+2007-06-15  Dmitry Timoshkov  <dmitry@codeweavers.com>
 
 	* builds/win32/ftdebug.c: Unify debug level handling with other
 	platforms.
 
-2006-06-14  Dmitry Timoshkov  <dmitry@codeweavers.com>
+2007-06-14  Dmitry Timoshkov  <dmitry@codeweavers.com>
 
 	* builds/win32/ftdebug.c (FT_Message): Send debug output to the
 	console as well as to the debugger.
 
-2006-06-14  Werner Lemberg  <wl@gnu.org>
+2007-06-14  Werner Lemberg  <wl@gnu.org>
 
 	* src/autofit/aflatin.c (af_latin_uniranges): Expand structure to
 	cover all ranges which could possibly be handled by the aflatin
diff --git a/builds/mac/ftmac.c b/builds/mac/ftmac.c
index 45365dc..445ff9a 100644
--- a/builds/mac/ftmac.c
+++ b/builds/mac/ftmac.c
@@ -153,6 +153,10 @@
                             FSSpec*      pathSpec,
                             FT_Long*     face_index )
   {
+    FT_UNUSED( fontName );
+    FT_UNUSED( pathSpec );
+    FT_UNUSED( face_index );
+
     return FT_Err_Unimplemented_Feature;
   }
 
@@ -323,6 +327,11 @@
                                     UInt32       maxPathSize,
                                     FT_Long*     face_index )
   {
+    FT_UNUSED( fontName );
+    FT_UNUSED( path );
+    FT_UNUSED( maxPathSize );
+    FT_UNUSED( face_index );
+
     return FT_Err_Unimplemented_Feature;
   }
 
@@ -358,6 +367,10 @@
                                 FSSpec*      pathSpec,
                                 FT_Long*     face_index )
   {
+    FT_UNUSED( fontName );
+    FT_UNUSED( pathSpec );
+    FT_UNUSED( face_index );
+
     return FT_Err_Unimplemented_Feature;
   }
 
@@ -778,10 +791,10 @@
 
 
   static  FT_Error
-  lookup_lwfn_by_fond( const UInt8*     path_fond,
-                       const StringPtr  base_lwfn,
-                       UInt8*           path_lwfn,
-                       int              path_size )
+  lookup_lwfn_by_fond( const UInt8*      path_fond,
+                       ConstStr255Param  base_lwfn,
+                       UInt8*            path_lwfn,
+                       int               path_size )
   {
 
 #if HAVE_FSREF
@@ -806,7 +819,7 @@
     if ( ft_strlen( (char *)path_lwfn ) + 1 + base_lwfn[0] > path_size )
       return FT_Err_Invalid_Argument;
 
-    /* now we have absolute dirname in lookup_path */
+    /* now we have absolute dirname in path_lwfn */
     if ( path_lwfn[0] == '/' )
       ft_strcat( (char *)path_lwfn, "/" );
     else
@@ -1450,6 +1463,11 @@
 
 #if !HAVE_FSREF
 
+    FT_UNUSED( library );
+    FT_UNUSED( ref );
+    FT_UNUSED( face_index );
+    FT_UNUSED( aface );
+
     return FT_Err_Unimplemented_Feature;
 
 #else
@@ -1533,6 +1551,11 @@
 
 #else
 
+    FT_UNUSED( library );
+    FT_UNUSED( spec );
+    FT_UNUSED( face_index );
+    FT_UNUSED( aface );
+
     return FT_Err_Unimplemented_Feature;
 
 #endif /* HAVE_FSREF, HAVE_FSSPEC */
diff --git a/src/base/ftmac.c b/src/base/ftmac.c
index d696586..fd6201a 100644
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -105,6 +105,10 @@
                             FSSpec*      pathSpec,
                             FT_Long*     face_index )
   {
+    FT_UNUSED( fontName );
+    FT_UNUSED( pathSpec );
+    FT_UNUSED( face_index );
+
     return FT_Err_Unimplemented_Feature;
   }
 
@@ -118,6 +122,12 @@
   FT_ATSFontGetFileReference( ATSFontRef  ats_font_id,
                               FSRef*      ats_font_ref )
   {
+#if __LP64__
+    FT_UNUSED( ats_font_id );
+    FT_UNUSED( ats_font_ref );
+
+    return fnfErr;
+#else
     OSStatus  err;
     FSSpec    spec;
 
@@ -127,6 +137,7 @@
       err = FSpMakeFSRef( &spec, ats_font_ref );
 
     return err;
+#endif
   }
 
 
@@ -204,11 +215,12 @@
                                 FT_Long*     face_index )
   {
 #if __LP64__
+    FT_UNUSED( fontName );
+    FT_UNUSED( pathSpec );
+    FT_UNUSED( face_index );
 
     return FT_Err_Unimplemented_Feature;
-
 #else
-
     FSRef     ref;
     FT_Error  err;
 
@@ -222,7 +234,6 @@
       return FT_Err_Unknown_File_Format;
 
     return FT_Err_Ok;
-
 #endif
   }
 
@@ -447,10 +458,10 @@
 
 
   static  FT_Error
-  lookup_lwfn_by_fond( const UInt8*     path_fond,
-                       const StringPtr  base_lwfn,
-                       UInt8*           path_lwfn,
-                       int              path_size )
+  lookup_lwfn_by_fond( const UInt8*      path_fond,
+                       ConstStr255Param  base_lwfn,
+                       UInt8*            path_lwfn,
+                       size_t            path_size )
   {
     FSRef  ref, par_ref;
     int    dirname_len;
@@ -472,12 +483,8 @@
     if ( ft_strlen( (char *)path_lwfn ) + 1 + base_lwfn[0] > path_size )
       return FT_Err_Invalid_Argument;
 
-    /* now we have absolute dirname in lookup_path */
-    if ( path_lwfn[0] == '/' )
-      ft_strcat( (char *)path_lwfn, "/" );
-    else
-      ft_strcat( (char *)path_lwfn, ":" );
-
+    /* now we have absolute dirname in path_lwfn */
+    ft_strcat( (char *)path_lwfn, "/" );
     dirname_len = ft_strlen( (char *)path_lwfn );
     ft_strcat( (char *)path_lwfn, (char *)base_lwfn + 1 );
     path_lwfn[dirname_len + base_lwfn[0]] = '\0';
@@ -507,7 +514,6 @@
 
     have_sfnt = have_lwfn = 0;
 
-    HLock( fond );
     parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, 0 );
 
     if ( lwfn_file_name[0] )
@@ -523,7 +529,6 @@
     else
       num_faces = count_faces_scalable( *fond );
 
-    HUnlock( fond );
     return num_faces;
   }
 
@@ -810,9 +815,7 @@
       return error;
     }
 
-    HLock( sfnt );
     ft_memcpy( sfnt_data, *sfnt, sfnt_size );
-    HUnlock( sfnt );
     ReleaseResource( sfnt );
 
     is_cff = sfnt_size > 4 && sfnt_data[0] == 'O' &&
@@ -894,9 +897,7 @@
     if ( ResError() != noErr || fond_type != 'FOND' )
       return FT_Err_Invalid_File_Format;
 
-    HLock( fond );
     parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index );
-    HUnlock( fond );
 
     if ( lwfn_file_name[0] )
     {
@@ -1073,6 +1074,14 @@
                            FT_Long        face_index,
                            FT_Face*       aface )
   {
+#if __LP64__
+    FT_UNUSED( library );
+    FT_UNUSED( spec );
+    FT_UNUSED( face_index );
+    FT_UNUSED( aface );
+
+    return FT_Err_Unimplemented_Feature;
+#else
     FSRef  ref;
 
 
@@ -1080,6 +1089,7 @@
       return FT_Err_Invalid_Argument;
     else
       return FT_New_Face_From_FSRef( library, &ref, face_index, aface );
+#endif
   }