[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.
This commit is contained in:
suzuki toshiya 2012-01-15 01:29:41 +09:00
Родитель 226f361975
Коммит 0614febcec
2 изменённых файлов: 23 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,15 @@
2012-01-14 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
[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 <mpsuzuki@hiroshima-u.ac.jp>
Fix PIC build broken by d9145241fe378104ba4c12a42534549faacc92e6.

Просмотреть файл

@ -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 );