From 3b7e5f131383956e19642d28c938f1bc0d16295f Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 27 Oct 2018 02:39:20 -0700 Subject: [PATCH] [name] Rename hb_ot_name_get_names() to hb_ot_name_list_names() And swap return value positions, so can be annotated for gobject-introspectin. --- docs/harfbuzz-sections.txt | 2 +- src/hb-ot-name.cc | 17 ++++++++--------- src/hb-ot-name.h | 6 +++--- src/test-name-table.cc | 4 ++-- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/docs/harfbuzz-sections.txt b/docs/harfbuzz-sections.txt index 8229d4664..dcca4f6c9 100644 --- a/docs/harfbuzz-sections.txt +++ b/docs/harfbuzz-sections.txt @@ -490,7 +490,7 @@ hb_ot_font_set_funcs hb-ot-name hb_name_id_t HB_NAME_ID_INVALID -hb_ot_name_get_names +hb_ot_name_list_names hb_ot_name_get_utf16 hb_ot_name_get_utf32 hb_ot_name_get_utf8 diff --git a/src/hb-ot-name.cc b/src/hb-ot-name.cc index 650d99ab0..28a45f010 100644 --- a/src/hb-ot-name.cc +++ b/src/hb-ot-name.cc @@ -40,25 +40,24 @@ _get_name (hb_face_t *face) } /** - * hb_ot_name_get_names: + * hb_ot_name_list_names: * @face: font face. - * @entries: (out) (transfer none) (array): + * @num_entries: (out) number of returned entries. * * Enumerates all available name IDs and language combinations. Returned * array is owned by the @face and should not be modified. It can be * used as long as @face is alive. * - * Returns: Number of entries returned. + * Returns: (out) (transfer none) (array length=num_entries) Array of available name entries. * Since: 2.1.0 **/ -unsigned int -hb_ot_name_get_names (hb_face_t *face, - const hb_ot_name_entry_t **entries /* OUT */) +const hb_ot_name_entry_t * +hb_ot_name_list_names (hb_face_t *face, + unsigned int *num_entries /* OUT */) { const OT::name_accelerator_t &name = _get_name (face); - if (entries) - *entries = name.names.arrayZ(); - return name.names.len; + *num_entries = name.names.len; + return name.names.arrayZ(); } diff --git a/src/hb-ot-name.h b/src/hb-ot-name.h index 18476553b..076773946 100644 --- a/src/hb-ot-name.h +++ b/src/hb-ot-name.h @@ -124,9 +124,9 @@ typedef struct hb_ot_name_entry_t hb_language_t language; } hb_ot_name_entry_t; -HB_EXTERN unsigned int -hb_ot_name_get_names (hb_face_t *face, - const hb_ot_name_entry_t **entries /* OUT */); +HB_EXTERN const hb_ot_name_entry_t * +hb_ot_name_list_names (hb_face_t *face, + unsigned int *num_entries /* OUT */); HB_END_DECLS diff --git a/src/test-name-table.cc b/src/test-name-table.cc index ad6d493de..333052729 100644 --- a/src/test-name-table.cc +++ b/src/test-name-table.cc @@ -43,8 +43,8 @@ main (int argc, char **argv) hb_blob_destroy (blob); blob = NULL; - const hb_ot_name_entry_t *entries; - unsigned int count = hb_ot_name_get_names (face, &entries); + unsigned int count; + const hb_ot_name_entry_t *entries = hb_ot_name_list_names (face, &count); for (unsigned int i = 0; i < count; i++) {