2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-09 23:00:57 +00:00
Commit Graph

1766 Commits

Author SHA1 Message Date
Jay Berkenbilt
b8fd18ae56 Merge branch 'parse_ref' into work 2023-12-21 15:43:50 -05:00
Jay Berkenbilt
d61612a2e5 Bug fix: don't compress hint streams when --compress-streams=n 2023-12-20 15:46:20 -05:00
Jay Berkenbilt
c5f622a09e Bug fix: don't compress object/xref streams with --compress-streams=n 2023-12-20 15:46:20 -05:00
Jay Berkenbilt
290742b069
Merge pull request #1070 from m-holger/flate
Change default for SF_FlateLzwDecode::columns to 1
2023-12-16 11:50:17 -05:00
Jay Berkenbilt
b0b6d9f21f
Merge pull request #1067 from m-holger/pl_buff
Reduce copying of Buffer contents
2023-12-16 11:31:11 -05:00
Jay Berkenbilt
d7a364b882 Allow regular C++ functions to interoperate with the C API 2023-12-16 10:06:34 -05:00
Jay Berkenbilt
414c83f767 Install cmake files with dev component 2023-12-09 06:28:13 -05:00
m-holger
368666899f Refactor InlineImageTracker::handleToken 2023-11-26 13:08:55 +00:00
m-holger
ddad5ad53e In QPDF::pipeStreamData use unique_ptr as heap 2023-11-26 13:06:12 +00:00
m-holger
0dee397075 In QPDF::pipeStreamData read buffer in a single read 2023-11-26 12:26:57 +00:00
m-holger
9f7f9496ed Add Buffer constructors taking std::string parameters 2023-11-26 12:26:44 +00:00
m-holger
4c71c8680a Refactor QPDF_Stream::getStreamJSON 2023-11-26 12:22:36 +00:00
m-holger
9146f1f0fd Change default for SF_FlateLzwDecode::columns to 1 2023-11-23 01:51:38 +00:00
m-holger
3237ef70fb Add new method Pl_Buffer::getString 2023-11-18 16:34:17 +00:00
m-holger
d11622b6fd Change Pl_Buffer to use std::string for storage 2023-11-17 15:55:11 +00:00
m-holger
1285f9767a Add new method QPDFParser::fixMissingKeys 2023-11-03 11:22:21 +00:00
m-holger
605b1429e8 In QPDFParser::parse create dictionaries on the fly
Also, don't search for /Contents name unless the result is used.
2023-11-03 11:09:58 +00:00
m-holger
0328d87237 In QPDFParser::parse refactor parsing of indirect references 2023-11-03 01:34:16 +00:00
m-holger
1548b8d8be In QPDFParser::parseRemainder eliminate most temporary variables 2023-11-03 01:34:10 +00:00
m-holger
4c8836d520 In QPDFParser::parse eliminate most temporary variables 2023-11-03 01:33:59 +00:00
m-holger
c912af7384 In QPDFParser remove state st_top 2023-11-03 01:32:04 +00:00
m-holger
172cc61305 Remove redundant code in QPDFParser::parse and parseRemainder
Also, fix test cases.
2023-11-03 01:26:34 +00:00
m-holger
5a1bf035f9 Add new method QPDFParser::parseRemainder
The new method is temporarily an (almost) complete copy of parse, which is
temporarily (almost) unchanged.
2023-11-03 01:26:12 +00:00
m-holger
db6ab9cbfa In QPDFParser::parse merge state and object stacks 2023-11-01 15:45:17 +00:00
m-holger
d904eab84c In QPDFParser::parse refactor handling of array_open and dict_open tokens 2023-11-01 15:38:01 +00:00
m-holger
90829228b8 In QPDFParser::parse refactor handling of dict_close tokens 2023-11-01 15:27:52 +00:00
m-holger
12837f14b6 In QPDFParser::parse refactor handling of array_close tokens 2023-11-01 15:26:04 +00:00
m-holger
26e0bf4610 In QPDFParser::parse refactor eof handling 2023-11-01 15:23:30 +00:00
m-holger
37f7a73488 In QPDFParser::parse refactor handling of bad tokens 2023-11-01 15:21:08 +00:00
m-holger
29cd8f4f53 Avoid unnecessary string copies in QPDFParser::parse
Fixes #864. QPDFTokenizer::getValue originally had a std::string_view
return type, which was changed to std::string without removing some
unnecessary string creation.
2023-10-27 14:16:51 +01:00
Jay Berkenbilt
71566a2761 Write offsets as unsigned in linearization hint tables (fixes #1023) 2023-10-14 18:04:13 -04:00
Jay Berkenbilt
1ecc6bb29e Don't lose character after \d or \dd parsing string (fixes #1050) 2023-10-14 17:12:56 -04:00
Jay Berkenbilt
8854143c7b Spell check 2023-10-07 17:52:35 -04:00
Jay Berkenbilt
98014ec98a Fix error with stream recovery (fixes #1042) 2023-10-07 13:29:10 -04:00
m-holger
fb504ce913 Fix #1028 2023-09-05 17:22:34 +01:00
Jay Berkenbilt
bfbd97b938 Spell check 2023-09-03 14:07:30 -04:00
Jay Berkenbilt
806922f643 ascii85: ignore whitespace between ~ and > (fixes #973) 2023-09-03 13:56:34 -04:00
Jay Berkenbilt
3372615e5b Quote program name in completion output (fixes #1021) 2023-09-03 10:13:17 -04:00
Jay Berkenbilt
87765bace9 Move random number device check to runtime (fixes #1022)
Having it at compile time breaks cross-compilation and isn't really
right anyway.
2023-09-03 09:36:13 -04:00
Jay Berkenbilt
2b4dcb33aa
Merge pull request #1014 from m-holger/i1011
Change QPDF::copyForeignObject to return a null object when called wi…
2023-09-03 08:54:12 -04:00
m-holger
b0c3ea2bb6 Refactor test for /Pages object in QPDF::copyForeignObject
Test for missing object before accessing obj_copier.object_map.
2023-09-03 13:41:11 +01:00
Jay Berkenbilt
fec75b44b4
Merge pull request #1030 from m-holger/exit
Fix exit code when an input other than the primary input generates wa…
2023-09-03 08:37:14 -04:00
Jay Berkenbilt
c6a3d83fb5 Revert "Check for warnings in files used by --pages"
m-holger's fix is better

This reverts commit fa3cdaf1b4.
2023-09-03 08:12:31 -04:00
Jay Berkenbilt
fa3cdaf1b4 Check for warnings in files used by --pages 2023-09-03 08:07:07 -04:00
Jay Berkenbilt
dedf9a06df Fix a few things found by CLion 2023-09-03 08:07:07 -04:00
m-holger
94e6323206 Fix exit code when an input other than the primary input generates warnings 2023-09-03 12:27:23 +01:00
Jay Berkenbilt
fb704143cd
Merge pull request #1013 from m-holger/po
Simplify QPDFObjectHandle::isPageObject
2023-09-02 15:37:06 -04:00
Jay Berkenbilt
e640dd30be
Merge pull request #1016 from m-holger/i1010
Change QUtil::read_file_into_string to work with pipes (fixes #1010)
2023-09-02 15:21:04 -04:00
Jay Berkenbilt
c51bdeb19c
Merge pull request #1017 from m-holger/mbox
Check for missing mediaboxes
2023-09-02 15:03:03 -04:00
Jay Berkenbilt
ec6784411d
Merge pull request #1028 from m-holger/i1003
Maintain links to foreign pages when copying foreign objects (fixes #1003)
2023-09-02 14:59:16 -04:00
m-holger
ac32dbc313 Reserve foreign /Page objects in QPDF::copyForeignObject
Ensure that links to foreign pages are not broken provided that the page is
subsequently copied.
2023-08-25 14:06:42 +01:00
m-holger
ad73bbcd90 Change QPDF::reserveObjects to reserve indirect nulls to reserve foreign objects 2023-08-25 13:30:55 +01:00
m-holger
52539544c4 Modify QPDF::replaceReserved to allow replacing indirect nulls 2023-08-25 12:37:24 +01:00
m-holger
6574dc5c03 Store indirect nulls in QPDF_Dictionary 2023-08-25 12:25:06 +01:00
m-holger
34491c612d Store indirect nulls in QPDF_Dictionary 2023-08-25 12:21:25 +01:00
m-holger
fedd42191f Change QPDF::copyForeignObject to return a null object when called with a /Pages object (fixes #1011) 2023-08-25 12:10:51 +01:00
Zoe Clifford
cbae2f916b Remove use of non-standard char_traits<unsigned char> from Pl_Buffer
`basic_string<unsigned char>` implies use of
`char_traits<unsigned char>`.

This char_traits specialization is not standard C++, and will be
removed from LibC++ as of LLVM 18. To ensure continued LibC++
compatibility it needs to be removed.

There are two possible replacements here: `std::string` (e.g.
`std::basic_string<char>`), or `std::vector<unsigned char>`.

I have opted for vector since this code is dealing with a binary
buffer; though probably either way is fine (why does C++ even have
strings anyway??).

https://github.com/qpdf/qpdf/issues/1024
2023-08-22 13:44:58 -07:00
m-holger
d7efc661ec Change QUtil::read_file_into_string to work with pipes (fixes #1010) 2023-08-07 12:40:34 +01:00
m-holger
9a69cbba5b Check for missing mediaboxes 2023-07-29 13:16:40 +01:00
m-holger
b683e65cca Simplify QPDFObjectHandle::isPageObject 2023-07-25 12:43:19 +01:00
m-holger
d531309cf9 Fix QPDFObjectHandle::disconnect (partially fixes #1011) 2023-07-24 18:51:30 +01:00
Jay Berkenbilt
3f9b5053ba Format code 2023-07-09 09:59:55 -04:00
m-holger
ba3953f1bf Tune QPDF::readObject 2023-07-08 16:32:07 +01:00
m-holger
5754ab8b39 Tune QPDF::readObjectInStream 2023-07-08 16:32:00 +01:00
m-holger
aabd3f6f9b Add private method QPDF::validateStreamLineEnd 2023-07-08 16:31:57 +01:00
m-holger
ef866d68cd In QPDF::readStream remove variable done 2023-07-08 16:31:50 +01:00
m-holger
c422b918b1 Add new private method QPDF::readStream 2023-07-08 16:31:44 +01:00
m-holger
2643ed4dd9 Add new private method QPDF::readTrailer() 2023-07-08 01:28:15 +01:00
m-holger
bee726609c Remove redundant parameters from QPDF::readObject 2023-07-07 20:37:13 +01:00
m-holger
2bf7359e35 Add new private method QPDF::readObjectInStream 2023-07-07 20:14:59 +01:00
m-holger
098b98c889 Tidy QPDF::read_xrefTable(qpdf_offset_t xref_offset) 2023-07-04 19:59:09 +01:00
m-holger
8e6974710c Add private method QPDF::insertFreeXrefEntry 2023-07-04 19:59:09 +01:00
m-holger
250a736482 Remove parameter overwrite from QPDF::processXRefStream 2023-07-04 19:59:09 +01:00
m-holger
769a4915e8 Add new private method QPDF::insertReconstructedXrefEntry 2023-07-04 19:59:09 +01:00
Jay Berkenbilt
2ff7ac8a58
Merge pull request #990 from m-holger/issue600
Ensure copied annotations are fixed (fixes #600)
2023-06-17 17:54:27 -04:00
Jay Berkenbilt
328a2d083e
Merge pull request #983 from m-holger/buffer
Add new Buffer method copy and deprecate copy constructor / assignment operator
2023-06-17 14:04:06 -04:00
m-holger
0f2ef5e85b Add new Buffer method copy and deprecate copy constructor / assignment operator
Also fix accidental Buffer copy in Pl_LZWDecoder::addToTable.
2023-06-17 17:18:31 +01:00
Jay Berkenbilt
071fe4a0e5
Merge pull request #985 from m-holger/members
Change JSONHandler::m to std::unique_ptr and declare Members in implementation file
2023-06-17 11:57:02 -04:00
Jay Berkenbilt
0b538ec877
Merge pull request #982 from m-holger/cltidy
Apply various Clang-Tidy rules
2023-06-17 11:29:21 -04:00
Jay Berkenbilt
21612165c6
Merge pull request #981 from m-holger/writer
Remove redundant loop in QPDFWriter::prepareFileForWrite
2023-06-17 10:57:56 -04:00
Jay Berkenbilt
d3c444a7fb
Merge pull request #980 from m-holger/readobject
Avoid unnecessary copying of stream dictionary in QPDF::readObject
2023-06-17 10:54:45 -04:00
m-holger
8cb89529bd Use early returns in JSONHandler::handle 2023-06-17 14:38:20 +01:00
m-holger
75e74679c5 Move struct JSONHandler::Handlers to implementation file 2023-06-17 14:38:20 +01:00
m-holger
62f00b6d9c Change JSONHandler::m to std::unique_ptr and declare Members in implementation file 2023-06-17 14:38:20 +01:00
m-holger
8b05c550b3 Fix doc typos 2023-06-17 14:38:20 +01:00
m-holger
ae19d703f4 Ensure copied annotations are fixed (fixes #600)
Case where pages from a main input without /AcroForm key were duplicated
was omitted
2023-06-15 15:49:50 +01:00
m-holger
d784e8033c Code tidy - Clang-Tidy rule performance-for-range-copy 2023-06-09 15:55:49 +01:00
m-holger
0ac005f0d9 Code tidy - Clang-Tidy rule modernize-use-override 2023-06-09 15:52:56 +01:00
m-holger
ae3642ce42 Code tidy - Clang-Tidy rule modernize-use-equals-default 2023-06-09 15:45:14 +01:00
m-holger
5906dd5c1f Code tidy - Clang-Tidy rule modernize-use-default-member-init 2023-06-09 15:43:21 +01:00
m-holger
7bc0f1d828 Code tidy - Clang-Tidy rule modernize-use-emplace 2023-06-09 15:42:11 +01:00
m-holger
22c6b8ccbc Code tidy QPDFObjectHandle::newArray 2023-06-09 15:39:19 +01:00
m-holger
320bbb9854 Code tidy - Clang-Tidy rule modernize-return-braced-init-list 2023-06-09 15:35:56 +01:00
m-holger
d8e078fbb7 Remove redundant loop in QPDFWriter::prepareFileForWrite 2023-06-09 15:29:16 +01:00
m-holger
4490d4c35e Avoid unnecessary copying of stream dictionary in QPDF::readObject 2023-06-05 21:22:40 +01:00
m-holger
acd0acf169 Fix doc typos 2023-06-02 19:24:12 +01:00
m-holger
3c5700c255 Code tidy - reflow comments and strings 2023-06-02 16:00:40 +01:00
m-holger
db6c09b625 Fix doc typos 2023-05-27 11:06:37 +01:00
m-holger
698a70e6a8 Code tidy - reflow comments and strings 2023-05-27 10:54:19 +01:00
Jay Berkenbilt
a90787c5e1 Spell check 2023-05-21 14:25:31 -04:00
Jay Berkenbilt
5bbce89e6a Add clarification about empty passwords to doc 2023-05-21 13:46:19 -04:00
Jay Berkenbilt
60965d5f4d Rerun clang-format 2023-05-21 13:35:09 -04:00
m-holger
49e6365f63 Replace 'this->m' with 'm'
Manual edits for cases not handled by search and replace
2023-05-21 14:52:24 +01:00
m-holger
85d784952f Globally replace 'this->m->' with 'm->'
Using search and replace.
2023-05-21 14:42:34 +01:00
Jay Berkenbilt
280c9057c9 Strip DLLs with mingw in Release mode 2023-05-20 19:51:12 -04:00
Jay Berkenbilt
293a2e52b3 Disregard appearance state when irrelevant (fixes #949)
If /AP is a dictionary of streams rather than a dictionary of
dictionaries, disregard /AS, which is supposed to point to a subkey of
one of the dictionaries. This fix prevents qpdf's annotation
flattening from discarding some annotations when /AS is erroneously
set.
2023-05-20 15:46:16 -04:00
Jay Berkenbilt
1c14a9e6c4
Merge pull request #959 from m-holger/reserved
Add new method QPDF::newReserved()
2023-05-20 15:27:33 -04:00
m-holger
05a49cecf1 Add new method QPDF::newReserved 2023-05-20 19:56:01 +01:00
Jay Berkenbilt
d740c6ccce Rerun format_code (after merging clang-tidy PR) 2023-05-20 14:52:19 -04:00
Jay Berkenbilt
a85635b839
Merge pull request #929 from m-holger/ogguard
Add new convenience class QPDFObjGen::Guard
2023-05-20 14:09:49 -04:00
m-holger
e6577a1323 Replace 'virtual' specifier with 'override' 2023-05-20 15:41:56 +01:00
m-holger
ba5a3567a2 Remove redundant 'virtual' specifiers 2023-05-20 15:41:52 +01:00
m-holger
774d0d558e Use auto when declaring iterators 2023-05-20 15:41:48 +01:00
m-holger
2fa581537b Use auto when initializing with a cast 2023-05-20 15:41:44 +01:00
m-holger
41ec7eda54 Use auto when initialializing with new 2023-05-20 15:41:40 +01:00
m-holger
d0682f0f60 Use nullptr instead of 0 or NULL 2023-05-20 15:41:36 +01:00
m-holger
e28f4efb00 Replace deprecated C++ includes 2023-05-20 15:41:25 +01:00
m-holger
7f043fe88e Remove unused include directives 2023-05-20 15:37:41 +01:00
m-holger
50bc82b4e0 Tidy QPDFJob::doJSONObjects 2023-05-19 18:56:17 +01:00
m-holger
9db2965f62 Use QPDFObjGen::set in QPDFJob::getWantedJSONObjects 2023-05-19 18:56:10 +01:00
m-holger
0c45bd8749 Use QPDFObjGen::set in QPDFJob::shouldRemoveUnreferencedResources 2023-05-19 18:56:06 +01:00
m-holger
ae2d623929 Use QPDFObjGen::set in QPDF::updateObjectMaps 2023-05-19 18:56:01 +01:00
m-holger
8fbef47093 Use QPDFObjGen::set in QPDF::getAllPages 2023-05-19 18:55:55 +01:00
m-holger
5473c0956c Use QPDFObjGen::set in QPDF::replaceForeignIndirectObjects 2023-05-19 18:52:48 +01:00
m-holger
aeb66311c2 Use QPDFObjGen::set in QPDF::getCompressibleObjGens 2023-05-19 18:49:41 +01:00
m-holger
53f6c0a55a Use QPDFObjGen::set in QPDFPageObjectHelper::forEachXObject 2023-05-19 18:49:36 +01:00
m-holger
1957ad1e05 Use QPDFObjGen::set in QPDFPageObjectHelper::getAttribute 2023-05-19 18:49:33 +01:00
m-holger
8335b2833b Use QPDFObjGen::set in QPDFObjectHandle 2023-05-19 18:47:58 +01:00
m-holger
d60f06c15d Use QPDFObjGen::set in QPDFFormFieldObjectHelper 2023-05-19 17:42:12 +01:00
m-holger
d395a90904 Use QPDFObjGen::set in QPDFAcroFormDocumentHelper::getFormFieldsForPage 2023-05-19 16:58:43 +01:00
m-holger
5b3b135fda Tidy QPDFAcroFormDocumentHelper::getFieldsWithQualifiedName 2023-05-19 16:58:34 +01:00
m-holger
e37ce44186 Use QPDFObjGen::set in QPDFAcroFormDocumentHelper::transformAnnotations 2023-05-19 16:58:28 +01:00
m-holger
c12a6d06fc Use QPDFObjGen::set in QPDFAcroFormDocumentHelper::traverseField 2023-05-19 16:58:24 +01:00
m-holger
e7e24fe070 Tidy QPDFAcroFormDocumentHelper::addAndRenameFormFields 2023-05-19 16:58:14 +01:00
m-holger
55abecc42d Use QPDFObjGen::set in QPDFOutlineDocumentHelper 2023-05-19 16:58:08 +01:00
m-holger
0e81ffa7b6 Use QPDFObjGen::set in NNTree 2023-05-19 16:58:04 +01:00
m-holger
9b08017217 Add new convenience class QPDFObjGen::set 2023-05-19 12:27:53 +01:00
m-holger
08d7b56746 Prevent destruction of shared null objects
#863 uses a single null object for nulls that were previously implicit. In
certain circumstances this shared null object gets destroyed (i.e changed
to a QPDF_Destroyed object) when a QPDF object is destroyed.

Modify the QPDF destructor so that null objects get disconnected from the
dying QPDF object but not destroyed to prevent this from happening.
2023-04-11 18:01:14 +01:00
m-holger
3f2ebf334b Fix bug in QPDF_Name::normalizeName introduced in #891
'#' was omitted from the list of chars that need to be escaped.
2023-04-04 15:54:54 +01:00
m-holger
41f79bedbc Add new functions qpdfjob_create_qpdf and qpdfjob_write_qpdf 2023-04-02 09:45:19 +01:00
m-holger
c78f44798a Add new _qpdf_data constructor taking a std::unique_ptr<QPDF>
Also, move _qpdf_data and to new header filer _qpdf_error to new header
file qpdf-c_impl.hh
2023-04-02 09:24:08 +01:00
m-holger
a2edf27b76 Initialize _qpdf_data members 2023-04-02 09:24:08 +01:00
Jay Berkenbilt
f8e39253be
Merge pull request #863 from m-holger/array
Refactor QPDF_Array
2023-04-01 11:05:07 -04:00
Jay Berkenbilt
40e4d1f97c
Merge pull request #930 from m-holger/throw
Code tidy re-throwing of exceptions
2023-04-01 09:42:52 -04:00
Jay Berkenbilt
5981b25e98
Merge pull request #932 from m-holger/wr_upo
Tune indentations in QPDFWriter::unparseObject
2023-04-01 09:37:55 -04:00
m-holger
0b53b648ab Refactor QPDF_Array::unparse 2023-04-01 13:58:21 +01:00
m-holger
c2ab0441b5 Refactor QPDF_Array::getJSON 2023-04-01 13:58:15 +01:00
m-holger
a7b6975132 Remove SparseOHArray 2023-04-01 13:58:06 +01:00
m-holger
d3f2dc322b Refactor QPDF_Array::copy 2023-04-01 13:57:47 +01:00
m-holger
a171ebb942 Refactor QPDF_Array::disconnect 2023-04-01 13:57:35 +01:00