diff options
author | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2012-01-14 06:40:03 +0900 |
---|---|---|
committer | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2012-01-14 06:40:03 +0900 |
commit | 226f3619750ff34ca698304f1d009d0abdcf720e (patch) | |
tree | 82f98cdd89ce36b79e48c2299949ea529d47d024 | |
parent | 4b733517d77856d192c5929dbbff449b813dc23a (diff) | |
download | freetype2-226f3619750ff34ca698304f1d009d0abdcf720e.tar.gz |
Fix PIC build broken by d9145241fe378104ba4c12a42534549faacc92e6.
Under PIC configuration, FT_{CFF,PSCMAPS,SFNT,TT}_SERVICES_GET
take no arguments but derefer the variable named `library'
internally.
* src/cff/cffdrivr.c (cff_get_interface): Declare `library' and
set it if non-NULL driver is passed.
* src/truetype/ttdriver.c (tt_get_interface): Ditto.
* src/sfnt/sfdriver.c (sfnt_get_interface): Declare `library'
under PIC configuration, and set it if non-NULL module is given.
* src/psnames/psmodule.c (psnames_get_interface): Ditto.
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | src/cff/cffdrivr.c | 20 | ||||
-rw-r--r-- | src/psnames/psmodule.c | 12 | ||||
-rw-r--r-- | src/sfnt/sfdriver.c | 13 | ||||
-rw-r--r-- | src/truetype/ttdriver.c | 18 |
5 files changed, 75 insertions, 4 deletions
@@ -1,5 +1,21 @@ 2012-01-13 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> + Fix PIC build broken by d9145241fe378104ba4c12a42534549faacc92e6. + + Under PIC configuration, FT_{CFF,PSCMAPS,SFNT,TT}_SERVICES_GET + take no arguments but derefer the variable named `library' + internally. + + * src/cff/cffdrivr.c (cff_get_interface): Declare `library' and + set it if non-NULL driver is passed. + * src/truetype/ttdriver.c (tt_get_interface): Ditto. + + * src/sfnt/sfdriver.c (sfnt_get_interface): Declare `library' + under PIC configuration, and set it if non-NULL module is given. + * src/psnames/psmodule.c (psnames_get_interface): Ditto. + +2012-01-13 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> + Make PIC files to include module error headers, to use the error codes with per-module prefix. diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 61ab70589..49453f116 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -599,19 +599,35 @@ cff_get_interface( FT_Module driver, /* CFF_Driver */ const char* module_interface ) { + FT_Library library; FT_Module sfnt; FT_Module_Interface result; + /* FT_CFF_SERVICES_GET derefers `library' in PIC mode */ +#ifdef FT_CONFIG_OPTION_PIC + if ( !driver ) + return NULL; + library = driver->library; + if ( !library ) + return NULL; +#endif + result = ft_service_list_lookup( FT_CFF_SERVICES_GET, module_interface ); if ( result != NULL ) - return result; + return result; + /* `driver' is not yet evaluated in non-PIC mode */ +#ifndef FT_CONFIG_OPTION_PIC if ( !driver ) return NULL; + library = driver->library; + if ( !library ) + return NULL; +#endif /* we pass our request to the `sfnt' module */ - sfnt = FT_Get_Module( driver->library, "sfnt" ); + sfnt = FT_Get_Module( library, "sfnt" ); return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0; } diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c index 752869693..2577382ec 100644 --- a/src/psnames/psmodule.c +++ b/src/psnames/psmodule.c @@ -563,7 +563,19 @@ psnames_get_service( FT_Module module, const char* service_id ) { + /* FT_PSCMAPS_SERVICES_GET derefers `library' in PIC mode */ +#ifdef FT_CONFIG_OPTION_PIC + FT_Library library; + + + if ( !module ) + return NULL; + library = module->library; + if ( !library ) + return NULL; +#else FT_UNUSED( module ); +#endif return ft_service_list_lookup( FT_PSCMAPS_SERVICES_GET, service_id ); } diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 17ef310bd..fadb15b76 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -422,8 +422,19 @@ sfnt_get_interface( FT_Module module, const char* module_interface ) { - FT_UNUSED( module ); + /* FT_SFNT_SERVICES_GET derefers `library' in PIC mode */ +#ifdef FT_CONFIG_OPTION_PIC + FT_Library library; + + if ( !module ) + return NULL; + library = module->library; + if ( !library ) + return NULL; +#else + FT_UNUSED( module ); +#endif return ft_service_list_lookup( FT_SFNT_SERVICES_GET, module_interface ); } diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index b2171976a..c30bec238 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -402,19 +402,35 @@ tt_get_interface( FT_Module driver, /* TT_Driver */ const char* tt_interface ) { + FT_Library library; FT_Module_Interface result; FT_Module sfntd; SFNT_Service sfnt; + + /* FT_TT_SERVICES_GET derefers `library' in PIC mode */ +#ifdef FT_CONFIG_OPTION_PIC + if ( !driver ) + return NULL; + library = driver->library; + if ( !library ) + return NULL; +#endif + result = ft_service_list_lookup( FT_TT_SERVICES_GET, tt_interface ); if ( result != NULL ) return result; +#ifndef FT_CONFIG_OPTION_PIC if ( !driver ) return NULL; + library = driver->library; + if ( !library ) + return NULL; +#endif /* only return the default interface from the SFNT module */ - sfntd = FT_Get_Module( driver->library, "sfnt" ); + sfntd = FT_Get_Module( library, "sfnt" ); if ( sfntd ) { sfnt = (SFNT_Service)( sfntd->clazz->module_interface ); |