shithub: freetype+ttf2subf

Download patch

ref: 0614febcec522c608a3d4d62cb5eac544af1a4f6
parent: 226f3619750ff34ca698304f1d009d0abdcf720e
author: suzuki toshiya <[email protected]>
date: Sat Jan 14 20:29:41 EST 2012

[base] Insert explict cast for GCC 4.6 in PIC mode.

* src/base/ftinit.c (FT_Add_Default_Modules): Under PIC
configuration, FT_DEFAULT_MODULES_GET returns
FT_Module_Class** pointer, GCC 4.6 warns that
const FT_Module_Class* const* variable is warned as
inappropriate to store it.  To calm it, explicit cast is
inserted.  Also `library' is checked to prevent the NULL
pointer dereference in FT_DEFAULT_MODULES_GET.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-01-14  suzuki toshiya  <[email protected]>
+
+	[base] Insert explict cast for GCC 4.6 in PIC mode.
+
+	* src/base/ftinit.c (FT_Add_Default_Modules): Under PIC
+	configuration, FT_DEFAULT_MODULES_GET returns
+	FT_Module_Class** pointer, GCC 4.6 warns that
+	const FT_Module_Class* const* variable is warned as
+	inappropriate to store it.  To calm it, explicit cast is
+	inserted.  Also `library' is checked to prevent the NULL
+	pointer dereference in FT_DEFAULT_MODULES_GET.
+
 2012-01-13  suzuki toshiya  <[email protected]>
 
 	Fix PIC build broken by d9145241fe378104ba4c12a42534549faacc92e6.
--- a/src/base/ftinit.c
+++ b/src/base/ftinit.c
@@ -181,9 +181,18 @@
     const FT_Module_Class* const*  cur;
 
 
-    /* test for valid `library' delayed to FT_Add_Module() */
+    /* FT_DEFAULT_MODULES_GET derefers `library' in PIC mode */
+#ifdef FT_CONFIG_OPTION_PIC
+    if ( !library )
+      return;
+#endif
 
-    cur = FT_DEFAULT_MODULES_GET;
+    /* GCC 4.6 warns the type difference:
+     *   FT_Module_Class** != const FT_Module_Class* const*
+     */
+    cur = ( const FT_Module_Class* const* )FT_DEFAULT_MODULES_GET;
+
+    /* test for valid `library' delayed to FT_Add_Module() */
     while ( *cur )
     {
       error = FT_Add_Module( library, *cur );