/* We create a new entry, and link it into the middle of
* the chain. If we actually come to put anything into
- * it later, then the call to add_fragment during that
- * addition will discard everything in the history that
- * follows it. */
+ * it later, then the call to pdf_add_journal_fragment
+ * during that addition will discard everything in the
+ * history that follows it. */
entry = fz_malloc_struct(ctx, pdf_journal_entry);
if (doc->journal->current == NULL)
fz_write_printf(ctx, out, "endjournal\n");
}
-static void
-add_fragment(fz_context *ctx, pdf_document *doc, int parent, pdf_obj *copy, fz_buffer *copy_stream, int newobj)
+void
+pdf_add_journal_fragment(fz_context *ctx, pdf_document *doc, int parent, pdf_obj *copy, fz_buffer *copy_stream, int newobj)
{
- pdf_journal_entry *entry = doc->journal->current;
+ pdf_journal_entry *entry;
pdf_journal_fragment *frag;
- fz_var(copy_stream);
+ if (doc->journal == NULL)
+ return;
+
+ entry = doc->journal->current;
if (entry->next)
{
/* Read the object/stream for the next fragment. */
obj = pdf_parse_journal_obj(ctx, doc, stm, &num, &buffer, &newobj);
- add_fragment(ctx, doc, num, obj, buffer, newobj);
+ pdf_add_journal_fragment(ctx, doc, num, obj, buffer, newobj);
}
fz_skip_space(ctx, stm);
if (pdf_obj_num_is_stream(ctx, doc, parent))
copy_stream = pdf_load_raw_stream_number(ctx, doc, parent);
}
- add_fragment(ctx, doc, parent, copy, copy_stream, was_empty);
+ pdf_add_journal_fragment(ctx, doc, parent, copy, copy_stream, was_empty);
}
fz_always(ctx)
{