summaryrefslogtreecommitdiff
path: root/source/html/html-doc.c
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/html-doc.c
parentf8809680945937d49f70be417e2f8ffda8a57558 (diff)
downloadmupdf-daff628cd6a54c163743e91637b697bec269f1b8.tar.xz
Clean up some type casts.
Diffstat (limited to 'source/html/html-doc.c')
-rw-r--r--source/html/html-doc.c26
1 files changed, 13 insertions, 13 deletions
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
};