From 2d6b1e2af74abea645a943d264e148d56d018101 Mon Sep 17 00:00:00 2001 From: Rod Sheeter Date: Wed, 14 Feb 2018 19:14:01 -0800 Subject: [PATCH] [subset] maxp copy writeable fn --- src/hb-ot-maxp-table.hh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/hb-ot-maxp-table.hh b/src/hb-ot-maxp-table.hh index ceb83628c..3ffa57b15 100644 --- a/src/hb-ot-maxp-table.hh +++ b/src/hb-ot-maxp-table.hh @@ -64,15 +64,14 @@ struct maxp inline bool subset (hb_subset_plan_t *plan) const { hb_blob_t *maxp_blob = OT::Sanitizer().sanitize (hb_face_reference_table (plan->source, HB_OT_TAG_maxp)); - // TODO(grieger): hb_blob_copy_writable_or_fail - hb_blob_t *maxp_prime_blob = hb_blob_create_sub_blob (maxp_blob, 0, -1); + hb_blob_t *maxp_prime_blob = hb_blob_copy_writable_or_fail (maxp_blob); hb_blob_destroy (maxp_blob); - OT::maxp *maxp_prime = (OT::maxp *) hb_blob_get_data_writable (maxp_prime_blob, nullptr); - if (unlikely (!maxp_prime)) { - hb_blob_destroy (maxp_prime_blob); + if (unlikely (!maxp_prime_blob)) { return false; } + unsigned int length; + OT::maxp *maxp_prime = (OT::maxp *) hb_blob_get_data (maxp_prime_blob, &length); maxp_prime->set_num_glyphs (plan->gids_to_retain_sorted.len);