From daff628cd6a54c163743e91637b697bec269f1b8 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 23 Feb 2015 17:03:43 +0100 Subject: Clean up some type casts. --- source/html/epub-doc.c | 14 +++++++------- source/html/html-doc.c | 26 +++++++++++++------------- 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'source/html') diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c index 69963ff0..51eca0b9 100644 --- a/source/html/epub-doc.c +++ b/source/html/epub-doc.c @@ -253,7 +253,7 @@ epub_parse_header(fz_context *ctx, epub_document *doc) fz_drop_xml(ctx, content_opf); } -static epub_document * +static fz_document * epub_init(fz_context *ctx, fz_archive *zip) { epub_document *doc; @@ -278,16 +278,16 @@ epub_init(fz_context *ctx, fz_archive *zip) fz_rethrow(ctx); } - return doc; + return (fz_document*)doc; } -static epub_document * +static fz_document * epub_open_document_with_stream(fz_context *ctx, fz_stream *file) { return epub_init(ctx, fz_open_archive_with_stream(ctx, file)); } -static epub_document * +static fz_document * epub_open_document(fz_context *ctx, const char *filename) { if (strstr(filename, "META-INF/container.xml") || strstr(filename, "META-INF\\container.xml")) @@ -320,7 +320,7 @@ epub_recognize(fz_context *doc, const char *magic) fz_document_handler epub_document_handler = { - (fz_document_recognize_fn *)&epub_recognize, - (fz_document_open_fn *)&epub_open_document, - (fz_document_open_with_stream_fn *)&epub_open_document_with_stream + &epub_recognize, + &epub_open_document, + &epub_open_document_with_stream }; diff --git a/source/html/html-doc.c b/source/html/html-doc.c index 7217f74c..80bc98b3 100644 --- a/source/html/html-doc.c +++ b/source/html/html-doc.c @@ -89,21 +89,21 @@ htdoc_load_page(fz_context *ctx, fz_document *doc_, int number) return (fz_page*)page; } -static html_document * +static fz_document * htdoc_open_document_with_stream(fz_context *ctx, fz_stream *file) { html_document *doc; fz_buffer *buf; doc = fz_malloc_struct(ctx, html_document); - doc->zip = fz_open_directory(ctx, "."); - doc->set = fz_new_html_font_set(ctx); - doc->super.close = htdoc_close_document; doc->super.layout = htdoc_layout; doc->super.count_pages = htdoc_count_pages; doc->super.load_page = htdoc_load_page; + doc->zip = fz_open_directory(ctx, "."); + doc->set = fz_new_html_font_set(ctx); + buf = fz_read_all(ctx, file, 0); fz_write_buffer_byte(ctx, buf, 0); doc->box = fz_parse_html(ctx, doc->set, doc->zip, ".", buf, NULL); @@ -111,10 +111,10 @@ htdoc_open_document_with_stream(fz_context *ctx, fz_stream *file) htdoc_layout(ctx, (fz_document*)doc, DEFW, DEFH, DEFEM); - return doc; + return (fz_document*)doc; } -static html_document * +static fz_document * htdoc_open_document(fz_context *ctx, const char *filename) { char dirname[2048]; @@ -124,14 +124,14 @@ htdoc_open_document(fz_context *ctx, const char *filename) fz_dirname(dirname, filename, sizeof dirname); doc = fz_malloc_struct(ctx, html_document); - doc->zip = fz_open_directory(ctx, dirname); - doc->set = fz_new_html_font_set(ctx); - doc->super.close = htdoc_close_document; doc->super.layout = htdoc_layout; doc->super.count_pages = htdoc_count_pages; doc->super.load_page = htdoc_load_page; + doc->zip = fz_open_directory(ctx, dirname); + doc->set = fz_new_html_font_set(ctx); + buf = fz_read_file(ctx, filename); fz_write_buffer_byte(ctx, buf, 0); doc->box = fz_parse_html(ctx, doc->set, doc->zip, ".", buf, NULL); @@ -139,7 +139,7 @@ htdoc_open_document(fz_context *ctx, const char *filename) htdoc_layout(ctx, (fz_document*)doc, DEFW, DEFH, DEFEM); - return doc; + return (fz_document*)doc; } static int @@ -160,7 +160,7 @@ htdoc_recognize(fz_context *doc, const char *magic) fz_document_handler html_document_handler = { - (fz_document_recognize_fn *)&htdoc_recognize, - (fz_document_open_fn *)&htdoc_open_document, - (fz_document_open_with_stream_fn *)&htdoc_open_document_with_stream + &htdoc_recognize, + &htdoc_open_document, + &htdoc_open_document_with_stream }; -- cgit v1.2.3