From b31d6def96ff99e89ba42e09661992498bda460d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 6 Apr 2006 18:23:49 +0000 Subject: [PATCH] Update from HarfBuzz. Lars Knoll fixed all the warnings. 2006-04-06 Behdad Esfahbod * pango/opentype: Update from HarfBuzz. Lars Knoll fixed all the warnings. --- src/harfbuzz-dump.c | 94 +++++++++++++++++++++++------------- src/harfbuzz-gpos.c | 80 +++++++++++++++++++------------ src/harfbuzz-gsub.c | 114 +++++++++++++++++++++++++------------------- src/harfbuzz-impl.h | 4 ++ 4 files changed, 179 insertions(+), 113 deletions(-) diff --git a/src/harfbuzz-dump.c b/src/harfbuzz-dump.c index 0500ff5e8..bf30f66b7 100644 --- a/src/harfbuzz-dump.c +++ b/src/harfbuzz-dump.c @@ -48,23 +48,23 @@ do_indent (FILE *stream, int indent) fprintf (stream, "%*s", indent * 3, ""); } -static void -dump (FILE *stream, int indent, const char *format, ...) +static void +dump (FILE *stream, int indent, const char *format, ...) { va_list list; - + do_indent (stream, indent); - + va_start (list, format); vfprintf (stream, format, list); va_end (list); } -static void -Dump_UShort_Array (FT_UShort *array, int count, const char *name, FILE *stream, int indent) +static void +Dump_UShort_Array (FT_UShort *array, int count, const char *name, FILE *stream, int indent) { int i; - + do_indent (stream, indent); fprintf (stream, "<%s>", name); @@ -73,10 +73,10 @@ Dump_UShort_Array (FT_UShort *array, int count, const char *name, FILE *stream, fprintf (stream, "\n", name); } -static void +static void Print_Tag (FT_ULong tag, FILE *stream) { - fprintf (stream, "%c%c%c%c", + fprintf (stream, "%c%c%c%c", (unsigned char)(tag >> 24), (unsigned char)((tag >> 16) & 0xff), (unsigned char)((tag >> 8) & 0xff), @@ -87,6 +87,8 @@ DEF_DUMP (LangSys) { int i; + FT_UNUSED(hb_type); + DUMP_FUINT (LangSys, LookupOrderOffset); DUMP_FUINT (LangSys, ReqFeatureIndex); DUMP_FUINT (LangSys, FeatureCount); @@ -116,11 +118,11 @@ DEF_DUMP (Script) DEF_DUMP (ScriptList) { int i; - + DUMP_FUINT (ScriptList, ScriptCount); for (i=0; i < ScriptList->ScriptCount; i++) - { + { do_indent (stream, indent); fprintf (stream, ""); Print_Tag (ScriptList->ScriptRecord[i].ScriptTag, stream); @@ -132,7 +134,9 @@ DEF_DUMP (ScriptList) DEF_DUMP (Feature) { int i; - + + FT_UNUSED(hb_type); + DUMP_FUINT (Feature, FeatureParams); DUMP_FUINT (Feature, LookupListCount); @@ -142,6 +146,8 @@ DEF_DUMP (Feature) DEF_DUMP (MarkRecord) { + FT_UNUSED(hb_type); + DUMP_FUINT (MarkRecord, Class); DUMP1("%d\n", MarkRecord->MarkAnchor.PosFormat ); } @@ -159,11 +165,11 @@ DEF_DUMP (MarkArray) DEF_DUMP (FeatureList) { int i; - + DUMP_FUINT (FeatureList, FeatureCount); for (i=0; i < FeatureList->FeatureCount; i++) - { + { do_indent (stream, indent); fprintf (stream, ""); Print_Tag (FeatureList->FeatureRecord[i].FeatureTag, stream); @@ -174,6 +180,8 @@ DEF_DUMP (FeatureList) DEF_DUMP (Coverage) { + FT_UNUSED(hb_type); + DUMP_FUINT (Coverage, CoverageFormat); if (Coverage->CoverageFormat == 1) @@ -189,7 +197,7 @@ DEF_DUMP (Coverage) { int i; DUMP_FUINT (&Coverage->cf.cf2, RangeCount); - + for ( i = 0; i < Coverage->cf.cf2.RangeCount; i++ ) DUMP3("%#06x - %#06x \n", Coverage->cf.cf2.RangeRecord[i].Start, @@ -199,13 +207,17 @@ DEF_DUMP (Coverage) DEF_DUMP (ClassRangeRecord) { + FT_UNUSED(hb_type); + DUMP_FGLYPH (ClassRangeRecord, Start); DUMP_FGLYPH (ClassRangeRecord, End); DUMP_FUINT (ClassRangeRecord, Class); } - + DEF_DUMP (ClassDefinition) { + FT_UNUSED(hb_type); + DUMP_FUINT( ClassDefinition, ClassFormat); DUMP_FUINT( ClassDefinition, loaded); @@ -225,7 +237,7 @@ DEF_DUMP (ClassDefinition) int i; HB_ClassDefFormat2 *ClassDefFormat2 = &ClassDefinition->cd.cd2; DUMP_FUINT (ClassDefFormat2, ClassRangeCount); - + for (i = 0; i < ClassDefFormat2->ClassRangeCount; i++) RECURSE_NUM (ClassRangeRecord, i, ClassRangeRecord, &ClassDefFormat2->ClassRangeRecord[i]); } @@ -235,6 +247,8 @@ DEF_DUMP (ClassDefinition) DEF_DUMP (SubstLookupRecord) { + FT_UNUSED(hb_type); + DUMP_FUINT (SubstLookupRecord, SequenceIndex); DUMP_FUINT (SubstLookupRecord, LookupListIndex); } @@ -246,7 +260,7 @@ DEF_DUMP (ChainSubClassRule) DUMP_USHORT_ARRAY (ChainSubClassRule, Backtrack, ChainSubClassRule->BacktrackGlyphCount); DUMP_USHORT_ARRAY (ChainSubClassRule, Input, ChainSubClassRule->InputGlyphCount - 1); DUMP_USHORT_ARRAY (ChainSubClassRule, Lookahead, ChainSubClassRule->LookaheadGlyphCount); - + for (i = 0; i < ChainSubClassRule->SubstCount; i++) RECURSE_NUM (SubstLookupRecord, i, SubstLookupRecord, &ChainSubClassRule->SubstLookupRecord[i]); @@ -256,7 +270,7 @@ DEF_DUMP (ChainSubClassRule) DEF_DUMP (ChainSubClassSet) { int i; - + DUMP_FUINT( ChainSubClassSet, ChainSubClassRuleCount ); for (i = 0; i < ChainSubClassSet->ChainSubClassRuleCount; i++) RECURSE_NUM (ChainSubClassRule, i, ChainSubClassRule, &ChainSubClassSet->ChainSubClassRule[i]); @@ -277,7 +291,7 @@ Dump_GSUB_Lookup_Single (HB_SubTable *subtable, FILE *stream, int indent, HB_Typ else { int i; - + DUMP_FINT (&SingleSubst->ssf.ssf2, GlyphCount); for (i=0; i < SingleSubst->ssf.ssf2.GlyphCount; i++) DUMP2("%#06x \n", SingleSubst->ssf.ssf2.Substitute[i], i); @@ -287,7 +301,9 @@ Dump_GSUB_Lookup_Single (HB_SubTable *subtable, FILE *stream, int indent, HB_Typ DEF_DUMP (Ligature) { int i; - + + FT_UNUSED(hb_type); + DUMP_FGLYPH (Ligature, LigGlyph); DUMP_FUINT (Ligature, ComponentCount); @@ -298,7 +314,7 @@ DEF_DUMP (Ligature) DEF_DUMP (LigatureSet) { int i; - + DUMP_FUINT (LigatureSet, LigatureCount); for (i=0; i < LigatureSet->LigatureCount; i++) @@ -322,6 +338,10 @@ Dump_GSUB_Lookup_Ligature (HB_SubTable *subtable, FILE *stream, int indent, HB_T DEF_DUMP (ContextSubstFormat1) { + FT_UNUSED(hb_type); + FT_UNUSED(ContextSubstFormat1); + + DUMP("\n"); } @@ -334,6 +354,9 @@ DEF_DUMP (ContextSubstFormat2) DEF_DUMP (ContextSubstFormat3) { + FT_UNUSED(hb_type); + FT_UNUSED(ContextSubstFormat3); + DUMP("\n"); } @@ -361,13 +384,16 @@ Dump_GSUB_Lookup_Context (HB_SubTable *subtable, FILE *stream, int indent, HB_Ty DEF_DUMP (ChainContextSubstFormat1) { + FT_UNUSED(hb_type); + FT_UNUSED(ChainContextSubstFormat1); + DUMP("\n"); } DEF_DUMP (ChainContextSubstFormat2) { int i; - + RECURSE (Coverage, Coverage, &ChainContextSubstFormat2->Coverage); DUMP_FUINT (ChainContextSubstFormat2, MaxBacktrackLength); RECURSE (ClassDefinition, ClassDefinition, &ChainContextSubstFormat2->BacktrackClassDef); @@ -375,7 +401,7 @@ DEF_DUMP (ChainContextSubstFormat2) RECURSE (ClassDefinition, ClassDefinition, &ChainContextSubstFormat2->InputClassDef); DUMP_FUINT (ChainContextSubstFormat2, MaxLookaheadLength); RECURSE (ClassDefinition, ClassDefinition, &ChainContextSubstFormat2->LookaheadClassDef); - + DUMP_FUINT (ChainContextSubstFormat2, ChainSubClassSetCount); for (i = 0; i < ChainContextSubstFormat2->ChainSubClassSetCount; i++) RECURSE (ChainSubClassSet, ChainSubClassSet, &ChainContextSubstFormat2->ChainSubClassSet[i]); @@ -384,7 +410,7 @@ DEF_DUMP (ChainContextSubstFormat2) DEF_DUMP (ChainContextSubstFormat3) { int i; - + DUMP_FUINT (ChainContextSubstFormat3, BacktrackGlyphCount); for (i = 0; i < ChainContextSubstFormat3->BacktrackGlyphCount; i++) RECURSE (BacktrackCoverage, Coverage, &ChainContextSubstFormat3->BacktrackCoverage[i]); @@ -404,7 +430,7 @@ static void Dump_GSUB_Lookup_Chain (HB_SubTable *subtable, FILE *stream, int indent, HB_Type hb_type) { HB_ChainContextSubst *chain = &subtable->st.gsub.chain; - + DUMP_FUINT (chain, SubstFormat); switch (chain->SubstFormat) { @@ -429,7 +455,9 @@ Dump_Device (HB_Device *Device, FILE *stream, int indent, HB_Type hb_type) int bits = 0; int n_per; unsigned int mask; - + + FT_UNUSED(hb_type); + DUMP_FUINT (Device, StartSize); DUMP_FUINT (Device, EndSize); DUMP_FUINT (Device, DeltaFormat); @@ -469,7 +497,7 @@ Dump_Device (HB_Device *Device, FILE *stream, int indent, HB_Type hb_type) } DUMP ("\n"); } - + static void Dump_ValueRecord (HB_ValueRecord *ValueRecord, FILE *stream, int indent, HB_Type hb_type, FT_UShort value_format) { @@ -516,7 +544,7 @@ Dump_GPOS_Lookup_Single (HB_SubTable *subtable, FILE *stream, int indent, HB_Typ else { int i; - + DUMP_FUINT (&SinglePos->spf.spf2, ValueCount); for (i = 0; i < SinglePos->spf.spf2.ValueCount; i++) DUMP_VALUE_RECORD (&SinglePos->spf.spf2.Value[i], SinglePos->ValueFormat); @@ -578,16 +606,16 @@ Dump_GPOS_Lookup_Markbase (HB_SubTable *subtable, FILE *stream, int indent, HB_T { int i; HB_MarkBasePos *markbase = &subtable->st.gpos.markbase; - + DUMP_FUINT (markbase, PosFormat); RECURSE (Coverage, Coverage, &markbase->MarkCoverage); RECURSE (Coverage, Coverage, &markbase->BaseCoverage); DUMP_FUINT (markbase, ClassCount); RECURSE (MarkArray, MarkArray, &markbase->MarkArray); - + DUMP ("\n"); indent++; - + DUMP_FUINT (&markbase->BaseArray, BaseCount); for (i = 0; i < markbase->BaseArray.BaseCount; i++) { @@ -598,7 +626,7 @@ Dump_GPOS_Lookup_Markbase (HB_SubTable *subtable, FILE *stream, int indent, HB_T DUMP1 (" %d\n", r->BaseAnchor->PosFormat); DUMP ("\n"); } - + indent--; DUMP ("\n"); } diff --git a/src/harfbuzz-gpos.c b/src/harfbuzz-gpos.c index e75e1cc65..d668749e5 100644 --- a/src/harfbuzz-gpos.c +++ b/src/harfbuzz-gpos.c @@ -48,6 +48,10 @@ static FT_Error default_mmfunc( FT_Face face, FT_Pos* metric_value, void* data ) { + FT_UNUSED(face); + FT_UNUSED(metric_id); + FT_UNUSED(metric_value); + FT_UNUSED(data); return HB_Err_No_MM_Interpreter; } @@ -184,7 +188,7 @@ Fail4: FT_Error HB_Done_GPOS_Table( HB_GPOSHeader* gpos ) { FT_Memory memory = gpos->memory; - + _HB_OPEN_Free_LookupList( &gpos->LookupList, HB_Type_GPOS, memory ); _HB_OPEN_Free_FeatureList( &gpos->FeatureList, memory ); _HB_OPEN_Free_ScriptList( &gpos->ScriptList, memory ); @@ -212,7 +216,7 @@ static FT_Error Load_ValueRecord( HB_ValueRecord* vr, { FT_Error error; FT_Memory memory = stream->memory; - + FT_ULong cur_offset, new_offset; @@ -745,10 +749,10 @@ static FT_Error Get_Anchor( GPOS_Instance* gpi, return error; if ( gpi->face->glyph->format != ft_glyph_format_outline ) - return HB_Err_Invalid_GPOS_SubTable; + return HB_Err_Invalid_GPOS_SubTable; ap = an->af.af2.AnchorPoint; - + outline = gpi->face->glyph->outline; /* if outline.n_points is set to zero by gfunc(), we use the @@ -824,7 +828,7 @@ static FT_Error Load_MarkArray ( HB_MarkArray* ma, return error; count = ma->MarkCount = GET_UShort(); - + FORGET_Frame(); ma->MarkRecord = NULL; @@ -1013,6 +1017,12 @@ static FT_Error Lookup_DefaultPos( GPOS_Instance* gpi, FT_UShort context_length, int nesting_level ) { + FT_UNUSED(gpi); + FT_UNUSED(st); + FT_UNUSED(buffer); + FT_UNUSED(flags); + FT_UNUSED(context_length); + FT_UNUSED(nesting_level); return HB_Err_Not_Covered; } @@ -1028,6 +1038,7 @@ static FT_Error Lookup_SinglePos( GPOS_Instance* gpi, HB_GPOSHeader* gpos = gpi->gpos; HB_SinglePos* sp = &st->single; + FT_UNUSED(nesting_level); if ( context_length != 0xFFFF && context_length < 1 ) return HB_Err_Not_Covered; @@ -1091,7 +1102,7 @@ static FT_Error Load_PairSet ( HB_PairSet* ps, return error; count = ps->PairValueCount = GET_UShort(); - + FORGET_Frame(); ps->PairValueRecord = NULL; @@ -1333,7 +1344,7 @@ static FT_Error Load_PairPos2( HB_PairPosFormat2* ppf2, if ( error ) { if ( format1 ) - Free_ValueRecord( &c2r[n].Value1, format1, memory ); + Free_ValueRecord( &c2r[n].Value1, format1, memory ); goto Fail0; } } @@ -1591,6 +1602,7 @@ static FT_Error Lookup_PairPos( GPOS_Instance* gpi, HB_GPOSHeader* gpos = gpi->gpos; HB_PairPos* pp = &st->pair; + FT_UNUSED(nesting_level); if ( buffer->in_pos >= buffer->in_length - 1 ) return HB_Err_Not_Covered; /* Not enough glyphs in stream */ @@ -1697,7 +1709,7 @@ static FT_Error Load_CursivePos( HB_GPOS_SubTable* st, for ( n = 0; n < count; n++ ) { FT_ULong entry_offset; - + if ( ACCESS_Frame( 2L ) ) return error; @@ -1805,6 +1817,7 @@ static FT_Error Lookup_CursivePos( GPOS_Instance* gpi, FT_Pos entry_x, entry_y; FT_Pos exit_x, exit_y; + FT_UNUSED(nesting_level); if ( context_length != 0xFFFF && context_length < 1 ) { @@ -2035,7 +2048,7 @@ static FT_Error Load_BaseArray( HB_BaseArray* ba, return error; count = ba->BaseCount = GET_UShort(); - + FORGET_Frame(); ba->BaseRecord = NULL; @@ -2089,7 +2102,7 @@ Fail: for ( k = 0; k < m; k++ ) { ban = br[k].BaseAnchor; - + for ( n = 0; n < num_classes; n++ ) Free_Anchor( &ban[n], memory ); @@ -2249,6 +2262,7 @@ static FT_Error Lookup_MarkBasePos( GPOS_Instance* gpi, HB_Position o; + FT_UNUSED(nesting_level); if ( context_length != 0xFFFF && context_length < 1 ) return HB_Err_Not_Covered; @@ -2367,7 +2381,7 @@ static FT_Error Load_LigatureAttach( HB_LigatureAttach* lat, return error; count = lat->ComponentCount = GET_UShort(); - + FORGET_Frame(); lat->ComponentRecord = NULL; @@ -2422,7 +2436,7 @@ Fail: for ( k = 0; k < m; k++ ) { lan = cr[k].LigatureAnchor; - + for ( n = 0; n < num_classes; n++ ) Free_Anchor( &lan[n], memory ); @@ -2664,6 +2678,7 @@ static FT_Error Lookup_MarkLigPos( GPOS_Instance* gpi, HB_Position o; + FT_UNUSED(nesting_level); if ( context_length != 0xFFFF && context_length < 1 ) return HB_Err_Not_Covered; @@ -2798,7 +2813,7 @@ static FT_Error Load_Mark2Array( HB_Mark2Array* m2a, return error; count = m2a->Mark2Count = GET_UShort(); - + FORGET_Frame(); m2a->Mark2Record = NULL; @@ -2846,7 +2861,7 @@ Fail: for ( k = 0; k < m; k++ ) { m2an = m2r[k].Mark2Anchor; - + for ( n = 0; n < num_classes; n++ ) Free_Anchor( &m2an[n], memory ); @@ -3006,6 +3021,7 @@ static FT_Error Lookup_MarkMarkPos( GPOS_Instance* gpi, HB_Position o; + FT_UNUSED(nesting_level); if ( context_length != 0xFFFF && context_length < 1 ) return HB_Err_Not_Covered; @@ -3897,7 +3913,7 @@ static FT_Error Lookup_ContextPos1( GPOS_Instance* gpi, if ( error && error != HB_Err_Not_Covered ) return error; - if ( j + pr[k].GlyphCount - i == buffer->in_length ) + if ( j + pr[k].GlyphCount - i == (FT_Long)buffer->in_length ) goto next_posrule; j++; } @@ -3910,7 +3926,7 @@ static FT_Error Lookup_ContextPos1( GPOS_Instance* gpi, pr[k].PosCount, pr[k].PosLookupRecord, buffer, nesting_level ); - + next_posrule: ; } @@ -3990,7 +4006,7 @@ static FT_Error Lookup_ContextPos2( GPOS_Instance* gpi, if ( error && error != HB_Err_Not_Covered ) goto End; - if ( j + pr->GlyphCount - i == buffer->in_length ) + if ( j + pr->GlyphCount - i == (FT_Long)buffer->in_length ) goto next_posclassrule; j++; } @@ -4062,7 +4078,7 @@ static FT_Error Lookup_ContextPos3( GPOS_Instance* gpi, if ( error && error != HB_Err_Not_Covered ) return error; - if ( j + cpf3->GlyphCount - i == buffer->in_length ) + if ( j + cpf3->GlyphCount - i == (FT_Long)buffer->in_length ) return HB_Err_Not_Covered; j++; } @@ -5215,7 +5231,7 @@ static FT_Error Lookup_ChainContextPos1( if ( error && error != HB_Err_Not_Covered ) return error; - if ( j + igc - i + lgc == buffer->in_length ) + if ( j + igc - i + lgc == (FT_Long)buffer->in_length ) goto next_chainposrule; j++; } @@ -5234,7 +5250,7 @@ static FT_Error Lookup_ChainContextPos1( if ( error && error != HB_Err_Not_Covered ) return error; - if ( j + lgc - i == buffer->in_length ) + if ( j + lgc - i == (FT_Long)buffer->in_length ) goto next_chainposrule; j++; } @@ -5387,7 +5403,7 @@ static FT_Error Lookup_ChainContextPos2( if ( error && error != HB_Err_Not_Covered ) goto End1; - if ( j + igc - i + lgc == buffer->in_length ) + if ( j + igc - i + lgc == (FT_Long)buffer->in_length ) goto next_chainposclassrule; j++; } @@ -5417,7 +5433,7 @@ static FT_Error Lookup_ChainContextPos2( if ( error && error != HB_Err_Not_Covered ) goto End1; - if ( j + lgc - i == buffer->in_length ) + if ( j + lgc - i == (FT_Long)buffer->in_length ) goto next_chainposclassrule; j++; } @@ -5531,7 +5547,7 @@ static FT_Error Lookup_ChainContextPos3( if ( error && error != HB_Err_Not_Covered ) return error; - if ( j + igc - i + lgc == buffer->in_length ) + if ( j + igc - i + lgc == (FT_Long)buffer->in_length ) return HB_Err_Not_Covered; j++; } @@ -5553,7 +5569,7 @@ static FT_Error Lookup_ChainContextPos3( if ( error && error != HB_Err_Not_Covered ) return error; - if ( j + lgc - i == buffer->in_length ) + if ( j + lgc - i == (FT_Long)buffer->in_length ) return HB_Err_Not_Covered; j++; } @@ -5968,6 +5984,8 @@ static FT_Error GPOS_Do_Glyph_Lookup( GPOS_Instance* gpi, static FT_Error Load_DefaultPos( HB_GPOS_SubTable* st, FT_Stream stream ) { + FT_UNUSED(st); + FT_UNUSED(stream); return HB_Err_Invalid_GPOS_SubTable_Format; } @@ -6004,6 +6022,8 @@ FT_Error _HB_GPOS_Load_SubTable( HB_GPOS_SubTable* st, static void Free_DefaultPos( HB_GPOS_SubTable* st, FT_Memory memory ) { + FT_UNUSED(st); + FT_UNUSED(memory); } typedef void (*Free_Pos_Func_Type)( HB_GPOS_SubTable* st, @@ -6103,7 +6123,7 @@ static FT_Error Position_CursiveChain ( HB_Buffer buffer ) if (positions[j].cursive_chain > 0) positions[j].y_pos += positions[j - positions[j].cursive_chain].y_pos; } - + /* Then handle all right-to-left connections */ for (i = buffer->in_length; i > 0; i--) { @@ -6112,7 +6132,7 @@ static FT_Error Position_CursiveChain ( HB_Buffer buffer ) if (positions[j].cursive_chain < 0) positions[j].y_pos += positions[j - positions[j].cursive_chain].y_pos; } - + return FT_Err_Ok; } @@ -6129,7 +6149,7 @@ FT_Error HB_GPOS_Add_Feature( HB_GPOSHeader* gpos, FT_UShort lookup_count; /* Each feature can only be added once */ - + if ( !gpos || feature_index >= gpos->FeatureList.FeatureCount || gpos->FeatureList.ApplyCount == gpos->FeatureList.FeatureCount ) @@ -6228,11 +6248,11 @@ FT_Error HB_GPOS_Apply_String( FT_Face face, gpi.load_flags = load_flags; gpi.r2l = r2l; gpi.dvi = dvi; - + lookup_count = gpos->LookupList.LookupCount; for ( i = 0; i < gpos->FeatureList.ApplyCount; i++ ) - { + { /* index of i'th feature */ feature_index = gpos->FeatureList.ApplyOrder[i]; feature = gpos->FeatureList.FeatureRecord[feature_index].Feature; @@ -6255,7 +6275,7 @@ FT_Error HB_GPOS_Apply_String( FT_Face face, retError = error; } } - + error = Position_CursiveChain ( buffer ); if ( error ) return error; diff --git a/src/harfbuzz-gsub.c b/src/harfbuzz-gsub.c index 7610e1e2a..1d91a1176 100644 --- a/src/harfbuzz-gsub.c +++ b/src/harfbuzz-gsub.c @@ -155,7 +155,7 @@ Fail4: FT_Error HB_Done_GSUB_Table( HB_GSUBHeader* gsub ) { FT_Memory memory = gsub->memory; - + _HB_OPEN_Free_LookupList( &gsub->LookupList, HB_Type_GSUB, memory ); _HB_OPEN_Free_FeatureList( &gsub->FeatureList, memory ); _HB_OPEN_Free_ScriptList( &gsub->ScriptList, memory ); @@ -176,6 +176,12 @@ static FT_Error Lookup_DefaultSubst( HB_GSUBHeader* gsub, FT_UShort context_length, int nesting_level ) { + FT_UNUSED(gsub); + FT_UNUSED(st); + FT_UNUSED(buffer); + FT_UNUSED(flags); + FT_UNUSED(context_length); + FT_UNUSED(nesting_level); return HB_Err_Not_Covered; } @@ -297,6 +303,8 @@ static FT_Error Lookup_SingleSubst( HB_GSUBHeader* gsub, HB_SingleSubst* ss = &st->single; HB_GDEFHeader* gdef = gsub->gdef; + FT_UNUSED(nesting_level); + if ( context_length != 0xFFFF && context_length < 1 ) return HB_Err_Not_Covered; @@ -506,6 +514,7 @@ static FT_Error Lookup_MultipleSubst( HB_GSUBHeader* gsub, HB_MultipleSubst* ms = &st->multiple; HB_GDEFHeader* gdef = gsub->gdef; + FT_UNUSED(nesting_level); if ( context_length != 0xFFFF && context_length < 1 ) return HB_Err_Not_Covered; @@ -705,10 +714,9 @@ static FT_Error Lookup_AlternateSubst( HB_GSUBHeader* gsub, FT_UShort index, alt_index, property; HB_AlternateSubst* as = &st->alternate; HB_GDEFHeader* gdef = gsub->gdef; - - HB_AlternateSet aset; + FT_UNUSED(nesting_level); if ( context_length != 0xFFFF && context_length < 1 ) return HB_Err_Not_Covered; @@ -995,6 +1003,7 @@ static FT_Error Lookup_LigatureSubst( HB_GSUBHeader* gsub, HB_Ligature* lig; + FT_UNUSED(nesting_level); if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) return error; @@ -1032,7 +1041,7 @@ static FT_Error Lookup_LigatureSubst( HB_GSUBHeader* gsub, if ( error && error != HB_Err_Not_Covered ) return error; - if ( j + lig->ComponentCount - i == buffer->in_length ) + if ( j + lig->ComponentCount - i == (FT_Long)buffer->in_length ) goto next_ligature; j++; } @@ -1924,7 +1933,7 @@ static FT_Error Lookup_ContextSubst1( HB_GSUBHeader* gsub, if ( error && error != HB_Err_Not_Covered ) return error; - if ( j + sr[k].GlyphCount - i == buffer->in_length ) + if ( j + sr[k].GlyphCount - i == (FT_Long)buffer->in_length ) goto next_subrule; j++; } @@ -2015,7 +2024,7 @@ static FT_Error Lookup_ContextSubst2( HB_GSUBHeader* gsub, if ( error && error != HB_Err_Not_Covered ) goto End; - if ( j + sr->GlyphCount - i < buffer->in_length ) + if ( j + sr->GlyphCount - i < (FT_Long)buffer->in_length ) goto next_subclassrule; j++; } @@ -2086,7 +2095,7 @@ static FT_Error Lookup_ContextSubst3( HB_GSUBHeader* gsub, if ( error && error != HB_Err_Not_Covered ) return error; - if ( j + csf3->GlyphCount - i == buffer->in_length ) + if ( j + csf3->GlyphCount - i == (FT_Long)buffer->in_length ) return HB_Err_Not_Covered; j++; } @@ -2786,7 +2795,7 @@ static FT_Error Load_ChainContextSubst2( backtrack_offset, base_offset, stream ) ) != FT_Err_Ok ) goto Fail5; - + if ( ( error = GSUB_Load_EmptyOrClassDefinition( &ccsf2->InputClassDef, count, input_offset, base_offset, stream ) ) != FT_Err_Ok ) @@ -3242,7 +3251,7 @@ static FT_Error Lookup_ChainContextSubst1( HB_GSUBHeader* gsub, if ( error && error != HB_Err_Not_Covered ) return error; - if ( j + igc - i + lgc == buffer->in_length ) + if ( j + igc - i + lgc == (FT_Long)buffer->in_length ) goto next_chainsubrule; j++; } @@ -3261,7 +3270,7 @@ static FT_Error Lookup_ChainContextSubst1( HB_GSUBHeader* gsub, if ( error && error != HB_Err_Not_Covered ) return error; - if ( j + lgc - i == buffer->in_length ) + if ( j + lgc - i == (FT_Long)buffer->in_length ) goto next_chainsubrule; j++; } @@ -3413,7 +3422,7 @@ static FT_Error Lookup_ChainContextSubst2( HB_GSUBHeader* gsub, if ( error && error != HB_Err_Not_Covered ) goto End1; - if ( j + igc - i + lgc == buffer->in_length ) + if ( j + igc - i + lgc == (FT_Long)buffer->in_length ) goto next_chainsubclassrule; j++; } @@ -3443,7 +3452,7 @@ static FT_Error Lookup_ChainContextSubst2( HB_GSUBHeader* gsub, if ( error && error != HB_Err_Not_Covered ) goto End1; - if ( j + lgc - i == buffer->in_length ) + if ( j + lgc - i == (FT_Long)buffer->in_length ) goto next_chainsubclassrule; j++; } @@ -3554,8 +3563,8 @@ static FT_Error Lookup_ChainContextSubst3( HB_GSUBHeader* gsub, { if ( error && error != HB_Err_Not_Covered ) return error; - - if ( j + igc - i + lgc == buffer->in_length ) + + if ( j + igc - i + lgc == (FT_Long)buffer->in_length ) return HB_Err_Not_Covered; j++; } @@ -3577,7 +3586,7 @@ static FT_Error Lookup_ChainContextSubst3( HB_GSUBHeader* gsub, if ( error && error != HB_Err_Not_Covered ) return error; - if ( j + lgc - i == buffer->in_length ) + if ( j + lgc - i == (FT_Long)buffer->in_length ) return HB_Err_Not_Covered; j++; } @@ -3650,17 +3659,17 @@ static FT_Error Load_ReverseChainContextSubst( HB_GSUB_SubTable* st, if ( ACCESS_Frame( 2L ) ) return error; - + rccs->SubstFormat = GET_UShort(); - + if ( rccs->SubstFormat != 1 ) return HB_Err_Invalid_GSUB_SubTable_Format; - FORGET_Frame(); + FORGET_Frame(); if ( ACCESS_Frame( 2L ) ) return error; - + new_offset = GET_UShort() + base_offset; FORGET_Frame(); @@ -3671,12 +3680,12 @@ static FT_Error Load_ReverseChainContextSubst( HB_GSUB_SubTable* st, return error; (void)FILE_Seek( cur_offset ); - + if ( ACCESS_Frame( 2L ) ) goto Fail4; rccs->BacktrackGlyphCount = GET_UShort(); - + FORGET_Frame(); rccs->BacktrackCoverage = NULL; @@ -3686,7 +3695,7 @@ static FT_Error Load_ReverseChainContextSubst( HB_GSUB_SubTable* st, if ( ALLOC_ARRAY( rccs->BacktrackCoverage, backtrack_count, HB_Coverage ) ) goto Fail4; - + b = rccs->BacktrackCoverage; for ( nb = 0; nb < backtrack_count; nb++ ) @@ -3710,7 +3719,7 @@ static FT_Error Load_ReverseChainContextSubst( HB_GSUB_SubTable* st, goto Fail3; rccs->LookaheadGlyphCount = GET_UShort(); - + FORGET_Frame(); rccs->LookaheadCoverage = NULL; @@ -3738,12 +3747,12 @@ static FT_Error Load_ReverseChainContextSubst( HB_GSUB_SubTable* st, goto Fail2; (void)FILE_Seek( cur_offset ); } - + if ( ACCESS_Frame( 2L ) ) goto Fail2; rccs->GlyphCount = GET_UShort(); - + FORGET_Frame(); rccs->Substitute = NULL; @@ -3755,20 +3764,20 @@ static FT_Error Load_ReverseChainContextSubst( HB_GSUB_SubTable* st, goto Fail2; sub = rccs->Substitute; - + if ( ACCESS_Frame( count * 2L ) ) goto Fail1; - + for ( n = 0; n < count; n++ ) sub[n] = GET_UShort(); - + FORGET_Frame(); - + return FT_Err_Ok; Fail1: FREE( sub ); - + Fail2: for ( m = 0; m < nl; m++ ) _HB_OPEN_Free_Coverage( &l[m], memory ); @@ -3782,21 +3791,21 @@ Fail3: FREE( b ); Fail4: - _HB_OPEN_Free_Coverage( &rccs->Coverage, memory ); + _HB_OPEN_Free_Coverage( &rccs->Coverage, memory ); return error; } static void Free_ReverseChainContextSubst( HB_GSUB_SubTable* st, FT_Memory memory ) -{ +{ FT_UShort n, count; HB_ReverseChainContextSubst* rccs = &st->reverse; HB_Coverage* c; _HB_OPEN_Free_Coverage( &rccs->Coverage, memory ); - + if ( rccs->LookaheadCoverage ) { count = rccs->LookaheadGlyphCount; @@ -3847,10 +3856,10 @@ static FT_Error Lookup_ReverseChainContextSubst( HB_GSUBHeader* gsub, lgc = rccs->LookaheadGlyphCount; /* check whether context is too long; it is a first guess only */ - + if ( bgc > string_index || string_index + 1 + lgc > buffer->in_length ) return HB_Err_Not_Covered; - + if ( bgc ) { /* Since we don't know in advance the number of glyphs to inspect, @@ -3877,14 +3886,14 @@ static FT_Error Lookup_ReverseChainContextSubst( HB_GSUBHeader* gsub, } j = string_index; - + error = _HB_OPEN_Coverage_Index( &rccs->Coverage, IN_GLYPH( j ), &input_index ); if ( error ) return error; /* we are starting for lookahead glyphs right after the last context glyph */ - + j += 1; lc = rccs->LookaheadCoverage; @@ -3896,7 +3905,7 @@ static FT_Error Lookup_ReverseChainContextSubst( HB_GSUBHeader* gsub, if ( error && error != HB_Err_Not_Covered ) return error; - if ( j + lgc - i == buffer->in_length ) + if ( j + lgc - i == (FT_Long)buffer->in_length ) return HB_Err_Not_Covered; j++; } @@ -3907,7 +3916,7 @@ static FT_Error Lookup_ReverseChainContextSubst( HB_GSUBHeader* gsub, } IN_GLYPH( string_index ) = rccs->Substitute[input_index]; - + return error; } @@ -4110,7 +4119,7 @@ FT_Error HB_GSUB_Query_Languages( HB_GSUBHeader* gsub, return FT_Err_Invalid_Argument; memory = gsub->memory; - + sl = &gsub->ScriptList; sr = sl->ScriptRecord; @@ -4162,7 +4171,7 @@ FT_Error HB_GSUB_Query_Features( HB_GSUBHeader* gsub, return FT_Err_Invalid_Argument; memory = gsub->memory; - + sl = &gsub->ScriptList; sr = sl->ScriptRecord; @@ -4283,6 +4292,9 @@ static FT_Error GSUB_Do_Glyph_Lookup( HB_GSUBHeader* gsub, static FT_Error Load_DefaultSubst( HB_GSUB_SubTable* st, FT_Stream stream ) { + FT_UNUSED(st); + FT_UNUSED(stream); + return HB_Err_Invalid_GSUB_SubTable_Format; } @@ -4318,6 +4330,8 @@ FT_Error _HB_GSUB_Load_SubTable( HB_GSUB_SubTable* st, static void Free_DefaultSubst( HB_GSUB_SubTable* st, FT_Memory memory ) { + FT_UNUSED(st); + FT_UNUSED(memory); } typedef void (*Free_Subst_Func_Type)( HB_GSUB_SubTable* st, @@ -4398,14 +4412,14 @@ static FT_Error Apply_ReverseChainContextSubst( HB_GSUBHeader* gsub, FT_Error error, retError = HB_Err_Not_Covered; FT_ULong subtable_Count, string_index; FT_UShort flags; - HB_Lookup* lo; + HB_Lookup* lo; if ( buffer->in_length == 0 ) return HB_Err_Not_Covered; - + lo = &gsub->LookupList.Lookup[lookup_index]; - flags = lo->LookupFlag; - + flags = lo->LookupFlag; + for ( subtable_Count = 0; subtable_Count < lo->SubTableCount; subtable_Count++ ) { string_index = buffer->in_length - 1; @@ -4426,7 +4440,7 @@ static FT_Error Apply_ReverseChainContextSubst( HB_GSUBHeader* gsub, } while (string_index--); } - + return retError; } @@ -4443,7 +4457,7 @@ FT_Error HB_GSUB_Add_Feature( HB_GSUBHeader* gsub, FT_UShort lookup_count; /* Each feature can only be added once */ - + if ( !gsub || feature_index >= gsub->FeatureList.FeatureCount || gsub->FeatureList.ApplyCount == gsub->FeatureList.FeatureCount ) @@ -4558,16 +4572,16 @@ FT_Error HB_GSUB_Apply_String( HB_GSUBHeader* gsub, } else retError = error; - + if ( need_swap ) { error = hb_buffer_swap( buffer ); if ( error ) goto End; } - } + } } - + error = retError; End: diff --git a/src/harfbuzz-impl.h b/src/harfbuzz-impl.h index 15b63c68f..f31f5cde5 100644 --- a/src/harfbuzz-impl.h +++ b/src/harfbuzz-impl.h @@ -41,6 +41,10 @@ FT_BEGIN_HEADER # define TTAG_GSUB FT_MAKE_TAG( 'G', 'S', 'U', 'B' ) #endif +#ifndef FT_UNUSED +# define FT_UNUSED(arg) ((arg) = (arg)) +#endif + #include "ftglue.h" #define ARRAY_LEN(Array) ((int)(sizeof (Array) / sizeof (Array)[0]))