Make sure we initialize all callbacks upon creation

Also fixes issue with unicode callbacks never being set really.
This commit is contained in:
Behdad Esfahbod 2010-05-24 17:50:19 +01:00
parent bf36a1074a
commit f97bf4f812
2 changed files with 9 additions and 18 deletions

View File

@ -75,9 +75,7 @@ hb_font_get_kerning_nil (hb_font_t *font HB_UNUSED,
hb_font_funcs_t _hb_font_funcs_nil = { hb_font_funcs_t _hb_font_funcs_nil = {
HB_REFERENCE_COUNT_INVALID, /* ref_count */ HB_REFERENCE_COUNT_INVALID, /* ref_count */
TRUE, /* immutable */ TRUE, /* immutable */
{ {
hb_font_get_glyph_nil, hb_font_get_glyph_nil,
hb_font_get_contour_point_nil, hb_font_get_contour_point_nil,
@ -94,6 +92,8 @@ hb_font_funcs_create (void)
if (!HB_OBJECT_DO_CREATE (hb_font_funcs_t, ffuncs)) if (!HB_OBJECT_DO_CREATE (hb_font_funcs_t, ffuncs))
return &_hb_font_funcs_nil; return &_hb_font_funcs_nil;
ffuncs->v = _hb_font_funcs_nil.v;
return ffuncs; 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)) if (!HB_OBJECT_DO_CREATE (hb_font_funcs_t, ffuncs))
return &_hb_font_funcs_nil; return &_hb_font_funcs_nil;
*ffuncs = *other_ffuncs; ffuncs->v = other_ffuncs->v;
/* re-init refcount */
HB_OBJECT_DO_INIT (ffuncs);
ffuncs->immutable = FALSE;
return ffuncs; return ffuncs;
} }

View File

@ -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_unicode_funcs_t _hb_unicode_funcs_nil = {
HB_REFERENCE_COUNT_INVALID, /* ref_count */ HB_REFERENCE_COUNT_INVALID, /* ref_count */
TRUE, /* immutable */ TRUE, /* immutable */
{ {
hb_unicode_get_general_category_nil, hb_unicode_get_general_category_nil,
hb_unicode_get_combining_class_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)) if (!HB_OBJECT_DO_CREATE (hb_unicode_funcs_t, ufuncs))
return &_hb_unicode_funcs_nil; return &_hb_unicode_funcs_nil;
*ufuncs = _hb_unicode_funcs_nil; ufuncs->v = _hb_unicode_funcs_nil.v;
HB_OBJECT_DO_INIT (ufuncs);
return ufuncs; 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)) if (!HB_OBJECT_DO_CREATE (hb_unicode_funcs_t, ufuncs))
return &_hb_unicode_funcs_nil; return &_hb_unicode_funcs_nil;
*ufuncs = *other_ufuncs; ufuncs->v = other_ufuncs->v;
HB_OBJECT_DO_INIT (ufuncs);
ufuncs->immutable = FALSE;
return ufuncs; return ufuncs;
} }