From 5c3112aec8b77d0fe39164f0f700e2a1aa810022 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 1 May 2018 19:07:04 -0400 Subject: [PATCH] s/hb_prealloced_array_t/hb_vector_t/g Part of https://github.com/harfbuzz/harfbuzz/issues/1017 --- src/hb-ot-cmap-table.hh | 6 +++--- src/hb-ot-hmtx-table.hh | 2 +- src/hb-ot-map-private.hh | 10 +++++----- src/hb-ot-os2-table.hh | 4 ++-- src/hb-ot-post-table.hh | 2 +- src/hb-private.hh | 6 +++--- src/hb-set-private.hh | 4 ++-- src/hb-subset-glyf.cc | 12 ++++++------ src/hb-subset-plan.cc | 8 ++++---- src/hb-subset-plan.hh | 6 +++--- src/hb-subset.cc | 2 +- 11 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 7eb706af..0c313a7c 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -294,7 +294,7 @@ struct CmapSubtableLongSegmented } inline bool serialize (hb_serialize_context_t *c, - hb_prealloced_array_t &group_data) + hb_vector_t &group_data) { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); @@ -548,7 +548,7 @@ struct cmap } inline bool populate_groups (hb_subset_plan_t *plan, - hb_prealloced_array_t *groups) const + hb_vector_t *groups) const { CmapSubtableLongGroup *group = nullptr; for (unsigned int i = 0; i < plan->codepoints.len; i++) { @@ -582,7 +582,7 @@ struct cmap return true; } - inline bool _subset (hb_prealloced_array_t &groups, + inline bool _subset (hb_vector_t &groups, size_t dest_sz, void *dest) const { diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index b209a4ec..5944688a 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -94,7 +94,7 @@ struct hmtxvmtx /* All the trailing glyphs with the same advance can use one LongMetric * and just keep LSB */ - hb_prealloced_array_t &gids = plan->gids_to_retain_sorted; + hb_vector_t &gids = plan->gids_to_retain_sorted; unsigned int num_advances = gids.len; unsigned int last_advance = _mtx.get_advance (gids[num_advances - 1]); while (num_advances > 1 diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh index 9cfe3668..f34c2bfc 100644 --- a/src/hb-ot-map-private.hh +++ b/src/hb-ot-map-private.hh @@ -147,9 +147,9 @@ struct hb_ot_map_t hb_mask_t global_mask; - hb_prealloced_array_t features; - hb_prealloced_array_t lookups[2]; /* GSUB/GPOS */ - hb_prealloced_array_t stages[2]; /* GSUB/GPOS */ + hb_vector_t features; + hb_vector_t lookups[2]; /* GSUB/GPOS */ + hb_vector_t stages[2]; /* GSUB/GPOS */ }; enum hb_ot_map_feature_flags_t { @@ -241,8 +241,8 @@ struct hb_ot_map_builder_t private: unsigned int current_stage[2]; /* GSUB/GPOS */ - hb_prealloced_array_t feature_infos; - hb_prealloced_array_t stages[2]; /* GSUB/GPOS */ + hb_vector_t feature_infos; + hb_vector_t stages[2]; /* GSUB/GPOS */ }; diff --git a/src/hb-ot-os2-table.hh b/src/hb-ot-os2-table.hh index dfb87dc0..7d26a207 100644 --- a/src/hb-ot-os2-table.hh +++ b/src/hb-ot-os2-table.hh @@ -74,7 +74,7 @@ struct os2 return result; } - inline void _update_unicode_ranges (const hb_prealloced_array_t &codepoints, + inline void _update_unicode_ranges (const hb_vector_t &codepoints, HBUINT32 ulUnicodeRange[4]) const { for (unsigned int i = 0; i < 4; i++) @@ -101,7 +101,7 @@ struct os2 } } - static inline void find_min_and_max_codepoint (const hb_prealloced_array_t &codepoints, + static inline void find_min_and_max_codepoint (const hb_vector_t &codepoints, uint16_t *min_cp, /* OUT */ uint16_t *max_cp /* OUT */) { diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh index f3605242..0cd97fa2 100644 --- a/src/hb-ot-post-table.hh +++ b/src/hb-ot-post-table.hh @@ -258,7 +258,7 @@ struct post hb_blob_t *blob; uint32_t version; const ArrayOf *glyphNameIndex; - hb_prealloced_array_t index_to_offset; + hb_vector_t index_to_offset; const uint8_t *pool; mutable uint16_t *gids_sorted_by_name; }; diff --git a/src/hb-private.hh b/src/hb-private.hh index a9a6bda4..d7c8fef8 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -527,7 +527,7 @@ _hb_ceil_to_4 (unsigned int v) #define HB_PREALLOCED_ARRAY_INIT {0, 0, nullptr} template -struct hb_prealloced_array_t +struct hb_vector_t { unsigned int len; unsigned int allocated; @@ -710,14 +710,14 @@ struct hb_auto_t : Type void fini (void) {} }; template -struct hb_auto_array_t : hb_auto_t > {}; +struct hb_auto_array_t : hb_auto_t > {}; #define HB_LOCKABLE_SET_INIT {HB_PREALLOCED_ARRAY_INIT} template struct hb_lockable_set_t { - hb_prealloced_array_t items; + hb_vector_t items; inline void init (void) { items.init (); } diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh index df3326b3..4288b15b 100644 --- a/src/hb-set-private.hh +++ b/src/hb-set-private.hh @@ -190,8 +190,8 @@ struct hb_set_t ASSERT_POD (); bool in_error; mutable unsigned int population; - hb_prealloced_array_t page_map; - hb_prealloced_array_t pages; + hb_vector_t page_map; + hb_vector_t pages; inline void init (void) { diff --git a/src/hb-subset-glyf.cc b/src/hb-subset-glyf.cc index 372832f1..2daa63ed 100644 --- a/src/hb-subset-glyf.cc +++ b/src/hb-subset-glyf.cc @@ -32,12 +32,12 @@ static bool _calculate_glyf_and_loca_prime_size (const OT::glyf::accelerator_t &glyf, - hb_prealloced_array_t &glyph_ids, + hb_vector_t &glyph_ids, hb_bool_t drop_hints, bool *use_short_loca /* OUT */, unsigned int *glyf_size /* OUT */, unsigned int *loca_size /* OUT */, - hb_prealloced_array_t *instruction_ranges /* OUT */) + hb_vector_t *instruction_ranges /* OUT */) { unsigned int total = 0; for (unsigned int i = 0; i < glyph_ids.len; i++) @@ -159,13 +159,13 @@ _write_glyf_and_loca_prime (hb_subset_plan_t *plan, const OT::glyf::accelerator_t &glyf, const char *glyf_data, bool use_short_loca, - hb_prealloced_array_t &instruction_ranges, + hb_vector_t &instruction_ranges, unsigned int glyf_prime_size, char *glyf_prime_data /* OUT */, unsigned int loca_prime_size, char *loca_prime_data /* OUT */) { - hb_prealloced_array_t &glyph_ids = plan->gids_to_retain_sorted; + hb_vector_t &glyph_ids = plan->gids_to_retain_sorted; char *glyf_prime_data_next = glyf_prime_data; bool success = true; @@ -234,11 +234,11 @@ _hb_subset_glyf_and_loca (const OT::glyf::accelerator_t &glyf, hb_blob_t **loca_prime /* OUT */) { // TODO(grieger): Sanity check allocation size for the new table. - hb_prealloced_array_t &glyphs_to_retain = plan->gids_to_retain_sorted; + hb_vector_t &glyphs_to_retain = plan->gids_to_retain_sorted; unsigned int glyf_prime_size; unsigned int loca_prime_size; - hb_prealloced_array_t instruction_ranges; + hb_vector_t instruction_ranges; instruction_ranges.init(); if (unlikely (!_calculate_glyf_and_loca_prime_size (glyf, diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc index 1784aefb..c28e6085 100644 --- a/src/hb-subset-plan.cc +++ b/src/hb-subset-plan.cc @@ -87,7 +87,7 @@ hb_subset_plan_add_table (hb_subset_plan_t *plan, static void _populate_codepoints (hb_set_t *input_codepoints, - hb_prealloced_array_t& plan_codepoints) + hb_vector_t& plan_codepoints) { plan_codepoints.alloc (hb_set_get_population (input_codepoints)); hb_codepoint_t cp = -1; @@ -121,9 +121,9 @@ _add_gid_and_children (const OT::glyf::accelerator_t &glyf, static void _populate_gids_to_retain (hb_face_t *face, - hb_prealloced_array_t& codepoints, - hb_prealloced_array_t& old_gids, - hb_prealloced_array_t& old_gids_sorted) + hb_vector_t& codepoints, + hb_vector_t& old_gids, + hb_vector_t& old_gids_sorted) { OT::cmap::accelerator_t cmap; OT::glyf::accelerator_t glyf; diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh index d1b66b44..3b9db03f 100644 --- a/src/hb-subset-plan.hh +++ b/src/hb-subset-plan.hh @@ -45,12 +45,12 @@ struct hb_subset_plan_t { // These first two lists provide a mapping from cp -> gid // As a result it does not list the full set of glyphs to retain. - hb_prealloced_array_t codepoints; - hb_prealloced_array_t gids_to_retain; + hb_vector_t codepoints; + hb_vector_t gids_to_retain; // This list contains the complete set of glyphs to retain and may contain // more glyphs then the lists above. - hb_prealloced_array_t gids_to_retain_sorted; + hb_vector_t gids_to_retain_sorted; // Plan is only good for a specific source/dest so keep them with it hb_face_t *source; diff --git a/src/hb-subset.cc b/src/hb-subset.cc index 41f44533..35fe0ef8 100644 --- a/src/hb-subset.cc +++ b/src/hb-subset.cc @@ -123,7 +123,7 @@ struct hb_subset_face_data_t hb_blob_t *blob; }; - hb_prealloced_array_t tables; + hb_vector_t tables; }; static hb_subset_face_data_t * -- GitLab