2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-08 05:10:53 +00:00
Commit Graph

184 Commits

Author SHA1 Message Date
m-holger
85d784952f Globally replace 'this->m->' with 'm->'
Using search and replace.
2023-05-21 14:42:34 +01:00
Jay Berkenbilt
d740c6ccce Rerun format_code (after merging clang-tidy PR) 2023-05-20 14:52:19 -04:00
m-holger
41ec7eda54 Use auto when initialializing with new 2023-05-20 15:41:40 +01:00
m-holger
e28f4efb00 Replace deprecated C++ includes 2023-05-20 15:41:25 +01:00
m-holger
ce66604290 Tune indentations in QPDFWriter::unparseObject
Set indent differently for qdf and non-qdf files.
Combine with preceding newline for qdf files.
2023-03-21 10:59:05 +00:00
m-holger
b7791566f6 Add new data member QPDFWriter::Members::root_og
Also, uninitialize QPDFWriter::Members members.
2023-03-17 11:19:48 +00:00
m-holger
d16308b3f5 Tune QPDFWriter::writeString etc methods
Use string_view parameters and call pipeline write methods directly.
2023-01-23 07:00:58 -05:00
m-holger
e8cdc46286 Tidy QPDFXRefEntry creation 2023-01-21 18:18:15 -05:00
m-holger
aefb8ff9ef Refactor QPDFWriter::writePad 2023-01-08 13:33:10 -05:00
m-holger
8363657cf3 Change QPDFWriter::object_queue to std::vector 2023-01-08 13:33:10 -05:00
m-holger
9c216a06d9 Tune QPDFWriter::enqueueObject 2023-01-08 13:33:10 -05:00
m-holger
59191ebbc4 Tune QPDFWriter::unparseObject 2023-01-07 13:27:17 -05:00
m-holger
383f5a0077 Refactor QPDFWriter::enqueueObject
Move test for m->linearized outside loop.
2022-12-31 09:22:45 -05:00
m-holger
cfcb279e49 Alternative fix logic for fixDanglingReferences 2022-12-06 15:21:34 -05:00
m-holger
2e6869483b Replace calls to QUtil::int_to_string with std::to_string 2022-09-21 15:57:14 -04:00
Jay Berkenbilt
c7a4967d10 Change reset to disconnect and clarify comments
I decided that it's actually fine to copy a direct object to another
QPDF. Even if we eventually prevent a QPDFObject from having multiple
parents, this could happen if an object is moved.
2022-09-08 11:06:15 -04:00
Jay Berkenbilt
264e25f391 Clear owning QPDF information for all objects, not just indirect 2022-09-08 10:19:38 -04:00
m-holger
1553868c4a Add QPDF::getObject to replace getObjectByObjGen and getObjectByID
For consistency with similar methods, e.g. replaceObject.
2022-08-01 19:22:37 +01:00
Jay Berkenbilt
4feb10fdaf
Merge pull request #734 from m-holger/nullptr
Code tidy : replace 0 with nullptr or true
2022-07-31 08:33:45 -04:00
m-holger
073808aa50 Code tidy : replace 0 with nullptr or true 2022-07-26 13:40:13 +01:00
Jay Berkenbilt
b3e6d445cb Tweak "AndGet" mutator functions again
Remove any ambiguity around whether old or new value is being
returned.
2022-07-24 15:42:23 -04:00
m-holger
eeb6162f76 Add optional parameter separator to QPDFObjGen::unparse
Also, revert inlining of unparse and operator << from commit 4c6640c in
order to avoid exposing QUtil.
2022-07-24 15:41:48 +01:00
Jay Berkenbilt
3a7ee7e938 Move C-based ProgressReporter helper into QPDFWriter 2022-06-19 08:46:58 -04:00
m-holger
6c69a747b9 Code clean up: use range-style for loops wherever possible
Remove variables obsoleted by commit 4f24617.
2022-05-21 16:06:29 -04:00
Jay Berkenbilt
6c2fb5b8f0 Add test for bad data and bad datafile 2022-05-20 13:33:30 -04:00
Jay Berkenbilt
21d6e3231f Make use of the new Pipeline methods in some places 2022-05-03 18:31:23 -04:00
Jay Berkenbilt
59f3e09edf Make Pipeline::write take an unsigned char const* (API change) 2022-05-03 18:31:22 -04:00
Jay Berkenbilt
62bf296a9c Make assert handling less error-prone
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-03 18:31:22 -04:00
Jay Berkenbilt
92b692466f Remove remaining incorrect assert calls from implementation 2022-05-03 18:31:22 -04:00
Jay Berkenbilt
8ccd3a8a89 Mark weak encryption with API changes (fixes #576) 2022-04-30 17:24:15 -04:00
Jay Berkenbilt
2213ed0c3d Remove deprecated (pre-8.4.0) encryption APIs 2022-04-30 17:23:58 -04:00
Jay Berkenbilt
4f24617e1e Code clean up: use range-style for loops wherever possible
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-30 13:27:18 -04:00
Jay Berkenbilt
7f023701dd Formatting: remove space in range-style for loops
Change .clang-format and commit automated changes from a fresh run of
format-code
2022-04-30 13:26:43 -04:00
Jay Berkenbilt
d8fdf632a9 Use replaceKeyAndGet in a few places in existing code 2022-04-29 20:28:02 -04:00
Jay Berkenbilt
cdd0b4fb7d Use = default and = delete where possible in classes 2022-04-16 11:39:14 -04:00
Jay Berkenbilt
a68703b07e Replace PointerHolder with std::shared_ptr in library sources only
(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-09 17:33:29 -04:00
Jay Berkenbilt
12f1eb15ca Programmatically apply new formatting to code
Run this:

for i in  **/*.cc **/*.c **/*.h **/*.hh; do
  clang-format < $i >| $i.new && mv $i.new $i
done
2022-04-04 08:10:40 -04:00
Jay Berkenbilt
f91b21c7d4 Preserve input PDF version on pages/split-pages (fixes #610) 2022-02-08 12:34:14 -05:00
Jay Berkenbilt
cb769c62e5 WHITESPACE ONLY -- expand tabs in source code
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-08 11:51:15 -05:00
Jay Berkenbilt
c62e8e2b28 Update for clean compile with POINTERHOLDER_TRANSITION=2 2022-02-07 17:38:22 -05:00
Jay Berkenbilt
cfaae47dc6 Add getBufferSharedPointer() to Pl_Buffer and QPDFWriter 2022-02-07 12:53:28 -05:00
Jay Berkenbilt
5f3f78822b Improve use of std::unique_ptr
* 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-05 11:24:56 -05:00
Jay Berkenbilt
2229e37e88 Add a blank line after the first header included in each source 2022-02-04 16:31:31 -05:00
Jay Berkenbilt
abc300f05c Replace containers of PointerHolder with containers of std::shared_ptr
None of these are in the public API.
2022-02-04 13:12:37 -05:00
Jay Berkenbilt
9044a24097 PointerHolder: deprecate getPointer() and getRefcount()
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-02-04 13:12:37 -05:00
Jay Berkenbilt
76c4f78b5c Add QUtil::make_shared_cstr
Replace most of the calls to QUtil::copy_string with this instead.
2022-01-30 13:11:03 -05:00
m-holger
07db3200cb Remove some if statements and simplify some boolean expressions
Use QPDFObjectHandle::isNameAndEquals, isDictionaryOfType and
isStreamOfType.
2022-01-27 07:31:12 -06:00
Jay Berkenbilt
3cacb27a90 Performance fix on preserveObjectStreams 2021-05-09 07:51:14 -04:00
Jay Berkenbilt
30ac51bc78 Exclude unreferenced objects in object streams (fixes #520) 2021-05-08 09:42:09 -04:00
Jay Berkenbilt
12ecd2019a Add QPDFObjectHandle::setFilterOnWrite 2020-12-28 12:58:19 -05:00