diff --git a/ChangeLog b/ChangeLog index fa9e335e8..4c04559cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,66 @@ +2002-03-07 Werner Lemberg + + * src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new, + ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free, + ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug, + FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings. + * src/base/ftcalc.c (FT_MulFix): Ditto. + * src/cff/cffdrivr.c (cff_get_name_index): Ditto. + * src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init, + CFF_GlyphSlot_Init): Ditto. + * src/cid/cidobjs.c (CID_GlyphSlot_Init, + CID_Size_Get_Globals_Funcs): Ditto. + * src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init): + Ditto. + * src/pshinter/pshmod.c (pshinter_interface): Use `static const'. + * src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused + variables. + + * include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed + to... + (T1_Builder_FuncsRec): This. + (T1_Builder_Funcs): New typedef. + (PSAux_Interface): Remove compiler warnings. + * src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h + (t1_builder_funcs): Updated. + + * src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ... + (PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines. + (PSH_AlignmentRec): Updated. + + * include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix + typo. + * include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto. + * src/base/ftstream (FT_Get_Char): Rename to... + (FT_Stream_Get_Char): This. + + * src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is + a built-in function in gcc, causing warning messages with gcc 3.0. + * src/autohint/ahglyph.c (ah_outline_load): Ditto. + * src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto. + * src/cache/ftcmanag.c (ftc_family_table_alloc, + ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache): + Ditto. + * src/cff/cffload.c (cff_new_index, cff_done_index, + cff_explicit_index, CFF_Access_Element, CFF_Forget_Element, + CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font, + CFF_Done_Font): Ditto. + * src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto. + * src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto. + * src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit, + ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3, + * src/pshinter/pshalgo1.c (psh1_hint_table_record, + psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto. + * src/pshinter/pshalgo2.c (psh2_hint_table_record, + psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto. + * src/sfnt/ttpost.c (Load_Format_20, Load_Format_25, + TT_Get_PS_Name): Ditto. + * src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics, + load_truetype_glyph): Ditto. + * src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto. + * src/type1/t1afm.c (T1_Get_Kerning): Ditto. + * include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto. + 2002-03-06 David Turner * src/type1/t1objs.c (T1_Face_Init), src/cid/cidobjs.c (CID_Face_Init): @@ -11,7 +74,6 @@ src/base/ftobjs.c, src/base/ftinit.c: adding the new FT_Library_Version API to return the library's current version in dynamic links. - 2002-03-06 Werner Lemberg * src/pshinter/pshglob.h (PSH_DimensionRec): s/std/stdw/. diff --git a/include/freetype/cache/ftcmanag.h b/include/freetype/cache/ftcmanag.h index da6ce6242..97c77591b 100644 --- a/include/freetype/cache/ftcmanag.h +++ b/include/freetype/cache/ftcmanag.h @@ -118,7 +118,7 @@ FT_BEGIN_HEADER FT_EXPORT( void ) ftc_family_table_free( FTC_FamilyTable table, - FT_UInt index ); + FT_UInt idx ); /*************************************************************************/ diff --git a/include/freetype/internal/ftgloadr.h b/include/freetype/internal/ftgloadr.h index ac3dcfb4e..1207c6ee3 100644 --- a/include/freetype/internal/ftgloadr.h +++ b/include/freetype/internal/ftgloadr.h @@ -50,7 +50,7 @@ FT_BEGIN_HEADER }; - typedef struct FT_SubGlyph_ + struct FT_SubGlyph_ { FT_Int index; FT_UShort flags; diff --git a/include/freetype/internal/ftstream.h b/include/freetype/internal/ftstream.h index e5f029b0d..6bfb1b03d 100644 --- a/include/freetype/internal/ftstream.h +++ b/include/freetype/internal/ftstream.h @@ -265,8 +265,8 @@ FT_BEGIN_HEADER /* */ #define FT_GET_MACRO( func, type ) ( (type)func( stream ) ) -#define GET_Char() FT_GET_MACRO( FT_Get_Char, FT_Char ) -#define GET_Byte() FT_GET_MACRO( FT_Get_Char, FT_Byte ) +#define GET_Char() FT_GET_MACRO( FT_Stream_Get_Char, FT_Char ) +#define GET_Byte() FT_GET_MACRO( FT_Stream_Get_Char, FT_Byte ) #define GET_Short() FT_GET_MACRO( FT_Stream_Get_Short, FT_Short ) #define GET_UShort() FT_GET_MACRO( FT_Stream_Get_Short, FT_UShort ) #define GET_Offset() FT_GET_MACRO( FT_Stream_Get_Offset, FT_Long ) diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index ef144abbd..a104fd5c4 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -38,9 +38,8 @@ FT_BEGIN_HEADER /*************************************************************************/ - typedef struct PS_TableRec_* PS_Table; - - typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs; + typedef struct PS_TableRec_* PS_Table; + typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs; /*************************************************************************/ /* */ @@ -433,7 +432,9 @@ FT_BEGIN_HEADER (*T1_Builder_Close_Contour_Func)( T1_Builder* builder ); - typedef struct T1_Builder_Funcs_ + typedef const struct T1_Builder_FuncsRec_* T1_Builder_Funcs; + + typedef struct T1_Builder_FuncsRec_ { void (*init)( T1_Builder* builder, @@ -452,8 +453,7 @@ FT_BEGIN_HEADER T1_Builder_Start_Point_Func start_point; T1_Builder_Close_Contour_Func close_contour; - } T1_Builder_Funcs; - + } T1_Builder_FuncsRec; /*************************************************************************/ @@ -514,37 +514,37 @@ FT_BEGIN_HEADER /* */ struct T1_Builder_ { - FT_Memory memory; - FT_Face face; - FT_GlyphSlot glyph; - FT_GlyphLoader loader; - FT_Outline* base; - FT_Outline* current; + FT_Memory memory; + FT_Face face; + FT_GlyphSlot glyph; + FT_GlyphLoader loader; + FT_Outline* base; + FT_Outline* current; - FT_Vector last; + FT_Vector last; - FT_Fixed scale_x; - FT_Fixed scale_y; + FT_Fixed scale_x; + FT_Fixed scale_y; - FT_Pos pos_x; - FT_Pos pos_y; + FT_Pos pos_x; + FT_Pos pos_y; - FT_Vector left_bearing; - FT_Vector advance; + FT_Vector left_bearing; + FT_Vector advance; - FT_BBox bbox; /* bounding box */ - FT_Bool path_begun; - FT_Bool load_points; - FT_Bool no_recurse; - FT_Bool shift; + FT_BBox bbox; /* bounding box */ + FT_Bool path_begun; + FT_Bool load_points; + FT_Bool no_recurse; + FT_Bool shift; - FT_Error error; /* only used for memory errors */ - FT_Bool metrics_only; + FT_Error error; /* only used for memory errors */ + FT_Bool metrics_only; - void* hints_funcs; /* hinter-specific */ - void* hints_globals; /* hinter-specific */ + void* hints_funcs; /* hinter-specific */ + void* hints_globals; /* hinter-specific */ - T1_Builder_Funcs funcs; + T1_Builder_FuncsRec funcs; }; @@ -661,10 +661,10 @@ FT_BEGIN_HEADER typedef struct PSAux_Interface_ { - const PS_Table_Funcs ps_table_funcs; - const PS_Parser_Funcs ps_parser_funcs; - const T1_Builder_Funcs* t1_builder_funcs; - const T1_Decoder_Funcs t1_decoder_funcs; + const PS_Table_FuncsRec* ps_table_funcs; + const PS_Parser_FuncsRec* ps_parser_funcs; + const T1_Builder_FuncsRec* t1_builder_funcs; + const T1_Decoder_FuncsRec* t1_decoder_funcs; void (*t1_decrypt)( FT_Byte* buffer, diff --git a/src/autohint/ahglobal.c b/src/autohint/ahglobal.c index cd123e3a7..0619bb593 100644 --- a/src/autohint/ahglobal.c +++ b/src/autohint/ahglobal.c @@ -158,7 +158,7 @@ /* segment; we first need to find in which contour the extremum */ /* lies, then see its previous and next points */ { - FT_Int index = (FT_Int)( extremum - points ); + FT_Int idx = (FT_Int)( extremum - points ); FT_Int n; FT_Int first, last, prev, next, end; FT_Pos dist; @@ -170,7 +170,7 @@ for ( n = 0; n < glyph->outline.n_contours; n++ ) { end = glyph->outline.contours[n]; - if ( end >= index ) + if ( end >= idx ) { last = end; break; @@ -185,7 +185,7 @@ /* now look for the previous and next points that are not on the */ /* same Y coordinate. Threshold the `closeness'... */ - prev = index; + prev = idx; next = prev; do @@ -199,7 +199,7 @@ if ( dist < -5 || dist > 5 ) break; - } while ( prev != index ); + } while ( prev != idx ); do { @@ -212,7 +212,7 @@ if ( dist < -5 || dist > 5 ) break; - } while ( next != index ); + } while ( next != idx ); /* now, set the `round' flag depending on the segment's kind */ round = FT_BOOL( diff --git a/src/autohint/ahglyph.c b/src/autohint/ahglyph.c index 56e7ff757..65a42a8ac 100644 --- a/src/autohint/ahglyph.c +++ b/src/autohint/ahglyph.c @@ -552,13 +552,13 @@ AH_Point** contour = outline->contours; AH_Point** contour_limit = contour + outline->num_contours; short* end = source->contours; - short index = 0; + short idx = 0; for ( ; contour < contour_limit; contour++, end++ ) { - contour[0] = points + index; - index = (short)( end[0] + 1 ); + contour[0] = points + idx; + idx = (short)( end[0] + 1 ); } } diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index 8f024673b..f02b2f116 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -427,7 +427,7 @@ ( ( al * ( ub & 0xFFFF ) + 0x8000 ) >> 16 ); } - return ( s < 0 ? -(FT_Long)ua : ua ); + return ( s < 0 ? -(FT_Long)ua : (FT_Long)ua ); } diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c index 324d84814..be2d9109b 100644 --- a/src/base/ftdbgmem.c +++ b/src/base/ftdbgmem.c @@ -199,7 +199,8 @@ FT_ULong i; - new_buckets = ft_mem_table_alloc( table, + new_buckets = (FT_MemNode *) + ft_mem_table_alloc( table, new_size * sizeof ( FT_MemNode ) ); if ( new_buckets == NULL ) return; @@ -241,7 +242,7 @@ FT_MemTable table; - table = memory->alloc( memory, sizeof ( *table ) ); + table = (FT_MemTable)memory->alloc( memory, sizeof ( *table ) ); if ( table == NULL ) goto Exit; @@ -258,7 +259,8 @@ table->realloc = memory->realloc; table->free = memory->free; - table->buckets = memory->alloc( memory, + table->buckets = (FT_MemNode *) + memory->alloc( memory, table->size * sizeof ( FT_MemNode ) ); if ( table->buckets ) MEM_Set( table->buckets, 0, sizeof ( FT_MemNode ) * table->size ); @@ -395,7 +397,7 @@ } /* we need to create a new node in this table */ - node = ft_mem_table_alloc( table, sizeof ( *node ) ); + node = (FT_MemNode)ft_mem_table_alloc( table, sizeof ( *node ) ); if ( node == NULL ) ft_mem_debug_panic( "not enough memory to run memory tests" ); @@ -469,14 +471,14 @@ ft_mem_debug_alloc( FT_Memory memory, FT_Long size ) { - FT_MemTable table = memory->user; + FT_MemTable table = (FT_MemTable)memory->user; FT_Byte* block; if ( size <= 0 ) ft_mem_debug_panic( "negative block size allocation (%ld)", size ); - block = ft_mem_table_alloc( table, size ); + block = (FT_Byte *)ft_mem_table_alloc( table, size ); if ( block ) ft_mem_table_set( table, block, (FT_ULong)size ); @@ -491,7 +493,7 @@ ft_mem_debug_free( FT_Memory memory, FT_Pointer block ) { - FT_MemTable table = memory->user; + FT_MemTable table = (FT_MemTable)memory->user; if ( block == NULL ) @@ -513,7 +515,7 @@ FT_Long new_size, FT_Pointer block ) { - FT_MemTable table = memory->user; + FT_MemTable table = (FT_MemTable)memory->user; FT_MemNode node, *pnode; FT_Pointer new_block; @@ -589,7 +591,7 @@ extern void ft_mem_debug_done( FT_Memory memory ) { - FT_MemTable table = memory->user; + FT_MemTable table = (FT_MemTable)memory->user; if ( table ) @@ -611,7 +613,7 @@ const char* file_name, FT_Long line_no ) { - FT_MemTable table = memory->user; + FT_MemTable table = (FT_MemTable)memory->user; if ( table ) @@ -631,7 +633,7 @@ const char* file_name, FT_Long line_no ) { - FT_MemTable table = memory->user; + FT_MemTable table = (FT_MemTable)memory->user; if ( table ) @@ -649,7 +651,7 @@ const char* file_name, FT_Long line_no ) { - FT_MemTable table = memory->user; + FT_MemTable table = (FT_MemTable)memory->user; if ( table ) @@ -657,7 +659,7 @@ table->file_name = file_name; table->line_no = line_no; } - FT_Free( memory, block ); + FT_Free( memory, (void **)block ); } diff --git a/src/base/ftnames.c b/src/base/ftnames.c index d38d2d507..43c6cf103 100644 --- a/src/base/ftnames.c +++ b/src/base/ftnames.c @@ -40,7 +40,7 @@ FT_EXPORT_DEF( FT_Error ) FT_Get_Sfnt_Name( FT_Face face, - FT_UInt index, + FT_UInt idx, FT_SfntName *aname ) { FT_Error error = FT_Err_Invalid_Argument; @@ -51,9 +51,9 @@ TT_Face ttface = (TT_Face)face; - if ( index < (FT_UInt)ttface->num_names ) + if ( idx < (FT_UInt)ttface->num_names ) { - TT_NameRec* name = ttface->name_table.names + index; + TT_NameRec* name = ttface->name_table.names + idx; aname->platform_id = name->platformID; diff --git a/src/base/ftstream.c b/src/base/ftstream.c index 459bf8342..cda168c7e 100644 --- a/src/base/ftstream.c +++ b/src/base/ftstream.c @@ -289,7 +289,7 @@ FT_BASE_DEF( FT_Char ) - FT_Get_Char( FT_Stream stream ) + FT_Stream_Get_Char( FT_Stream stream ) { FT_Char result; diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c index e72c89fc2..9219f6459 100644 --- a/src/cache/ftccmap.c +++ b/src/cache/ftccmap.c @@ -177,27 +177,27 @@ if ( !error ) { FT_UInt count = face->num_charmaps; - FT_UInt index = count; + FT_UInt idx = count; FT_CharMap* cur = face->charmaps; switch ( desc->type ) { case FTC_CMAP_BY_INDEX: - index = desc->u.index; - hash = index * 33; + idx = desc->u.index; + hash = idx * 33; break; case FTC_CMAP_BY_ENCODING: - for ( index = 0; index < count; index++, cur++ ) + for ( idx = 0; idx < count; idx++, cur++ ) if ( cur[0]->encoding == desc->u.encoding ) break; - hash = index * 67; + hash = idx * 67; break; case FTC_CMAP_BY_ID: - for ( index = 0; index < count; index++, cur++ ) + for ( idx = 0; idx < count; idx++, cur++ ) { if ( (FT_UInt)cur[0]->platform_id == desc->u.id.platform && (FT_UInt)cur[0]->encoding_id == desc->u.id.encoding ) @@ -212,11 +212,11 @@ ; } - if ( index >= count ) + if ( idx >= count ) goto Bad_Descriptor; /* compute hash value, both in family and query */ - cfam->index = index; + cfam->index = idx; cfam->hash = hash ^ FTC_FACE_ID_HASH( desc->face_id ); FTC_QUERY( cquery )->hash = FTC_CMAP_HASH( cfam, cquery ); diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c index efc74c8b9..9d100b035 100644 --- a/src/cache/ftcmanag.c +++ b/src/cache/ftcmanag.c @@ -356,7 +356,7 @@ if ( table->free == FTC_FAMILY_ENTRY_NONE && table->count >= table->size ) { FT_UInt old_size = table->size; - FT_UInt new_size, index; + FT_UInt new_size, idx; if ( old_size == 0 ) @@ -379,14 +379,14 @@ entry = table->entries + old_size; table->free = old_size; - for ( index = old_size; index + 1 < new_size; index++, entry++ ) + for ( idx = old_size; idx + 1 < new_size; idx++, entry++ ) { - entry->link = index + 1; - entry->index = index; + entry->link = idx + 1; + entry->index = idx; } entry->link = FTC_FAMILY_ENTRY_NONE; - entry->index = index; + entry->index = idx; } if ( table->free != FTC_FAMILY_ENTRY_NONE ) @@ -414,12 +414,12 @@ FT_EXPORT_DEF( void ) ftc_family_table_free( FTC_FamilyTable table, - FT_UInt index ) + FT_UInt idx ) { /* simply add it to the linked list of free entries */ - if ( index < table->count ) + if ( idx < table->count ) { - FTC_FamilyEntry entry = table->entries + index; + FTC_FamilyEntry entry = table->entries + idx; if ( entry->link != FTC_FAMILY_ENTRY_NONE ) @@ -521,7 +521,7 @@ FTC_Manager_Done( FTC_Manager manager ) { FT_Memory memory; - FT_UInt index; + FT_UInt idx; if ( !manager || !manager->library ) @@ -530,16 +530,16 @@ memory = manager->library->memory; /* now discard all caches */ - for (index = 0; index < FTC_MAX_CACHES; index++ ) + for (idx = 0; idx < FTC_MAX_CACHES; idx++ ) { - FTC_Cache cache = manager->caches[index]; + FTC_Cache cache = manager->caches[idx]; if ( cache ) { cache->clazz->cache_done( cache ); FREE( cache ); - manager->caches[index] = 0; + manager->caches[idx] = 0; } } @@ -697,18 +697,18 @@ if ( manager && clazz && acache ) { FT_Memory memory = manager->library->memory; - FT_UInt index = 0; + FT_UInt idx = 0; /* check for an empty cache slot in the manager's table */ - for ( index = 0; index < FTC_MAX_CACHES; index++ ) + for ( idx = 0; idx < FTC_MAX_CACHES; idx++ ) { - if ( manager->caches[index] == 0 ) + if ( manager->caches[idx] == 0 ) break; } /* return an error if there are too many registered caches */ - if ( index >= FTC_MAX_CACHES ) + if ( idx >= FTC_MAX_CACHES ) { error = FTC_Err_Too_Many_Caches; FT_ERROR(( "FTC_Manager_Register_Cache:" )); @@ -724,7 +724,7 @@ /* THIS IS VERY IMPORTANT! IT WILL WRETCH THE MANAGER */ /* IF IT IS NOT SET CORRECTLY */ - cache->cache_index = index; + cache->cache_index = idx; if ( clazz->cache_init ) { @@ -739,7 +739,7 @@ } } - manager->caches[index] = cache; + manager->caches[idx] = cache; } } diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 84d295ac8..9420bc185 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -393,7 +393,7 @@ FT_Int result; - cff = face->extra.data; + cff = (CFF_Font *)face->extra.data; charset = &cff->charset; psnames = (PSNames_Service)FT_Get_Module_Interface( diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 53efb4975..7781e4fb8 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -1793,16 +1793,16 @@ case cff_op_index: { - FT_Int index = args[0] >> 16; + FT_Int idx = args[0] >> 16; FT_TRACE4(( " index" )); - if ( index < 0 ) - index = 0; - else if ( index > num_args - 2 ) - index = num_args - 2; - args[0] = args[-( index + 1 )]; + if ( idx < 0 ) + idx = 0; + else if ( idx > num_args - 2 ) + idx = num_args - 2; + args[0] = args[-( idx + 1 )]; args++; } break; @@ -1810,7 +1810,7 @@ case cff_op_roll: { FT_Int count = (FT_Int)( args[0] >> 16 ); - FT_Int index = (FT_Int)( args[1] >> 16 ); + FT_Int idx = (FT_Int)( args[1] >> 16 ); FT_TRACE4(( " roll" )); @@ -1822,9 +1822,9 @@ if ( args < stack ) goto Stack_Underflow; - if ( index >= 0 ) + if ( idx >= 0 ) { - while ( index > 0 ) + while ( idx > 0 ) { FT_Fixed tmp = args[count - 1]; FT_Int i; @@ -1833,12 +1833,12 @@ for ( i = count - 2; i >= 0; i-- ) args[i + 1] = args[i]; args[0] = tmp; - index--; + idx--; } } else { - while ( index < 0 ) + while ( idx < 0 ) { FT_Fixed tmp = args[0]; FT_Int i; @@ -1847,7 +1847,7 @@ for ( i = 0; i < count - 1; i++ ) args[i] = args[i + 1]; args[count - 1] = tmp; - index++; + idx++; } } args += count; @@ -1863,27 +1863,27 @@ case cff_op_put: { - FT_Fixed val = args[0]; - FT_Int index = (FT_Int)( args[1] >> 16 ); + FT_Fixed val = args[0]; + FT_Int idx = (FT_Int)( args[1] >> 16 ); FT_TRACE4(( " put" )); - if ( index >= 0 && index < decoder->len_buildchar ) - decoder->buildchar[index] = val; + if ( idx >= 0 && idx < decoder->len_buildchar ) + decoder->buildchar[idx] = val; } break; case cff_op_get: { - FT_Int index = (FT_Int)( args[0] >> 16 ); - FT_Fixed val = 0; + FT_Int idx = (FT_Int)( args[0] >> 16 ); + FT_Fixed val = 0; FT_TRACE4(( " get" )); - if ( index >= 0 && index < decoder->len_buildchar ) - val = decoder->buildchar[index]; + if ( idx >= 0 && idx < decoder->len_buildchar ) + val = decoder->buildchar[idx]; args[0] = val; args++; @@ -1956,13 +1956,13 @@ case cff_op_callsubr: { - FT_UInt index = (FT_UInt)( ( args[0] >> 16 ) + - decoder->locals_bias ); + FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + + decoder->locals_bias ); - FT_TRACE4(( " callsubr(%d)", index )); + FT_TRACE4(( " callsubr(%d)", idx )); - if ( index >= decoder->num_locals ) + if ( idx >= decoder->num_locals ) { FT_ERROR(( "CFF_Parse_CharStrings:" )); FT_ERROR(( " invalid local subr index\n" )); @@ -1978,8 +1978,8 @@ zone->cursor = ip; /* save current instruction pointer */ zone++; - zone->base = decoder->locals[index]; - zone->limit = decoder->locals[index + 1]; + zone->base = decoder->locals[idx]; + zone->limit = decoder->locals[idx + 1]; zone->cursor = zone->base; if ( !zone->base ) @@ -1996,13 +1996,13 @@ case cff_op_callgsubr: { - FT_UInt index = (FT_UInt)( ( args[0] >> 16 ) + - decoder->globals_bias ); + FT_UInt idx = (FT_UInt)( ( args[0] >> 16 ) + + decoder->globals_bias ); - FT_TRACE4(( " callgsubr(%d)", index )); + FT_TRACE4(( " callgsubr(%d)", idx )); - if ( index >= decoder->num_globals ) + if ( idx >= decoder->num_globals ) { FT_ERROR(( "CFF_Parse_CharStrings:" )); FT_ERROR(( " invalid global subr index\n" )); @@ -2018,8 +2018,8 @@ zone->cursor = ip; /* save current instruction pointer */ zone++; - zone->base = decoder->globals[index]; - zone->limit = decoder->globals[index+1]; + zone->base = decoder->globals[idx]; + zone->limit = decoder->globals[idx + 1]; zone->cursor = zone->base; if ( !zone->base ) diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 12202b6e0..006bb3d2c 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1082,18 +1082,18 @@ static FT_Error - cff_new_index( CFF_Index index, - FT_Stream stream, - FT_Bool load ) + cff_new_index( CFF_Index idx, + FT_Stream stream, + FT_Bool load ) { FT_Error error; FT_Memory memory = stream->memory; FT_UShort count; - MEM_Set( index, 0, sizeof ( *index ) ); + MEM_Set( idx, 0, sizeof ( *idx ) ); - index->stream = stream; + idx->stream = stream; if ( !READ_UShort( count ) && count > 0 ) { @@ -1108,16 +1108,16 @@ if ( READ_Byte( offsize ) ) goto Exit; - index->stream = stream; - index->count = count; - index->off_size = offsize; - data_size = (FT_ULong)( count + 1 ) * offsize; + idx->stream = stream; + idx->count = count; + idx->off_size = offsize; + data_size = (FT_ULong)( count + 1 ) * offsize; - if ( ALLOC_ARRAY( index->offsets, count + 1, FT_ULong ) || - ACCESS_Frame( data_size ) ) + if ( ALLOC_ARRAY( idx->offsets, count + 1, FT_ULong ) || + ACCESS_Frame( data_size ) ) goto Exit; - poff = index->offsets; + poff = idx->offsets; p = (FT_Byte*)stream->cursor; for ( ; (FT_Short)count >= 0; count-- ) @@ -1129,13 +1129,13 @@ FORGET_Frame(); - index->data_offset = FILE_Pos(); - data_size = poff[-1] - 1; + idx->data_offset = FILE_Pos(); + data_size = poff[-1] - 1; if ( load ) { /* load the data */ - if ( EXTRACT_Frame( data_size, index->bytes ) ) + if ( EXTRACT_Frame( data_size, idx->bytes ) ) goto Exit; } else @@ -1148,52 +1148,52 @@ Exit: if ( error ) - FREE( index->offsets ); + FREE( idx->offsets ); return error; } static void - cff_done_index( CFF_Index index ) + cff_done_index( CFF_Index idx ) { - if ( index->stream ) + if ( idx->stream ) { - FT_Stream stream = index->stream; + FT_Stream stream = idx->stream; FT_Memory memory = stream->memory; - if ( index->bytes ) - RELEASE_Frame( index->bytes ); + if ( idx->bytes ) + RELEASE_Frame( idx->bytes ); - FREE( index->offsets ); - MEM_Set( index, 0, sizeof ( *index ) ); + FREE( idx->offsets ); + MEM_Set( idx, 0, sizeof ( *idx ) ); } } static FT_Error - cff_explicit_index( CFF_Index index, + cff_explicit_index( CFF_Index idx, FT_Byte*** table ) { FT_Error error = 0; - FT_Memory memory = index->stream->memory; + FT_Memory memory = idx->stream->memory; FT_UInt n, offset, old_offset; FT_Byte** t; *table = 0; - if ( index->count > 0 && !ALLOC_ARRAY( t, index->count + 1, FT_Byte* ) ) + if ( idx->count > 0 && !ALLOC_ARRAY( t, idx->count + 1, FT_Byte* ) ) { old_offset = 1; - for ( n = 0; n <= index->count; n++ ) + for ( n = 0; n <= idx->count; n++ ) { - offset = index->offsets[n]; + offset = idx->offsets[n]; if ( !offset ) offset = old_offset; - t[n] = index->bytes + offset - 1; + t[n] = idx->bytes + offset - 1; old_offset = offset; } @@ -1205,29 +1205,29 @@ FT_LOCAL_DEF( FT_Error ) - CFF_Access_Element( CFF_Index index, - FT_UInt element, - FT_Byte** pbytes, - FT_ULong* pbyte_len ) + CFF_Access_Element( CFF_Index idx, + FT_UInt element, + FT_Byte** pbytes, + FT_ULong* pbyte_len ) { FT_Error error = 0; - if ( index && index->count > element ) + if ( idx && idx->count > element ) { /* compute start and end offsets */ FT_ULong off1, off2 = 0; - off1 = index->offsets[element]; + off1 = idx->offsets[element]; if ( off1 ) { do { element++; - off2 = index->offsets[element]; + off2 = idx->offsets[element]; - } while ( off2 == 0 && element < index->count ); + } while ( off2 == 0 && element < idx->count ); if ( !off2 ) off1 = 0; @@ -1238,18 +1238,18 @@ { *pbyte_len = off2 - off1; - if ( index->bytes ) + if ( idx->bytes ) { /* this index was completely loaded in memory, that's easy */ - *pbytes = index->bytes + off1 - 1; + *pbytes = idx->bytes + off1 - 1; } else { /* this index is still on disk/file, access it through a frame */ - FT_Stream stream = index->stream; + FT_Stream stream = idx->stream; - if ( FILE_Seek( index->data_offset + off1 - 1 ) || + if ( FILE_Seek( idx->data_offset + off1 - 1 ) || EXTRACT_Frame( off2 - off1, *pbytes ) ) goto Exit; } @@ -1270,12 +1270,12 @@ FT_LOCAL_DEF( void ) - CFF_Forget_Element( CFF_Index index, - FT_Byte** pbytes ) + CFF_Forget_Element( CFF_Index idx, + FT_Byte** pbytes ) { - if ( index->bytes == 0 ) + if ( idx->bytes == 0 ) { - FT_Stream stream = index->stream; + FT_Stream stream = idx->stream; RELEASE_Frame( *pbytes ); @@ -1284,17 +1284,17 @@ FT_LOCAL_DEF( FT_String* ) - CFF_Get_Name( CFF_Index index, - FT_UInt element ) + CFF_Get_Name( CFF_Index idx, + FT_UInt element ) { - FT_Memory memory = index->stream->memory; + FT_Memory memory = idx->stream->memory; FT_Byte* bytes; FT_ULong byte_len; FT_Error error; FT_String* name = 0; - error = CFF_Access_Element( index, element, &bytes, &byte_len ); + error = CFF_Access_Element( idx, element, &bytes, &byte_len ); if ( error ) goto Exit; @@ -1303,7 +1303,7 @@ MEM_Copy( name, bytes, byte_len ); name[byte_len] = 0; } - CFF_Forget_Element( index, &bytes ); + CFF_Forget_Element( idx, &bytes ); Exit: return name; @@ -1311,13 +1311,13 @@ FT_LOCAL_DEF( FT_String* ) - CFF_Get_String( CFF_Index index, - FT_UInt sid, + CFF_Get_String( CFF_Index idx, + FT_UInt sid, PSNames_Service interface ) { /* if it is not a standard string, return it */ if ( sid > 390 ) - return CFF_Get_Name( index, sid - 391 ); + return CFF_Get_Name( idx, sid - 391 ); /* that's a standard string, fetch a copy from the PSName module */ { @@ -1328,7 +1328,7 @@ if ( adobe_name ) { - FT_Memory memory = index->stream->memory; + FT_Memory memory = idx->stream->memory; FT_Error error; @@ -1958,7 +1958,7 @@ static FT_Error CFF_Load_SubFont( CFF_SubFont* font, - CFF_Index index, + CFF_Index idx, FT_UInt font_index, FT_Stream stream, FT_ULong base_offset ) @@ -1983,10 +1983,10 @@ top->font_matrix.yy = 0x10000L; top->cid_count = 8720; - error = CFF_Access_Element( index, font_index, &dict, &dict_len ) || + error = CFF_Access_Element( idx, font_index, &dict, &dict_len ) || CFF_Parser_Run( &parser, dict, dict + dict_len ); - CFF_Forget_Element( index, &dict ); + CFF_Forget_Element( idx, &dict ); if ( error ) goto Exit; @@ -2034,7 +2034,7 @@ font->num_local_subrs = font->local_subrs_index.count; error = cff_explicit_index( &font->local_subrs_index, - &font->local_subrs ); + &font->local_subrs ); if ( error ) goto Exit; } @@ -2137,9 +2137,9 @@ /* now, check for a CID font */ if ( dict->cid_registry ) { - CFF_IndexRec fd_index; + CFF_IndexRec fd_index; CFF_SubFont* sub; - FT_UInt index; + FT_UInt idx; /* this is a CID-keyed font, we must now allocate a table of */ @@ -2163,14 +2163,14 @@ goto Fail_CID; /* setup pointer table */ - for ( index = 0; index < fd_index.count; index++ ) - font->subfonts[index] = sub + index; + for ( idx = 0; idx < fd_index.count; idx++ ) + font->subfonts[idx] = sub + idx; /* now load each sub font independently */ - for ( index = 0; index < fd_index.count; index++ ) + for ( idx = 0; idx < fd_index.count; idx++ ) { - sub = font->subfonts[index]; - error = CFF_Load_SubFont( sub, &fd_index, index, + sub = font->subfonts[idx]; + error = CFF_Load_SubFont( sub, &fd_index, idx, stream, base_offset ); if ( error ) goto Fail_CID; @@ -2243,7 +2243,7 @@ CFF_Done_Font( CFF_Font* font ) { FT_Memory memory = font->memory; - FT_UInt index; + FT_UInt idx; cff_done_index( &font->global_subrs_index ); @@ -2256,8 +2256,8 @@ /* a CID keyed CFF font */ if ( font->num_subfonts > 0 ) { - for ( index = 0; index < font->num_subfonts; index++ ) - CFF_Done_SubFont( memory, font->subfonts[index] ); + for ( idx = 0; idx < font->num_subfonts; idx++ ) + CFF_Done_SubFont( memory, font->subfonts[idx] ); FREE( font->subfonts ); } diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 51af7d8aa..258e339f5 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -59,10 +59,10 @@ static PSH_Globals_Funcs CFF_Size_Get_Globals_Funcs( CFF_Size size ) { - CFF_Face face = (CFF_Face)size->face; - CFF_Font* font = face->extra.data; - PSHinter_Service pshinter = font->pshinter; - FT_Module module; + CFF_Face face = (CFF_Face)size->face; + CFF_Font* font = (CFF_Font *)face->extra.data; + PSHinter_Service pshinter = (PSHinter_Service)font->pshinter; + FT_Module module; module = FT_Get_Module( size->face->driver->root.library, @@ -101,7 +101,7 @@ { PSH_Globals globals; CFF_Face face = (CFF_Face)size->face; - CFF_Font* font = face->extra.data; + CFF_Font* font = (CFF_Font *)face->extra.data; CFF_SubFont* subfont = &font->top_font; CFF_Private cpriv = &subfont->private_dict; @@ -195,9 +195,9 @@ FT_LOCAL_DEF( FT_Error ) CFF_GlyphSlot_Init( CFF_GlyphSlot slot ) { - CFF_Face face = (CFF_Face)slot->root.face; - CFF_Font* font = face->extra.data; - PSHinter_Service pshinter = font->pshinter; + CFF_Face face = (CFF_Face)slot->root.face; + CFF_Font* font = (CFF_Font *)face->extra.data; + PSHinter_Service pshinter = (PSHinter_Service)font->pshinter; if ( pshinter ) diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index 1c7207ee8..4aee9562e 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -52,14 +52,14 @@ FT_LOCAL_DEF( FT_Error ) - CID_GlyphSlot_Init( CID_GlyphSlot slot ) + CID_GlyphSlot_Init( CID_GlyphSlot slot ) { - CID_Face face; + CID_Face face; PSHinter_Service pshinter; - face = (CID_Face) slot->root.face; - pshinter = face->pshinter; + face = (CID_Face)slot->root.face; + pshinter = (PSHinter_Service)face->pshinter; if ( pshinter ) { @@ -92,9 +92,9 @@ static PSH_Globals_Funcs CID_Size_Get_Globals_Funcs( CID_Size size ) { - CID_Face face = (CID_Face)size->root.face; - PSHinter_Service pshinter = face->pshinter; - FT_Module module; + CID_Face face = (CID_Face)size->root.face; + PSHinter_Service pshinter = (PSHinter_Service)face->pshinter; + FT_Module module; module = FT_Get_Module( size->root.face->driver->root.library, diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index 72a9b8251..6d99aff21 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -51,7 +51,7 @@ FT_CALLBACK_TABLE_DEF - const T1_Builder_Funcs t1_builder_funcs = + const T1_Builder_FuncsRec t1_builder_funcs = { T1_Builder_Init, T1_Builder_Done, diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 7dadb0af5..851413273 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -151,11 +151,11 @@ /* */ FT_LOCAL_DEF( FT_Error ) PS_Table_Add( PS_Table table, - FT_Int index, - void* object, - FT_Int length ) + FT_Int idx, + void* object, + FT_Int length ) { - if ( index < 0 || index > table->max_elems ) + if ( idx < 0 || idx > table->max_elems ) { FT_ERROR(( "PS_Table_Add: invalid index\n" )); return PSaux_Err_Invalid_Argument; @@ -185,8 +185,8 @@ } /* add the object to the base block and adjust offset */ - table->elements[index] = table->block + table->cursor; - table->lengths [index] = length; + table->elements[idx] = table->block + table->cursor; + table->lengths [idx] = length; MEM_Copy( table->block + table->cursor, object, length ); table->cursor += length; @@ -794,7 +794,7 @@ FT_Byte* cur; FT_Byte* limit; FT_UInt count; - FT_UInt index; + FT_UInt idx; FT_Error error; @@ -803,7 +803,7 @@ goto Fail; count = 1; - index = 0; + idx = 0; cur = token.start; limit = token.limit; @@ -814,12 +814,12 @@ goto Fail; count = max_objects; - index = 1; + idx = 1; } - for ( ; count > 0; count--, index++ ) + for ( ; count > 0; count--, idx++ ) { - FT_Byte* q = (FT_Byte*)objects[index] + field->offset; + FT_Byte* q = (FT_Byte*)objects[idx] + field->offset; FT_Long val; FT_String* string; diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index dac58fb22..23fd0ccb7 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -37,13 +37,13 @@ FT_BEGIN_HEADER FT_CALLBACK_TABLE - const PS_Table_FuncsRec ps_table_funcs; + const PS_Table_FuncsRec ps_table_funcs; FT_CALLBACK_TABLE - const PS_Parser_FuncsRec ps_parser_funcs; + const PS_Parser_FuncsRec ps_parser_funcs; FT_CALLBACK_TABLE - const T1_Builder_Funcs t1_builder_funcs; + const T1_Builder_FuncsRec t1_builder_funcs; FT_LOCAL( FT_Error ) diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index 8a4bb84b9..9c6736013 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -575,7 +575,8 @@ case 2: /* add flex vectors */ { - FT_Int index; + FT_Int idx; + if ( top[0] != 0 ) goto Unexpected_OtherSubr; @@ -583,12 +584,12 @@ /* note that we should not add a point for index 0; */ /* this will move our current position to the flex */ /* point without adding any point to the outline */ - index = decoder->num_flex_vectors++; - if ( index > 0 && index < 7 ) + idx = decoder->num_flex_vectors++; + if ( idx > 0 && idx < 7 ) add_point( builder, x, y, - (FT_Byte)( index == 3 || index == 6 ) ); + (FT_Byte)( idx == 3 || idx == 6 ) ); } break; @@ -933,13 +934,13 @@ case op_callsubr: { - FT_Int index; + FT_Int idx; FT_TRACE4(( " callsubr" )); - index = top[0]; - if ( index < 0 || index >= (FT_Int)decoder->num_subrs ) + idx = top[0]; + if ( idx < 0 || idx >= (FT_Int)decoder->num_subrs ) { FT_ERROR(( "T1_Decoder_Parse_CharStrings: " "invalid subrs index\n" )); @@ -960,16 +961,16 @@ /* The Type 1 driver stores subroutines without the seed bytes. */ /* The CID driver stores subroutines with seed bytes. This */ /* case is taken care of when decoder->subrs_len == 0. */ - zone->base = decoder->subrs[index]; + zone->base = decoder->subrs[idx]; if ( decoder->subrs_len ) - zone->limit = zone->base + decoder->subrs_len[index]; + zone->limit = zone->base + decoder->subrs_len[idx]; else { /* We are using subroutines from a CID font. We must adjust */ /* for the seed bytes. */ zone->base += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 ); - zone->limit = decoder->subrs[index + 1]; + zone->limit = decoder->subrs[idx + 1]; } zone->cursor = zone->base; diff --git a/src/pshinter/pshalgo1.c b/src/pshinter/pshalgo1.c index 438e99c6a..c09260b42 100644 --- a/src/pshinter/pshalgo1.c +++ b/src/pshinter/pshalgo1.c @@ -84,14 +84,14 @@ /* internal function used to record a new hint */ static void psh1_hint_table_record( PSH1_Hint_Table table, - FT_UInt index ) + FT_UInt idx ) { - PSH1_Hint hint = table->hints + index; + PSH1_Hint hint = table->hints + idx; - if ( index >= table->max_hints ) + if ( idx >= table->max_hints ) { - FT_ERROR(( "%s.activate: invalid hint index %d\n", index )); + FT_ERROR(( "%s.activate: invalid hint index %d\n", idx )); return; } @@ -136,7 +136,7 @@ { FT_Int mask = 0, val = 0; FT_Byte* cursor = hint_mask->bytes; - FT_UInt index, limit; + FT_UInt idx, limit; limit = hint_mask->num_bits; @@ -145,7 +145,7 @@ FT_ERROR(( "%s.activate_mask: invalid bit count (%d instead of %d)\n", "ps.fitter", hint_mask->num_bits, table->max_hints )); - for ( index = 0; index < limit; index++ ) + for ( idx = 0; idx < limit; idx++ ) { if ( mask == 0 ) { @@ -154,7 +154,7 @@ } if ( val & mask ) - psh1_hint_table_record( table, index ); + psh1_hint_table_record( table, idx ); mask >>= 1; } @@ -238,7 +238,7 @@ { FT_Int mask = 0, val = 0; FT_Byte* cursor = hint_mask->bytes; - FT_UInt index, limit, count; + FT_UInt idx, limit, count; limit = hint_mask->num_bits; @@ -246,7 +246,7 @@ psh1_hint_table_deactivate( table ); - for ( index = 0; index < limit; index++ ) + for ( idx = 0; idx < limit; idx++ ) { if ( mask == 0 ) { @@ -256,7 +256,7 @@ if ( val & mask ) { - PSH1_Hint hint = &table->hints[index]; + PSH1_Hint hint = &table->hints[idx]; if ( !psh1_hint_is_active( hint ) ) diff --git a/src/pshinter/pshalgo2.c b/src/pshinter/pshalgo2.c index bbc526584..35f18afa3 100644 --- a/src/pshinter/pshalgo2.c +++ b/src/pshinter/pshalgo2.c @@ -85,14 +85,14 @@ /* internal function used to record a new hint */ static void psh2_hint_table_record( PSH2_Hint_Table table, - FT_UInt index ) + FT_UInt idx ) { - PSH2_Hint hint = table->hints + index; + PSH2_Hint hint = table->hints + idx; - if ( index >= table->max_hints ) + if ( idx >= table->max_hints ) { - FT_ERROR(( "%s.activate: invalid hint index %d\n", index )); + FT_ERROR(( "%s.activate: invalid hint index %d\n", idx )); return; } @@ -137,12 +137,12 @@ { FT_Int mask = 0, val = 0; FT_Byte* cursor = hint_mask->bytes; - FT_UInt index, limit; + FT_UInt idx, limit; limit = hint_mask->num_bits; - for ( index = 0; index < limit; index++ ) + for ( idx = 0; idx < limit; idx++ ) { if ( mask == 0 ) { @@ -151,7 +151,7 @@ } if ( val & mask ) - psh2_hint_table_record( table, index ); + psh2_hint_table_record( table, idx ); mask >>= 1; } @@ -235,7 +235,7 @@ { FT_Int mask = 0, val = 0; FT_Byte* cursor = hint_mask->bytes; - FT_UInt index, limit, count; + FT_UInt idx, limit, count; limit = hint_mask->num_bits; @@ -243,7 +243,7 @@ psh2_hint_table_deactivate( table ); - for ( index = 0; index < limit; index++ ) + for ( idx = 0; idx < limit; idx++ ) { if ( mask == 0 ) { @@ -253,7 +253,7 @@ if ( val & mask ) { - PSH2_Hint hint = &table->hints[index]; + PSH2_Hint hint = &table->hints[idx]; if ( !psh2_hint_is_active( hint ) ) diff --git a/src/pshinter/pshglob.h b/src/pshinter/pshglob.h index a0ba233e7..0c666b785 100644 --- a/src/pshinter/pshglob.h +++ b/src/pshinter/pshglob.h @@ -141,20 +141,16 @@ FT_BEGIN_HEADER } PSH_GlobalsRec; - typedef enum - { - PSH_BLUE_ALIGN_NONE = 0, - PSH_BLUE_ALIGN_TOP = 1, - PSH_BLUE_ALIGN_BOT = 2 - - } PSH_Blue_Align; +#define PSH_BLUE_ALIGN_NONE 0 +#define PSH_BLUE_ALIGN_TOP 1 +#define PSH_BLUE_ALIGN_BOT 2 typedef struct PSH_AlignmentRec_ { - PSH_Blue_Align align; - FT_Pos align_top; - FT_Pos align_bot; + int align; + FT_Pos align_top; + FT_Pos align_bot; } PSH_AlignmentRec, *PSH_Alignment; diff --git a/src/pshinter/pshmod.c b/src/pshinter/pshmod.c index 47d38baf7..afaf73a4e 100644 --- a/src/pshinter/pshmod.c +++ b/src/pshinter/pshmod.c @@ -91,8 +91,8 @@ } - FT_CALLBACK_DEF( PSHinter_Interface ) - pshinter_interface = + static + const PSHinter_Interface pshinter_interface = { pshinter_get_globals_funcs, pshinter_get_t1_funcs, diff --git a/src/pshinter/pshrec.c b/src/pshinter/pshrec.c index e5485f445..eb72563ad 100644 --- a/src/pshinter/pshrec.c +++ b/src/pshinter/pshrec.c @@ -151,55 +151,55 @@ /* test a bit value in a given mask */ static FT_Int ps_mask_test_bit( PS_Mask mask, - FT_Int index ) + FT_Int idx ) { - if ( (FT_UInt)index >= mask->num_bits ) + if ( (FT_UInt)idx >= mask->num_bits ) return 0; - return mask->bytes[index >> 3] & ( 0x80 >> ( index & 7 ) ); + return mask->bytes[idx >> 3] & ( 0x80 >> ( idx & 7 ) ); } /* clear a given bit */ static void ps_mask_clear_bit( PS_Mask mask, - FT_Int index ) + FT_Int idx ) { FT_Byte* p; - if ( (FT_UInt)index >= mask->num_bits ) + if ( (FT_UInt)idx >= mask->num_bits ) return; - p = mask->bytes + ( index >> 3 ); - p[0] = (FT_Byte)( p[0] & ~( 0x80 >> ( index & 7 ) ) ); + p = mask->bytes + ( idx >> 3 ); + p[0] = (FT_Byte)( p[0] & ~( 0x80 >> ( idx & 7 ) ) ); } /* set a given bit, possibly grow the mask */ static FT_Error ps_mask_set_bit( PS_Mask mask, - FT_Int index, + FT_Int idx, FT_Memory memory ) { FT_Error error = 0; FT_Byte* p; - if ( index < 0 ) + if ( idx < 0 ) goto Exit; - if ( (FT_UInt)index >= mask->num_bits ) + if ( (FT_UInt)idx >= mask->num_bits ) { - error = ps_mask_ensure( mask, index + 1, memory ); + error = ps_mask_ensure( mask, idx + 1, memory ); if ( error ) goto Exit; - mask->num_bits = index + 1; + mask->num_bits = idx + 1; } - p = mask->bytes + ( index >> 3 ); - p[0] = (FT_Byte)( p[0] | ( 0x80 >> ( index & 7 ) ) ); + p = mask->bytes + ( idx >> 3 ); + p[0] = (FT_Byte)( p[0] | ( 0x80 >> ( idx & 7 ) ) ); Exit: return error; @@ -554,7 +554,7 @@ /* set a bit at a given index in the current hint mask */ static FT_Error ps_dimension_set_mask_bit( PS_Dimension dim, - FT_UInt index, + FT_UInt idx, FT_Memory memory ) { PS_Mask mask; @@ -566,7 +566,7 @@ if ( error ) goto Exit; - error = ps_mask_set_bit( mask, index, memory ); + error = ps_mask_set_bit( mask, idx, memory ); Exit: return error; @@ -665,19 +665,19 @@ /* now, lookup stem in the current hints table */ { PS_Mask mask; - FT_UInt index; + FT_UInt idx; FT_UInt max = dim->hints.num_hints; PS_Hint hint = dim->hints.hints; - for ( index = 0; index < max; index++, hint++ ) + for ( idx = 0; idx < max; idx++, hint++ ) { if ( hint->pos == pos && hint->len == len ) break; } /* we need to create a new hint in the table */ - if ( index >= max ) + if ( idx >= max ) { error = ps_hint_table_alloc( &dim->hints, memory, &hint ); if ( error ) @@ -693,12 +693,12 @@ if ( error ) goto Exit; - error = ps_mask_set_bit( mask, index, memory ); + error = ps_mask_set_bit( mask, idx, memory ); if ( error ) goto Exit; if ( aindex ) - *aindex = (FT_Int)index; + *aindex = (FT_Int)idx; } Exit: @@ -898,7 +898,7 @@ PS_Dimension dim; FT_Memory memory = hints->memory; FT_Int count; - FT_Int index[3]; + FT_Int idx[3]; /* limit "dimension" to 0..1 */ @@ -918,14 +918,14 @@ for ( count = 0; count < 3; count++, stems += 2 ) { error = ps_dimension_add_t1stem( dim, stems[0], stems[1], - memory, &index[count] ); + memory, &idx[count] ); if ( error ) goto Fail; } /* now, add the hints to the counters table */ - error = ps_dimension_add_counter( dim, index[0], index[1], - index[2], memory ); + error = ps_dimension_add_counter( dim, idx[0], idx[1], idx[2], + memory ); if ( error ) goto Fail; } diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index fa2baeec4..628ec63fd 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -204,15 +204,15 @@ for ( n = 0; n < num_glyphs; n++ ) { - FT_Int index; + FT_Int idx; - index = glyph_indices[n]; - if ( index >= 258 ) + idx = glyph_indices[n]; + if ( idx >= 258 ) { - index -= 257; - if ( index > num_names ) - num_names = (FT_UShort)index; + idx -= 257; + if ( idx > num_names ) + num_names = (FT_UShort)idx; } } } @@ -303,10 +303,10 @@ for ( n = 0; n < num_glyphs; n++ ) { - FT_Long index = (FT_Long)n + offset_table[n]; + FT_Long idx = (FT_Long)n + offset_table[n]; - if ( index < 0 || index > num_glyphs ) + if ( idx < 0 || idx > num_glyphs ) { error = SFNT_Err_Invalid_File_Format; goto Fail; @@ -431,7 +431,7 @@ /* */ /* face :: A handle to the parent face. */ /* */ - /* index :: The glyph index. */ + /* idx :: The glyph index. */ /* */ /* PSname :: The address of a string pointer. Will be NULL in case */ /* of error, otherwise it is a pointer to the glyph name. */ @@ -443,7 +443,7 @@ /* */ FT_LOCAL_DEF( FT_Error ) TT_Get_PS_Name( TT_Face face, - FT_UInt index, + FT_UInt idx, FT_String** PSname ) { FT_Error error; @@ -457,7 +457,7 @@ if ( !face ) return SFNT_Err_Invalid_Face_Handle; - if ( index >= (FT_UInt)face->root.num_glyphs ) + if ( idx >= (FT_UInt)face->root.num_glyphs ) return SFNT_Err_Invalid_Glyph_Index; #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES @@ -474,8 +474,8 @@ switch ( face->postscript.FormatType ) { case 0x00010000L: - if ( index < 258 ) /* paranoid checking */ - *PSname = MAC_NAME( index ); + if ( idx < 258 ) /* paranoid checking */ + *PSname = MAC_NAME( idx ); break; case 0x00020000L: @@ -490,9 +490,9 @@ break; } - if ( index < (FT_UInt)table->num_glyphs ) + if ( idx < (FT_UInt)table->num_glyphs ) { - FT_UShort name_index = table->glyph_indices[index]; + FT_UShort name_index = table->glyph_indices[idx]; if ( name_index < 258 ) @@ -515,10 +515,10 @@ break; } - if ( index < (FT_UInt)table->num_glyphs ) /* paranoid checking */ + if ( idx < (FT_UInt)table->num_glyphs ) /* paranoid checking */ { - index += table->offsets[index]; - *PSname = MAC_NAME( index ); + idx += table->offsets[idx]; + *PSname = MAC_NAME( idx ); } } break; diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index ba5ee7212..5201a671a 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -70,7 +70,7 @@ /* header :: A pointer to either the horizontal or vertical metrics */ /* structure. */ /* */ - /* index :: The glyph index. */ + /* idx :: The glyph index. */ /* */ /* */ /* bearing :: The bearing, either left side or top side. */ @@ -83,7 +83,7 @@ /* */ FT_LOCAL_DEF( void ) TT_Get_Metrics( TT_HoriHeader* header, - FT_UInt index, + FT_UInt idx, FT_Short* bearing, FT_UShort* advance ) { @@ -91,15 +91,15 @@ FT_UShort k = header->number_Of_HMetrics; - if ( index < (FT_UInt)k ) + if ( idx < (FT_UInt)k ) { - longs_m = (TT_LongMetrics*)header->long_metrics + index; + longs_m = (TT_LongMetrics*)header->long_metrics + idx; *bearing = longs_m->bearing; *advance = longs_m->advance; } else { - *bearing = ((TT_ShortMetrics*)header->short_metrics)[index - k]; + *bearing = ((TT_ShortMetrics*)header->short_metrics)[idx - k]; *advance = ((TT_LongMetrics*)header->long_metrics)[k - 1].advance; } } @@ -113,12 +113,12 @@ /* */ static void Get_HMetrics( TT_Face face, - FT_UInt index, + FT_UInt idx, FT_Bool check, FT_Short* lsb, FT_UShort* aw ) { - TT_Get_Metrics( &face->horizontal, index, lsb, aw ); + TT_Get_Metrics( &face->horizontal, idx, lsb, aw ); if ( check && face->postscript.isFixedPitch ) *aw = face->horizontal.advance_Width_Max; @@ -749,22 +749,22 @@ TT_Face face = (TT_Face)loader->face; FT_ULong offset; FT_Int contours_count; - FT_UInt index, num_points, count; + FT_UInt idx, num_points, count; FT_Fixed x_scale, y_scale; FT_GlyphLoader gloader = loader->gloader; FT_Bool opened_frame = 0; /* check glyph index */ - index = glyph_index; - if ( index >= (FT_UInt)face->root.num_glyphs ) + idx = glyph_index; + if ( idx >= (FT_UInt)face->root.num_glyphs ) { error = TT_Err_Invalid_Glyph_Index; goto Exit; } loader->glyph_index = glyph_index; - num_points = 0; + num_points = 0; x_scale = 0x10000L; y_scale = 0x10000L; @@ -780,7 +780,7 @@ FT_UShort advance_width; - Get_HMetrics( face, index, + Get_HMetrics( face, idx, (FT_Bool)!(loader->load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH), &left_bearing, @@ -796,11 +796,11 @@ } } - offset = face->glyph_locations[index]; + offset = face->glyph_locations[idx]; count = 0; - if ( index < (FT_UInt)face->num_locations - 1 ) - count = face->glyph_locations[index + 1] - offset; + if ( idx < (FT_UInt)face->num_locations - 1 ) + count = face->glyph_locations[idx + 1] - offset; if ( count == 0 ) { diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c index edb740876..2c4dc1824 100644 --- a/src/type1/t1afm.c +++ b/src/type1/t1afm.c @@ -251,7 +251,7 @@ FT_Vector* kerning ) { T1_Kern_Pair *min, *mid, *max; - FT_ULong index = KERN_INDEX( glyph1, glyph2 ); + FT_ULong idx = KERN_INDEX( glyph1, glyph2 ); /* simple binary search */ @@ -266,13 +266,13 @@ mid = min + ( max - min ) / 2; midi = KERN_INDEX( mid->glyph1, mid->glyph2 ); - if ( midi == index ) + if ( midi == idx ) { *kerning = mid->kerning; return; } - if ( midi < index ) + if ( midi < idx ) min = mid + 1; else max = mid - 1; diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 25c553c16..9228b0d56 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -1133,7 +1133,7 @@ for ( n = 0; n < loader->num_subrs; n++ ) { - FT_Int index, size; + FT_Int idx, size; FT_Byte* base; @@ -1142,7 +1142,7 @@ if ( strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 ) break; - index = T1_ToInt( parser ); + idx = T1_ToInt( parser ); if ( !read_binary_data( parser, &size, &base ) ) return; @@ -1177,12 +1177,12 @@ MEM_Copy( temp, base, size ); psaux->t1_decrypt( temp, size, 4330 ); size -= face->type1.private_dict.lenIV; - error = T1_Add_Table( table, index, + error = T1_Add_Table( table, idx, temp + face->type1.private_dict.lenIV, size ); FREE( temp ); } else - error = T1_Add_Table( table, index, base, size ); + error = T1_Add_Table( table, idx, base, size ); if ( error ) goto Fail; } @@ -1709,7 +1709,7 @@ /* array.. */ if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY ) { - FT_Int charcode, index, min_char, max_char; + FT_Int charcode, idx, min_char, max_char; FT_Byte* char_name; FT_Byte* glyph_name; @@ -1730,13 +1730,13 @@ char_name = loader.encoding_table.elements[charcode]; if ( char_name ) - for ( index = 0; index < type1->num_glyphs; index++ ) + for ( idx = 0; idx < type1->num_glyphs; idx++ ) { - glyph_name = (FT_Byte*)type1->glyph_names[index]; + glyph_name = (FT_Byte*)type1->glyph_names[idx]; if ( strcmp( (const char*)char_name, (const char*)glyph_name ) == 0 ) { - type1->encoding.char_index[charcode] = (FT_UShort)index; + type1->encoding.char_index[charcode] = (FT_UShort)idx; type1->encoding.char_name [charcode] = (char*)glyph_name; /* Change min/max encoded char only if glyph name is */ diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 7c36a6fae..a21f16f84 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -58,9 +58,9 @@ static PSH_Globals_Funcs T1_Size_Get_Globals_Funcs( T1_Size size ) { - T1_Face face = (T1_Face) size->root.face; - PSHinter_Service pshinter = face->pshinter; - FT_Module module; + T1_Face face = (T1_Face)size->root.face; + PSHinter_Service pshinter = (PSHinter_Service)face->pshinter; + FT_Module module; module = FT_Get_Module( size->root.face->driver->root.library, @@ -143,15 +143,18 @@ FT_LOCAL_DEF( FT_Error ) T1_GlyphSlot_Init( T1_GlyphSlot slot ) { - T1_Face face; + T1_Face face; PSHinter_Service pshinter; - face = (T1_Face) slot->root.face; - pshinter = face->pshinter; - if (pshinter) + + face = (T1_Face)slot->root.face; + pshinter = (PSHinter_Service)face->pshinter; + + if ( pshinter ) { FT_Module module; + module = FT_Get_Module( slot->root.face->driver->root.library, "pshinter" ); if (module) { diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index f3c7d536c..4a85efb03 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -414,13 +414,11 @@ return result; } + static FT_Long FNT_Get_Next_Char( FT_CharMap charmap, FT_Long char_code ) { - FT_ULong result = 0; - FT_UInt gindex = 0; - char_code++; if ( charmap ) { @@ -441,10 +439,6 @@ #endif /* !FT_CONFIG_OPTION_USE_CMAPS */ - - - - static void FNT_Face_Done( FNT_Face face ) {