summaryrefslogtreecommitdiff
path: root/source/html
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-02-23 17:03:43 +0100
committerTor Andersson <tor.andersson@artifex.com>2015-02-26 15:09:49 +0100
commitdaff628cd6a54c163743e91637b697bec269f1b8 (patch)
tree863f737fb08e5f7db3ae198528480730be248b2b /source/html
parentf8809680945937d49f70be417e2f8ffda8a57558 (diff)
downloadmupdf-daff628cd6a54c163743e91637b697bec269f1b8.tar.xz
Clean up some type casts.
Diffstat (limited to 'source/html')
-rw-r--r--source/html/epub-doc.c14
-rw-r--r--source/html/html-doc.c26
2 files changed, 20 insertions, 20 deletions
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
};