aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFWriter.cc
AgeCommit message (Collapse)Author
2022-08-01Add QPDF::getObject to replace getObjectByObjGen and getObjectByIDm-holger
For consistency with similar methods, e.g. replaceObject.
2022-07-31Merge pull request #734 from m-holger/nullptrJay Berkenbilt
Code tidy : replace 0 with nullptr or true
2022-07-26Code tidy : replace 0 with nullptr or truem-holger
2022-07-24Tweak "AndGet" mutator functions againJay Berkenbilt
Remove any ambiguity around whether old or new value is being returned.
2022-07-24Add optional parameter separator to QPDFObjGen::unparsem-holger
Also, revert inlining of unparse and operator << from commit 4c6640c in order to avoid exposing QUtil.
2022-06-19Move C-based ProgressReporter helper into QPDFWriterJay Berkenbilt
2022-05-21Code clean up: use range-style for loops wherever possiblem-holger
Remove variables obsoleted by commit 4f24617.
2022-05-20Add test for bad data and bad datafileJay Berkenbilt
2022-05-04Make use of the new Pipeline methods in some placesJay Berkenbilt
2022-05-04Make Pipeline::write take an unsigned char const* (API change)Jay Berkenbilt
2022-05-04Make assert handling less error-proneJay Berkenbilt
Prevent my future self or other contributors from using assert in tests and then having that assert not do anything because of the NDEBUG macro.
2022-05-04Remove remaining incorrect assert calls from implementationJay Berkenbilt
2022-04-30Mark weak encryption with API changes (fixes #576)Jay Berkenbilt
2022-04-30Remove deprecated (pre-8.4.0) encryption APIsJay Berkenbilt
2022-04-30Code clean up: use range-style for loops wherever possibleJay Berkenbilt
Where not possible, use "auto" to get the iterator type. Editorial note: I have avoid this change for a long time because of not wanting to make gratuitous changes to version history, which can obscure when certain changes were made, but with having recently touched every single file to apply automatic code formatting and with making several broad changes to the API, I decided it was time to take the plunge and get rid of the older (pre-C++11) verbose iterator syntax. The new code is just easier to read and understand, and in many cases, it will be more effecient as fewer temporary copies are being made. m-holger, if you're reading, you can see that I've finally come around. :-)
2022-04-30Formatting: remove space in range-style for loopsJay Berkenbilt
Change .clang-format and commit automated changes from a fresh run of format-code
2022-04-30Use replaceKeyAndGet in a few places in existing codeJay Berkenbilt
2022-04-16Use = default and = delete where possible in classesJay Berkenbilt
2022-04-09Replace PointerHolder with std::shared_ptr in library sources onlyJay Berkenbilt
(patrepl and cleanpatch are my own utilities) patrepl s/PointerHolder/std::shared_ptr/g {include,libqpdf}/qpdf/*.hh patrepl s/PointerHolder/std::shared_ptr/g libqpdf/*.cc patrepl s/make_pointer_holder/std::make_shared/g libqpdf/*.cc patrepl s/make_array_pointer_holder/QUtil::make_shared_array/g libqpdf/*.cc patrepl s,qpdf/std::shared_ptr,qpdf/PointerHolder, **/*.cc **/*.hh git restore include/qpdf/PointerHolder.hh cleanpatch ./format-code
2022-04-04Programmatically apply new formatting to codeJay Berkenbilt
Run this: for i in **/*.cc **/*.c **/*.h **/*.hh; do clang-format < $i >| $i.new && mv $i.new $i done
2022-02-08Preserve input PDF version on pages/split-pages (fixes #610)Jay Berkenbilt
2022-02-08WHITESPACE ONLY -- expand tabs in source codeJay Berkenbilt
This comment expands all tabs using an 8-character tab-width. You should ignore this commit when using git blame or use git blame -w. In the early days, I used to use tabs where possible for indentation, since emacs did this automatically. In recent years, I have switched to only using spaces, which means qpdf source code has been a mixture of spaces and tabs. I have avoided cleaning this up because of not wanting gratuitous whitespaces change to cloud the output of git blame, but I changed my mind after discussing with users who view qpdf source code in editors/IDEs that have other tab widths by default and in light of the fact that I am planning to start applying automatic code formatting soon.
2022-02-07Update for clean compile with POINTERHOLDER_TRANSITION=2Jay Berkenbilt
2022-02-07Add getBufferSharedPointer() to Pl_Buffer and QPDFWriterJay Berkenbilt
2022-02-05Improve use of std::unique_ptrJay Berkenbilt
* Use unique_ptr in place of shared_ptr in some cases * unique_ptr for arrays does not require a custom deleter * use std::make_unique (c++14) where possible
2022-02-04Add a blank line after the first header included in each sourceJay Berkenbilt
2022-02-04Replace containers of PointerHolder with containers of std::shared_ptrJay Berkenbilt
None of these are in the public API.
2022-02-04PointerHolder: deprecate getPointer() and getRefcount()Jay Berkenbilt
Use get() and use_count() instead. Add #define NO_POINTERHOLDER_DEPRECATION to remove deprecation markers for these only. This commit also removes all deprecated PointerHolder API calls from qpdf's code except in PointerHolder's test suite, which must continue to test the deprecated APIs.
2022-01-30Add QUtil::make_shared_cstrJay Berkenbilt
Replace most of the calls to QUtil::copy_string with this instead.
2022-01-27Remove some if statements and simplify some boolean expressionsm-holger
Use QPDFObjectHandle::isNameAndEquals, isDictionaryOfType and isStreamOfType.
2021-05-09Performance fix on preserveObjectStreamsJay Berkenbilt
2021-05-08Exclude unreferenced objects in object streams (fixes #520)Jay Berkenbilt
2020-12-28Add QPDFObjectHandle::setFilterOnWriteJay Berkenbilt
2020-12-28Let optimize filter stream parameters instead of making them directJay Berkenbilt
Also removes preclusion of stream references in stream parameters of filterable streams and reduces write times by about 8% by eliminating an extra traversal of the objects.
2020-12-28Refactor: separate code that determines whether to filter a streamJay Berkenbilt
2020-10-31Fix stack overflow on direct root (fuzz issue 26761)Jay Berkenbilt
2020-10-22Minor code cleanupJay Berkenbilt
* Return rather than exiting from realmain in qpdf.cc * Remove extraneous blank line * Don't assign temporary to const reference
2020-04-16Fix warnings reported by -Wshadow=local (fixes #431)Jay Berkenbilt
2020-04-03Internally use unsafeShallowCopy where we canJay Berkenbilt
2020-01-26In qdf mode, don't write extra XRef streams (fixes #386)Jay Berkenbilt
fix-qdf assumes there is exactly one XRef stream and that it is at the end of the file.
2019-11-09Allow /P in encryption dictionary to be positive (fixes #382)Jay Berkenbilt
Even though this is disallowed by the spec, files like this have been encountered in the wild.
2019-10-22Parse Contents in signature dictionary without encryptionMasamichi Hosoda
Various PDF digital signing tools do not encrypt /Contents value in signature dictionary. Adobe Acrobat Reader DC can handle a PDF with the /Contents value not encrypted. Write Contents in signature dictionary without encryption Tests ensure that string /Contents are not handled specially when not found in sig dicts.
2019-10-22Add QPDFWriter::getWrittenXRefTable()Masamichi Hosoda
2019-10-22Add QPDFWriter::getRenumberedObjGen()Masamichi Hosoda
2019-10-22Fix /Contents value representation in a signature dictionaryMasamichi Hosoda
Table 8.93 "Entries in a signature dictionary" in PDF 1.5 reference describes that the value of Contents entry is a hexadecimal string representation when ByteRange is specified. This commit makes QPDF always uses hexadecimal strings representation instead of literal strings for it.
2019-08-29Don't encrypt trailer, fixes fuzz issue 15983Jay Berkenbilt
Ordinarily the trailer doesn't contain any strings, so this is usually a non-issue, but if the trailer contains strings, linearizing and encrypting with object streams would include encrypted strings in the trailer, which would blow out the padding because encrypted strings are longer than their cleartext counterparts.
2019-08-28Detect stream in object stream, fixing fuzz 16214Jay Berkenbilt
It's detected in QPDFWriter instead of at parse time because I can't figure out how to construct a test case in a reasonable time. This commit moves the fuzz file into the regular test suite for a QTC coverage case.
2019-08-28Make popping pipeline stack saferJay Berkenbilt
Use destructors to pop the pipeline stack, and ensure that code that pops the stack is actually popping the intended thing.
2019-08-24Add flags to control zlib compression level (fixes #113)Jay Berkenbilt
2019-08-22Remove array null flatteningJay Berkenbilt
For some reason, qpdf from the beginning was replacing indirect references to null with literal null in arrays even after removing the old behavior of flattening scalar references. This seems like a bad idea.