From f97bf4f81257c97a46dff51be31b2ec214d6c270 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 24 May 2010 17:50:19 +0100 Subject: [PATCH] Make sure we initialize all callbacks upon creation Also fixes issue with unicode callbacks never being set really. --- src/hb-font.cc | 18 +++++++----------- src/hb-unicode.c | 9 ++------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/hb-font.cc b/src/hb-font.cc index 72dc044..34c2345 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -75,14 +75,12 @@ hb_font_get_kerning_nil (hb_font_t *font HB_UNUSED, hb_font_funcs_t _hb_font_funcs_nil = { HB_REFERENCE_COUNT_INVALID, /* ref_count */ - TRUE, /* immutable */ - { - hb_font_get_glyph_nil, - hb_font_get_contour_point_nil, - hb_font_get_glyph_metrics_nil, - hb_font_get_kerning_nil + hb_font_get_glyph_nil, + hb_font_get_contour_point_nil, + hb_font_get_glyph_metrics_nil, + hb_font_get_kerning_nil } }; @@ -94,6 +92,8 @@ hb_font_funcs_create (void) if (!HB_OBJECT_DO_CREATE (hb_font_funcs_t, ffuncs)) return &_hb_font_funcs_nil; + ffuncs->v = _hb_font_funcs_nil.v; + return ffuncs; } @@ -125,11 +125,7 @@ hb_font_funcs_copy (hb_font_funcs_t *other_ffuncs) if (!HB_OBJECT_DO_CREATE (hb_font_funcs_t, ffuncs)) return &_hb_font_funcs_nil; - *ffuncs = *other_ffuncs; - - /* re-init refcount */ - HB_OBJECT_DO_INIT (ffuncs); - ffuncs->immutable = FALSE; + ffuncs->v = other_ffuncs->v; return ffuncs; } diff --git a/src/hb-unicode.c b/src/hb-unicode.c index 69ba58c..77efb67 100644 --- a/src/hb-unicode.c +++ b/src/hb-unicode.c @@ -40,9 +40,7 @@ static unsigned int hb_unicode_get_eastasian_width_nil (hb_codepoint_t unicode H hb_unicode_funcs_t _hb_unicode_funcs_nil = { HB_REFERENCE_COUNT_INVALID, /* ref_count */ - TRUE, /* immutable */ - { hb_unicode_get_general_category_nil, hb_unicode_get_combining_class_nil, @@ -60,8 +58,7 @@ hb_unicode_funcs_create (void) if (!HB_OBJECT_DO_CREATE (hb_unicode_funcs_t, ufuncs)) return &_hb_unicode_funcs_nil; - *ufuncs = _hb_unicode_funcs_nil; - HB_OBJECT_DO_INIT (ufuncs); + ufuncs->v = _hb_unicode_funcs_nil.v; return ufuncs; } @@ -94,9 +91,7 @@ hb_unicode_funcs_copy (hb_unicode_funcs_t *other_ufuncs) if (!HB_OBJECT_DO_CREATE (hb_unicode_funcs_t, ufuncs)) return &_hb_unicode_funcs_nil; - *ufuncs = *other_ufuncs; - HB_OBJECT_DO_INIT (ufuncs); - ufuncs->immutable = FALSE; + ufuncs->v = other_ufuncs->v; return ufuncs; } -- 2.7.4