summaryrefslogtreecommitdiff
path: root/source/pdf
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-12-15 11:31:36 +0100
committerTor Andersson <tor.andersson@artifex.com>2015-12-15 14:11:10 +0100
commit3afdcd7307fd5e68f35c7bb91a4d856499f1df44 (patch)
tree13253bb6d7af2716f882e878be956fa157544ec6 /source/pdf
parent88a1d527a50e3cc48606ce097a335669ae84a716 (diff)
downloadmupdf-3afdcd7307fd5e68f35c7bb91a4d856499f1df44.tar.xz
Rename fz_write_x to fz_save_pixmap_as_x or fz_save_bitmap_as_x.
Separate naming of functions that save complete files to disk from functions that write data to streams.
Diffstat (limited to 'source/pdf')
-rw-r--r--source/pdf/pdf-clean-file.c4
-rw-r--r--source/pdf/pdf-write.c80
-rw-r--r--source/pdf/pdf-xref.c2
3 files changed, 43 insertions, 43 deletions
diff --git a/source/pdf/pdf-clean-file.c b/source/pdf/pdf-clean-file.c
index f1302efb..69e796b3 100644
--- a/source/pdf/pdf-clean-file.c
+++ b/source/pdf/pdf-clean-file.c
@@ -190,7 +190,7 @@ static void retainpages(fz_context *ctx, globals *glo, int argc, char **argv)
}
}
-void pdf_clean_file(fz_context *ctx, char *infile, char *outfile, char *password, fz_write_options *opts, char *argv[], int argc)
+void pdf_clean_file(fz_context *ctx, char *infile, char *outfile, char *password, fz_save_options *opts, char *argv[], int argc)
{
globals glo = { 0 };
@@ -207,7 +207,7 @@ void pdf_clean_file(fz_context *ctx, char *infile, char *outfile, char *password
if (argc)
retainpages(ctx, &glo, argc, argv);
- pdf_write_document(ctx, glo.doc, outfile, opts);
+ pdf_save_document(ctx, glo.doc, outfile, opts);
}
fz_always(ctx)
{
diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c
index 1c7a3739..b321edf7 100644
--- a/source/pdf/pdf-write.c
+++ b/source/pdf/pdf-write.c
@@ -6,7 +6,7 @@
/* #define DEBUG_HEAP_SORT */
/* #define DEBUG_WRITING */
-typedef struct pdf_write_options_s pdf_write_options;
+typedef struct pdf_save_options_s pdf_save_options;
/*
As part of linearization, we need to keep a list of what objects are used
@@ -45,7 +45,7 @@ typedef struct {
page_objects *page[1];
} page_objects_list;
-struct pdf_write_options_s
+struct pdf_save_options_s
{
fz_output *out;
int do_incremental;
@@ -181,7 +181,7 @@ page_objects_insert(fz_context *ctx, page_objects **ppo, int i)
}
static void
-page_objects_list_insert(fz_context *ctx, pdf_write_options *opts, int page, int object)
+page_objects_list_insert(fz_context *ctx, pdf_save_options *opts, int page, int object)
{
page_objects_list_ensure(ctx, &opts->page_object_lists, page+1);
if (opts->page_object_lists->len < page+1)
@@ -190,7 +190,7 @@ page_objects_list_insert(fz_context *ctx, pdf_write_options *opts, int page, int
}
static void
-page_objects_list_set_page_object(fz_context *ctx, pdf_write_options *opts, int page, int object)
+page_objects_list_set_page_object(fz_context *ctx, pdf_save_options *opts, int page, int object)
{
page_objects_list_ensure(ctx, &opts->page_object_lists, page+1);
opts->page_object_lists->page[page]->page_object_number = object;
@@ -472,7 +472,7 @@ page_objects_list_sort_and_dedupe(fz_context *ctx, page_objects_list *pol)
#ifdef DEBUG_LINEARIZATION
static void
-page_objects_dump(pdf_write_options *opts)
+page_objects_dump(pdf_save_options *opts)
{
page_objects_list *pol = opts->page_object_lists;
int i, j;
@@ -493,7 +493,7 @@ page_objects_dump(pdf_write_options *opts)
}
static void
-objects_dump(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+objects_dump(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
int i;
@@ -513,7 +513,7 @@ objects_dump(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
* that we can continue our recursive marking. If it's a duff reference
* return the fact so that we can remove the reference at source.
*/
-static pdf_obj *markref(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *obj, int *duff)
+static pdf_obj *markref(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *obj, int *duff)
{
int num = pdf_to_num(ctx, obj);
int gen = pdf_to_gen(ctx, obj);
@@ -561,7 +561,7 @@ static pdf_obj *markref(fz_context *ctx, pdf_document *doc, pdf_write_options *o
/* Recursively mark an object. If any references found are duff, then
* replace them with nulls. */
-static int markobj(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *obj)
+static int markobj(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *obj)
{
int i;
@@ -596,7 +596,7 @@ static int markobj(fz_context *ctx, pdf_document *doc, pdf_write_options *opts,
* Scan for and remove duplicate objects (slow)
*/
-static void removeduplicateobjs(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+static void removeduplicateobjs(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
int num, other;
int xref_len = pdf_xref_len(ctx, doc);
@@ -696,7 +696,7 @@ static void removeduplicateobjs(fz_context *ctx, pdf_document *doc, pdf_write_op
* This code assumes that any opts->renumber_map[n] <= n for all n.
*/
-static void compactxref(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+static void compactxref(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
int num, newnum;
int xref_len = pdf_xref_len(ctx, doc);
@@ -738,7 +738,7 @@ static void compactxref(fz_context *ctx, pdf_document *doc, pdf_write_options *o
* removing duplicate objects and compacting the xref.
*/
-static void renumberobj(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *obj)
+static void renumberobj(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *obj)
{
int i;
int xref_len = pdf_xref_len(ctx, doc);
@@ -791,7 +791,7 @@ static void renumberobj(fz_context *ctx, pdf_document *doc, pdf_write_options *o
}
}
-static void renumberobjs(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+static void renumberobjs(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
pdf_xref_entry *newxref = NULL;
int newlen;
@@ -877,7 +877,7 @@ static void renumberobjs(fz_context *ctx, pdf_document *doc, pdf_write_options *
}
}
-static void page_objects_list_renumber(pdf_write_options *opts)
+static void page_objects_list_renumber(pdf_save_options *opts)
{
int i, j;
@@ -893,7 +893,7 @@ static void page_objects_list_renumber(pdf_write_options *opts)
}
static void
-mark_all(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *val, int flag, int page)
+mark_all(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *val, int flag, int page)
{
if (pdf_mark_obj(ctx, val))
@@ -943,7 +943,7 @@ mark_all(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *v
}
static int
-mark_pages(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *val, int pagenum)
+mark_pages(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *val, int pagenum)
{
if (pdf_mark_obj(ctx, val))
@@ -1011,7 +1011,7 @@ mark_pages(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj
}
static void
-mark_root(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *dict)
+mark_root(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *dict)
{
int i, n = pdf_dict_len(ctx, dict);
@@ -1063,7 +1063,7 @@ mark_root(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *
}
static void
-mark_trailer(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *dict)
+mark_trailer(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *dict)
{
int i, n = pdf_dict_len(ctx, dict);
@@ -1094,7 +1094,7 @@ mark_trailer(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_ob
}
static void
-add_linearization_objs(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+add_linearization_objs(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
pdf_obj *params_obj = NULL;
pdf_obj *params_ref = NULL;
@@ -1357,7 +1357,7 @@ pdf_localise_page_resources(fz_context *ctx, pdf_document *doc)
}
static void
-linearize(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+linearize(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
int i;
int n = pdf_xref_len(ctx, doc) + 2;
@@ -1433,7 +1433,7 @@ linearize(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
}
static void
-update_linearization_params(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+update_linearization_params(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
fz_off_t offset;
pdf_set_int(ctx, opts->linear_l, opts->file_len);
@@ -1587,7 +1587,7 @@ static fz_buffer *deflatebuf(fz_context *ctx, unsigned char *p, int n)
return buf;
}
-static void copystream(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *obj_orig, int num, int gen)
+static void copystream(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *obj_orig, int num, int gen)
{
fz_buffer *buf, *tmp;
pdf_obj *newlen;
@@ -1631,7 +1631,7 @@ static void copystream(fz_context *ctx, pdf_document *doc, pdf_write_options *op
pdf_drop_obj(ctx, obj);
}
-static void expandstream(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *obj_orig, int num, int gen)
+static void expandstream(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *obj_orig, int num, int gen)
{
fz_buffer *buf, *tmp;
pdf_obj *newlen;
@@ -1708,7 +1708,7 @@ static int filter_implies_image(fz_context *ctx, pdf_document *doc, pdf_obj *o)
return 0;
}
-static void writeobject(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, int num, int gen, int skip_xrefs)
+static void writeobject(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, int num, int gen, int skip_xrefs)
{
pdf_xref_entry *entry;
pdf_obj *obj;
@@ -1821,7 +1821,7 @@ static void writeobject(fz_context *ctx, pdf_document *doc, pdf_write_options *o
pdf_drop_obj(ctx, obj);
}
-static void writexrefsubsect(fz_context *ctx, pdf_write_options *opts, int from, int to)
+static void writexrefsubsect(fz_context *ctx, pdf_save_options *opts, int from, int to)
{
int num;
@@ -1835,7 +1835,7 @@ static void writexrefsubsect(fz_context *ctx, pdf_write_options *opts, int from,
}
}
-static void writexref(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, int from, int to, int first, int main_xref_offset, int startxref)
+static void writexref(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, int from, int to, int first, int main_xref_offset, int startxref)
{
pdf_obj *trailer = NULL;
pdf_obj *obj;
@@ -1935,7 +1935,7 @@ static void writexref(fz_context *ctx, pdf_document *doc, pdf_write_options *opt
doc->has_xref_streams = 0;
}
-static void writexrefstreamsubsect(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, pdf_obj *index, fz_buffer *fzbuf, int from, int to)
+static void writexrefstreamsubsect(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, pdf_obj *index, fz_buffer *fzbuf, int from, int to)
{
int num;
@@ -1952,7 +1952,7 @@ static void writexrefstreamsubsect(fz_context *ctx, pdf_document *doc, pdf_write
}
}
-static void writexrefstream(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, int from, int to, int first, int main_xref_offset, int startxref)
+static void writexrefstream(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, int from, int to, int first, int main_xref_offset, int startxref)
{
int num;
pdf_obj *dict = NULL;
@@ -2082,7 +2082,7 @@ padto(fz_context *ctx, fz_output *out, fz_off_t target)
}
static void
-dowriteobject(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, int num, int pass)
+dowriteobject(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, int num, int pass)
{
pdf_xref_entry *entry = pdf_get_xref_entry(ctx, doc, num);
if (entry->type == 'f')
@@ -2118,7 +2118,7 @@ dowriteobject(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, int n
}
static void
-writeobjects(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, int pass)
+writeobjects(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, int pass)
{
int num;
int xref_len = pdf_xref_len(ctx, doc);
@@ -2174,7 +2174,7 @@ my_log2(int x)
}
static void
-make_page_offset_hints(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, fz_buffer *buf)
+make_page_offset_hints(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, fz_buffer *buf)
{
int i, j;
int min_objs_per_page, max_objs_per_page;
@@ -2444,7 +2444,7 @@ make_page_offset_hints(fz_context *ctx, pdf_document *doc, pdf_write_options *op
}
static void
-make_hint_stream(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+make_hint_stream(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
fz_buffer *buf = fz_new_buffer(ctx, 100);
@@ -2463,7 +2463,7 @@ make_hint_stream(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
}
#ifdef DEBUG_WRITING
-static void dump_object_details(fz_context *ctx, pdf_document *doc, pdf_write_options *opts)
+static void dump_object_details(fz_context *ctx, pdf_document *doc, pdf_save_options *opts)
{
int i;
@@ -2511,7 +2511,7 @@ static void presize_unsaved_signature_byteranges(fz_context *ctx, pdf_document *
}
}
-static void complete_signatures(fz_context *ctx, pdf_document *doc, pdf_write_options *opts, char *filename)
+static void complete_signatures(fz_context *ctx, pdf_document *doc, pdf_save_options *opts, char *filename)
{
pdf_unsaved_sig *usig;
char buf[5120];
@@ -2615,9 +2615,9 @@ static void sanitize(fz_context *ctx, pdf_document *doc, int ascii)
}
}
-/* Initialise the pdf_write_options, used dynamically during the write, from the static
- * fz_write_options, passed into pdf_write_document */
-static void initialise_write_options(fz_context *ctx, pdf_document *doc, const fz_write_options *fz_opts, pdf_write_options *opts)
+/* Initialise the pdf_save_options, used dynamically during the write, from the static
+ * fz_save_options, passed into pdf_save_document */
+static void initialise_write_options(fz_context *ctx, pdf_document *doc, const fz_save_options *fz_opts, pdf_save_options *opts)
{
int num;
int xref_len = pdf_xref_len(ctx, doc);
@@ -2655,7 +2655,7 @@ static void initialise_write_options(fz_context *ctx, pdf_document *doc, const f
}
/* Free the resources held by the dynamic write options */
-static void finalise_write_options(fz_context *ctx, pdf_write_options *opts)
+static void finalise_write_options(fz_context *ctx, pdf_save_options *opts)
{
fz_free(ctx, opts->use_list);
fz_free(ctx, opts->ofs_list);
@@ -2676,10 +2676,10 @@ static void finalise_write_options(fz_context *ctx, pdf_write_options *opts)
fz_drop_output(ctx, opts->out);
}
-void pdf_write_document(fz_context *ctx, pdf_document *doc, char *filename, fz_write_options *fz_opts)
+void pdf_save_document(fz_context *ctx, pdf_document *doc, char *filename, fz_save_options *fz_opts)
{
- fz_write_options opts_defaults = { 0 };
- pdf_write_options opts = { 0 };
+ fz_save_options opts_defaults = { 0 };
+ pdf_save_options opts = { 0 };
int lastfree;
int num;
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index f65edefc..960c1c34 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -2336,7 +2336,7 @@ pdf_new_document(fz_context *ctx, fz_stream *file)
doc->super.count_pages = (fz_document_count_pages_fn *)pdf_count_pages;
doc->super.load_page = (fz_document_load_page_fn *)pdf_load_page;
doc->super.lookup_metadata = (fz_document_lookup_metadata_fn *)pdf_lookup_metadata;
- doc->super.write = (fz_document_write_fn *)pdf_write_document;
+ doc->super.save = (fz_document_save_fn *)pdf_save_document;
doc->update_appearance = pdf_update_appearance;
pdf_lexbuf_init(ctx, &doc->lexbuf.base, PDF_LEXBUF_LARGE);