From c16db4106c4c4c2fff0b0780b4da56426098340b Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sun, 24 Jun 2012 15:07:54 -0400 Subject: Increase padding in linearized files With QPDF allowing integers to contain 64-bit quantities, this change is necessary to be able to linearize files whose sizes might be larger than 10 digits. --- libqpdf/QPDFWriter.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libqpdf') diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index 26713225..22d0b6ea 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -882,8 +882,7 @@ QPDFWriter::writeTrailer(trailer_e which, int size, bool xref_stream, writeString(" /Prev "); qpdf_offset_t pos = this->pipeline->getCount(); writeString(QUtil::int_to_string(prev)); - // XXX - int nspaces = (int)(pos - this->pipeline->getCount() + 11); + int nspaces = (int)(pos - this->pipeline->getCount() + 21); assert(nspaces >= 0); writePad(nspaces); } @@ -2122,9 +2121,10 @@ QPDFWriter::writeLinearized() writeHeader(); // Part 2: linearization parameter dictionary. Save enough - // space to write real dictionary. 150 characters is enough + // space to write real dictionary. 200 characters is enough // space if all numerical values in the parameter dictionary - // are 10 digits long plus a few extra characters for safety. + // that contain offsets are 20 digits long plus a few extra + // characters for safety. qpdf_offset_t pos = this->pipeline->getCount(); openObject(lindict_id); @@ -2154,7 +2154,7 @@ QPDFWriter::writeLinearized() } writeString(" >>"); closeObject(lindict_id); - static int const pad = 150; + static int const pad = 200; int spaces = (pos - this->pipeline->getCount() + pad); assert(spaces >= 0); writePad(spaces); -- cgit v1.2.3-54-g00ecf