[minor] Use serializer->propagate_error() to simplify code
This commit is contained in:
parent
5faae8260a
commit
dfa9d7acdc
|
@ -455,8 +455,8 @@ struct IndexSubtableRecord
|
||||||
unsigned int old_cbdt_prime_length = bitmap_size_context->cbdt_prime->length;
|
unsigned int old_cbdt_prime_length = bitmap_size_context->cbdt_prime->length;
|
||||||
|
|
||||||
// Set to invalid state to indicate filling glyphs is not yet started.
|
// Set to invalid state to indicate filling glyphs is not yet started.
|
||||||
if (unlikely (!records->resize (records->length + 1)))
|
if (unlikely (!c->serializer->check_success (records->resize (records->length + 1))))
|
||||||
return_trace (c->serializer->check_success (false));
|
return_trace (false);
|
||||||
|
|
||||||
(*records)[records->length - 1].firstGlyphIndex = 1;
|
(*records)[records->length - 1].firstGlyphIndex = 1;
|
||||||
(*records)[records->length - 1].lastGlyphIndex = 0;
|
(*records)[records->length - 1].lastGlyphIndex = 0;
|
||||||
|
@ -567,8 +567,8 @@ struct IndexSubtableArray
|
||||||
|
|
||||||
hb_vector_t<hb_pair_t<hb_codepoint_t, const IndexSubtableRecord*>> lookup;
|
hb_vector_t<hb_pair_t<hb_codepoint_t, const IndexSubtableRecord*>> lookup;
|
||||||
build_lookup (c, bitmap_size_context, &lookup);
|
build_lookup (c, bitmap_size_context, &lookup);
|
||||||
if (unlikely (lookup.in_error ()))
|
if (unlikely (!c->serializer->propagate_error (lookup)))
|
||||||
return c->serializer->check_success (false);
|
return false;
|
||||||
|
|
||||||
bitmap_size_context->size = 0;
|
bitmap_size_context->size = 0;
|
||||||
bitmap_size_context->num_tables = 0;
|
bitmap_size_context->num_tables = 0;
|
||||||
|
|
|
@ -2838,19 +2838,17 @@ struct ChainContextFormat2
|
||||||
out->coverage.serialize_subset (c, coverage, this);
|
out->coverage.serialize_subset (c, coverage, this);
|
||||||
|
|
||||||
hb_map_t backtrack_klass_map;
|
hb_map_t backtrack_klass_map;
|
||||||
out->backtrackClassDef.serialize_subset (c, backtrackClassDef, this, &backtrack_klass_map);
|
|
||||||
if (unlikely (!c->serializer->check_success (!backtrack_klass_map.in_error ())))
|
|
||||||
return_trace (false);
|
|
||||||
|
|
||||||
// subset inputClassDef based on glyphs survived in Coverage subsetting
|
|
||||||
hb_map_t input_klass_map;
|
hb_map_t input_klass_map;
|
||||||
out->inputClassDef.serialize_subset (c, inputClassDef, this, &input_klass_map);
|
|
||||||
if (unlikely (!c->serializer->check_success (!input_klass_map.in_error ())))
|
|
||||||
return_trace (false);
|
|
||||||
|
|
||||||
hb_map_t lookahead_klass_map;
|
hb_map_t lookahead_klass_map;
|
||||||
|
|
||||||
|
out->backtrackClassDef.serialize_subset (c, backtrackClassDef, this, &backtrack_klass_map);
|
||||||
|
// TODO: subset inputClassDef based on glyphs survived in Coverage subsetting
|
||||||
|
out->inputClassDef.serialize_subset (c, inputClassDef, this, &input_klass_map);
|
||||||
out->lookaheadClassDef.serialize_subset (c, lookaheadClassDef, this, &lookahead_klass_map);
|
out->lookaheadClassDef.serialize_subset (c, lookaheadClassDef, this, &lookahead_klass_map);
|
||||||
if (unlikely (!c->serializer->check_success (!lookahead_klass_map.in_error ())))
|
|
||||||
|
if (unlikely (!c->serializer->propagate_error (backtrack_klass_map,
|
||||||
|
input_klass_map,
|
||||||
|
lookahead_klass_map)))
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
|
|
||||||
int non_zero_index = -1, index = 0;
|
int non_zero_index = -1, index = 0;
|
||||||
|
|
|
@ -256,10 +256,11 @@ struct hb_serialize_context_t
|
||||||
|
|
||||||
packed.push (obj);
|
packed.push (obj);
|
||||||
|
|
||||||
if (unlikely (packed.in_error ())) {
|
if (unlikely (!propagate_error (packed)))
|
||||||
// obj wasn't successfully added to packed, so clean it up otherwise it's
|
{
|
||||||
// links will be leaked.
|
/* Obj wasn't successfully added to packed, so clean it up otherwise its
|
||||||
propagate_error (packed);
|
* links will be leaked. When we use constructor/destructors properly, we
|
||||||
|
* can remove these. */
|
||||||
obj->fini ();
|
obj->fini ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue