From 08e280fd84384f73d395918646ee044a5bbfee45 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 8 May 2018 01:57:27 -0700 Subject: [PATCH] Rename hb_string_t to hb_bytes_t --- src/hb-ot-post-table.hh | 16 ++++++++-------- src/hb-private.hh | 12 ++++++------ src/hb-string-array.hh | 6 +++--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh index 0cd97fa20..63aa83ad0 100644 --- a/src/hb-ot-post-table.hh +++ b/src/hb-ot-post-table.hh @@ -141,7 +141,7 @@ struct post inline bool get_glyph_name (hb_codepoint_t glyph, char *buf, unsigned int buf_len) const { - hb_string_t s = find_glyph_name (glyph); + hb_bytes_t s = find_glyph_name (glyph); if (!s.len) return false; if (!buf_len) @@ -185,7 +185,7 @@ struct post } } - hb_string_t st (name, len); + hb_bytes_t st (name, len); const uint16_t *gid = (const uint16_t *) hb_bsearch_r (&st, gids, count, sizeof (gids[0]), cmp_key, (void *) this); if (gid) { @@ -220,23 +220,23 @@ struct post static inline int cmp_key (const void *pk, const void *po, void *arg) { const accelerator_t *thiz = (const accelerator_t *) arg; - const hb_string_t *key = (const hb_string_t *) pk; + const hb_bytes_t *key = (const hb_bytes_t *) pk; uint16_t o = * (const uint16_t *) po; return thiz->find_glyph_name (o).cmp (*key); } - inline hb_string_t find_glyph_name (hb_codepoint_t glyph) const + inline hb_bytes_t find_glyph_name (hb_codepoint_t glyph) const { if (version == 0x00010000) { if (glyph >= NUM_FORMAT1_NAMES) - return hb_string_t (); + return hb_bytes_t (); return format1_names (glyph); } if (version != 0x00020000 || glyph >= glyphNameIndex->len) - return hb_string_t (); + return hb_bytes_t (); unsigned int index = glyphNameIndex->array[glyph]; if (index < NUM_FORMAT1_NAMES) @@ -244,14 +244,14 @@ struct post index -= NUM_FORMAT1_NAMES; if (index >= index_to_offset.len) - return hb_string_t (); + return hb_bytes_t (); unsigned int offset = index_to_offset.array[index]; const uint8_t *data = pool + offset; unsigned int name_length = *data; data++; - return hb_string_t ((const char *) data, name_length); + return hb_bytes_t ((const char *) data, name_length); } private: diff --git a/src/hb-private.hh b/src/hb-private.hh index 1b1e83f42..21561ce44 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -1052,12 +1052,12 @@ hb_options (void) /* String type. */ -struct hb_string_t +struct hb_bytes_t { - inline hb_string_t (void) : bytes (nullptr), len (0) {} - inline hb_string_t (const char *bytes_, unsigned int len_) : bytes (bytes_), len (len_) {} + inline hb_bytes_t (void) : bytes (nullptr), len (0) {} + inline hb_bytes_t (const char *bytes_, unsigned int len_) : bytes (bytes_), len (len_) {} - inline int cmp (const hb_string_t &a) const + inline int cmp (const hb_bytes_t &a) const { if (len != a.len) return (int) a.len - (int) len; @@ -1066,8 +1066,8 @@ struct hb_string_t } static inline int cmp (const void *pa, const void *pb) { - hb_string_t *a = (hb_string_t *) pa; - hb_string_t *b = (hb_string_t *) pb; + hb_bytes_t *a = (hb_bytes_t *) pa; + hb_bytes_t *b = (hb_bytes_t *) pb; return b->cmp (*a); } diff --git a/src/hb-string-array.hh b/src/hb-string-array.hh index d83553dd0..679841c87 100644 --- a/src/hb-string-array.hh +++ b/src/hb-string-array.hh @@ -66,12 +66,12 @@ static const unsigned int HB_STRING_ARRAY_OFFS_NAME[] = sizeof (HB_STRING_ARRAY_TYPE_NAME) }; -static inline hb_string_t +static inline hb_bytes_t HB_STRING_ARRAY_NAME (unsigned int i) { assert (i < ARRAY_LENGTH (HB_STRING_ARRAY_OFFS_NAME) - 1); - return hb_string_t (HB_STRING_ARRAY_POOL_NAME.str + HB_STRING_ARRAY_OFFS_NAME[i], - HB_STRING_ARRAY_OFFS_NAME[i + 1] - HB_STRING_ARRAY_OFFS_NAME[i] - 1); + return hb_bytes_t (HB_STRING_ARRAY_POOL_NAME.str + HB_STRING_ARRAY_OFFS_NAME[i], + HB_STRING_ARRAY_OFFS_NAME[i + 1] - HB_STRING_ARRAY_OFFS_NAME[i] - 1); } #undef HB_STRING_ARRAY_TYPE_NAME