Commit Graph

1107 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 92b692466f Remove remaining incorrect assert calls from implementation 2022-05-03 18:31:22 -04:00
Jay Berkenbilt 3d9bac43da Add internal Pl_Base64
Bidirectional base64; will be used by JSON v2.
2022-05-03 18:31:22 -04:00
Jay Berkenbilt 6724a362c3 Move generate_auto_job to the top-level CMakeLists.txt 2022-05-03 08:39:50 -04:00
Jay Berkenbilt 8d2a0eda5a Add reactors to the JSON parser 2022-05-01 19:55:52 -04:00
Jay Berkenbilt 72e5c73419 Limit parser depth for json parser 2022-05-01 12:56:22 -04:00
Jay Berkenbilt e34dbbfa18 Spell check 2022-05-01 12:56: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 cff26040d8 Using insecure crytpo from the CLI is now an error by default 2022-04-30 17:23:58 -04:00
Jay Berkenbilt ce19471f18 Add comments around non-security-related uses of MD5 2022-04-30 14:15:07 -04:00
Jay Berkenbilt c365a26e9d Revert "Remove QPDFObjectHandle::replaceOrRemoveKey"
This reverts commit dc059560e7.

I changed my mind. There's no harm in leaving it deprecated for a
release cycle.
2022-04-30 14:15:07 -04:00
Jay Berkenbilt dc059560e7 Remove QPDFObjectHandle::replaceOrRemoveKey
See ChangeLog for rationale for not deprecating it as originally
planned.
2022-04-30 13:39:45 -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 d8fdf632a9 Use replaceKeyAndGet in a few places in existing code 2022-04-29 20:28:02 -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 63c5a56f38 Fix build logic around generate_auto_job
It was being run at configuration time, not build time.
2022-04-24 13:06:16 -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 4925f0d18c Have dictionary/streams mutators take const& where possible 2022-04-24 09:05:50 -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 5bbb0d4c30 Replace switch statements with static map initializers
Character transcoding from Unicode to single-byte characters used
hard-coded switch statements because the code predated our adoption of
C++11. Now we have thread-safe, static initialization of map literals,
so use that instead.
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 75fe4f60c3 Use anonymous namespaces for file-private classes 2022-04-16 13:35:27 -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 496ca2e4dc Remove QPDFAcroFormDocumentHelper::copyFieldsFromForeignPage 2022-04-16 13:12:07 -04:00
Jay Berkenbilt 6df6260751 Change default --json from 1 to latest 2022-04-16 12:57:33 -04:00
Jay Berkenbilt cdd0b4fb7d Use = default and = delete where possible in classes 2022-04-16 11:39:14 -04:00
Jay Berkenbilt 2a7d2b63c2 Make ABI-breaking changes that don't modify API at all
* Merge overloaded functions by adding default values
* Remove non-const methods that are identical to const methods
2022-04-16 10:41:46 -04:00
Jay Berkenbilt ce86307a1a Fix typo in error message 2022-04-10 16:54:23 -04:00
Jay Berkenbilt 90cfe80bac Clean up/fix DLL.h
* Change DLL_EXPORT to libqpdf_EXPORTS (internal to the build). The
  new name is cmake's default, is more conventional, and is less
  likely to clash with other symbols.
* Add QPDF_DLL_PRIVATE for non-Windows
* Make logic around when to define QPDF_DLL et al more explicit
* Add detailed comments
2022-04-10 16:52:36 -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 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 08fb583449 Remove accidentally committed file 2022-04-09 14:37:00 -04:00
Jay Berkenbilt 59834db472 Add documentation for code formatting and contribution guidelines 2022-04-09 12:25:08 -04:00
Jay Berkenbilt 77e889495f Update some code manually to get better formatting results
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-05 14:56:19 -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 97fc98901c Protect gnutls headers from clang-format rearranging them 2022-04-04 08:05:39 -04:00
Jay Berkenbilt 33caed4f17 Exclude formatting on embedded native crypto 2022-04-03 17:58:36 -04:00
Jay Berkenbilt f8e97e0ed5 Put spaces around version constraint in pkg-config (fixes #677)
Also add a pkg-config runtime test that would have caught the error.
2022-03-23 10:52:40 -04:00
Jay Berkenbilt 6dcb26d21e Fix test for whether atomic library is needed
Some platforms need it for atomic<long long> but not for atomic<int>.
2022-03-19 18:19:44 -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 70d0d0889b Remove old build files 2022-03-18 19:53:18 -04:00