From 0987c4204fae66f80224c6f01d9c5dc3abe809e0 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 7 May 2019 11:01:02 -0700 Subject: [PATCH] [name] Remove dead code --- src/hb-ot-name-table.hh | 88 +------------------------------------------------ 1 file changed, 1 insertion(+), 87 deletions(-) diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index 855b868..07c3f28 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -102,7 +102,6 @@ struct NameRecord TRACE_SERIALIZE (this); auto *out = c->embed (this); if (unlikely (!out)) return_trace (nullptr); - out->offset.serialize_copy (c, src_base + offset, dst_base, length); return_trace (out); } @@ -185,91 +184,6 @@ struct name } } - bool serialize_name_record (hb_serialize_context_t *c, - const name *source_name, - const hb_vector_t& name_record_idx_to_retain) - { - for (unsigned int i = 0; i < name_record_idx_to_retain.length; i++) - { - unsigned int idx = name_record_idx_to_retain[i]; - if (unlikely (idx >= source_name->count)) - { - DEBUG_MSG (SUBSET, nullptr, "Invalid index: %d.", idx); - return false; - } - - c->push (); - - NameRecord *p = c->embed (source_name->nameRecordZ[idx]); - if (!p) - return false; - p->offset = 0; - } - - return true; - } - - bool serialize_strings (hb_serialize_context_t *c, - const name *source_name, - const hb_subset_plan_t *plan, - const hb_vector_t& name_record_idx_to_retain) - { - hb_face_t *face = plan->source; - accelerator_t acc; - acc.init (face); - - for (unsigned int i = 0; i < name_record_idx_to_retain.length; i++) - { - unsigned int idx = name_record_idx_to_retain[i]; - unsigned int size = acc.get_name (idx).get_size (); - - c->push (); - char *new_pos = c->allocate_size (size); - - if (unlikely (new_pos == nullptr)) - { - acc.fini (); - DEBUG_MSG (SUBSET, nullptr, "Couldn't allocate enough space for Name string: %u.", - size); - return false; - } - - const HBUINT8* source_string_pool = (source_name + source_name->stringOffset).arrayZ; - unsigned int name_record_offset = source_name->nameRecordZ[idx].offset; - - memcpy (new_pos, source_string_pool + name_record_offset, size); - } - - acc.fini (); - return true; - } - - bool pack_record_and_strings (name *dest_name_unpacked, - hb_serialize_context_t *c, - unsigned length) - { - hb_hashmap_t id_str_idx_map; - for (int i = length-1; i >= 0; i--) - { - unsigned objidx = c->pop_pack (); - id_str_idx_map.set ((unsigned)i, objidx); - } - - const void *base = & (dest_name_unpacked->nameRecordZ[length]); - for (int i = length-1; i >= 0; i--) - { - unsigned str_idx = id_str_idx_map.get ((unsigned)i); - NameRecord& namerecord = dest_name_unpacked->nameRecordZ[i]; - c->add_link (namerecord.offset, str_idx, base); - c->pop_pack (); - } - - if (c->in_error ()) - return false; - - return true; - } - bool serialize (hb_serialize_context_t *c, const name *source_name, const hb_subset_plan_t *plan, @@ -294,7 +208,7 @@ struct name + hb_iter (name_record_idx_to_retain) | hb_apply ([&] (unsigned _) { c->copy (src_array[_], src_base, dst_base); }) ; - + if (unlikely (c->ran_out_of_room)) return_trace (false); assert (this->stringOffset == c->length ()); -- 2.7.4