diff options
author | Jay Berkenbilt <ejb@ql.org> | 2012-06-24 21:07:54 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2012-06-24 21:56:59 +0200 |
commit | c16db4106c4c4c2fff0b0780b4da56426098340b (patch) | |
tree | 92ec8c0642eca60105a62ea70267083b6578d560 /libqpdf | |
parent | 8318d81ada86d4ec8e343c47103932b6bbe45a42 (diff) | |
download | qpdf-c16db4106c4c4c2fff0b0780b4da56426098340b.tar.zst |
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.
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDFWriter.cc | 10 |
1 files changed, 5 insertions, 5 deletions
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); |