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

47 Commits

Author SHA1 Message Date
m-holger
5d25aac6c7 In QPDFParser constructor change input parameter to InputSource& 2024-09-05 15:30:32 +01:00
m-holger
06001ed25b Refactor the creation of unresolved objects
Create unresolved objects only for objects in the xref table (except during
parsing of the xref table). Do not add indirect nulls into the the object
cache as the result of a cache miss during a call to getObject except
during parsing or creation/updating from JSON. To support this behaviour,
add new private methods getObjectForParser and getObjectForJSON.

As a result of this change, dangling references are treated as direct nulls
rather than indirect nulls.
2024-08-06 12:22:09 +01:00
Jay Berkenbilt
7caa9ddf5a Format code 2024-02-04 16:12:01 -05:00
m-holger
ed43691bf3 Tighten checks for invalid indirect references in QPDFParser 2024-01-17 13:15:13 +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
m-holger
7bc0f1d828 Code tidy - Clang-Tidy rule modernize-use-emplace 2023-06-09 15:42:11 +01:00
m-holger
698a70e6a8 Code tidy - reflow comments and strings 2023-05-27 10:54:19 +01:00
Jay Berkenbilt
60965d5f4d Rerun clang-format 2023-05-21 13:35:09 -04:00
m-holger
7f043fe88e Remove unused include directives 2023-05-20 15:37:41 +01:00
m-holger
8fdc3f0964 Optimize QPDFParser for non-sparse QPDF_Arrays
Stop using nullptr to represent null objects.
Count null array elements and trigger creation of sparse arrays if null count is
greater than 100.
2023-03-29 12:10:19 +01:00
m-holger
60538f1958 Change QPDFParser::parse to use QPDFTokenizer::nextToken 2023-01-07 15:24:51 -05:00
m-holger
3f567ae02d Refactor dictionary processing loop in QPDFParser::parse 2022-12-31 14:37:35 -05:00
m-holger
d67a54ae93 Tune parsing of dictionaries in QPDFParser::parse
Use move semantics for dictionary creation.
2022-12-31 14:37:35 -05:00
m-holger
846504129f Remove redundant parameter qpdf from QPDFParser::warn 2022-12-31 14:37:35 -05:00
m-holger
b19e06fd8b Change QPDFParser::setDescription to take a shared_ptr<QPDFObject> parameter 2022-12-31 14:37:35 -05:00
m-holger
8391022416 Avoid inserting direct null objects into olist 2022-12-31 14:37:35 -05:00
m-holger
9da50ca360 Change olist variable in QPDFParser::parse to vector<shared_ptr<QPDFObject>> 2022-12-31 14:37:35 -05:00
m-holger
e91e642cf3 Change object variable in QPDFParser::parse to shared_ptr<QPDFObject> 2022-12-31 14:37:35 -05:00
m-holger
0ef2def8ad Delay adding offsets to object descriptions until necessary 2022-12-31 10:23:59 -05:00
m-holger
e684d8169b Make QPDFValue::object_description a shared pointer 2022-12-31 10:23:59 -05:00
m-holger
d03ca88275 Refactor QPDFParser::setDescriptionFromInput and rename to setDescription
Set parsed offset at the same time as setting description.
2022-12-31 10:23:59 -05:00
m-holger
2693a082ab Fix check for direct nulls in QPDFParser::parse 2022-12-15 13:07:42 -05:00
m-holger
3f632458ae Refactor QPDF::fixDanglingReferences 2022-11-26 16:26:42 -05:00
m-holger
2e6869483b Replace calls to QUtil::int_to_string with std::to_string 2022-09-21 15:57:14 -04:00
m-holger
356b582cec Remove QPDFObjectHandle::newIndirect
Modify QPDFParser::parse to call QPDF::getObject instead.
2022-09-01 16:59:01 +01:00
Jay Berkenbilt
7b3134ef94 Add ChangeLog for previous contribution
Also remove no-longer-needed #include
2022-08-31 15:06:37 -04:00
m-holger
70d985f942 Optimise QPDFParser::parse for #311 problem
Avoid creating new null objects that later will be discarded and made
implicit.

Part of #729
2022-08-30 13:32:54 +01:00
m-holger
97a7ad1d80 Avoid setting descriptions / offsets for direct nulls in QPDFParser::parse
Part of #729
2022-08-30 13:07:48 +01:00
m-holger
7402c02c80 Combine stacks in QPDFParser::parse
Part of #729
2022-08-30 12:53:19 +01:00
m-holger
74162a2d48 Tune QPDFParser::parse
Replace SparseOHArray with std::vector<QPDFObjectHandle>.

Part of #729
2022-08-30 11:32:43 +01:00
m-holger
6fc982b71a Move QPDFObjectHandle::setObjectDescriptionFromInput to QPDFParser
Part of #729
2022-08-30 06:42:46 +01:00
m-holger
8ad1ea34fe Add private methods QPDFParser::warn
Part of #729
2022-08-30 06:04:34 +01:00
m-holger
6670c685ab Move QPDFObjectHandle::parseInternal to new class QPDFParser
Part of #729
2022-08-30 05:56:23 +01:00