summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-form.c
diff options
context:
space:
mode:
authorPaul Gardiner <paul.gardiner@artifex.com>2015-08-27 16:55:45 +0100
committerPaul Gardiner <paul.gardiner@artifex.com>2015-08-27 16:55:45 +0100
commit0d74c055c16c391a76c79cec4eb7636e72a407f9 (patch)
tree2529bcb973074e9d49fa32f712564c5fb802b86c /source/pdf/pdf-form.c
parent71459622bc78f03c379c59f1e60a9008147b32fc (diff)
downloadmupdf-0d74c055c16c391a76c79cec4eb7636e72a407f9.tar.xz
Support several levels of incremental xref
This fixes bug #696123 by allowing multiple signatures each to be written to the document in a separate incemental update. Add count num_incremental_sections to keep track of the number of incremental sections. Add xref_base, which can be set between 0 and num_incremental_sections inclusive to access different versions of the document. Add disallow_new_increments flag that stops new incremental sections being provoked by the creation of an xref stream. Move the unsaved_sigs list from the document structure to the xref structure. With this commit in place, the lists will never grow beyond length one, but we've maintained the list structure in case other cases need supporting in the future. Add an end offset field to the xref structure, so that during completion of signatures the document length of the various incremental versions of the document are available. Factor out functions for storing unsaved signatures and for checking if an object is an unsaved signature. Do deep copy of objects that require the holding of several versions.
Diffstat (limited to 'source/pdf/pdf-form.c')
-rw-r--r--source/pdf/pdf-form.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c
index 5a23786f..dcb08bc7 100644
--- a/source/pdf/pdf-form.c
+++ b/source/pdf/pdf-form.c
@@ -1439,7 +1439,6 @@ void pdf_signature_set_value(fz_context *ctx, pdf_document *doc, pdf_obj *field,
pdf_obj *byte_range;
pdf_obj *contents;
char buf[2048];
- pdf_unsaved_sig *unsaved_sig;
memset(buf, 0, sizeof(buf));
@@ -1474,13 +1473,5 @@ void pdf_signature_set_value(fz_context *ctx, pdf_document *doc, pdf_obj *field,
/* Record details within the document structure so that contents
* and byte_range can be updated with their correct values at
* saving time */
- unsaved_sig = fz_malloc_struct(ctx, pdf_unsaved_sig);
- unsaved_sig->field = pdf_keep_obj(ctx, field);
- unsaved_sig->signer = pdf_keep_signer(ctx, signer);
- unsaved_sig->next = NULL;
- if (doc->unsaved_sigs_end == NULL)
- doc->unsaved_sigs_end = &doc->unsaved_sigs;
-
- *doc->unsaved_sigs_end = unsaved_sig;
- doc->unsaved_sigs_end = &unsaved_sig->next;
+ pdf_xref_store_unsaved_signature(ctx, doc, field, signer);
}