aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFObjectHandle.cc
AgeCommit message (Collapse)Author
2022-05-20Bug fix: isReserved() true for indirect reference to reserved objectJay Berkenbilt
2022-05-20Back out fluent QPDFObjectHandle methods. Keep the andGet methods.Jay Berkenbilt
I decided these were confusing and inconsistent with how JSON works. They muddle the API rather than improving it.
2022-05-20Add private methods for reserving specific objectsJay Berkenbilt
2022-05-16Improve handling of replacing stream data with empty stringsJay Berkenbilt
When an empty string was passed to replaceStreamData, the code was passing a null pointer to memcpy. Since a 0 size was also passed, this was harmless, but it triggers sanitizer errors. The code properly handles a null pointer as the buffer in other places.
2022-05-08Implement JSON v2 outputJay Berkenbilt
2022-05-08Implement JSON v2 for StreamJay Berkenbilt
Not fully exercised in this commit
2022-05-07Prepare code for JSON v2Jay Berkenbilt
Update getJSON() methods and calls to them
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-04-30Revert "Remove QPDFObjectHandle::replaceOrRemoveKey"Jay Berkenbilt
This reverts commit dc059560e73e0b373a6e54e71b07e3af4b692cb4. I changed my mind. There's no harm in leaving it deprecated for a release cycle.
2022-04-30Remove QPDFObjectHandle::replaceOrRemoveKeyJay Berkenbilt
See ChangeLog for rationale for not deprecating it as originally planned.
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-30Add new QPDFObjectHandle methods for more fluent programmingJay Berkenbilt
2022-04-24Deprecate replaceOrRemoveKey -- it's the same as replaceKeyJay Berkenbilt
2022-04-24Have dictionary/streams mutators take const& where possibleJay Berkenbilt
2022-04-24Add new QPDF::warn that takes most of QPDFExc's argumentsJay Berkenbilt
2022-04-16Use anonymous namespaces for file-private classesJay Berkenbilt
2022-04-16Use = default and = delete where possible in classesJay Berkenbilt
2022-04-16Make ABI-breaking changes that don't modify API at allJay Berkenbilt
* Merge overloaded functions by adding default values * Remove non-const methods that are identical to const methods
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-05Update some code manually to get better formatting resultsJay Berkenbilt
Add comments to force line breaks, parenthesize function arguments that are contatenated strings, etc. -- these kinds of changes improve clang-format's results and also cause emacs cc-mode to match clang-format. After this type of change, most of the time, when clang-format and emacs disagree, clang-format is better.
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-11Fix tests for Form XObjectsm-holger
Remove test for type == /XObject in QPDFObjectHandle::isFormXObject as type value is optional (as per spec 8.10.2). Replace code to test for /Form in QPDFJob::shouldRemoveUnreferencedResources with a call to isFormXObject.
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-06Add method QPDFObjectHandle::getKeyIfDictm-holger
2022-02-05Add operator ""_qpdf for creating QPDFObjectHandle literalsJay Berkenbilt
2022-02-05Add new QPDFObjectHandle::getValueAs... accessorsm-holger
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-27Fix QPDFObjectHandle::isOrHasNamem-holger
Ensure isOrHasName returns true if object is an array and the name is present anywhere in the array.
2022-01-27Remove some if statements and simplify some boolean expressionsm-holger
Use QPDFObjectHandle::isNameAndEquals, isDictionaryOfType and isStreamOfType.
2022-01-27Allow testing for subtype without specifying type in isDictionaryOfType etcm-holger
Accept empty string as type parameter in QPDFObjectHandle::isDictionaryOfType and isStreamOfType to allow for dictionaries with optional type.
2022-01-22Add new convenience methods QPDFObjectHandle::isNameAndEquals, etcm-holger
Add methods isNameAndEquals, isDictionaryOfType, isStreamOfType
2021-12-10Use a specific error code for type warnings and clarify docsJay Berkenbilt
2021-11-04Check object ownership when addingJay Berkenbilt
When adding a QPDFObjectHandle to an array or dictionary, if possible, check if the new object belongs to the same QPDF. This makes it much easier to find incorrect code than waiting for the situation to be detected when the file is written.
2021-03-04Revert non-binary-compatible handleWarning change -- see TODO (ABI)Jay Berkenbilt
2021-03-04Don't use handleWarning, which is being revertedJay Berkenbilt
2021-03-04Check for reserved after dereferenceJay Berkenbilt
2021-03-04Add optional conflict detection to mergeResourcesJay Berkenbilt
Also improve behavior around direct vs. indirect resources.
2021-03-03Enhancements to ParserCallbacksJay Berkenbilt
2021-02-25Have QPDFObjectHandle notice when replaceObject was calledJay Berkenbilt
This results in a performance penalty of 1% to 2% when replaceObject and swapObjects are never called and a somewhat larger penalty if they are called, but it's worth it to avoid very confusing behavior as discussed in depth in qpdf#507.
2021-02-25Always call dereference() before querying obj pointerJay Berkenbilt
2021-02-22Change from QPDF{Array,Dict}Items to aitems() and ditems()Jay Berkenbilt
2021-02-21QPDFObjectHandle::copyStreamJay Berkenbilt
2021-02-21Enhance QPDFMatrix APIJay Berkenbilt
2021-02-21Fix isPagesObject and isPageObjectJay Berkenbilt
There are lots of things with /Kids that are not pages. Repair the pages tree, then do a reliable check.
2021-02-20Allow --rotate=0Jay Berkenbilt
2021-02-15Add QPDFObjectHandle::parse for strings with contextJay Berkenbilt