diff --git a/ChangeLog b/ChangeLog index 6c0a3b4d..bbb205b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2012-01-14 suzuki toshiya + + [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 Fix PIC build broken by d9145241fe378104ba4c12a42534549faacc92e6. diff --git a/src/base/ftinit.c b/src/base/ftinit.c index 305177a7..6711b6e9 100644 --- a/src/base/ftinit.c +++ b/src/base/ftinit.c @@ -181,9 +181,18 @@ Exit: 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 );