summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorSimon Bünzli <zeniko@gmail.com>2014-01-02 22:13:52 +0100
committerRobin Watts <robin.watts@artifex.com>2014-01-06 13:13:36 +0000
commitfc0432b9121d528d9b775cd9ed103732c6440973 (patch)
tree535f81099ad080269b043cc37300effa1b3c5a06 /source
parent9b92bac1ec135862132b1c49b977b53891b73d88 (diff)
downloadmupdf-fc0432b9121d528d9b775cd9ed103732c6440973.tar.xz
fix MSVC warnings C4054 and C4152
These warnings are caused by casting function pointers to void* instead of proper function types.
Diffstat (limited to 'source')
-rw-r--r--source/cbz/mucbz.c16
-rw-r--r--source/img/muimage.c16
-rw-r--r--source/pdf/pdf-xref-aux.c18
-rw-r--r--source/pdf/pdf-xref.c34
-rw-r--r--source/xps/xps-zip.c20
5 files changed, 47 insertions, 57 deletions
diff --git a/source/cbz/mucbz.c b/source/cbz/mucbz.c
index d9be58f3..fa654a54 100644
--- a/source/cbz/mucbz.c
+++ b/source/cbz/mucbz.c
@@ -421,12 +421,12 @@ cbz_rebind(cbz_document *doc, fz_context *ctx)
static void
cbz_init_document(cbz_document *doc)
{
- doc->super.close = (void*)cbz_close_document;
- doc->super.count_pages = (void*)cbz_count_pages;
- doc->super.load_page = (void*)cbz_load_page;
- doc->super.bound_page = (void*)cbz_bound_page;
- doc->super.run_page_contents = (void*)cbz_run_page;
- doc->super.free_page = (void*)cbz_free_page;
- doc->super.meta = (void*)cbz_meta;
- doc->super.rebind = (void *)cbz_rebind;
+ doc->super.close = (fz_document_close_fn *)cbz_close_document;
+ doc->super.count_pages = (fz_document_count_pages_fn *)cbz_count_pages;
+ doc->super.load_page = (fz_document_load_page_fn *)cbz_load_page;
+ doc->super.bound_page = (fz_document_bound_page_fn *)cbz_bound_page;
+ doc->super.run_page_contents = (fz_document_run_page_contents_fn *)cbz_run_page;
+ doc->super.free_page = (fz_document_free_page_fn *)cbz_free_page;
+ doc->super.meta = (fz_document_meta_fn *)cbz_meta;
+ doc->super.rebind = (fz_document_rebind_fn *)cbz_rebind;
}
diff --git a/source/img/muimage.c b/source/img/muimage.c
index 7a6dfc3a..26f4a0f3 100644
--- a/source/img/muimage.c
+++ b/source/img/muimage.c
@@ -145,12 +145,12 @@ image_rebind(image_document *doc, fz_context *ctx)
static void
image_init_document(image_document *doc)
{
- doc->super.close = (void*)image_close_document;
- doc->super.count_pages = (void*)image_count_pages;
- doc->super.load_page = (void*)image_load_page;
- doc->super.bound_page = (void*)image_bound_page;
- doc->super.run_page_contents = (void*)image_run_page;
- doc->super.free_page = (void*)image_free_page;
- doc->super.meta = (void*)image_meta;
- doc->super.rebind = (void*)image_rebind;
+ doc->super.close = (fz_document_close_fn *)image_close_document;
+ doc->super.count_pages = (fz_document_count_pages_fn *)image_count_pages;
+ doc->super.load_page = (fz_document_load_page_fn *)image_load_page;
+ doc->super.bound_page = (fz_document_bound_page_fn *)image_bound_page;
+ doc->super.run_page_contents = (fz_document_run_page_contents_fn *)image_run_page;
+ doc->super.free_page = (fz_document_free_page_fn *)image_free_page;
+ doc->super.meta = (fz_document_meta_fn *)image_meta;
+ doc->super.rebind = (fz_document_rebind_fn *)image_rebind;
}
diff --git a/source/pdf/pdf-xref-aux.c b/source/pdf/pdf-xref-aux.c
index 48634374..968a8f9f 100644
--- a/source/pdf/pdf-xref-aux.c
+++ b/source/pdf/pdf-xref-aux.c
@@ -8,22 +8,12 @@
resulting executables.
*/
-static void pdf_run_page_contents_shim(fz_document *doc, fz_page *page, fz_device *dev, const fz_matrix *transform, fz_cookie *cookie)
-{
- pdf_run_page_contents((pdf_document*)doc, (pdf_page*)page, dev, transform, cookie);
-}
-
-static void pdf_run_annot_shim(fz_document *doc, fz_page *page, fz_annot *annot, fz_device *dev, const fz_matrix *transform, fz_cookie *cookie)
-{
- pdf_run_annot((pdf_document*)doc, (pdf_page*)page, (pdf_annot *)annot, dev, transform, cookie);
-}
-
pdf_document *
pdf_open_document_with_stream(fz_context *ctx, fz_stream *file)
{
pdf_document *doc = pdf_open_document_no_run_with_stream(ctx, file);
- doc->super.run_page_contents = pdf_run_page_contents_shim;
- doc->super.run_annot = pdf_run_annot_shim;
+ doc->super.run_page_contents = (fz_document_run_page_contents_fn *)pdf_run_page_contents;
+ doc->super.run_annot = (fz_document_run_annot_fn *)pdf_run_annot;
doc->update_appearance = pdf_update_appearance;
return doc;
}
@@ -32,8 +22,8 @@ pdf_document *
pdf_open_document(fz_context *ctx, const char *filename)
{
pdf_document *doc = pdf_open_document_no_run(ctx, filename);
- doc->super.run_page_contents = pdf_run_page_contents_shim;
- doc->super.run_annot = pdf_run_annot_shim;
+ doc->super.run_page_contents = (fz_document_run_page_contents_fn *)pdf_run_page_contents;
+ doc->super.run_annot = (fz_document_run_annot_fn *)pdf_run_annot;
doc->update_appearance = pdf_update_appearance;
return doc;
}
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index 523dd1f3..d7c5cd1b 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -1963,24 +1963,24 @@ pdf_new_document(fz_context *ctx, fz_stream *file)
{
pdf_document *doc = fz_malloc_struct(ctx, pdf_document);
- doc->super.close = (void*)pdf_close_document;
- doc->super.needs_password = (void*)pdf_needs_password;
- doc->super.authenticate_password = (void*)pdf_authenticate_password;
- doc->super.load_outline = (void*)pdf_load_outline;
- doc->super.count_pages = (void*)pdf_count_pages;
- doc->super.load_page = (void*)pdf_load_page;
- doc->super.load_links = (void*)pdf_load_links;
- doc->super.bound_page = (void*)pdf_bound_page;
- doc->super.first_annot = (void*)pdf_first_annot;
- doc->super.next_annot = (void*)pdf_next_annot;
- doc->super.bound_annot = (void*)pdf_bound_annot;
+ doc->super.close = (fz_document_close_fn *)pdf_close_document;
+ doc->super.needs_password = (fz_document_needs_password_fn *)pdf_needs_password;
+ doc->super.authenticate_password = (fz_document_authenticate_password_fn *)pdf_authenticate_password;
+ doc->super.load_outline = (fz_document_load_outline_fn *)pdf_load_outline;
+ doc->super.count_pages = (fz_document_count_pages_fn *)pdf_count_pages;
+ doc->super.load_page = (fz_document_load_page_fn *)pdf_load_page;
+ doc->super.load_links = (fz_document_load_links_fn *)pdf_load_links;
+ doc->super.bound_page = (fz_document_bound_page_fn *)pdf_bound_page;
+ doc->super.first_annot = (fz_document_first_annot_fn *)pdf_first_annot;
+ doc->super.next_annot = (fz_document_next_annot_fn *)pdf_next_annot;
+ doc->super.bound_annot = (fz_document_bound_annot_fn *)pdf_bound_annot;
doc->super.run_page_contents = NULL; /* see pdf_xref_aux.c */
doc->super.run_annot = NULL; /* see pdf_xref_aux.c */
- doc->super.free_page = (void*)pdf_free_page;
- doc->super.meta = (void*)pdf_meta;
- doc->super.page_presentation = (void*)pdf_page_presentation;
- doc->super.write = (void*)pdf_write_document;
- doc->super.rebind = (void*)pdf_rebind;
+ doc->super.free_page = (fz_document_free_page_fn *)pdf_free_page;
+ doc->super.meta = (fz_document_meta_fn *)pdf_meta;
+ doc->super.page_presentation = (fz_document_page_presentation_fn *)pdf_page_presentation;
+ doc->super.write = (fz_document_write_fn *)pdf_write_document;
+ doc->super.rebind = (fz_document_rebind_fn *)pdf_rebind;
pdf_lexbuf_init(ctx, &doc->lexbuf.base, PDF_LEXBUF_LARGE);
doc->file = fz_keep_stream(file);
@@ -2370,7 +2370,7 @@ pdf_obj *pdf_progressive_advance(pdf_document *doc, int pagenum)
pdf_document *pdf_specifics(fz_document *doc)
{
- return (pdf_document *)((doc && doc->close == (void *)pdf_close_document) ? doc : NULL);
+ return (pdf_document *)((doc && doc->close == (fz_document_close_fn *)pdf_close_document) ? doc : NULL);
}
pdf_document *pdf_create_document(fz_context *ctx)
diff --git a/source/xps/xps-zip.c b/source/xps/xps-zip.c
index 3aca8cdb..f70a28bf 100644
--- a/source/xps/xps-zip.c
+++ b/source/xps/xps-zip.c
@@ -691,14 +691,14 @@ xps_rebind(xps_document *doc, fz_context *ctx)
static void
xps_init_document(xps_document *doc)
{
- doc->super.close = (void*)xps_close_document;
- doc->super.load_outline = (void*)xps_load_outline;
- doc->super.count_pages = (void*)xps_count_pages;
- doc->super.load_page = (void*)xps_load_page;
- doc->super.load_links = (void*)xps_load_links;
- doc->super.bound_page = (void*)xps_bound_page;
- doc->super.run_page_contents = (void*)xps_run_page;
- doc->super.free_page = (void*)xps_free_page;
- doc->super.meta = (void*)xps_meta;
- doc->super.rebind = (void*)xps_rebind;
+ doc->super.close = (fz_document_close_fn *)xps_close_document;
+ doc->super.load_outline = (fz_document_load_outline_fn *)xps_load_outline;
+ doc->super.count_pages = (fz_document_count_pages_fn *)xps_count_pages;
+ doc->super.load_page = (fz_document_load_page_fn *)xps_load_page;
+ doc->super.load_links = (fz_document_load_links_fn *)xps_load_links;
+ doc->super.bound_page = (fz_document_bound_page_fn *)xps_bound_page;
+ doc->super.run_page_contents = (fz_document_run_page_contents_fn *)xps_run_page;
+ doc->super.free_page = (fz_document_free_page_fn *)xps_free_page;
+ doc->super.meta = (fz_document_meta_fn *)xps_meta;
+ doc->super.rebind = (fz_document_rebind_fn *)xps_rebind;
}