Commit fc4c82a9501d13a398682c308fc24c4427cfd77e
1 parent
8d2b29ef
Reset state in QPDF::calculateLinearizationData
This makes it possible to use two different writers to write linearized files from the same QPDF object.
Showing
2 changed files
with
15 additions
and
0 deletions
ChangeLog
| 1 | 1 | 2012-09-06 Jay Berkenbilt <ejb@ql.org> |
| 2 | 2 | |
| 3 | + * Make it possible to write the same QPDF object with two | |
| 4 | + different QPDFWriter objects that have both called | |
| 5 | + setLinearization(true) by making private method | |
| 6 | + QPDF::calculateLinearizationData() properly initialize its state. | |
| 7 | + | |
| 3 | 8 | * Bug fix: Writing after calling QPDFWriter::setOutputMemory() |
| 4 | 9 | would cause a segmentation fault because of an internal field not |
| 5 | 10 | being initialized, rendering that method useless. This has been | ... | ... |
libqpdf/QPDF_linearization.cc
| ... | ... | @@ -1241,6 +1241,16 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data) |
| 1241 | 1241 | |
| 1242 | 1242 | // * outlines: part 6 or 9 |
| 1243 | 1243 | |
| 1244 | + this->part4.clear(); | |
| 1245 | + this->part6.clear(); | |
| 1246 | + this->part7.clear(); | |
| 1247 | + this->part8.clear(); | |
| 1248 | + this->part9.clear(); | |
| 1249 | + this->c_linp = LinParameters(); | |
| 1250 | + this->c_page_offset_data = CHPageOffset(); | |
| 1251 | + this->c_shared_object_data = CHSharedObject(); | |
| 1252 | + this->c_outline_data = HGeneric(); | |
| 1253 | + | |
| 1244 | 1254 | QPDFObjectHandle root = getRoot(); |
| 1245 | 1255 | bool outlines_in_first_page = false; |
| 1246 | 1256 | QPDFObjectHandle pagemode = root.getKey("/PageMode"); | ... | ... |