Commit Graph

754 Commits

Author SHA1 Message Date
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 8ccd3a8a89 Mark weak encryption with API changes (fixes #576) 2022-04-30 17:24:15 -04:00
Jay Berkenbilt cff26040d8 Using insecure crytpo from the CLI is now an error by default 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 2878c186bf Use fluent appendItem 2022-04-30 10:54:16 -04:00
Jay Berkenbilt ab9d557cb0 Use fluent replaceKey 2022-04-29 20:39:54 -04:00
Jay Berkenbilt e80fad86e9 Add new QPDFObjectHandle methods for more fluent programming 2022-04-29 20:09:10 -04:00
Jay Berkenbilt d0b7cc8ac6 QPDFJob json: make removeAttachment take an array (fixes #693) 2022-04-24 13:06:19 -04:00
Jay Berkenbilt 08ba21cf49 Fix some bugs around null values in dictionaries
Make it so that a key with a null value is always treated as not being
present. This was inconsistent before.
2022-04-24 10:08:32 -04:00
Jay Berkenbilt 4be2f36049 Deprecate replaceOrRemoveKey -- it's the same as replaceKey 2022-04-24 09:31:32 -04:00
Jay Berkenbilt b8d0b0b638 Re-add accidentally removed qpdf.testcov 2022-04-24 09:18:04 -04:00
Jay Berkenbilt 68e721981a Add new QPDF::warn that takes most of QPDFExc's arguments 2022-04-23 18:25:43 -04:00
Jay Berkenbilt 22b35c4928 Expose QUtil::get_next_utf8_codepoint 2022-04-23 18:25:43 -04:00
Jay Berkenbilt ce5c3bcad8 QPDFJob: pass capture output streams through to underlying QPDF 2022-04-18 11:24:17 -04:00
Jay Berkenbilt 80ed3076a0 Remove deprecated name/number tree constructors
Remove the name/number tree object helper constructors that don't take
a QPDF&.
2022-04-16 13:13:15 -04:00
Jay Berkenbilt cdd0b4fb7d Use = default and = delete where possible in classes 2022-04-16 11:39:14 -04:00
Jay Berkenbilt ce86307a1a Fix typo in error message 2022-04-10 16:54:23 -04:00
Jay Berkenbilt 5f4675bb24 Mark non-ABI symbols in exported class with QPDF_DLL_PRIVATE 2022-04-10 16:54:23 -04:00
Jay Berkenbilt 5525c93124 Use QPDF_DLL_CLASS with Pipeline and InputSource subclasses
This enables RTTI so we can use dynamic_cast on them across the shared
object boundary.
2022-04-10 16:52:57 -04:00
Jay Berkenbilt 07edf96440 Remove methods of private classes from ABI
Prior to the cmake conversion, several private classes had methods
that were exported into the shared library so they could be tested
with libtests. With cmake, we build libtests using an object library,
so this is no longer necessary. The methods that are disappearing from
the ABI were never exposed through public headers, so no code should
be using them. Removal had to wait until the window for ABI-breaking
changes was open.
2022-04-09 17:33:29 -04:00
Jay Berkenbilt 128e41648f Remove PointerHolder.hh from other than public header files
Increase to POINTERHOLDER_TRANSITION=4
2022-04-09 17:33:29 -04:00
Jay Berkenbilt ba0ef7a124 Replace PointerHolder with std::shared_ptr in the rest of the code
Increase to POINTERHOLDER_TRANSITION=3

patrepl s/PointerHolder/std::shared_ptr/g **/*.cc **/*.hh
patrepl s/make_pointer_holder/std::make_shared/g **/*.cc
patrepl s/make_array_pointer_holder/QUtil::make_shared_array/g **/*.cc
patrepl s,qpdf/std::shared_ptr,qpdf/PointerHolder, **/*.cc **/*.hh
git restore include/qpdf/PointerHolder.hh
git restore libtests/pointer_holder.cc
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 820a3f04fd Remove "lt-" workarounds
The executables that libtool built invoked the underlying binary with
an "lt-" prefix. The code contained numerous workarounds for testing,
which can now be removed.
2022-03-18 19:53:18 -04:00
Jay Berkenbilt acdf5b2e7a Update process for ABI testing 2022-03-18 19:53:18 -04:00
Jay Berkenbilt f58d2a60d5 Update build-related documentation and comments 2022-03-18 19:53:18 -04:00
Jay Berkenbilt 70d0d0889b Remove old build files 2022-03-18 19:53:18 -04:00
Jay Berkenbilt b8aff90997 Add cmake configuration files 2022-03-18 19:53:18 -04:00
Jay Berkenbilt 6941923ca9 Improve large file test output 2022-03-18 19:53:18 -04:00
Jay Berkenbilt c0a231bf32 Reverse sense of compare images toggle for qpdf.test
Run compare images tests when QPDF_TEST_COMPARE_IMAGES is set rather
than when QPDF_SKIP_TEST_COMPARE_IMAGES is not set.
2022-03-18 19:53:18 -04:00
Jay Berkenbilt 17c0e38c8e Force assert to be defined in test code 2022-03-07 10:07:27 -05:00
Jay Berkenbilt 1d86b70eab Tweak include of config for ctest 2022-03-01 14:01:34 -05:00
Jay Berkenbilt 99393e6ab7 Shorten coverage case name
This is so it will fit on one line after a qtest upgrade allows us to
split lines.
2022-02-26 10:18:23 -05:00
Jay Berkenbilt f7ac591590 Recognize explicit UTF-8 strings (fixes #654) 2022-02-22 08:10:05 -05:00
Jay Berkenbilt 31b45b0fd4 Fix logic error with Tf when generating appearances (fixes #655) 2022-02-18 13:46:35 -05:00
Jay Berkenbilt 3e2109ab37 Remove special case for 0xad for 10.6.2. 2022-02-16 06:52:05 -05:00
Jay Berkenbilt e810fe678a Fix asymmetry between newUnicodeString and getUTF8Value 2022-02-15 19:22:35 -05:00
Jay Berkenbilt a478cbb6dc Silently/transparently recognize UTF-16LE as UTF-16 (fixes #649)
The PDF spec only allows UTF-16BE, but most readers seem to accept
UTF-16LE as well, so now qpdf does too.
2022-02-15 16:13:12 -05:00
Jay Berkenbilt fbd3e56da7 Ignore -- at the top level arg parser (fixes #652)
This was unintended behavior that was added back for backward
compatibility. It is intentionally undocumented.
2022-02-15 16:13:12 -05:00
Jay Berkenbilt 19608ec151 Add missing spaces in usageExit 2022-02-15 16:11:33 -05:00
Jay Berkenbilt 956a272d62 Remove abs calls and pick correct floating point epsilon values (fixes #641) 2022-02-11 07:18:33 -05:00
Jay Berkenbilt d501e1c0d4 Only update output version from files used as input
If we're opening a PDF file to copy its encryption information or
attachments, its version doesn't need to influence the output version.
2022-02-08 13:49:22 -05:00
Jay Berkenbilt f91b21c7d4 Preserve input PDF version on pages/split-pages (fixes #610) 2022-02-08 12:34:14 -05:00
Jay Berkenbilt cfd5147d92 Add QPDF::getVersionAsPDFVersion 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
m-holger 5901fcad4c C-API expose QPDFObjectHandle::getKeyIfDict 2022-02-06 11:21:15 -05:00
m-holger 8371060340 Add method QPDFObjectHandle::getKeyIfDict 2022-02-06 11:21:15 -05:00
m-holger 2ed5f49a79 C-API expose QPDFObjectHandle::getValueAs... accessors 2022-02-05 19:40:30 -05:00