diff options
author | Simon Bünzli <zeniko@gmail.com> | 2013-09-14 15:07:57 +0200 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-09-30 16:55:35 +0100 |
commit | dc371071308690a9dc84701fdb2cce6a01ba9338 (patch) | |
tree | 25068e16fd75dd9145a8d25a02dfd940cda83f0c | |
parent | 049839fcef1ff37b91e3b1adb669d42e6c1a3843 (diff) | |
download | mupdf-dc371071308690a9dc84701fdb2cce6a01ba9338.tar.xz |
make pdf_write_document again accept NULL for fz_opts
In order to prevent this from breaking again, a fz_write_options struct
with default values is allocated locally and used whenever fz_opts is
NULL.
-rw-r--r-- | source/pdf/pdf-write.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c index 579204ca..42316da1 100644 --- a/source/pdf/pdf-write.c +++ b/source/pdf/pdf-write.c @@ -2532,10 +2532,14 @@ void pdf_write_document(pdf_document *doc, char *filename, fz_write_options *fz_ pdf_write_options opts = { 0 }; fz_context *ctx; int xref_len; + fz_write_options fz_opts_defaults = { 0 }; if (!doc) return; + if (!fz_opts) + fz_opts = &fz_opts_defaults; + doc->freeze_updates = 1; ctx = doc->ctx; @@ -2560,11 +2564,11 @@ void pdf_write_document(pdf_document *doc, char *filename, fz_write_options *fz_ fz_try(ctx) { - opts.do_incremental = fz_opts ? fz_opts->do_incremental : 0; - opts.do_expand = fz_opts ? fz_opts->do_expand : 0; - opts.do_garbage = fz_opts ? fz_opts->do_garbage : 0; - opts.do_ascii = fz_opts ? fz_opts->do_ascii: 0; - opts.do_linear = fz_opts ? fz_opts->do_linear: 0; + opts.do_incremental = fz_opts->do_incremental; + opts.do_expand = fz_opts->do_expand; + opts.do_garbage = fz_opts->do_garbage; + opts.do_ascii = fz_opts->do_ascii; + opts.do_linear = fz_opts->do_linear; opts.start = 0; opts.main_xref_offset = INT_MIN; /* We deliberately make these arrays long enough to cope with |