diff options
author | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2012-01-15 01:29:41 +0900 |
---|---|---|
committer | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2012-01-15 01:31:07 +0900 |
commit | 0614febcec522c608a3d4d62cb5eac544af1a4f6 (patch) | |
tree | 0fe1f8dcc68a13295019f86024325ace0559d2c5 | |
parent | 226f3619750ff34ca698304f1d009d0abdcf720e (diff) | |
download | freetype2-0614febcec522c608a3d4d62cb5eac544af1a4f6.tar.gz |
[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.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | src/base/ftinit.c | 13 |
2 files changed, 23 insertions, 2 deletions
@@ -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. diff --git a/src/base/ftinit.c b/src/base/ftinit.c index 305177a7e..6711b6e9c 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 ); |