summaryrefslogtreecommitdiff
path: root/source/tools/mjsgen.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-01-21 16:42:45 +0100
committerTor Andersson <tor.andersson@artifex.com>2015-02-17 18:05:39 +0100
commitf84a189d5f94250e46d2cbd1a75aba00130e2dd6 (patch)
tree8ee614ab90de1baa8941f91ae4946ed5c2e70721 /source/tools/mjsgen.c
parent681039767f2ccc72e236246178893eb0989169c9 (diff)
downloadmupdf-f84a189d5f94250e46d2cbd1a75aba00130e2dd6.tar.xz
Add ctx parameter and remove embedded contexts for API regularity.
Purge several embedded contexts: Remove embedded context in fz_output. Remove embedded context in fz_stream. Remove embedded context in fz_device. Remove fz_rebind_stream (since it is no longer necessary). Remove embedded context in svg_device. Remove embedded context in XML parser. Add ctx argument to fz_document functions. Remove embedded context in fz_document. Remove embedded context in pdf_document. Remove embedded context in pdf_obj. Make fz_page independent of fz_document in the interface. We shouldn't need to pass the document to all functions handling a page. If a page is tied to the source document, it's redundant; otherwise it's just pointless. Fix reference counting oddity in fz_new_image_from_pixmap.
Diffstat (limited to 'source/tools/mjsgen.c')
-rw-r--r--source/tools/mjsgen.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/tools/mjsgen.c b/source/tools/mjsgen.c
index cb4c1f1c..d1366062 100644
--- a/source/tools/mjsgen.c
+++ b/source/tools/mjsgen.c
@@ -100,14 +100,14 @@ static void processpage(fz_context *ctx, fz_document *doc, int pagenum)
fz_try(ctx)
{
- page = fz_load_page(doc, pagenum - 1);
+ page = fz_load_page(ctx, doc, pagenum - 1);
}
fz_catch(ctx)
{
fz_rethrow_message(ctx, "cannot load page %d in file '%s'", pagenum, filename);
}
- pdf_document *inter = pdf_specifics(doc);
+ pdf_document *inter = pdf_specifics(ctx, doc);
pdf_widget *widget = NULL;
if (inter)
@@ -220,7 +220,7 @@ static void processpage(fz_context *ctx, fz_document *doc, int pagenum)
static void processpages(fz_context *ctx, fz_document *doc)
{
int page, pagecount;
- pagecount = fz_count_pages(doc);
+ pagecount = fz_count_pages(ctx, doc);
for (page = 1; page <= pagecount; ++page)
processpage(ctx, doc, page);
}
@@ -232,7 +232,7 @@ int main(int argc, char **argv)
fz_context *ctx;
int c;
- fz_var(doc);
+ fz_var(ctx, doc);
while ((c = fz_getopt(argc, argv, "p:")) != -1)
{
@@ -269,7 +269,7 @@ int main(int argc, char **argv)
if (fz_needs_password(doc))
{
- if (!fz_authenticate_password(doc, password))
+ if (!fz_authenticate_password(ctx, doc, password))
fz_throw(ctx, FZ_ERROR_GENERIC, "cannot authenticate password: %s", filename);
fprintf(mujstest_file, "PASSWORD %s\n", password);
}
@@ -278,7 +278,7 @@ int main(int argc, char **argv)
processpages(ctx, doc);
- fz_drop_document(doc);
+ fz_drop_document(ctx, doc);
}
fz_catch(ctx)
{