From 22985917f145d86c975c77399110e566ad3231c3 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Mon, 11 Dec 2017 13:04:36 +0100 Subject: Never write negative xref offsets when saving to PDF. --- source/pdf/pdf-write.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c index 9fcdbf0a..51f7ad7a 100644 --- a/source/pdf/pdf-write.c +++ b/source/pdf/pdf-write.c @@ -1946,9 +1946,9 @@ static void writexrefsubsect(fz_context *ctx, pdf_write_state *opts, int from, i for (num = from; num < to; num++) { if (opts->use_list[num]) - fz_write_printf(ctx, opts->out, "%010ld %05d n \n", opts->ofs_list[num], opts->gen_list[num]); + fz_write_printf(ctx, opts->out, "%010lu %05d n \n", opts->ofs_list[num], opts->gen_list[num]); else - fz_write_printf(ctx, opts->out, "%010ld %05d f \n", opts->ofs_list[num], opts->gen_list[num]); + fz_write_printf(ctx, opts->out, "%010lu %05d f \n", opts->ofs_list[num], opts->gen_list[num]); } } @@ -2031,7 +2031,7 @@ static void writexref(fz_context *ctx, pdf_document *doc, pdf_write_state *opts, pdf_drop_obj(ctx, trailer); - fz_write_printf(ctx, opts->out, "startxref\n%ld\n%%%%EOF\n", startxref); + fz_write_printf(ctx, opts->out, "startxref\n%lu\n%%%%EOF\n", startxref); doc->has_xref_streams = 0; } @@ -2155,7 +2155,7 @@ static void writexrefstream(fz_context *ctx, pdf_document *doc, pdf_write_state pdf_update_stream(ctx, doc, dict, fzbuf, 0); writeobject(ctx, doc, opts, num, 0, 0); - fz_write_printf(ctx, opts->out, "startxref\n%ld\n%%%%EOF\n", startxref); + fz_write_printf(ctx, opts->out, "startxref\n%lu\n%%%%EOF\n", startxref); } fz_always(ctx) { -- cgit v1.2.3