summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2017-06-03 21:25:52 -0700
committerRobin Watts <Robin.Watts@artifex.com>2017-06-03 21:25:52 -0700
commitac99be0eb766433e6f0bb6275b3e23791e7b7204 (patch)
tree9a6cba5b2251ece14e74691c369be691b014f377
parent565624dd5c042de4ddf95be251d4cd011e9460d0 (diff)
downloadmupdf-ac99be0eb766433e6f0bb6275b3e23791e7b7204.tar.xz
Add pdf_keep_document.
We have pdf_drop_document, so a pdf_keep_document seems justified too.
-rw-r--r--include/mupdf/pdf/document.h7
-rw-r--r--source/pdf/pdf-xref.c6
2 files changed, 13 insertions, 0 deletions
diff --git a/include/mupdf/pdf/document.h b/include/mupdf/pdf/document.h
index 177f947c..68303f05 100644
--- a/include/mupdf/pdf/document.h
+++ b/include/mupdf/pdf/document.h
@@ -96,6 +96,13 @@ pdf_document *pdf_open_document_with_stream(fz_context *ctx, fz_stream *file);
void pdf_drop_document(fz_context *ctx, pdf_document *doc);
/*
+ pdf_keep_document: Keep a reference to an open document.
+
+ Does not throw exceptions.
+*/
+pdf_document *pdf_keep_document(fz_context *ctx, pdf_document *doc);
+
+/*
pdf_specifics: down-cast a fz_document to a pdf_document.
Returns NULL if underlying document is not PDF
*/
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index ba2689b9..9c98296f 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -1550,6 +1550,12 @@ pdf_drop_document(fz_context *ctx, pdf_document *doc)
fz_drop_document(ctx, &doc->super);
}
+pdf_document *
+pdf_keep_document(fz_context *ctx, pdf_document *doc)
+{
+ return (pdf_document *)fz_keep_document(ctx, &doc->super);
+}
+
/*
* compressed object streams
*/