diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-04-27 12:43:00 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-04-27 15:12:03 +0200 |
commit | c586d072fd786e66851173f5ddd31241ad28f3e6 (patch) | |
tree | d6db1b68dc122f8349513633ae76a73ed353b69b /source/pdf/pdf-resources.c | |
parent | ce680b96e207c90429eb702c5ee4b9bec177fdfd (diff) | |
download | mupdf-c586d072fd786e66851173f5ddd31241ad28f3e6.tar.xz |
Avoid typecasting function pointers in subclasses.
Do the typecasting in the functions instead, reducing the risk
of function prototype mismatches.
Diffstat (limited to 'source/pdf/pdf-resources.c')
-rw-r--r-- | source/pdf/pdf-resources.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/pdf/pdf-resources.c b/source/pdf/pdf-resources.c index f3b71e23..67008159 100644 --- a/source/pdf/pdf-resources.c +++ b/source/pdf/pdf-resources.c @@ -70,6 +70,11 @@ pdf_preload_image_resources(fz_context *ctx, pdf_document *doc) } } +static void pdf_drop_obj_as_void(fz_context *ctx, void *obj) +{ + pdf_drop_obj(ctx, obj); +} + pdf_obj * pdf_find_image_resource(fz_context *ctx, pdf_document *doc, fz_image *item, unsigned char digest[16]) { @@ -77,7 +82,7 @@ pdf_find_image_resource(fz_context *ctx, pdf_document *doc, fz_image *item, unsi if (!doc->resources.images) { - doc->resources.images = fz_new_hash_table(ctx, 4096, 16, -1, (fz_hash_table_drop_fn*)pdf_drop_obj); + doc->resources.images = fz_new_hash_table(ctx, 4096, 16, -1, pdf_drop_obj_as_void); pdf_preload_image_resources(ctx, doc); } @@ -111,7 +116,7 @@ pdf_find_font_resource(fz_context *ctx, pdf_document *doc, fz_buffer *item, unsi pdf_obj *res; if (!doc->resources.fonts) - doc->resources.fonts = fz_new_hash_table(ctx, 4096, 16, -1, (fz_hash_table_drop_fn*)pdf_drop_obj); + doc->resources.fonts = fz_new_hash_table(ctx, 4096, 16, -1, pdf_drop_obj_as_void); /* Create md5 and see if we have the item in our table */ fz_md5_buffer(ctx, item, digest); |