提交 e1b6d923 编写于 作者: B Behdad Esfahbod

Remove cast of functions to (hb_destroy_func_t)

Fixes https://github.com/behdad/harfbuzz/issues/474
上级 717fcb51
......@@ -128,6 +128,12 @@ hb_blob_create (const char *data,
return blob;
}
static void
_hb_blob_destroy (void *data)
{
hb_blob_destroy ((hb_blob_t *) data);
}
/**
* hb_blob_create_sub_blob:
* @parent: Parent blob.
......@@ -164,7 +170,7 @@ hb_blob_create_sub_blob (hb_blob_t *parent,
MIN (length, parent->length - offset),
HB_MEMORY_MODE_READONLY,
hb_blob_reference (parent),
(hb_destroy_func_t) hb_blob_destroy);
_hb_blob_destroy);
return blob;
}
......
......@@ -64,10 +64,16 @@ reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
release_table_data);
}
static void
_hb_cg_font_release (void *data)
{
CGFontRelease ((CGFontRef) data);
}
hb_face_t *
hb_coretext_face_create (CGFontRef cg_font)
{
return hb_face_create_for_tables (reference_table, CGFontRetain (cg_font), (hb_destroy_func_t) CGFontRelease);
return hb_face_create_for_tables (reference_table, CGFontRetain (cg_font), _hb_cg_font_release);
}
......@@ -116,7 +122,7 @@ static CGFontRef
create_cg_font (hb_face_t *face)
{
CGFontRef cg_font = NULL;
if (face->destroy == (hb_destroy_func_t) CGFontRelease)
if (face->destroy == _hb_cg_font_release)
{
cg_font = CGFontRetain ((CGFontRef) face->user_data);
}
......
......@@ -118,8 +118,10 @@ _hb_face_for_data_closure_create (hb_blob_t *blob, unsigned int index)
}
static void
_hb_face_for_data_closure_destroy (hb_face_for_data_closure_t *closure)
_hb_face_for_data_closure_destroy (void *data)
{
hb_face_for_data_closure_t *closure = (hb_face_for_data_closure_t *) data;
hb_blob_destroy (closure->blob);
free (closure);
}
......@@ -169,7 +171,7 @@ hb_face_create (hb_blob_t *blob,
face = hb_face_create_for_tables (_hb_face_for_data_reference_table,
closure,
(hb_destroy_func_t) _hb_face_for_data_closure_destroy);
_hb_face_for_data_closure_destroy);
face->index = index;
......
......@@ -95,14 +95,16 @@ _hb_ft_font_create (FT_Face ft_face, bool symbol, bool unref)
}
static void
_hb_ft_face_destroy (FT_Face ft_face)
_hb_ft_face_destroy (void *data)
{
FT_Done_Face (ft_face);
FT_Done_Face ((FT_Face) data);
}
static void
_hb_ft_font_destroy (hb_ft_font_t *ft_font)
_hb_ft_font_destroy (void *data)
{
hb_ft_font_t *ft_font = (hb_ft_font_t *) data;
if (ft_font->unref)
_hb_ft_face_destroy (ft_font->ft_face);
......@@ -124,7 +126,7 @@ hb_ft_font_set_load_flags (hb_font_t *font, int load_flags)
if (font->immutable)
return;
if (font->destroy != (hb_destroy_func_t) _hb_ft_font_destroy)
if (font->destroy != _hb_ft_font_destroy)
return;
hb_ft_font_t *ft_font = (hb_ft_font_t *) font->user_data;
......@@ -144,7 +146,7 @@ hb_ft_font_set_load_flags (hb_font_t *font, int load_flags)
int
hb_ft_font_get_load_flags (hb_font_t *font)
{
if (font->destroy != (hb_destroy_func_t) _hb_ft_font_destroy)
if (font->destroy != _hb_ft_font_destroy)
return 0;
const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font->user_data;
......@@ -155,7 +157,7 @@ hb_ft_font_get_load_flags (hb_font_t *font)
FT_Face
hb_ft_font_get_face (hb_font_t *font)
{
if (font->destroy != (hb_destroy_func_t) _hb_ft_font_destroy)
if (font->destroy != _hb_ft_font_destroy)
return NULL;
const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font->user_data;
......@@ -474,7 +476,7 @@ retry:
hb_font_set_funcs (font,
funcs,
_hb_ft_font_create (ft_face, symbol, unref),
(hb_destroy_func_t) _hb_ft_font_destroy);
_hb_ft_font_destroy);
}
......@@ -553,7 +555,7 @@ hb_face_t *
hb_ft_face_create_referenced (FT_Face ft_face)
{
FT_Reference_Face (ft_face);
return hb_ft_face_create (ft_face, (hb_destroy_func_t) _hb_ft_face_destroy);
return hb_ft_face_create (ft_face, _hb_ft_face_destroy);
}
static void
......@@ -655,7 +657,7 @@ hb_font_t *
hb_ft_font_create_referenced (FT_Face ft_face)
{
FT_Reference_Face (ft_face);
return hb_ft_font_create (ft_face, (hb_destroy_func_t) _hb_ft_face_destroy);
return hb_ft_font_create (ft_face, _hb_ft_face_destroy);
}
......
......@@ -383,6 +383,13 @@ hb_glib_get_unicode_funcs (void)
}
#if GLIB_CHECK_VERSION(2,31,10)
static void
_hb_g_bytes_unref (void *data)
{
g_bytes_unref ((GBytes *) data);
}
/**
* hb_glib_blob_create:
*
......@@ -397,6 +404,6 @@ hb_glib_blob_create (GBytes *gbytes)
size,
HB_MEMORY_MODE_READONLY,
g_bytes_ref (gbytes),
(hb_destroy_func_t) g_bytes_unref);
_hb_g_bytes_unref);
}
#endif
......@@ -458,8 +458,10 @@ _hb_ot_font_create (hb_face_t *face)
}
static void
_hb_ot_font_destroy (hb_ot_font_t *ot_font)
_hb_ot_font_destroy (void *data)
{
hb_ot_font_t *ot_font = (hb_ot_font_t *) data;
ot_font->cmap.fini ();
ot_font->h_metrics.fini ();
ot_font->v_metrics.fini ();
......@@ -627,5 +629,5 @@ hb_ot_font_set_funcs (hb_font_t *font)
hb_font_set_funcs (font,
_hb_ot_get_font_funcs (),
ot_font,
(hb_destroy_func_t) _hb_ot_font_destroy);
_hb_ot_font_destroy);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册