summaryrefslogtreecommitdiff
path: root/pdf/pdf_xref.c
diff options
context:
space:
mode:
Diffstat (limited to 'pdf/pdf_xref.c')
-rw-r--r--pdf/pdf_xref.c103
1 files changed, 17 insertions, 86 deletions
diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c
index 054f8edb..8f51c46b 100644
--- a/pdf/pdf_xref.c
+++ b/pdf/pdf_xref.c
@@ -1232,18 +1232,14 @@ pdf_meta(pdf_document *doc, int key, void *ptr, int size)
}
}
-static fz_interactive *pdf_interact_shim(fz_document *doc)
+static fz_interactive *
+pdf_interact(pdf_document *doc)
{
- /*
- Currently pdf is the only supporter of interaction,
- so no need for indirecting interaction through
- function pointers.
- */
return (fz_interactive *)doc;
}
/*
- Wrappers to implement the fz_document interface for pdf_document.
+ Initializers for the fz_document interface.
The functions are split across two files to allow calls to a
version of the constructor that does not link in the interpreter.
@@ -1252,92 +1248,27 @@ static fz_interactive *pdf_interact_shim(fz_document *doc)
saves roughly 6MB of space.
*/
-static void pdf_close_document_shim(fz_document *doc)
-{
- pdf_close_document((pdf_document*)doc);
-}
-
-static int pdf_needs_password_shim(fz_document *doc)
-{
- return pdf_needs_password((pdf_document*)doc);
-}
-
-static int pdf_authenticate_password_shim(fz_document *doc, char *password)
-{
- return pdf_authenticate_password((pdf_document*)doc, password);
-}
-
-static fz_outline *pdf_load_outline_shim(fz_document *doc)
-{
- return pdf_load_outline((pdf_document*)doc);
-}
-
-static int pdf_count_pages_shim(fz_document *doc)
-{
- return pdf_count_pages((pdf_document*)doc);
-}
-
-static fz_page *pdf_load_page_shim(fz_document *doc, int number)
-{
- return (fz_page*) pdf_load_page((pdf_document*)doc, number);
-}
-
-static fz_link *pdf_load_links_shim(fz_document *doc, fz_page *page)
-{
- return pdf_load_links((pdf_document*)doc, (pdf_page*)page);
-}
-
-static fz_rect pdf_bound_page_shim(fz_document *doc, fz_page *page)
-{
- return pdf_bound_page((pdf_document*)doc, (pdf_page*)page);
-}
-
-static fz_annot *pdf_first_annot_shim(fz_document *doc, fz_page *page)
-{
- return (fz_annot *)pdf_first_annot((pdf_document*)doc, (pdf_page*)page);
-}
-
-static fz_annot *pdf_next_annot_shim(fz_document *doc, fz_annot *annot)
-{
- return (fz_annot *)pdf_next_annot((pdf_document*)doc, (pdf_annot*)annot);
-}
-
-static fz_rect pdf_bound_annot_shim(fz_document *doc, fz_annot *annot)
-{
- return pdf_bound_annot((pdf_document*)doc, (pdf_annot*)annot);
-}
-
-static void pdf_free_page_shim(fz_document *doc, fz_page *page)
-{
- pdf_free_page((pdf_document*)doc, (pdf_page*)page);
-}
-
-static int pdf_meta_shim(fz_document *doc, int key, void *ptr, int size)
-{
- return pdf_meta((pdf_document*)doc, key, ptr, size);
-}
-
static pdf_document *
pdf_new_document(fz_stream *file)
{
fz_context *ctx = file->ctx;
pdf_document *doc = fz_malloc_struct(ctx, pdf_document);
- doc->super.close = pdf_close_document_shim;
- doc->super.needs_password = pdf_needs_password_shim;
- doc->super.authenticate_password = pdf_authenticate_password_shim;
- doc->super.load_outline = pdf_load_outline_shim;
- doc->super.count_pages = pdf_count_pages_shim;
- doc->super.load_page = pdf_load_page_shim;
- doc->super.load_links = pdf_load_links_shim;
- doc->super.bound_page = pdf_bound_page_shim;
- doc->super.first_annot = pdf_first_annot_shim;
- doc->super.next_annot = pdf_next_annot_shim;
- doc->super.bound_annot = pdf_bound_annot_shim;
+ 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.run_page = NULL; /* see pdf_xref_aux.c */
- doc->super.free_page = pdf_free_page_shim;
- doc->super.meta = pdf_meta_shim;
- doc->super.interact = pdf_interact_shim;
+ doc->super.free_page = (void*)pdf_free_page;
+ doc->super.meta = (void*)pdf_meta;
+ doc->super.interact = (void*)pdf_interact;
doc->lexbuf.base.size = PDF_LEXBUF_LARGE;
doc->file = fz_keep_stream(file);