diff --git a/src/harfbuzz-dump-main.c b/src/harfbuzz-dump-main.c index 7f2ab5bb8..1e8c5e5f2 100644 --- a/src/harfbuzz-dump-main.c +++ b/src/harfbuzz-dump-main.c @@ -200,7 +200,7 @@ main (int argc, char **argv) if ((error = HB_Done_GSUB_Table (gsub))) croak ("HB_Done_GSUB_Table", error); } - else if (error != HB_Err_Table_Missing) + else if (error != HB_Err_Not_Covered) fprintf (stderr, "HB_Load_GSUB_Table %x\n", error); if (!(error = HB_Load_GPOS_Table (face, &gpos, NULL))) @@ -210,7 +210,7 @@ main (int argc, char **argv) if ((error = HB_Done_GPOS_Table (gpos))) croak ("HB_Done_GPOS_Table", error); } - else if (error != HB_Err_Table_Missing) + else if (error != HB_Err_Not_Covered) fprintf (stderr, "HB_Load_GPOS_Table %x\n", error); printf ("\n"); diff --git a/src/harfbuzz-dump.c b/src/harfbuzz-dump.c index 4ae548fcc..ed365d8ae 100644 --- a/src/harfbuzz-dump.c +++ b/src/harfbuzz-dump.c @@ -97,21 +97,21 @@ DEF_DUMP (LangSys) DUMP1("%d\n", LangSys->FeatureIndex[i]); } -DEF_DUMP (Script) +DEF_DUMP (ScriptTable) { int i; - RECURSE (DefaultLangSys, LangSys, &Script->DefaultLangSys); + RECURSE (DefaultLangSys, LangSys, &ScriptTable->DefaultLangSys); - DUMP_FUINT (Script, LangSysCount); + DUMP_FUINT (ScriptTable, LangSysCount); - for (i=0; i < Script->LangSysCount; i++) + for (i=0; i < ScriptTable->LangSysCount; i++) { do_indent (stream, indent); fprintf (stream, ""); - Print_Tag (Script->LangSysRecord[i].LangSysTag, stream); + Print_Tag (ScriptTable->LangSysRecord[i].LangSysTag, stream); fprintf (stream, "\n"); - RECURSE_NUM (LangSys, i, LangSys, &Script->LangSysRecord[i].LangSys); + RECURSE_NUM (LangSys, i, LangSys, &ScriptTable->LangSysRecord[i].LangSys); } } @@ -127,7 +127,7 @@ DEF_DUMP (ScriptList) fprintf (stream, ""); Print_Tag (ScriptList->ScriptRecord[i].ScriptTag, stream); fprintf (stream, "\n"); - RECURSE_NUM (Script, i, Script, &ScriptList->ScriptRecord[i].Script); + RECURSE_NUM (Script, i, ScriptTable, &ScriptList->ScriptRecord[i].Script); } } diff --git a/src/harfbuzz-gdef.c b/src/harfbuzz-gdef.c index cca0b8c93..041ddd5dd 100644 --- a/src/harfbuzz-gdef.c +++ b/src/harfbuzz-gdef.c @@ -21,6 +21,7 @@ static HB_Error Load_LigCaretList( HB_LigCaretList* lcl, static void Free_AttachList( HB_AttachList* al ); static void Free_LigCaretList( HB_LigCaretList* lcl ); + static void Free_NewGlyphClasses( HB_GDEFHeader* gdef ); @@ -104,7 +105,7 @@ HB_Error HB_Init_GDEF_Extension( HB_Engine engine ) if ( !_engine ) - return HB_Err_Invalid_Engine; + return ERR(HB_Err_Invalid_Engine); return HB_Register_Extension( _engine, GDEF_ID, @@ -133,7 +134,7 @@ HB_Error HB_New_GDEF_Table( HB_GDEFHeader** retptr ) HB_GDEFHeader* gdef; if ( !retptr ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); if ( ALLOC( gdef, sizeof( *gdef ) ) ) return error; @@ -164,7 +165,7 @@ HB_Error HB_Load_GDEF_Table( FT_Face face, if ( !retptr ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); if ( GOTO_Table( TTAG_GDEF ) ) return error; @@ -523,7 +524,7 @@ static HB_Error Load_CaretValue( HB_CaretValue* cv, break; default: - return _hb_err(HB_Err_Invalid_GDEF_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; @@ -768,7 +769,7 @@ HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef, if ( !gdef || !property ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); /* first, we check for mark attach classes */ @@ -873,7 +874,7 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, if ( !gdef || !glyph_array || !class_array ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); gcd = &gdef->GlyphClassDef; @@ -895,7 +896,7 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, if ( curr_class >= 5 ) { - error = HB_Err_Invalid_Argument; + error = ERR(HB_Err_Invalid_Argument); goto Fail4; } @@ -916,7 +917,7 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, { if ( curr_glyph == 0xFFFF ) { - error = HB_Err_Invalid_Argument; + error = ERR(HB_Err_Invalid_Argument); goto Fail3; } else @@ -932,7 +933,7 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, if ( curr_glyph > glyph_array[n] ) { - error = HB_Err_Invalid_Argument; + error = ERR(HB_Err_Invalid_Argument); goto Fail3; } @@ -942,7 +943,7 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, if ( curr_class >= 5 ) { - error = HB_Err_Invalid_Argument; + error = ERR(HB_Err_Invalid_Argument); goto Fail3; } @@ -957,7 +958,7 @@ HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, { if ( curr_glyph == 0xFFFF ) { - error = HB_Err_Invalid_Argument; + error = ERR(HB_Err_Invalid_Argument); goto Fail3; } else @@ -1103,7 +1104,7 @@ _HB_GDEF_Add_Glyph_Property( HB_GDEFHeader* gdef, break; default: - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); } count = gdef->GlyphClassDef.cd.cd2.ClassRangeCount; diff --git a/src/harfbuzz-gdef.h b/src/harfbuzz-gdef.h index 08ff36270..9f9338c8d 100644 --- a/src/harfbuzz-gdef.h +++ b/src/harfbuzz-gdef.h @@ -17,9 +17,6 @@ HB_BEGIN_HEADER -#define HB_Err_Invalid_GDEF_SubTable_Format 0x1030 -#define HB_Err_Invalid_GDEF_SubTable 0x1031 - /* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding * flag in the LookupFlag field. */ diff --git a/src/harfbuzz-global.h b/src/harfbuzz-global.h index 88fe1aa28..9aed8ca8d 100644 --- a/src/harfbuzz-global.h +++ b/src/harfbuzz-global.h @@ -30,21 +30,24 @@ typedef signed int HB_Int; typedef int HB_Bool; -/* compatible with FT_Error */ typedef enum { - HB_Err_Invalid_Argument = FT_Err_Invalid_Argument, - HB_Err_Invalid_Face_Handle = FT_Err_Invalid_Face_Handle, - HB_Err_Invalid_Stream_Operation = FT_Err_Invalid_Stream_Operation, - HB_Err_Empty_Script = 0x1005, + /* no error */ + HB_Err_Ok = 0x0000, + HB_Err_Not_Covered = 0xFFFF, - HB_Err_Ok = FT_Err_Ok, - HB_Err_Not_Covered = 0x1002, - HB_Err_Out_Of_Memory = FT_Err_Out_Of_Memory, - HB_Err_Table_Missing = FT_Err_Table_Missing, - HB_Err_Invalid_SubTable_Format = 0x1000, - HB_Err_Invalid_SubTable = 0x1001, - HB_Err_Too_Many_Nested_Contexts = 0x1003, - HB_Err_No_MM_Interpreter = 0x1004 + /* _hb_err() is called whenever returning the following errors, + * and in a couple places for HB_Err_Not_Covered too. */ + + /* programmer error */ + HB_Err_Invalid_Argument = 0x1A66, + + /* font error */ + HB_Err_Invalid_SubTable_Format = 0x157F, + HB_Err_Invalid_SubTable = 0x1570, + HB_Err_Read_Error = 0x6EAD, + + /* system error */ + HB_Err_Out_Of_Memory = 0xDEAD } HB_Error; HB_END_HEADER diff --git a/src/harfbuzz-gpos.c b/src/harfbuzz-gpos.c index 7ba16410b..71dade7f1 100644 --- a/src/harfbuzz-gpos.c +++ b/src/harfbuzz-gpos.c @@ -53,7 +53,7 @@ static HB_Error default_mmfunc( FT_Face face, HB_UNUSED(metric_id); HB_UNUSED(metric_value); HB_UNUSED(data); - return _hb_err(HB_Err_No_MM_Interpreter); + return ERR(HB_Err_Not_Covered); /* ERR() call intended */ } @@ -73,7 +73,7 @@ HB_Error HB_Load_GPOS_Table( FT_Face face, if ( !retptr ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); if ( GOTO_Table( TTAG_GPOS ) ) return error; @@ -672,7 +672,7 @@ static HB_Error Load_Anchor( HB_Anchor* an, break; default: - return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; @@ -742,7 +742,7 @@ static HB_Error Get_Anchor( GPOS_Instance* gpi, return error; if ( gpi->face->glyph->format != ft_glyph_format_outline ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); ap = an->af.af2.AnchorPoint; @@ -756,7 +756,7 @@ static HB_Error Get_Anchor( GPOS_Instance* gpi, goto no_contour_point; if ( ap >= outline.n_points ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); *x_value = outline.points[ap].x; *y_value = outline.points[ap].y; @@ -908,7 +908,7 @@ static HB_Error Load_SinglePos( HB_GPOS_SubTable* st, FORGET_Frame(); if ( !format ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || @@ -949,7 +949,7 @@ static HB_Error Load_SinglePos( HB_GPOS_SubTable* st, break; default: - return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; @@ -1036,7 +1036,7 @@ static HB_Error Lookup_SinglePos( GPOS_Instance* gpi, case 2: if ( index >= sp->spf.spf2.ValueCount ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); error = Get_ValueRecord( gpi, &sp->spf.spf2.Value[index], sp->ValueFormat, POSITION( buffer->in_pos ) ); if ( error ) @@ -1044,7 +1044,7 @@ static HB_Error Lookup_SinglePos( GPOS_Instance* gpi, break; default: - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); } (buffer->in_pos)++; @@ -1445,7 +1445,7 @@ static HB_Error Load_PairPos( HB_GPOS_SubTable* st, break; default: - return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; @@ -1498,11 +1498,11 @@ static HB_Error Lookup_PairPos1( GPOS_Instance* gpi, if ( index >= ppf1->PairSetCount ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); pvr = ppf1->PairSet[index].PairValueRecord; if ( !pvr ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); glyph2 = IN_CURGLYPH(); @@ -1550,7 +1550,7 @@ static HB_Error Lookup_PairPos2( GPOS_Instance* gpi, c1r = &ppf2->Class1Record[cl1]; if ( !c1r ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); c2r = &c1r->Class2Record[cl2]; error = Get_ValueRecord( gpi, &c2r->Value1, format1, POSITION( first_pos ) ); @@ -1622,7 +1622,7 @@ static HB_Error Lookup_PairPos( GPOS_Instance* gpi, break; default: - return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); } /* if we don't have coverage for the second glyph don't skip it for @@ -1827,7 +1827,7 @@ static HB_Error Lookup_CursivePos( GPOS_Instance* gpi, } if ( index >= cp->EntryExitCount ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); eer = &cp->EntryExitRecord[index]; @@ -2146,7 +2146,7 @@ static HB_Error Load_MarkBasePos( HB_GPOS_SubTable* st, FORGET_Frame(); if (mbp->PosFormat != 1) - return _hb_err(HB_Err_Invalid_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || @@ -2293,18 +2293,18 @@ static HB_Error Lookup_MarkBasePos( GPOS_Instance* gpi, ma = &mbp->MarkArray; if ( mark_index >= ma->MarkCount ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); class = ma->MarkRecord[mark_index].Class; mark_anchor = &ma->MarkRecord[mark_index].MarkAnchor; if ( class >= mbp->ClassCount ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); ba = &mbp->BaseArray; if ( base_index >= ba->BaseCount ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); br = &ba->BaseRecord[base_index]; base_anchor = &br->BaseAnchor[class]; @@ -2704,18 +2704,18 @@ static HB_Error Lookup_MarkLigPos( GPOS_Instance* gpi, ma = &mlp->MarkArray; if ( mark_index >= ma->MarkCount ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); class = ma->MarkRecord[mark_index].Class; mark_anchor = &ma->MarkRecord[mark_index].MarkAnchor; if ( class >= mlp->ClassCount ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); la = &mlp->LigatureArray; if ( lig_index >= la->LigatureCount ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); lat = &la->LigatureAttach[lig_index]; @@ -3044,18 +3044,18 @@ static HB_Error Lookup_MarkMarkPos( GPOS_Instance* gpi, ma1 = &mmp->Mark1Array; if ( mark1_index >= ma1->MarkCount ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); class = ma1->MarkRecord[mark1_index].Class; mark1_anchor = &ma1->MarkRecord[mark1_index].MarkAnchor; if ( class >= mmp->ClassCount ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); ma2 = &mmp->Mark2Array; if ( mark2_index >= ma2->Mark2Count ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable); + return ERR(HB_Err_Invalid_SubTable); m2r = &ma2->Mark2Record[mark2_index]; mark2_anchor = &m2r->Mark2Anchor[class]; @@ -3802,7 +3802,7 @@ static HB_Error Load_ContextPos( HB_GPOS_SubTable* st, return Load_ContextPos3( &cp->cpf.cpf3, stream ); default: - return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; /* never reached */ @@ -3933,7 +3933,7 @@ static HB_Error Lookup_ContextPos2( GPOS_Instance* gpi, pcs = &cpf2->PosClassSet[classes[0]]; if ( !pcs ) { - error = _hb_err(HB_Err_Invalid_GPOS_SubTable); + error = ERR(HB_Err_Invalid_SubTable); goto End; } @@ -4071,7 +4071,7 @@ static HB_Error Lookup_ContextPos( GPOS_Instance* gpi, flags, context_length, nesting_level ); default: - return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; /* never reached */ @@ -4688,16 +4688,16 @@ static HB_Error Load_ChainContextPos2( HB_ChainContextPosFormat2* ccpf2, FORGET_Frame(); if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccpf2->BacktrackClassDef, 65535, - backtrack_offset, base_offset, - stream ) ) != HB_Err_Ok ) + backtrack_offset, base_offset, + stream ) ) != HB_Err_Ok ) goto Fail5; if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccpf2->InputClassDef, count, - input_offset, base_offset, - stream ) ) != HB_Err_Ok ) + input_offset, base_offset, + stream ) ) != HB_Err_Ok ) goto Fail4; if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccpf2->LookaheadClassDef, 65535, - lookahead_offset, base_offset, - stream ) ) != HB_Err_Ok ) + lookahead_offset, base_offset, + stream ) ) != HB_Err_Ok ) goto Fail3; ccpf2->ChainPosClassSet = NULL; @@ -5028,7 +5028,7 @@ static HB_Error Load_ChainContextPos( HB_GPOS_SubTable* st, return Load_ChainContextPos3( &ccp->ccpf.ccpf3, stream ); default: - return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; /* never reached */ @@ -5241,7 +5241,7 @@ static HB_Error Lookup_ChainContextPos2( cpcs = &ccpf2->ChainPosClassSet[input_classes[0]]; if ( !cpcs ) { - error = _hb_err(HB_Err_Invalid_GPOS_SubTable); + error = ERR(HB_Err_Invalid_SubTable); goto End1; } @@ -5519,7 +5519,7 @@ static HB_Error Lookup_ChainContextPos( nesting_level ); default: - return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; /* never reached */ @@ -5544,7 +5544,7 @@ HB_Error HB_GPOS_Select_Script( HB_GPOSHeader* gpos, if ( !gpos || !script_index ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); sl = &gpos->ScriptList; sr = sl->ScriptRecord; @@ -5572,18 +5572,18 @@ HB_Error HB_GPOS_Select_Language( HB_GPOSHeader* gpos, HB_ScriptList* sl; HB_ScriptRecord* sr; - HB_Script* s; + HB_ScriptTable* s; HB_LangSysRecord* lsr; if ( !gpos || !language_index || !req_feature_index ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); sl = &gpos->ScriptList; sr = sl->ScriptRecord; if ( script_index >= sl->ScriptCount ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); s = &sr[script_index].Script; lsr = s->LangSysRecord; @@ -5615,7 +5615,7 @@ HB_Error HB_GPOS_Select_Feature( HB_GPOSHeader* gpos, HB_ScriptList* sl; HB_ScriptRecord* sr; - HB_Script* s; + HB_ScriptTable* s; HB_LangSysRecord* lsr; HB_LangSys* ls; HB_UShort* fi; @@ -5625,7 +5625,7 @@ HB_Error HB_GPOS_Select_Feature( HB_GPOSHeader* gpos, if ( !gpos || !feature_index ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); sl = &gpos->ScriptList; sr = sl->ScriptRecord; @@ -5634,7 +5634,7 @@ HB_Error HB_GPOS_Select_Feature( HB_GPOSHeader* gpos, fr = fl->FeatureRecord; if ( script_index >= sl->ScriptCount ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); s = &sr[script_index].Script; lsr = s->LangSysRecord; @@ -5644,7 +5644,7 @@ HB_Error HB_GPOS_Select_Feature( HB_GPOSHeader* gpos, else { if ( language_index >= s->LangSysCount ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); ls = &lsr[language_index].LangSys; } @@ -5654,7 +5654,7 @@ HB_Error HB_GPOS_Select_Feature( HB_GPOSHeader* gpos, for ( n = 0; n < ls->FeatureCount; n++ ) { if ( fi[n] >= fl->FeatureCount ) - return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); if ( feature_tag == fr[fi[n]].FeatureTag ) { @@ -5683,7 +5683,7 @@ HB_Error HB_GPOS_Query_Scripts( HB_GPOSHeader* gpos, if ( !gpos || !script_tag_list ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); sl = &gpos->ScriptList; sr = sl->ScriptRecord; @@ -5712,18 +5712,18 @@ HB_Error HB_GPOS_Query_Languages( HB_GPOSHeader* gpos, HB_ScriptList* sl; HB_ScriptRecord* sr; - HB_Script* s; + HB_ScriptTable* s; HB_LangSysRecord* lsr; if ( !gpos || !language_tag_list ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); sl = &gpos->ScriptList; sr = sl->ScriptRecord; if ( script_index >= sl->ScriptCount ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); s = &sr[script_index].Script; lsr = s->LangSysRecord; @@ -5756,7 +5756,7 @@ HB_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos, HB_ScriptList* sl; HB_ScriptRecord* sr; - HB_Script* s; + HB_ScriptTable* s; HB_LangSysRecord* lsr; HB_LangSys* ls; HB_UShort* fi; @@ -5766,7 +5766,7 @@ HB_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos, if ( !gpos || !feature_tag_list ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); sl = &gpos->ScriptList; sr = sl->ScriptRecord; @@ -5775,7 +5775,7 @@ HB_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos, fr = fl->FeatureRecord; if ( script_index >= sl->ScriptCount ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); s = &sr[script_index].Script; lsr = s->LangSysRecord; @@ -5785,7 +5785,7 @@ HB_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos, else { if ( language_index >= s->LangSysCount ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); ls = &lsr[language_index].LangSys; } @@ -5800,7 +5800,7 @@ HB_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos, if ( fi[n] >= fl->FeatureCount ) { FREE( ftl ); - return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); } ftl[n] = fr[fi[n]].FeatureTag; } @@ -5830,7 +5830,7 @@ static HB_Error GPOS_Do_Glyph_Lookup( GPOS_Instance* gpi, nesting_level++; if ( nesting_level > HB_MAX_NESTING_LEVEL ) - return _hb_err(HB_Err_Too_Many_Nested_Contexts); + return ERR(HB_Err_Not_Covered); /* ERR() call intended */ lookup_count = gpos->LookupList.LookupCount; if (lookup_index >= lookup_count) @@ -5892,7 +5892,7 @@ _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st, case HB_GPOS_LOOKUP_CONTEXT: return Load_ContextPos ( st, stream ); case HB_GPOS_LOOKUP_CHAIN: return Load_ChainContextPos ( st, stream ); /*case HB_GPOS_LOOKUP_EXTENSION: return Load_ExtensionPos ( st, stream );*/ - default: return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format); + default: return ERR(HB_Err_Invalid_SubTable_Format); } } @@ -6010,7 +6010,7 @@ HB_Error HB_GPOS_Add_Feature( HB_GPOSHeader* gpos, if ( !gpos || feature_index >= gpos->FeatureList.FeatureCount || gpos->FeatureList.ApplyCount == gpos->FeatureList.FeatureCount ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); gpos->FeatureList.ApplyOrder[gpos->FeatureList.ApplyCount++] = feature_index; @@ -6040,7 +6040,7 @@ HB_Error HB_GPOS_Clear_Features( HB_GPOSHeader* gpos ) if ( !gpos ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); gpos->FeatureList.ApplyCount = 0; @@ -6058,7 +6058,7 @@ HB_Error HB_GPOS_Register_Glyph_Function( HB_GPOSHeader* gpos, HB_GlyphFunction gfunc ) { if ( !gpos ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); gpos->gfunc = gfunc; @@ -6072,7 +6072,7 @@ HB_Error HB_GPOS_Register_MM_Function( HB_GPOSHeader* gpos, void* data ) { if ( !gpos ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); gpos->mmfunc = mmfunc; gpos->data = data; @@ -6096,7 +6096,7 @@ HB_Error HB_GPOS_Apply_String( FT_Face face, int i, j, lookup_count, num_features; if ( !face || !gpos || !buffer ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); if ( buffer->in_length == 0 ) return HB_Err_Not_Covered; diff --git a/src/harfbuzz-gpos.h b/src/harfbuzz-gpos.h index 6d8cd8d5a..3563759fe 100644 --- a/src/harfbuzz-gpos.h +++ b/src/harfbuzz-gpos.h @@ -18,9 +18,6 @@ HB_BEGIN_HEADER -#define HB_Err_Invalid_GPOS_SubTable_Format 0x1020 -#define HB_Err_Invalid_GPOS_SubTable 0x1021 - /* Lookup types for glyph positioning */ diff --git a/src/harfbuzz-gsub.c b/src/harfbuzz-gsub.c index ccdb57fc1..fd17a286b 100644 --- a/src/harfbuzz-gsub.c +++ b/src/harfbuzz-gsub.c @@ -43,7 +43,7 @@ HB_Error HB_Load_GSUB_Table( FT_Face face, HB_Lookup* lo; if ( !retptr ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); if ( GOTO_Table( TTAG_GSUB ) ) return error; @@ -238,7 +238,7 @@ static HB_Error Load_SingleSubst( HB_GSUB_SubTable* st, break; default: - return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; @@ -307,14 +307,14 @@ static HB_Error Lookup_SingleSubst( HB_GSUBHeader* gsub, case 2: if ( index >= ss->ssf.ssf2.GlyphCount ) - return _hb_err(HB_Err_Invalid_GSUB_SubTable); + return ERR(HB_Err_Invalid_SubTable); value = ss->ssf.ssf2.Substitute[index]; if ( REPLACE_Glyph( buffer, value, nesting_level ) ) return error; break; default: - return _hb_err(HB_Err_Invalid_GSUB_SubTable); + return ERR(HB_Err_Invalid_SubTable); } if ( gdef && gdef->NewGlyphClasses ) @@ -504,7 +504,7 @@ static HB_Error Lookup_MultipleSubst( HB_GSUBHeader* gsub, return error; if ( index >= ms->SequenceCount ) - return _hb_err(HB_Err_Invalid_GSUB_SubTable); + return ERR(HB_Err_Invalid_SubTable); count = ms->Sequence[index].GlyphCount; s = ms->Sequence[index].Substitute; @@ -982,7 +982,7 @@ static HB_Error Lookup_LigatureSubst( HB_GSUBHeader* gsub, return error; if ( index >= ls->LigatureSetCount ) - return _hb_err(HB_Err_Invalid_GSUB_SubTable); + return ERR(HB_Err_Invalid_SubTable); lig = ls->LigatureSet[index].Ligature; @@ -1801,7 +1801,7 @@ static HB_Error Load_ContextSubst( HB_GSUB_SubTable* st, case 1: return Load_ContextSubst1( &cs->csf.csf1, stream ); case 2: return Load_ContextSubst2( &cs->csf.csf2, stream ); case 3: return Load_ContextSubst3( &cs->csf.csf3, stream ); - default: return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format); + default: return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; /* never reached */ @@ -1929,7 +1929,7 @@ static HB_Error Lookup_ContextSubst2( HB_GSUBHeader* gsub, scs = &csf2->SubClassSet[classes[0]]; if ( !scs ) { - error = _hb_err(HB_Err_Invalid_GSUB_SubTable); + error = ERR(HB_Err_Invalid_SubTable); goto End; } @@ -2056,7 +2056,7 @@ static HB_Error Lookup_ContextSubst( HB_GSUBHeader* gsub, case 1: return Lookup_ContextSubst1( gsub, &cs->csf.csf1, buffer, flags, context_length, nesting_level ); case 2: return Lookup_ContextSubst2( gsub, &cs->csf.csf2, buffer, flags, context_length, nesting_level ); case 3: return Lookup_ContextSubst3( gsub, &cs->csf.csf3, buffer, flags, context_length, nesting_level ); - default: return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format); + default: return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; /* never reached */ @@ -2676,17 +2676,17 @@ static HB_Error Load_ChainContextSubst2( FORGET_Frame(); if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccsf2->BacktrackClassDef, 65535, - backtrack_offset, base_offset, - stream ) ) != HB_Err_Ok ) + backtrack_offset, base_offset, + stream ) ) != HB_Err_Ok ) goto Fail5; if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccsf2->InputClassDef, count, - input_offset, base_offset, - stream ) ) != HB_Err_Ok ) + input_offset, base_offset, + stream ) ) != HB_Err_Ok ) goto Fail4; if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccsf2->LookaheadClassDef, 65535, - lookahead_offset, base_offset, - stream ) ) != HB_Err_Ok ) + lookahead_offset, base_offset, + stream ) ) != HB_Err_Ok ) goto Fail3; ccsf2->ChainSubClassSet = NULL; @@ -3010,7 +3010,7 @@ static HB_Error Load_ChainContextSubst( HB_GSUB_SubTable* st, case 1: return Load_ChainContextSubst1( &ccs->ccsf.ccsf1, stream ); case 2: return Load_ChainContextSubst2( &ccs->ccsf.ccsf2, stream ); case 3: return Load_ChainContextSubst3( &ccs->ccsf.ccsf3, stream ); - default: return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format); + default: return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; /* never reached */ @@ -3218,7 +3218,7 @@ static HB_Error Lookup_ChainContextSubst2( HB_GSUBHeader* gsub, cscs = &ccsf2->ChainSubClassSet[input_classes[0]]; if ( !cscs ) { - error = _hb_err(HB_Err_Invalid_GSUB_SubTable); + error = ERR(HB_Err_Invalid_SubTable); goto End1; } @@ -3479,7 +3479,7 @@ static HB_Error Lookup_ChainContextSubst( HB_GSUBHeader* gsub, case 1: return Lookup_ChainContextSubst1( gsub, &ccs->ccsf.ccsf1, buffer, flags, context_length, nesting_level ); case 2: return Lookup_ChainContextSubst2( gsub, &ccs->ccsf.ccsf2, buffer, flags, context_length, nesting_level ); case 3: return Lookup_ChainContextSubst3( gsub, &ccs->ccsf.ccsf3, buffer, flags, context_length, nesting_level ); - default: return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format); + default: return ERR(HB_Err_Invalid_SubTable_Format); } } @@ -3508,7 +3508,7 @@ static HB_Error Load_ReverseChainContextSubst( HB_GSUB_SubTable* st, rccs->SubstFormat = GET_UShort(); if ( rccs->SubstFormat != 1 ) - return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); FORGET_Frame(); @@ -3783,7 +3783,7 @@ HB_Error HB_GSUB_Select_Script( HB_GSUBHeader* gsub, if ( !gsub || !script_index ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); sl = &gsub->ScriptList; sr = sl->ScriptRecord; @@ -3811,18 +3811,18 @@ HB_Error HB_GSUB_Select_Language( HB_GSUBHeader* gsub, HB_ScriptList* sl; HB_ScriptRecord* sr; - HB_Script* s; + HB_ScriptTable* s; HB_LangSysRecord* lsr; if ( !gsub || !language_index || !req_feature_index ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); sl = &gsub->ScriptList; sr = sl->ScriptRecord; if ( script_index >= sl->ScriptCount ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); s = &sr[script_index].Script; lsr = s->LangSysRecord; @@ -3854,7 +3854,7 @@ HB_Error HB_GSUB_Select_Feature( HB_GSUBHeader* gsub, HB_ScriptList* sl; HB_ScriptRecord* sr; - HB_Script* s; + HB_ScriptTable* s; HB_LangSysRecord* lsr; HB_LangSys* ls; HB_UShort* fi; @@ -3864,7 +3864,7 @@ HB_Error HB_GSUB_Select_Feature( HB_GSUBHeader* gsub, if ( !gsub || !feature_index ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); sl = &gsub->ScriptList; sr = sl->ScriptRecord; @@ -3873,7 +3873,7 @@ HB_Error HB_GSUB_Select_Feature( HB_GSUBHeader* gsub, fr = fl->FeatureRecord; if ( script_index >= sl->ScriptCount ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); s = &sr[script_index].Script; lsr = s->LangSysRecord; @@ -3883,7 +3883,7 @@ HB_Error HB_GSUB_Select_Feature( HB_GSUBHeader* gsub, else { if ( language_index >= s->LangSysCount ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); ls = &lsr[language_index].LangSys; } @@ -3893,7 +3893,7 @@ HB_Error HB_GSUB_Select_Feature( HB_GSUBHeader* gsub, for ( n = 0; n < ls->FeatureCount; n++ ) { if ( fi[n] >= fl->FeatureCount ) - return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); if ( feature_tag == fr[fi[n]].FeatureTag ) { @@ -3922,7 +3922,7 @@ HB_Error HB_GSUB_Query_Scripts( HB_GSUBHeader* gsub, if ( !gsub || !script_tag_list ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); sl = &gsub->ScriptList; sr = sl->ScriptRecord; @@ -3951,18 +3951,18 @@ HB_Error HB_GSUB_Query_Languages( HB_GSUBHeader* gsub, HB_ScriptList* sl; HB_ScriptRecord* sr; - HB_Script* s; + HB_ScriptTable* s; HB_LangSysRecord* lsr; if ( !gsub || !language_tag_list ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); sl = &gsub->ScriptList; sr = sl->ScriptRecord; if ( script_index >= sl->ScriptCount ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); s = &sr[script_index].Script; lsr = s->LangSysRecord; @@ -3995,7 +3995,7 @@ HB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub, HB_ScriptList* sl; HB_ScriptRecord* sr; - HB_Script* s; + HB_ScriptTable* s; HB_LangSysRecord* lsr; HB_LangSys* ls; HB_UShort* fi; @@ -4005,7 +4005,7 @@ HB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub, if ( !gsub || !feature_tag_list ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); sl = &gsub->ScriptList; sr = sl->ScriptRecord; @@ -4014,7 +4014,7 @@ HB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub, fr = fl->FeatureRecord; if ( script_index >= sl->ScriptCount ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); s = &sr[script_index].Script; lsr = s->LangSysRecord; @@ -4024,7 +4024,7 @@ HB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub, else { if ( language_index >= s->LangSysCount ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); ls = &lsr[language_index].LangSys; } @@ -4039,7 +4039,7 @@ HB_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub, if ( fi[n] >= fl->FeatureCount ) { FREE( ftl ); - return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format); + return ERR(HB_Err_Invalid_SubTable_Format); } ftl[n] = fr[fi[n]].FeatureTag; } @@ -4067,7 +4067,7 @@ static HB_Error GSUB_Do_Glyph_Lookup( HB_GSUBHeader* gsub, nesting_level++; if ( nesting_level > HB_MAX_NESTING_LEVEL ) - return _hb_err(HB_Err_Too_Many_Nested_Contexts); + return ERR(HB_Err_Not_Covered); /* ERR() call intended */ lookup_count = gsub->LookupList.LookupCount; if (lookup_index >= lookup_count) @@ -4126,7 +4126,7 @@ _HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st, case HB_GSUB_LOOKUP_CHAIN: return Load_ChainContextSubst ( st, stream ); /*case HB_GSUB_LOOKUP_EXTENSION: return Load_ExtensionSubst ( st, stream );*/ case HB_GSUB_LOOKUP_REVERSE_CHAIN: return Load_ReverseChainContextSubst ( st, stream ); - default: return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format); + default: return ERR(HB_Err_Invalid_SubTable_Format); }; } @@ -4257,7 +4257,7 @@ HB_Error HB_GSUB_Add_Feature( HB_GSUBHeader* gsub, if ( !gsub || feature_index >= gsub->FeatureList.FeatureCount || gsub->FeatureList.ApplyCount == gsub->FeatureList.FeatureCount ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); gsub->FeatureList.ApplyOrder[gsub->FeatureList.ApplyCount++] = feature_index; @@ -4287,7 +4287,7 @@ HB_Error HB_GSUB_Clear_Features( HB_GSUBHeader* gsub ) if ( !gsub ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); gsub->FeatureList.ApplyCount = 0; @@ -4306,7 +4306,7 @@ HB_Error HB_GSUB_Register_Alternate_Function( HB_GSUBHeader* gsub, void* data ) { if ( !gsub ) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); gsub->altfunc = altfunc; gsub->data = data; @@ -4325,7 +4325,7 @@ HB_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub, if ( !gsub || !buffer) - return HB_Err_Invalid_Argument; + return ERR(HB_Err_Invalid_Argument); if ( buffer->in_length == 0 ) return retError; diff --git a/src/harfbuzz-gsub.h b/src/harfbuzz-gsub.h index 3f8ed7c06..8caa2ba27 100644 --- a/src/harfbuzz-gsub.h +++ b/src/harfbuzz-gsub.h @@ -18,9 +18,6 @@ HB_BEGIN_HEADER -#define HB_Err_Invalid_GSUB_SubTable_Format 0x1010 -#define HB_Err_Invalid_GSUB_SubTable 0x1011 - /* Lookup types for glyph substitution */ diff --git a/src/harfbuzz-impl.c b/src/harfbuzz-impl.c index 4479cd4b5..1d2b69905 100644 --- a/src/harfbuzz-impl.c +++ b/src/harfbuzz-impl.c @@ -36,7 +36,7 @@ _hb_qalloc( HB_UInt size, { block = malloc( size ); if ( !block ) - error = HB_Err_Out_Of_Memory; + error = ERR(HB_Err_Out_Of_Memory); } *perror = error; @@ -58,7 +58,7 @@ _hb_alloc( HB_UInt size, { block = malloc( size ); if ( !block ) - error = HB_Err_Out_Of_Memory; + error = ERR(HB_Err_Out_Of_Memory); else memset( (char*)block, 0, (size_t)size ); } @@ -78,7 +78,7 @@ _hb_realloc( FT_Pointer block, block2 = realloc( block, new_size ); if ( block2 == NULL && new_size != 0 ) - error = HB_Err_Out_Of_Memory; + error = ERR(HB_Err_Out_Of_Memory); if ( !error ) block = block2; @@ -114,10 +114,10 @@ _hb_stream_seek( HB_Stream stream, if ( stream->read ) { if ( stream->read( stream, pos, NULL, 0 ) ) - error = HB_Err_Invalid_Stream_Operation; + error = ERR(HB_Err_Read_Error); } else if ( pos > (HB_Int)stream->size ) - error = HB_Err_Invalid_Stream_Operation; + error = ERR(HB_Err_Read_Error); LOG(( "_hb_stream_seek(%ld) -> %d\n", pos, error )); return error; @@ -144,7 +144,7 @@ _hb_stream_frame_enter( HB_Stream stream, if ( read_bytes < count ) { FREE( stream->base ); - error = HB_Err_Invalid_Stream_Operation; + error = ERR(HB_Err_Read_Error); } stream->cursor = stream->base; stream->limit = stream->cursor + count; @@ -156,7 +156,7 @@ _hb_stream_frame_enter( HB_Stream stream, if ( stream->pos >= stream->size || stream->pos + count > stream->size ) { - error = HB_Err_Invalid_Stream_Operation; + error = ERR(HB_Err_Read_Error); goto Exit; } @@ -204,7 +204,7 @@ _hb_face_goto_table( FT_Face face, if ( !FT_IS_SFNT(face) ) { LOG(( "not a SFNT face !!\n" )); - error = HB_Err_Invalid_Face_Handle; + error = ERR(HB_Err_Invalid_Argument); } else { @@ -259,7 +259,7 @@ _hb_face_goto_table( FT_Face face, goto FoundIt; } } - error = HB_Err_Table_Missing; + error = HB_Err_Not_Covered; FoundIt: FORGET_Frame(); diff --git a/src/harfbuzz-impl.h b/src/harfbuzz-impl.h index 353123b2b..3e7ac1c00 100644 --- a/src/harfbuzz-impl.h +++ b/src/harfbuzz-impl.h @@ -140,6 +140,8 @@ _hb_face_goto_table( FT_Face face, #define MEM_Copy(dest,source,count) memcpy( (char*)(dest), (const char*)(source), (size_t)(count) ) +#define ERR(err) _hb_err (err) + HB_INTERNAL FT_Pointer _hb_alloc( HB_UInt size, diff --git a/src/harfbuzz-open.c b/src/harfbuzz-open.c index dfdaefdfe..5844e7482 100644 --- a/src/harfbuzz-open.c +++ b/src/harfbuzz-open.c @@ -68,7 +68,7 @@ static void Free_LangSys( HB_LangSys* ls ) /* Script */ -static HB_Error Load_Script( HB_Script* s, +static HB_Error Load_Script( HB_ScriptTable* s, HB_Stream stream ) { HB_Error error; @@ -116,7 +116,7 @@ static HB_Error Load_Script( HB_Script* s, if ( s->LangSysCount == 0 && s->DefaultLangSys.FeatureCount == 0 ) { - error = HB_Err_Empty_Script; + error = HB_Err_Not_Covered; goto Fail2; } @@ -160,7 +160,7 @@ Fail2: } -static void Free_Script( HB_Script* s ) +static void Free_Script( HB_ScriptTable* s ) { HB_UShort n, count; @@ -231,7 +231,7 @@ _HB_OPEN_Load_ScriptList( HB_ScriptList* sl, error = Load_Script( &sr[sl->ScriptCount].Script, stream ); if ( error == HB_Err_Ok ) sl->ScriptCount += 1; - else if ( error != HB_Err_Empty_Script ) + else if ( error != HB_Err_Not_Covered ) goto Fail; (void)FILE_Seek( cur_offset ); @@ -243,7 +243,7 @@ _HB_OPEN_Load_ScriptList( HB_ScriptList* sl, #if 0 if ( sl->ScriptCount == 0 ) { - error = _hb_err(HB_Err_Invalid_SubTable); + error = ERR(HB_Err_Invalid_SubTable); goto Fail; } #endif @@ -739,7 +739,7 @@ static HB_Error Load_Coverage2( HB_CoverageFormat2* cf2, ( rr[n].End - rr[n].Start + (long)rr[n].StartCoverageIndex ) >= 0x10000L ) { - error = _hb_err(HB_Err_Invalid_SubTable); + error = ERR(HB_Err_Invalid_SubTable); goto Fail; } } @@ -777,7 +777,7 @@ _HB_OPEN_Load_Coverage( HB_Coverage* c, { case 1: return Load_Coverage1( &c->cf.cf1, stream ); case 2: return Load_Coverage2( &c->cf.cf2, stream ); - default: return _hb_err(HB_Err_Invalid_SubTable_Format); + default: return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; /* never reached */ @@ -905,7 +905,7 @@ _HB_OPEN_Coverage_Index( HB_Coverage* c, { case 1: return Coverage_Index1( &c->cf.cf1, glyphID, index ); case 2: return Coverage_Index2( &c->cf.cf2, glyphID, index ); - default: return _hb_err(HB_Err_Invalid_SubTable_Format); + default: return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; /* never reached */ @@ -947,7 +947,7 @@ static HB_Error Load_ClassDef1( HB_ClassDefinition* cd, /* sanity check; we are limited to 16bit integers */ if ( cdf1->StartGlyph + (long)count >= 0x10000L ) - return _hb_err(HB_Err_Invalid_SubTable); + return ERR(HB_Err_Invalid_SubTable); cdf1->ClassValueArray = NULL; @@ -965,7 +965,7 @@ static HB_Error Load_ClassDef1( HB_ClassDefinition* cd, cva[n] = GET_UShort(); if ( cva[n] >= limit ) { - error = _hb_err(HB_Err_Invalid_SubTable); + error = ERR(HB_Err_Invalid_SubTable); goto Fail; } d[cva[n]] = TRUE; @@ -1089,7 +1089,7 @@ _HB_OPEN_Load_ClassDefinition( HB_ClassDefinition* cd, { case 1: error = Load_ClassDef1( cd, limit, stream ); break; case 2: error = Load_ClassDef2( cd, limit, stream ); break; - default: error = _hb_err(HB_Err_Invalid_SubTable_Format); break; + default: error = ERR(HB_Err_Invalid_SubTable_Format); break; } if ( error ) @@ -1277,7 +1277,7 @@ _HB_OPEN_Get_Class( HB_ClassDefinition* cd, { case 1: return Get_Class1( &cd->cd.cd1, glyphID, klass, index ); case 2: return Get_Class2( &cd->cd.cd2, glyphID, klass, index ); - default: return _hb_err(HB_Err_Invalid_SubTable_Format); + default: return ERR(HB_Err_Invalid_SubTable_Format); } return HB_Err_Ok; /* never reached */ diff --git a/src/harfbuzz-open.h b/src/harfbuzz-open.h index fd9c11028..d7cc9f01d 100644 --- a/src/harfbuzz-open.h +++ b/src/harfbuzz-open.h @@ -50,20 +50,20 @@ struct HB_LangSysRecord_ typedef struct HB_LangSysRecord_ HB_LangSysRecord; -struct HB_Script_ +struct HB_ScriptTable_ { HB_LangSys DefaultLangSys; /* DefaultLangSys table */ HB_UShort LangSysCount; /* number of LangSysRecords */ HB_LangSysRecord* LangSysRecord; /* array of LangSysRecords */ }; -typedef struct HB_Script_ HB_Script; +typedef struct HB_ScriptTable_ HB_ScriptTable; struct HB_ScriptRecord_ { HB_UInt ScriptTag; /* ScriptTag identifier */ - HB_Script Script; /* Script table */ + HB_ScriptTable Script; /* Script table */ }; typedef struct HB_ScriptRecord_ HB_ScriptRecord;