aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2012-09-06 21:28:16 +0200
committerJay Berkenbilt <ejb@ql.org>2012-09-06 21:28:16 +0200
commitfc4c82a9501d13a398682c308fc24c4427cfd77e (patch)
treeba076a2a3ec02ec169de0b0cccf3239b2f5a3b2e
parent8d2b29ef988aa86489e36be50fa881335b81363e (diff)
downloadqpdf-fc4c82a9501d13a398682c308fc24c4427cfd77e.tar.zst
Reset state in QPDF::calculateLinearizationData
This makes it possible to use two different writers to write linearized files from the same QPDF object.
-rw-r--r--ChangeLog5
-rw-r--r--libqpdf/QPDF_linearization.cc10
2 files changed, 15 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ec165929..ad86b396 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-09-06 Jay Berkenbilt <ejb@ql.org>
+ * Make it possible to write the same QPDF object with two
+ different QPDFWriter objects that have both called
+ setLinearization(true) by making private method
+ QPDF::calculateLinearizationData() properly initialize its state.
+
* Bug fix: Writing after calling QPDFWriter::setOutputMemory()
would cause a segmentation fault because of an internal field not
being initialized, rendering that method useless. This has been
diff --git a/libqpdf/QPDF_linearization.cc b/libqpdf/QPDF_linearization.cc
index fdd0d702..65f2b99e 100644
--- a/libqpdf/QPDF_linearization.cc
+++ b/libqpdf/QPDF_linearization.cc
@@ -1241,6 +1241,16 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
// * outlines: part 6 or 9
+ this->part4.clear();
+ this->part6.clear();
+ this->part7.clear();
+ this->part8.clear();
+ this->part9.clear();
+ this->c_linp = LinParameters();
+ this->c_page_offset_data = CHPageOffset();
+ this->c_shared_object_data = CHSharedObject();
+ this->c_outline_data = HGeneric();
+
QPDFObjectHandle root = getRoot();
bool outlines_in_first_page = false;
QPDFObjectHandle pagemode = root.getKey("/PageMode");