diff --git a/src/base/basepic.c b/src/base/basepic.c index 5268e7c6..0af770eb 100644 --- a/src/base/basepic.c +++ b/src/base/basepic.c @@ -75,7 +75,7 @@ /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_ALLOC( container, sizeof ( *container ) ) ) return error; FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->base = container; @@ -96,13 +96,12 @@ (ft_raccess_guess_rec*)&container->ft_raccess_guess_table ); #endif -Exit: - if( error ) + Exit: + if ( error ) ft_base_pic_free( library ); return error; } - #endif /* FT_CONFIG_OPTION_PIC */ diff --git a/src/base/basepic.h b/src/base/basepic.h index bf90bef0..329d7c8f 100644 --- a/src/base/basepic.h +++ b/src/base/basepic.h @@ -25,11 +25,13 @@ FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H #ifndef FT_CONFIG_OPTION_PIC -#define FT_OUTLINE_GLYPH_CLASS_GET &ft_outline_glyph_class -#define FT_BITMAP_GLYPH_CLASS_GET &ft_bitmap_glyph_class -#define FT_DEFAULT_MODULES_GET ft_default_modules + +#define FT_OUTLINE_GLYPH_CLASS_GET &ft_outline_glyph_class +#define FT_BITMAP_GLYPH_CLASS_GET &ft_bitmap_glyph_class +#define FT_DEFAULT_MODULES_GET ft_default_modules + #ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK -#define FT_RACCESS_GUESS_TABLE_GET ft_raccess_guess_table +#define FT_RACCESS_GUESS_TABLE_GET ft_raccess_guess_table #endif #else /* FT_CONFIG_OPTION_PIC */ @@ -41,25 +43,35 @@ FT_BEGIN_HEADER #endif - typedef struct BasePIC_ + typedef struct BasePIC_ { - FT_Module_Class** default_module_classes; - FT_Glyph_Class ft_outline_glyph_class; - FT_Glyph_Class ft_bitmap_glyph_class; + FT_Module_Class** default_module_classes; + FT_Glyph_Class ft_outline_glyph_class; + FT_Glyph_Class ft_bitmap_glyph_class; + #ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK - ft_raccess_guess_rec ft_raccess_guess_table[FT_RACCESS_N_RULES]; + ft_raccess_guess_rec ft_raccess_guess_table[FT_RACCESS_N_RULES]; #endif + } BasePIC; -#define GET_PIC(lib) ((BasePIC*)((lib)->pic_container.base)) -#define FT_OUTLINE_GLYPH_CLASS_GET (&GET_PIC(library)->ft_outline_glyph_class) -#define FT_BITMAP_GLYPH_CLASS_GET (&GET_PIC(library)->ft_bitmap_glyph_class) -#define FT_DEFAULT_MODULES_GET (GET_PIC(library)->default_module_classes) + +#define GET_PIC( lib ) ( (BasePIC*)( (lib)->pic_container.base ) ) + +#define FT_OUTLINE_GLYPH_CLASS_GET \ + ( &GET_PIC( library )->ft_outline_glyph_class ) +#define FT_BITMAP_GLYPH_CLASS_GET \ + ( &GET_PIC( library )->ft_bitmap_glyph_class ) +#define FT_DEFAULT_MODULES_GET \ + ( GET_PIC( library )->default_module_classes ) + #ifdef FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK -#define FT_RACCESS_GUESS_TABLE_GET (GET_PIC(library)->ft_raccess_guess_table) +#define FT_RACCESS_GUESS_TABLE_GET \ + ( GET_PIC( library )->ft_raccess_guess_table ) #endif - /* see basepic.c for the implementation. */ + + /* see basepic.c for the implementation */ void ft_base_pic_free( FT_Library library ); @@ -67,7 +79,8 @@ FT_BEGIN_HEADER ft_base_pic_init( FT_Library library ); #endif /* FT_CONFIG_OPTION_PIC */ - /* */ + + /* */ FT_END_HEADER diff --git a/src/cff/cffpic.c b/src/cff/cffpic.c index e2c52cd2..f22e4f0d 100644 --- a/src/cff/cffpic.c +++ b/src/cff/cffpic.c @@ -23,65 +23,51 @@ #include "cffpic.h" #include "cfferrs.h" + #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from cffdrivr.c */ FT_Error - FT_Create_Class_cff_services( - FT_Library library, - FT_ServiceDescRec** output_class ); - + FT_Create_Class_cff_services( FT_Library library, + FT_ServiceDescRec** output_class ); void - FT_Destroy_Class_cff_services( - FT_Library library, - FT_ServiceDescRec* clazz ); - + FT_Destroy_Class_cff_services( FT_Library library, + FT_ServiceDescRec* clazz ); void - FT_Init_Class_cff_service_ps_info( - FT_Library library, - FT_Service_PsInfoRec* clazz ); - + FT_Init_Class_cff_service_ps_info( FT_Library library, + FT_Service_PsInfoRec* clazz ); void - FT_Init_Class_cff_service_glyph_dict( - FT_Library library, - FT_Service_GlyphDictRec* clazz ); - + FT_Init_Class_cff_service_glyph_dict( FT_Library library, + FT_Service_GlyphDictRec* clazz ); void - FT_Init_Class_cff_service_ps_name( - FT_Library library, - FT_Service_PsFontNameRec* clazz ); - + FT_Init_Class_cff_service_ps_name( FT_Library library, + FT_Service_PsFontNameRec* clazz ); void - FT_Init_Class_cff_service_get_cmap_info( - FT_Library library, - FT_Service_TTCMapsRec* clazz ); - + FT_Init_Class_cff_service_get_cmap_info( FT_Library library, + FT_Service_TTCMapsRec* clazz ); void - FT_Init_Class_cff_service_cid_info( - FT_Library library, - FT_Service_CIDRec* clazz ); + FT_Init_Class_cff_service_cid_info( FT_Library library, + FT_Service_CIDRec* clazz ); /* forward declaration of PIC init functions from cffparse.c */ FT_Error - FT_Create_Class_cff_field_handlers( - FT_Library library, - CFF_Field_Handler** output_class ); - + FT_Create_Class_cff_field_handlers( FT_Library library, + CFF_Field_Handler** output_class ); void - FT_Destroy_Class_cff_field_handlers( - FT_Library library, - CFF_Field_Handler* clazz ); + FT_Destroy_Class_cff_field_handlers( FT_Library library, + CFF_Field_Handler* clazz ); + void cff_driver_class_pic_free( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; - FT_Memory memory = library->memory; + FT_Memory memory = library->memory; if ( pic_container->cff ) { - CffModulePIC* container = ( CffModulePIC* )pic_container->cff; + CffModulePIC* container = (CffModulePIC*)pic_container->cff; if ( container->cff_services ) @@ -113,15 +99,18 @@ FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->cff = container; - /* initialize pointer table - this is how the module usually expects this data */ + /* initialize pointer table - */ + /* this is how the module usually expects this data */ error = FT_Create_Class_cff_services( library, &container->cff_services ); if ( error ) goto Exit; + error = FT_Create_Class_cff_field_handlers( library, &container->cff_field_handlers ); if ( error ) goto Exit; + FT_Init_Class_cff_service_ps_info( library, &container->cff_service_ps_info ); FT_Init_Class_cff_service_glyph_dict( @@ -136,7 +125,8 @@ library, &container->cff_cmap_encoding_class_rec ); FT_Init_Class_cff_cmap_unicode_class_rec( library, &container->cff_cmap_unicode_class_rec ); -Exit: + + Exit: if ( error ) cff_driver_class_pic_free( library ); return error; diff --git a/src/cff/cffpic.h b/src/cff/cffpic.h index b27f093d..cfb27c7b 100644 --- a/src/cff/cffpic.h +++ b/src/cff/cffpic.h @@ -62,26 +62,26 @@ FT_BEGIN_HEADER } CffModulePIC; -#define GET_PIC( lib ) \ - ( (CffModulePIC*)((lib)->pic_container.cff) ) +#define GET_PIC( lib ) \ + ( (CffModulePIC*)( (lib)->pic_container.cff ) ) -#define CFF_SERVICE_PS_INFO_GET \ +#define CFF_SERVICE_PS_INFO_GET \ ( GET_PIC( library )->cff_service_ps_info ) -#define CFF_SERVICE_GLYPH_DICT_GET \ +#define CFF_SERVICE_GLYPH_DICT_GET \ ( GET_PIC( library )->cff_service_glyph_dict ) -#define CFF_SERVICE_PS_NAME_GET \ +#define CFF_SERVICE_PS_NAME_GET \ ( GET_PIC( library )->cff_service_ps_name ) -#define CFF_SERVICE_GET_CMAP_INFO_GET \ +#define CFF_SERVICE_GET_CMAP_INFO_GET \ ( GET_PIC( library )->cff_service_get_cmap_info ) -#define CFF_SERVICE_CID_INFO_GET \ +#define CFF_SERVICE_CID_INFO_GET \ ( GET_PIC( library )->cff_service_cid_info ) -#define CFF_SERVICES_GET \ +#define CFF_SERVICES_GET \ ( GET_PIC( library )->cff_services ) -#define CFF_CMAP_ENCODING_CLASS_REC_GET \ +#define CFF_CMAP_ENCODING_CLASS_REC_GET \ ( GET_PIC( library )->cff_cmap_encoding_class_rec ) -#define CFF_CMAP_UNICODE_CLASS_REC_GET \ +#define CFF_CMAP_UNICODE_CLASS_REC_GET \ ( GET_PIC( library )->cff_cmap_unicode_class_rec ) -#define CFF_FIELD_HANDLERS_GET \ +#define CFF_FIELD_HANDLERS_GET \ ( GET_PIC( library )->cff_field_handlers ) /* see cffpic.c for the implementation */ diff --git a/src/pshinter/pshpic.c b/src/pshinter/pshpic.c index a18d21f2..568f4ac4 100644 --- a/src/pshinter/pshpic.c +++ b/src/pshinter/pshpic.c @@ -55,7 +55,7 @@ /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_ALLOC( container, sizeof ( *container ) ) ) return error; FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->pshinter = container; @@ -64,8 +64,9 @@ FT_Init_Class_pshinter_interface( library, &container->pshinter_interface ); - if( error ) + if ( error ) pshinter_module_class_pic_free( library ); + return error; } diff --git a/src/psnames/pspic.c b/src/psnames/pspic.c index 0c7b37ac..3820f65a 100644 --- a/src/psnames/pspic.c +++ b/src/psnames/pspic.c @@ -70,7 +70,7 @@ /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_ALLOC( container, sizeof ( *container ) ) ) return error; FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->psnames = container; diff --git a/src/raster/rastpic.h b/src/raster/rastpic.h index 7822a24b..e0ddba62 100644 --- a/src/raster/rastpic.h +++ b/src/raster/rastpic.h @@ -24,19 +24,25 @@ FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H + #ifndef FT_CONFIG_OPTION_PIC -#define FT_STANDARD_RASTER_GET ft_standard_raster + +#define FT_STANDARD_RASTER_GET ft_standard_raster #else /* FT_CONFIG_OPTION_PIC */ - typedef struct RasterPIC_ + typedef struct RasterPIC_ { - int ref_count; - FT_Raster_Funcs ft_standard_raster; + int ref_count; + FT_Raster_Funcs ft_standard_raster; + } RasterPIC; -#define GET_PIC(lib) ((RasterPIC*)((lib)->pic_container.raster)) -#define FT_STANDARD_RASTER_GET (GET_PIC(library)->ft_standard_raster) + +#define GET_PIC( lib ) \ + ( (RasterPIC*)( (lib)->pic_container.raster ) ) +#define FT_STANDARD_RASTER_GET ( GET_PIC( library )->ft_standard_raster ) + /* see rastpic.c for the implementation */ void diff --git a/src/sfnt/sfntpic.c b/src/sfnt/sfntpic.c index 75bac9da..b3fb24b3 100644 --- a/src/sfnt/sfntpic.c +++ b/src/sfnt/sfntpic.c @@ -29,42 +29,35 @@ FT_Error FT_Create_Class_sfnt_services( FT_Library library, FT_ServiceDescRec** output_class ); - void FT_Destroy_Class_sfnt_services( FT_Library library, FT_ServiceDescRec* clazz ); - void FT_Init_Class_sfnt_service_bdf( FT_Service_BDFRec* clazz ); - void FT_Init_Class_sfnt_interface( FT_Library library, SFNT_Interface* clazz ); - void FT_Init_Class_sfnt_service_glyph_dict( FT_Library library, FT_Service_GlyphDictRec* clazz ); - void FT_Init_Class_sfnt_service_ps_name( FT_Library library, FT_Service_PsFontNameRec* clazz ); - void FT_Init_Class_tt_service_get_cmap_info( FT_Library library, FT_Service_TTCMapsRec* clazz ); - void FT_Init_Class_sfnt_service_sfnt_table( FT_Service_SFNT_TableRec* clazz ); + /* forward declaration of PIC init functions from ttcmap.c */ FT_Error FT_Create_Class_tt_cmap_classes( FT_Library library, TT_CMap_Class** output_class ); - void FT_Destroy_Class_tt_cmap_classes( FT_Library library, TT_CMap_Class* clazz ); @@ -99,7 +92,7 @@ FT_Error - sfnt_module_class_pic_init( FT_Library library ) + sfnt_module_class_pic_init( FT_Library library ) { FT_PIC_Container* pic_container = &library->pic_container; FT_Error error = FT_Err_Ok; @@ -108,7 +101,7 @@ /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_ALLOC( container, sizeof ( *container ) ) ) return error; FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->sfnt = container; diff --git a/src/sfnt/sfntpic.h b/src/sfnt/sfntpic.h index 35d0f449..b09a9141 100644 --- a/src/sfnt/sfntpic.h +++ b/src/sfnt/sfntpic.h @@ -72,26 +72,26 @@ FT_BEGIN_HEADER } sfntModulePIC; -#define GET_PIC( lib ) \ - ( (sfntModulePIC*)((lib)->pic_container.sfnt) ) +#define GET_PIC( lib ) \ + ( (sfntModulePIC*)( (lib)->pic_container.sfnt ) ) -#define SFNT_SERVICES_GET \ +#define SFNT_SERVICES_GET \ ( GET_PIC( library )->sfnt_services ) -#define SFNT_SERVICE_GLYPH_DICT_GET \ +#define SFNT_SERVICE_GLYPH_DICT_GET \ ( GET_PIC( library )->sfnt_service_glyph_dict ) -#define SFNT_SERVICE_PS_NAME_GET \ +#define SFNT_SERVICE_PS_NAME_GET \ ( GET_PIC( library )->sfnt_service_ps_name ) -#define TT_SERVICE_CMAP_INFO_GET \ +#define TT_SERVICE_CMAP_INFO_GET \ ( GET_PIC( library )->tt_service_get_cmap_info ) -#define SFNT_SERVICES_GET \ +#define SFNT_SERVICES_GET \ ( GET_PIC( library )->sfnt_services ) -#define TT_CMAP_CLASSES_GET \ +#define TT_CMAP_CLASSES_GET \ ( GET_PIC( library )->tt_cmap_classes ) -#define SFNT_SERVICE_SFNT_TABLE_GET \ +#define SFNT_SERVICE_SFNT_TABLE_GET \ ( GET_PIC( library )->sfnt_service_sfnt_table ) -#define SFNT_SERVICE_BDF_GET \ +#define SFNT_SERVICE_BDF_GET \ ( GET_PIC( library )->sfnt_service_bdf ) -#define SFNT_INTERFACE_GET \ +#define SFNT_INTERFACE_GET \ ( GET_PIC( library )->sfnt_interface ) diff --git a/src/smooth/ftspic.h b/src/smooth/ftspic.h index 4686f5e3..334b51c3 100644 --- a/src/smooth/ftspic.h +++ b/src/smooth/ftspic.h @@ -25,18 +25,23 @@ FT_BEGIN_HEADER #include FT_INTERNAL_PIC_H #ifndef FT_CONFIG_OPTION_PIC -#define FT_GRAYS_RASTER_GET ft_grays_raster + +#define FT_GRAYS_RASTER_GET ft_grays_raster #else /* FT_CONFIG_OPTION_PIC */ - typedef struct SmoothPIC_ + typedef struct SmoothPIC_ { - int ref_count; - FT_Raster_Funcs ft_grays_raster; + int ref_count; + FT_Raster_Funcs ft_grays_raster; + } SmoothPIC; -#define GET_PIC(lib) ((SmoothPIC*)((lib)->pic_container.smooth)) -#define FT_GRAYS_RASTER_GET (GET_PIC(library)->ft_grays_raster) + +#define GET_PIC( lib ) \ + ( (SmoothPIC*)( (lib)->pic_container.smooth ) ) +#define FT_GRAYS_RASTER_GET ( GET_PIC( library )->ft_grays_raster ) + /* see ftspic.c for the implementation */ void diff --git a/src/truetype/ttpic.c b/src/truetype/ttpic.c index ca6d11c5..edefae72 100644 --- a/src/truetype/ttpic.c +++ b/src/truetype/ttpic.c @@ -22,21 +22,19 @@ #include "ttpic.h" #include "tterrors.h" + #ifdef FT_CONFIG_OPTION_PIC /* forward declaration of PIC init functions from ttdriver.c */ FT_Error FT_Create_Class_tt_services( FT_Library library, FT_ServiceDescRec** output_class ); - void FT_Destroy_Class_tt_services( FT_Library library, FT_ServiceDescRec* clazz ); - void FT_Init_Class_tt_service_gx_multi_masters( FT_Service_MultiMastersRec* sv_mm ); - void FT_Init_Class_tt_service_truetype_glyf( FT_Service_TTGlyfRec* sv_ttglyf ); @@ -73,7 +71,7 @@ /* allocate pointer, clear and set global container pointer */ - if ( FT_ALLOC ( container, sizeof ( *container ) ) ) + if ( FT_ALLOC( container, sizeof ( *container ) ) ) return error; FT_MEM_SET( container, 0, sizeof ( *container ) ); pic_container->truetype = container; @@ -91,7 +89,7 @@ FT_Init_Class_tt_service_truetype_glyf( &container->tt_service_truetype_glyf ); -Exit: + Exit: if ( error ) tt_driver_class_pic_free( library ); return error;