summaryrefslogtreecommitdiff
path: root/pdf/pdf_stream.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2012-05-23 14:59:26 +0200
committerTor Andersson <tor.andersson@artifex.com>2012-05-23 14:59:26 +0200
commitd7d281dea2f9816730337d97d110c6ddc20ff5c0 (patch)
treee140c436af23778ce1ea060bd3f3f461d95883bd /pdf/pdf_stream.c
parentfc3dfd623ec30e912bed9615126e0656406a5b75 (diff)
downloadmupdf-d7d281dea2f9816730337d97d110c6ddc20ff5c0.tar.xz
Bring xref object and stream mutation functions back from the dead.
Needs more work to use the linked list of free xref slots.
Diffstat (limited to 'pdf/pdf_stream.c')
-rw-r--r--pdf/pdf_stream.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/pdf/pdf_stream.c b/pdf/pdf_stream.c
index 8cc755f2..e312006c 100644
--- a/pdf/pdf_stream.c
+++ b/pdf/pdf_stream.c
@@ -13,7 +13,7 @@ pdf_is_stream(pdf_document *xref, int num, int gen)
pdf_cache_object(xref, num, gen);
/* RJW: "cannot load object, ignoring error" */
- return xref->table[num].stm_ofs > 0;
+ return xref->table[num].stm_ofs > 0 || xref->table[num].stm_buf;
}
/*
@@ -231,9 +231,12 @@ build_filter_chain(fz_stream *chain, pdf_document *xref, pdf_obj *fs, pdf_obj *p
static fz_stream *
pdf_open_raw_filter(fz_stream *chain, pdf_document *xref, pdf_obj *stmobj, int num, int gen, int offset)
{
+ fz_context *ctx = chain->ctx;
int hascrypt;
int len;
- fz_context *ctx = chain->ctx;
+
+ if (num > 0 && num < xref->len && xref->table[num].stm_buf)
+ return fz_open_buffer(ctx, xref->table[num].stm_buf);
/* don't close chain when we close this filter */
fz_keep_stream(chain);
@@ -431,6 +434,9 @@ pdf_load_raw_renumbered_stream(pdf_document *xref, int num, int gen, int orig_nu
int len;
fz_buffer *buf;
+ if (num > 0 && num < xref->len && xref->table[num].stm_buf)
+ return fz_keep_buffer(xref->ctx, xref->table[num].stm_buf);
+
dict = pdf_load_object(xref, num, gen);
/* RJW: "cannot load stream dictionary (%d %d R)", num, gen */