From: Behdad Esfahbod Date: Mon, 10 Apr 2006 10:33:17 +0000 (+0000) Subject: Fix minor bugs reported by the Coverity scan report. X-Git-Tag: submit/master/20120920.151126~7^2~1336 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=59aafd07806a2f0d4f399eff13aec74557f60522;p=framework%2Fuifw%2Fharfbuzz.git Fix minor bugs reported by the Coverity scan report. 2006-04-10 Behdad Esfahbod Fix minor bugs reported by the Coverity scan report. * pango/opentype/harfbuzz-gdef.c (HB_GDEF_Build_ClassDefinition): * pango/opentype/harfbuzz-gpos.c (HB_GPOS_Query_Scripts), (HB_GPOS_Query_Languages), (HB_GPOS_Query_Features): Do not access structs before we check them for nullity. * pango/pango-layout.c (pango_layout_index_to_line), (pango_layout_index_to_line_and_extents), (pango_layout_index_to_pos): Check for invalid iterators outside the loop, so we don't crash. * pango/pango-layout.c (pango_layout_line_x_to_index): Set char_trailing instead of trailing in one of too many paths. Should have been a typo. * pango/pangox.c (get_font_metrics_from_subfonts): Check for nullity somewhere. --- diff --git a/src/harfbuzz-gdef.c b/src/harfbuzz-gdef.c index 9b81fc7..5a649de 100644 --- a/src/harfbuzz-gdef.c +++ b/src/harfbuzz-gdef.c @@ -887,7 +887,7 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, FT_UShort start, curr_glyph, curr_class; FT_UShort n, m, count; FT_Error error; - FT_Memory memory = gdef->memory; + FT_Memory memory; HB_ClassDefinition* gcd; HB_ClassRangeRecord* gcrr; @@ -897,6 +897,7 @@ FT_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef, if ( !gdef || !glyph_array || !class_array ) return FT_Err_Invalid_Argument; + memory = gdef->memory; gcd = &gdef->GlyphClassDef; /* We build a format 2 table */ diff --git a/src/harfbuzz-gpos.c b/src/harfbuzz-gpos.c index d668749..95f9a72 100644 --- a/src/harfbuzz-gpos.c +++ b/src/harfbuzz-gpos.c @@ -5771,7 +5771,7 @@ FT_Error HB_GPOS_Query_Scripts( HB_GPOSHeader* gpos, FT_ULong** script_tag_list ) { FT_Error error; - FT_Memory memory = gpos->memory; + FT_Memory memory; FT_UShort n; FT_ULong* stl; @@ -5782,6 +5782,7 @@ FT_Error HB_GPOS_Query_Scripts( HB_GPOSHeader* gpos, if ( !gpos || !script_tag_list ) return FT_Err_Invalid_Argument; + memory = gpos->memory; sl = &gpos->ScriptList; sr = sl->ScriptRecord; @@ -5804,7 +5805,7 @@ FT_Error HB_GPOS_Query_Languages( HB_GPOSHeader* gpos, FT_ULong** language_tag_list ) { FT_Error error; - FT_Memory memory = gpos->memory; + FT_Memory memory; FT_UShort n; FT_ULong* ltl; @@ -5817,6 +5818,7 @@ FT_Error HB_GPOS_Query_Languages( HB_GPOSHeader* gpos, if ( !gpos || !language_tag_list ) return FT_Err_Invalid_Argument; + memory = gpos->memory; sl = &gpos->ScriptList; sr = sl->ScriptRecord; @@ -5850,7 +5852,7 @@ FT_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos, { FT_UShort n; FT_Error error; - FT_Memory memory = gpos->memory; + FT_Memory memory; FT_ULong* ftl; HB_ScriptList* sl; @@ -5867,6 +5869,7 @@ FT_Error HB_GPOS_Query_Features( HB_GPOSHeader* gpos, if ( !gpos || !feature_tag_list ) return FT_Err_Invalid_Argument; + memory = gpos->memory; sl = &gpos->ScriptList; sr = sl->ScriptRecord;