m-holger
98d9ae51fc
Integrate JSONParser::decode_string into getToken
2023-02-04 14:06:26 +00:00
m-holger
320245e0d1
In JSONParser::getToken decode escaped chars inside state ls_backslash
...
(except '\\' and '\uXXXX')
2023-02-04 14:06:26 +00:00
m-holger
cee746fc15
In JSONParser::getToken avoid copying '"' characters in strings
2023-02-04 14:06:26 +00:00
m-holger
a9a0667904
Make JSONParser::getToken responsible for decoding strings
2023-02-04 14:06:26 +00:00
m-holger
126dd31cad
In JSONParser combine stacks
2023-02-04 13:53:23 +00:00
m-holger
6748bd33f7
In JSONParser::handleToken remove next_state
2023-02-04 13:53:23 +00:00
m-holger
29093a167b
In JSONParser::handleToken refactor container creation
2023-02-04 13:53:23 +00:00
m-holger
a39043f65e
In JSONParser::handleToken avoid creating JSON objects for dictionary keys
2023-02-04 13:53:23 +00:00
m-holger
f2e46c20b6
In JSONParser::handleToken move remaining validations into second switch statement
2023-02-04 13:53:23 +00:00
m-holger
0de032bcdd
In JSONParser::handleToken simplify setting of start and end
2023-02-04 13:53:22 +00:00
m-holger
77ceebd6c9
In JSONParser::handleToken move processing for ls_end_array and ls_end_dict into switch statement
2023-02-04 13:53:22 +00:00
m-holger
a7338ab15a
In JSONParser::handleToken move processing for ls_colon and ls_comma into switch statement
2023-02-04 13:53:22 +00:00
m-holger
4dba3c95dd
In JSONParser::handleToken move validation for ls_colon etc into switch statement
2023-02-04 13:53:22 +00:00
m-holger
6f94a3a89a
In JSONParser::handleToken move string decoding into switch statement
2023-02-04 13:53:22 +00:00
m-holger
fcc123a62a
Avoid copying delimiters in JSONParser::getToken
2023-02-04 13:53:22 +00:00
m-holger
bb89a60320
Add data member JSONParser::token_start
2023-02-04 13:52:55 +00:00
m-holger
39dfd305c8
In JSONParser add lexer states for delimiters
2023-02-04 13:44:39 +00:00
m-holger
1e0ab79aec
Remove redundant JSONParser::before_point etc
2023-02-01 14:19:08 +00:00
m-holger
83f972ceda
Refactor end of input handling in JSONParser
2023-02-01 14:18:57 +00:00
m-holger
8fd6e1c5b2
Refactor handling of ls_number in JSONParser::getToken
...
Reflect that the ls_number case only handles the digits after an 'e'.
Also, change state to ls_number for all 'ready' numbers.
2023-02-01 14:18:39 +00:00
m-holger
6ea543e6c7
In JSONParser add lex_state ls_number_e_sign
2023-02-01 14:12:32 +00:00
m-holger
04333bbc20
In JSONParser add lex_state ls_number_e
...
Also, allow 'E' as alternative to 'e'.
2023-02-01 14:09:39 +00:00
m-holger
972ebca505
In JSONParser add lex_state ls_number_after_point
2023-02-01 14:01:57 +00:00
m-holger
cdd1f0a9f6
In JSONParser add lex_state ls_number_point
...
Also. remove '.' as starting char in lsTop.
2023-02-01 14:01:57 +00:00
m-holger
bfda62aeeb
In JSONParser add lex_state ls_number_before_point
2023-02-01 14:01:57 +00:00
m-holger
08e768909d
In JSONParser add lex_state ls_number_leading_zero
2023-02-01 14:01:57 +00:00
m-holger
cba1c352e3
In JSONParser add lex_state ls_number_minus
2023-02-01 14:01:57 +00:00
m-holger
b6b4d3b299
Add new method JSONParser::numberError
2023-02-01 14:01:57 +00:00
m-holger
1787d85096
Refactor JSON::addDictionaryMember
2023-01-28 14:49:37 -05:00
m-holger
dce43d4f7f
Refactor JSON::JSON_string::write
2023-01-28 14:49:32 -05:00
m-holger
4c914aee96
Refactor JSON::writeDictionaryKey
2023-01-28 14:49:32 -05:00
m-holger
3dde66ddcd
Refactor JSON::writeNext
2023-01-28 14:49:32 -05:00
m-holger
dfa7d414f5
Refactor JSON::writeClose
2023-01-28 14:49:32 -05:00
Jay Berkenbilt
1308c45090
Implement --remove-restrictions ( fixes #833 )
2023-01-28 13:42:19 -05:00
Jay Berkenbilt
fe11f13d63
Add stub for --remove-restrictions
2023-01-28 13:24:45 -05:00
Jay Berkenbilt
acfc9db051
QPDFJob: switch to C++11-style field initializers
2023-01-28 13:24:30 -05: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
Jay Berkenbilt
e4e0f40fc0
Fix annotations properly for page with no /Resources ( fixes #827 )
2023-01-09 07:31:39 -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
60538f1958
Change QPDFParser::parse to use QPDFTokenizer::nextToken
2023-01-07 15:24:51 -05:00
m-holger
863d95e567
Add new method QPDFTokenizer::nextToken
2023-01-07 15:24:51 -05:00
m-holger
a07d2b4190
Only build QPDFTokenizer::val for name and string tokens
...
For all other token types val and raw_val are identical.
2023-01-07 15:24:51 -05:00
m-holger
59191ebbc4
Tune QPDFWriter::unparseObject
2023-01-07 13:27:17 -05:00
m-holger
942a2c3f68
Add new function QUtil::hex_encode_char
2023-01-06 18:42:12 -05:00
m-holger
1326ff7f79
Inline QPDFObjectHandle::dereference
2023-01-02 14:15:16 -05:00
m-holger
d7b470761b
Remove QPDFObjectHandle::Factory and ObjAccessor
2022-12-31 19:16:38 -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
ec35156ab0
Refactor QPDFValue::getDescription
...
Remove parameters and return the description.
2022-12-31 10:23:59 -05:00
m-holger
0ef2def8ad
Delay adding offsets to object descriptions until necessary
2022-12-31 10:23:59 -05:00
m-holger
c833c25499
Delay adding ObjGen 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
218f069a69
Add new method QPDFObject::setDefaultDescription
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
6cbc55a5b5
Add new virtual method QPDFObject::getStringValue
...
Avoid dynamic casting.
2022-12-31 09:31:07 -05:00
m-holger
0ca44ef84c
Fix QPDFObjectHandle::isScalar
...
Exclude uninitialized, destroyed and reserved objects.
2022-12-31 09:27:19 -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
2693a082ab
Fix check for direct nulls in QPDFParser::parse
2022-12-15 13:07:42 -05:00
m-holger
cfcb279e49
Alternative fix logic for fixDanglingReferences
2022-12-06 15:21:34 -05:00
Jay Berkenbilt
ff42ea4e6c
Fix logic for fixDanglingReferences
2022-11-26 18:13:46 -05:00
m-holger
3f632458ae
Refactor QPDF::fixDanglingReferences
2022-11-26 16:26:42 -05:00
Jay Berkenbilt
562ff1b608
Rename function for pikepdf (for 11.2.0)
...
A new private overload of QPDF::makeIndirectObject breaks pikepdf's
build, so renaming function.
2022-11-20 16:04:58 -05:00
m-holger
4325e6e4a7
Refactor QPDFObjectHandle::copyObject and rename to makeDirect
2022-11-20 12:07:22 -05:00
m-holger
585ecf17c8
Remove redundant parameter cross_indirect from QPDFObjectHandle::copyObject
2022-11-20 12:07:22 -05:00
m-holger
ebc15f4dd0
Remove redundant parameter first_level_only from QPDFObjectHandle::copyObject
2022-11-20 12:07:22 -05:00
m-holger
64059014c9
Refactor QPDFObjectHandle::shallowCopy
2022-11-20 12:07:22 -05:00
m-holger
b1eb1a9584
Refactor QPDFObjectHandle::copyObject1
2022-11-20 12:07:22 -05:00
m-holger
3e3b79a774
Remove redundant parameter first_level_only from QPDFObjectHandle::shallowCopyInternal2 and copyObject2
2022-11-20 12:07:22 -05:00
m-holger
3efd665703
Remove redundant parameters cross_indirect and stop_atstreams from QPDFObjectHandle::copyObject1
2022-11-20 12:07:22 -05:00
m-holger
d7b8525235
Refactor QPDFObjectHandle::unsafeShallowCopy
2022-11-20 12:07:22 -05:00
m-holger
0289b21c3b
Remove redundant QPDFObjectHandle::copyObject2
...
copyObject2 repeats a second time what
new_obj = QPDFObjectHandle(obj->copy(true))
in shallowCopyInternal2 already did.
2022-11-20 12:07:22 -05:00
m-holger
15e8d3a763
Remove redundant parameter first_level_only from QPDFObjectHandle::shallowCopyInternal2 and copyObject2
2022-11-20 12:07:22 -05:00
m-holger
0827b1096e
Remove redundant parameters cross_indirect and stop_atstreams from QPDFObjectHandle::copyObject2
2022-11-20 12:07:22 -05:00
m-holger
63d1dcb414
Split QPDFObjectHandle::shallowCopyInternal and copyObject
...
Have separate versions for unsafeShallowCopy, shallowCopy and makeDirect.
2022-11-20 12:07:22 -05:00
m-holger
dbc5f07b90
Rename QPDFObject::shallowCopy to copy
...
Add optional parameter shallow. Change logic errors to runtime errors.
2022-11-20 12:07:22 -05:00
m-holger
34a6f8938f
Add methods QPDFTokenizer::Token::isWord
2022-11-20 11:55:02 -05:00
m-holger
dca70f13e7
Add method QPDFTokenizer::Token::isInteger
2022-11-20 11:55:02 -05:00
Jay Berkenbilt
e9980efec8
Correctly handle reuse of xref stream ( fixes #809 )
2022-11-19 17:03:17 -05:00
m-holger
d79a823d66
Remove QPDF_Stream::getOffset and QPDF_Stream::setObjGen
2022-11-19 14:10:42 -05:00
m-holger
6350cf16e6
Remove QPDF_Stream::offset
2022-11-19 14:10:42 -05:00
m-holger
3a86b893f7
Remove redundant parameters from QPDF_Stream::warn
2022-11-19 14:10:42 -05:00
m-holger
69e67b45bb
Remove QPDF_Stream qpdf and og data members
2022-11-19 14:10:42 -05:00
m-holger
bf347dfb73
Remove QPDFObjectHandle::Factory::newStream
2022-11-19 14:10:42 -05:00
m-holger
743a735ee0
Use QPDF::newStream in library
2022-11-19 14:10:42 -05:00
m-holger
9ebabd1953
Add new methods QPDF::newStream
2022-11-19 14:10:42 -05:00
m-holger
0a3c533186
Add private method QPDF::nextObjGen
2022-11-19 14:10:42 -05:00
m-holger
b3d71e1f58
Add private overload of QPDF::makeIndirectObject taking a QPDFObject shared_ptr
2022-11-19 14:10:42 -05:00
m-holger
fc64d0a371
Fix stray formatting error
2022-11-14 07:05:58 -05:00
Jay Berkenbilt
d94e6958ef
Fix stray formatting error
2022-10-08 17:05:11 -04:00
Jay Berkenbilt
2bc9121fa1
Fix major performance bug with openssl crypto ( fixes #798 )
...
Lazily load MD5 and RC4 once in the life of the program. Only load the
legacy provider if RC4 is actually being used.
2022-10-08 17:04:59 -04:00
Jay Berkenbilt
5c5b4e640e
Be more conservative about QPDF_DLL_CLASS with mingw ( fixes #799 )
...
* Define it even though previous experiments have shown it to be
unnecessary since it seems like it may be necessary after all
* Add QPDF_DLL_CLASS to QPDFObjectHelper and QPDFDocumentHelper in
case there's some future unknown reason why someone may want to have
them and/or in case it helps with the weird
QPDFNameTreeObjectHelper problem.
2022-10-06 08:40:08 -04:00
m-holger
d44bba3914
Fix typos in error message
2022-10-03 11:42:27 -04:00
m-holger
c63fb86c01
Inline call to QPDFObjectHandle::parse in QPDF::readObject
2022-10-01 11:17:39 -04:00
m-holger
cb0a6be983
Code tidy: use QPDF::toS and QPDF::toI where possible
2022-10-01 11:17:39 -04:00
m-holger
5ccab4be03
Add private methods QPDF::damagedPDF
2022-10-01 11:17:39 -04:00
Jay Berkenbilt
f4ca04cec1
Fix edge case in character encoding ( fixes #778 )
...
Avoid representing as PDF Doc encoding any string whose PDF Doc
encoding representation starts with a UTF-16 or UTF-8 marker.
2022-09-26 08:06:47 -04:00
m-holger
4fb7d1335a
Tune QPDF_String::useHexString()
2022-09-24 17:09:56 -04:00
m-holger
44a7aff56f
Refactor Pl_Buffer
...
Base implementation of the buffer on std::basic_string<unsigned char>.
2022-09-23 15:09:13 -04:00
m-holger
ae800361fe
Tune QUtil::hex_encode
2022-09-23 06:20:12 -04:00
m-holger
033a66e9a5
Tune unparsing of hex strings in QPDF_String::unparse
2022-09-23 06:20:12 -04: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
5796475a5e
Cosmetic: use default constructor for QPDFObjGen
2022-09-14 07:35:32 -04:00
Jay Berkenbilt
2394acf7a6
Remove explicit direct object check from getObject
...
An indirect object reference to 0, 0 is invalid. If it appears in the
file or is parsed from a string, the parser catches it. This check
would only be useful for someone explicitly calling getObject with 0,
0, and that would trigger an error during resolve().
2022-09-13 11:21:29 -04:00
Jay Berkenbilt
a0b1a18172
Remove redundant function calls
2022-09-13 11:20:28 -04:00
Jay Berkenbilt
31b2cfbb79
Fix up a few comments
2022-09-13 11:18:49 -04:00
Jay Berkenbilt
4963ce6a53
Remove obsolete LL_FMT check from build ( fixes #768 )
...
This was broken for cross-compilation and has probably been
unnecessary for several years now.
Also fix extraneous whitespace in related some tests.
2022-09-12 11:48:38 -04:00
Jay Berkenbilt
8a3cdfd2af
Change QPDFObjectHandle == to isSameObjectAs
...
Replace operator== and operator!=, which were testing for the same
underlying object, with isSameObjectAs. This change was motivated by
the fact that pikepdf internally had its own operator== method for
QPDFObjectHandle that did structural comparison. I backed out qpdf's
operator== as a courtesy to pikepdf (in my own testing) but also
because I think people might naturally assume that operator== does a
structural comparison, and isSameObjectAs is clearer in its intent.
2022-09-09 18:09:40 -04:00
Jay Berkenbilt
3dbab589e3
Add C API functions for using custom loggers
...
Expose functions to the C API to create new loggers and to setLogger
and getLogger for QPDF and QPDFJob.
2022-09-09 10:49:25 -04:00
Jay Berkenbilt
0ad4e190ff
Make QPDFLogger() private and provide create method
2022-09-09 07:03:29 -04:00
Jay Berkenbilt
f1a2d3160a
Add JSON v2 support to C API
2022-09-09 06:19:09 -04:00
Jay Berkenbilt
66f1fd2ad9
Switch user-supplied functions in C API to return int
2022-09-08 17:36:51 -04:00
Jay Berkenbilt
b0f054e600
Add ability to initialize Pl_Function with a C-style function
2022-09-08 17:35:27 -04:00
Jay Berkenbilt
18a583e8d9
Rename QPDFValueProxy back to QPDFObject
...
QPDFValueProxy wasn't a good name for it. We decided the evil of
having the header file be named QPDFObject_private.hh was less than
the evil of having the class be named something other than what it
should have been named.
2022-09-08 11:29:23 -04:00
Jay Berkenbilt
25ccc7eae4
Rename QPDFValueProxy.hh and QPDFValueProxy.cc
...
Preparing to change the class name back to QPDFObject
2022-09-08 11:19:49 -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
dba61da1bf
Create a special "destroyed" type rather than using null
...
When a QPDF is destroyed, changing indirect objects to direct nulls
makes them effectively disappear silently when they sneak into other
places. Instead, we should treat this as an error. Adding a destroyed
object type makes this possible.
2022-09-08 10:36:39 -04:00
Jay Berkenbilt
264e25f391
Clear owning QPDF information for all objects, not just indirect
2022-09-08 10:19:38 -04:00
Jay Berkenbilt
9dcd25a06e
Remove superfluous call to resetObjGen
2022-09-08 10:19:38 -04:00
Jay Berkenbilt
4422588d7d
Remove unneeded owning_qpdf from QPDFValue
...
The qpdf member was already sufficient. Removing this actually fixed a
few pre-existing issues around detecting foreign ownership and
allowing certain conditions to be warnings rather than exceptions.
2022-09-08 10:19:38 -04:00
Jay Berkenbilt
0132261ee0
Revert getOwningQPDF, and add getQPDF that returns a reference
2022-09-07 17:26:39 -04:00
Jay Berkenbilt
76cd7ea67a
Clarify and improve QPDFPageObjectHelper::get*Box methods
...
Add copy_if_fallback and explain how it differs from copy_if_shared.
2022-09-06 19:00:40 -04:00
Jay Berkenbilt
c1def4ead4
Implement QPDFObjectHandle equality
2022-09-06 18:34:23 -04:00
Jay Berkenbilt
94c79bb8f6
Support --show-encryption without a valid password ( fixes #598 )
2022-09-06 12:45:12 -04:00
Jay Berkenbilt
6c61be00e8
Rename QPDFObject -> QPDFValueProxy
...
This is in preparation for restoring a QPDFObject.hh to ease the
transition on qpdf_object_type_e.
This commit was created by
* Renaming QPDFObject.cc and QPDFObject.hh
* Replacing QPDFObject\b with QPDFValueProxy (where \b is word
boundary)
* Running format-code
* Manually resorting files in libqpdf/CMakeLists.txt
* Manually refilling the comment in QPDF.hh near class Resolver
2022-09-05 18:52:59 -04:00
James R. Barlow
12967bdf8a
Take advantage of unique_ptr and move construction for Buffer
...
Since Buffer has always implemented its copy constructor with a deep
copy, its Members object will never have multiple owners. Change to unique_ptr.
Also implement move constructors for Buffer, since there may be cases
where a deep copy is not needed.
2022-09-05 13:29:56 -07:00
m-holger
9c86ba40d8
Fix commit 805c1ad
: Reset QPDFValue::qpdf and QPDFValue::og when ...
...
On destruction of the QPDF object replace all indirect object references
with direct nulls.
Remove all existing code to release resolved references.
Fixes performance issue due to interaction of resetting QPDFValue::qpdf and
og members and prior code.
2022-09-04 10:41:18 +01:00
Jay Berkenbilt
31396f61c9
Disallow --empty with --replace-input ( fixes #728 )
2022-09-02 09:37:17 -04:00
Jay Berkenbilt
a59e7ac7ec
Disable copying/assigning to QPDF objects, add QPDF::create()
2022-09-02 08:53:27 -04:00
Jay Berkenbilt
2a1ae0b44c
Remove remaining virtual functions from QPDFObject
...
This doesn't need an explicit destructor anymore.
2022-09-01 18:19:48 -04:00
Jay Berkenbilt
6d62662e2d
Make QPDFObject::releaseResolved public
...
Now that QPDFObject.hh is out of the public API, we don't really need
QPDFObjAccessor. Also, the function didn't have to be virtual anymore.
2022-09-01 18:19:47 -04:00
Jay Berkenbilt
c510c01568
Remove copyright banner from newly private header files
...
We don't put specific copyright banners on files that aren't installed.
2022-09-01 18:19:47 -04:00
Jay Berkenbilt
1d57772b76
Remove QPDFObject and QPDFValue from public include directory
2022-09-01 18:19:47 -04:00
Jay Berkenbilt
f772c43de8
Stop including QPDFObject.hh from other than private files
...
This required moving some newly inlined functions back to the cc file,
but that seems to have had no measurable performance impact.
2022-09-01 18:19:47 -04:00
Jay Berkenbilt
b663926538
Remove QPDFObject::object_type_e as alias for qpdf_object_type_e
2022-09-01 18:11:22 -04:00
Jay Berkenbilt
ceeb25f3c8
Rename --report-mem-usage to --report-memory-usage
...
Avd xcsv brvtns.
2022-09-01 17:15:41 -04:00
Jay Berkenbilt
481b1aeb50
Add comments after merge of last pull request
2022-09-01 17:15:41 -04:00
Jay Berkenbilt
3d029fb17e
Merge pull request #730 from m-holger/allpages
...
Tidy QPDF::getAllPagesInternal and QPDF::pushInheritedAttributesToPageInternal
2022-09-01 15:28:32 -04:00
m-holger
805c1ad479
Reset QPDFValue::qpdf and QPDFValue::og when the owning QPDF object gets destroyed
2022-09-01 17:20:16 +01:00
m-holger
2b7e9ba2f5
Remove methods and parameters obsoleted by the last two commits
2022-09-01 17:20:02 +01:00
m-holger
1bb40238e0
Add method QPDFObject::getObjGen and remove QPDFObjectHandle::og
2022-09-01 17:19:40 +01:00
m-holger
5033e3b215
Add method QPDFObject::getQPDF and remove QPDFObjectHandle::qpdf
2022-09-01 17:19:31 +01:00
m-holger
4a8515912c
Add method QPDFObject::resolve
2022-09-01 17:19:06 +01:00
m-holger
56e9bcabe9
Add methods QPDFObject::setObjGen and QPDFObject::resetObjGen
...
Also, modify QPDFObject::swapWith to update the ObjGens of the swapped
objects.
Modify QPDF::newIndirect and QPDF::updateCache to keep object ObjGens
up to date.
2022-09-01 17:09:48 +01:00
m-holger
89061d5b33
Change QPDF_Unresolved::create method to take QPDF* and QPDFObjGen parameters
2022-09-01 17:09:07 +01:00
m-holger
ae6e484e23
Change return type of QPDF::resolve to void
2022-09-01 17:08:45 +01:00
m-holger
356b582cec
Remove QPDFObjectHandle::newIndirect
...
Modify QPDFParser::parse to call QPDF::getObject instead.
2022-09-01 16:59:01 +01:00
m-holger
c5d0428da2
Modify QPDF::getObject to not to resolve the object
2022-09-01 14:47:24 +01:00
m-holger
556c34f0f2
Add private method QPDF::ObjCache::update
...
Add a new obj_cache entry or update an existing entry in place.
2022-09-01 14:30:26 +01:00
m-holger
c0cd72a3ee
Add private methods QPDF::isCached and QPDF::isUnresolved
2022-09-01 14:29:53 +01:00
m-holger
23d50a2f14
Remove QPDFObjectHandle::initialized
2022-09-01 14:29:38 +01:00
m-holger
c7005e8a6d
Remove virtual methods QPDFValue::getTypeCode and getTypeName
2022-09-01 14:29:02 +01:00
m-holger
27fae2b55e
Remove QPDF::ObjectChanged
...
Also change QPDF::replaceObject and QPDF::swapObjects such that the
QPDFObject assigned to an og in the obj_cache is never replaced; only
QPDFObject::value is updated.
2022-09-01 14:27:46 +01:00
m-holger
431bd666c0
Split QPDFObject into QPDFObject and QPDFValue
2022-09-01 14:19:34 +01:00
m-holger
43983109f2
Change QPDFObjectHandle::shallowCopyInternal to copy scalars
2022-09-01 00:11:05 +01:00
m-holger
114bffa089
Add private methods QPDFObjectHandle::asArray etc
...
Centralise casting of QPDFObjects and reduce repeated dereferencing.
2022-09-01 00:10:04 +01:00
m-holger
2a2eebcaea
Modify newIndirect to set QPDFObjectHandle::obj
2022-08-31 22:47:11 +01:00
m-holger
16841bec32
Remove QPDFObjectHandle::makeReserved
2022-08-31 22:46:55 +01:00
m-holger
07b66eb0b6
Remove QPDFObjectHandle::reserved
2022-08-31 22:46:25 +01:00
m-holger
7248cab71b
Add class QPDF_Unresolved
...
Allow QPDFObjectHandle::obj to be set prior resolving object.
ot_unresolved has been appended to the list object types in order to
preserve the output of existing test cases.
2022-08-31 22:46:09 +01:00
m-holger
bd300be08d
Replace calls to QPDFObjectHandle::Factory::newIndirect where possible
2022-08-31 22:45:45 +01:00
Jay Berkenbilt
a078202c1b
Merge pull request #752 from jberkenbilt/report-mem-usage
...
Report mem usage
2022-08-31 15:50:17 -04:00
Jay Berkenbilt
7b3134ef94
Add ChangeLog for previous contribution
...
Also remove no-longer-needed #include
2022-08-31 15:06:37 -04:00
Jay Berkenbilt
433f1dae19
Add --report-mem-usage option for debugging/testing
2022-08-31 14:47:27 -04:00
Jay Berkenbilt
0a54247652
Add QUtil::get_max_memory_usage for testing
2022-08-31 14:47:27 -04:00
m-holger
9532dca3a5
Inline QPDFObjectHandle::setParsedOffset
...
Part of #729
2022-08-30 14:55:45 +01: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
Jay Berkenbilt
0adfd74f8b
Merge pull request #747 from m-holger/new_stream
...
Add optional parameter allow_nullptr to QPDFObjectHandle::getOwningQPDF
2022-08-29 16:33:19 -04:00
Jay Berkenbilt
2b01a79e87
Fix header ordering in QTC (format code)
2022-08-29 11:55:02 -04:00
m-holger
c53d54b13d
Add optional parameter allow_nullptr to QPDFObjectHandle::getOwningQPDF
...
Also, inline method and add optional parameter error_msg.
2022-08-28 22:15:59 +01:00
m-holger
b0c1ae05a3
Fix commit b45420a
2022-08-27 12:43:49 +01:00
m-holger
fc4feb6f1a
Remove BufferInputSource::Members
2022-08-27 12:19:51 +01:00
m-holger
d6a447b654
Remove ClosedFileInputSource::Members
2022-08-27 12:13:39 +01:00
m-holger
69a5fb7047
Add methods InputSource::fastRead, fastUnRead and fastTell
...
Provide buffered input for QPDFTokenizer.
2022-08-26 23:55:56 +01:00
m-holger
13ef50cd27
Avoid virtual method call in FileInputSource::read
2022-08-25 15:08:03 +01:00
m-holger
a318b203be
Refactor FileInputSource::seek and FileInputSource::unreadCh
...
Avoid building error message each call "just in case".
2022-08-25 15:04:41 +01:00
m-holger
dc5c8b82eb
Remove FileInputSource::Members
2022-08-25 12:42:14 +01:00
m-holger
7108cd7b98
Remove redundant tests in QPDFTokenizer::readToken
2022-08-25 11:32:08 +01:00
m-holger
10fda01b07
In QPDFTokenizer::readToken move call to getToken out of loop
2022-08-25 11:31:45 +01:00
m-holger
e4073ee868
Remove unnecessary string copy in QPDFTokenizer::getToken
2022-08-25 11:31:09 +01:00
m-holger
b45420a980
Remove QPDFTokenizer::unread_char
2022-08-25 11:30:49 +01:00
m-holger
706106dabb
Refactor QPDFTokenizer::betweenTokens()
2022-08-25 11:30:35 +01:00
m-holger
6371b90ae3
Refactor QPDFTokenizer::presentEOF
2022-08-25 11:30:24 +01:00
m-holger
42ed58e446
Integrate booleans and null into state machine in QPDFTokenizer
2022-08-25 11:30:13 +01:00
m-holger
fe33b7ca18
Integrate numbers into state machine in QPDFTokenizer
2022-08-25 11:26:46 +01:00
m-holger
931fbb6156
Integrate names into state machine in QPDFTokenizer
2022-08-25 11:26:38 +01:00
m-holger
a3f3238f37
Split QPDFTokenizer::handleCharacter into individual methods
2022-08-25 11:26:05 +01:00
m-holger
6111a6a424
Refactor QPDFTokenizer::inCharCode
2022-08-25 10:55:45 +01:00
m-holger
e7889ec5dc
Refactor st_top case in QPDFTokenizer::handleCharacter
2022-08-25 10:51:51 +01:00
m-holger
e4fe0d5cf5
Refactor QPDFTokenizer::inHexstring
2022-08-25 10:50:06 +01:00
m-holger
a5d2e88775
Code tidy: replace if with case statement in QPDFTokenizer::inString
2022-08-25 10:43:29 +01:00
m-holger
7c32f6cc2e
Add state st_string_escape in QPDFTokenizer
2022-08-25 10:41:36 +01:00
m-holger
7c5778f999
Add state st_string_after_cr in QPDFTokenizer
2022-08-21 11:13:48 +01:00
m-holger
f29d0a6312
Add state st_char_code in QPDFTokenizer
2022-08-21 11:01:48 +01:00
m-holger
d26b537a7c
Add private method QPDFTokenizer::inString
2022-08-21 02:54:34 +01:00
m-holger
2697ba49bc
Add private method QPDFTokenizer::inHexstring
2022-08-21 02:46:31 +01:00
m-holger
f9530a5815
Code tidy: replace if with case statement in QPDFTokenizer::handleCharacter
2022-08-21 02:38:49 +01:00
m-holger
86ade3f9cd
Add private method QPDFTokenizer::handleCharacter
2022-08-21 02:26:27 +01:00
m-holger
91fb61eda5
Code tidy: replace if with case statement in QPDFTokenizer::presentCharacter
2022-08-21 00:54:41 +01:00
m-holger
cf945eeabf
Avoid shrinking QPDFTokenizer::val and QPDFTokenizer::raw_val
2022-08-20 19:43:00 +01:00
m-holger
45a6100cbb
Inline QUtil functions used by QPDFTokenizer
2022-08-18 15:23:35 +01:00
m-holger
c08bb0ec02
Remove QPDFTokenizer::Members
2022-08-18 13:13:19 +01:00
Jay Berkenbilt
cef6425bca
Disable QTC inside the library by default ( fixes #714 )
...
This results in measurable performance improvements to packaged binary
libqpdf distributions. QTC remains available for library users and is
still selectively enabled in CI.
2022-08-07 16:20:49 -04:00
Jay Berkenbilt
da71dc6f37
QTC: cache get_env results for improved performance
...
It turns out that QUtil::get_env is particularly expensive on Windows
if there is a large environment. This may be true on other platforms
as well.
2022-08-07 14:23:05 -04:00
Jay Berkenbilt
32e30a3af2
Resolve QPDF{Name,Number} tree helper linker issues ( fixes #745 )
...
This is a guess...I'm not sure exactly why there are linker issues or
how to reproduce them.
2022-08-07 09:21:01 -04:00
Jay Berkenbilt
b90adb1c6c
Merge pull request #746 from m-holger/smart
...
Code tidy: remove redundant calls to smart_ptrs get() method
2022-08-07 08:41:50 -04:00
m-holger
7c6901bce5
Code tidy: remove redundant calls to smart_ptrs get() method
2022-08-07 10:33:25 +01:00
Jay Berkenbilt
3ec43f055a
Fix parsing comment
2022-08-06 14:24:08 -04:00
Jay Berkenbilt
a3037ca440
Merge pull request #739 from m-holger/getobject
...
Add QPDF::getObject to replace getObjectByObjGen and getObjectByID
2022-08-06 14:23:56 -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
m-holger
407b0766b8
Inline QPDFObjectHandle::getObjGen etc
...
Also, make QPDFObjectHandle::isIndirect const.
2022-08-01 15:08:48 +01:00
m-holger
903a86643a
Fix code formatting of QPDF::pushInheritedAttributesToPageInternal
2022-08-01 13:54:51 +01:00
m-holger
0356bcecc5
Tidy QPDF::pushInheritedAttributesToPageInternal
...
Remove unnecessary parameters.
Remove code that is unnecessary as result of a prior call to QPDF::getAllPages.
Avoid clearing and rebuilding of m->all_pages.
2022-08-01 13:29:14 +01:00
m-holger
ff69773b35
Fix warnings in QPDF::getAllPagesInternal
2022-08-01 13:29:14 +01:00
m-holger
9dea7d3080
Tune QPDF::getAllPagesInternal
...
Avoid calling getAllPagesInternal for each /Page object.
2022-08-01 13:29:14 +01:00
m-holger
4ccca20db0
Remove redundant parameter from QPDF::getAllPagesInternal
2022-08-01 13:29:14 +01:00
Jay Berkenbilt
5d63730b93
Clean up documentation
2022-07-31 16:26:02 -04:00
Jay Berkenbilt
12d065c751
Provide a simpler QPDF::writeJSON
2022-07-31 16:23:17 -04:00
Jay Berkenbilt
13cf35ce2f
Use calledgetallpages and pushedinheritedpageresources
2022-07-31 16:23:17 -04:00
Jay Berkenbilt
5f4224f31a
Simplify --json-output
...
Now --json-output just changes defaults. Allow output file with --json.
2022-07-31 16:23:17 -04:00
Jay Berkenbilt
80acfc3826
Fix --json-help to take a version parameter
2022-07-31 16:23:17 -04:00
Jay Berkenbilt
69820847af
Change the output of --json to use "qpdf" instead of "objects"
2022-07-31 15:17:01 -04:00
Jay Berkenbilt
d01c4f8819
Change --json-output format
...
from "qpdf-v2" to "qpdf": [..., ...]
2022-07-31 10:32:55 -04:00
Jay Berkenbilt
bb96499b61
Update docs and prepare QPDF::writeJSON for changes
...
Add additional parameters that will be needed to call QPDF::writeJSON
in partial mode.
2022-07-31 10:32:55 -04:00
Jay Berkenbilt
0e3d4cdc97
Fix/clarify meaning of depth parameter to json write methods
2022-07-31 10:32:55 -04: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
4674c04cb8
JSON schema: support multi-element array validation
2022-07-24 16:44:51 -04:00
Jay Berkenbilt
f8d1ab9462
JSON schema -- accept single item in place of array
...
When the schema wants a variable-length array, allow a single item as
well as allowing an array.
2022-07-24 16:17:03 -04: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
8b4afa428e
Revert making second parameter of QPDFObjGen::QPDFObjGen optional
...
Also, change test for QPDFObjGen::isIndirect to obj != 0.
Delete comment from commit afd35f9
.
2022-07-24 16:55:10 +01:00
m-holger
afd35f9a30
Overload StreamDataProvider::provideStreamData
...
Use 'QPDFObjGen const&' instead of 'int, int' in signature.
2022-07-24 16:02:35 +01:00
m-holger
5d0469f1bc
QPDFObjGen : tidy QPDFJob
...
Use QPDFObjGen::unparse where appropriate.
2022-07-24 16:02:35 +01:00
m-holger
4b73d057fb
QPDFObjGen : tidy QPDF_Stream
...
Change method signatures to use QPDFObjGen.
Replace QPDF_Stream::objid and generation with QPDF_Stream::og.
2022-07-24 16:02:35 +01:00
m-holger
f7978db1f6
QPDFObjGen : tidy QPDF private methods
...
Change method signatures to use QPDFObjGen.
Use QPDFObjGen methods where possible.
Remove redundant QPDF::objGenToIndirect.
2022-07-24 16:02:35 +01:00
m-holger
3404ca8ac8
QPDFObjGen : tidy QPDFObjectHandle private methods
...
Change method signature to use QPDFObjGen.
2022-07-24 15:59:49 +01:00
m-holger
b123f79dfd
Replace QPDFObjectHandle::objid and generation with QPDFObjectHandle::og
2022-07-24 15:59:49 +01:00
m-holger
c0168cf88c
QPPFObjGen : tidy QPDF::readObjectAtOffset
...
Change method signature to use QPDFObjGen.
2022-07-24 15:59:49 +01: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
6f1041afb8
Clarify intent in readObjectAtOffset
...
Rather than using object id -1 to mean "don't care", use object ID 0,
and clarify the difference between that use and indication of a direct
object.
2022-07-24 09:40:11 -04:00
m-holger
4c6640cb45
Inline QPDFObjGen methods
...
ABI breaking change
2022-07-16 14:32:48 -04:00
Jay Berkenbilt
a603c1e395
Run format-code
2022-06-27 12:50:35 -04:00
m-holger
f0a8178091
Refactor QPDFObject creation and cloning
...
Move responsibility for creating shared pointers to objects and cloning from QPDFObjectHandle to QPDFObject.
2022-06-27 12:47:02 -04:00
m-holger
5aa8225f49
Refactor QPDFObjectTypeAccessor and QPDFObjectHandle::dereference
2022-06-27 10:39:04 -04:00
Jay Berkenbilt
0c7c7e4ba4
Track whether certain page modifying methods have been called
...
We need to know whether pushInheritedAttributesToPage or getAllPages
have been called when generating JSON output. When reading the JSON
back in, we have to call the same methods so that object numbers will
line up properly.
2022-06-25 13:55:45 -04:00
Jay Berkenbilt
25aff0bd52
TODO: abandon (again) and update notes about QPDFPagesTree
2022-06-25 13:26:53 -04:00
Jay Berkenbilt
8a32515a62
Add warnings for some additional page tree repair
2022-06-25 13:25:35 -04:00
Jay Berkenbilt
6c4537885e
Reformat code
2022-06-25 11:11:24 -04:00
m-holger
7836e19747
Code tidy: remove redundant calls to QPDFObjectHandle::isInitialized
2022-06-25 11:10:06 -04:00
m-holger
3b3bcab349
Remove QPDF_Stream::setStreamDescription
2022-06-25 08:26:46 -04:00
m-holger
9eda1fdc41
Remove redundant QPDF_Array::setDescription and QPDF_Dictionary::setDescription
2022-06-25 08:25:58 -04:00
m-holger
e9c1637353
Add private method QPDFObjectHandle::getObjGenAsStr
...
Also, use methods to access objid and generation.
2022-06-25 08:25:32 -04:00
m-holger
97f737a562
Code tidy: QPDFJob::doJSONPageLabels
...
Remove redundant variables pages and next.
2022-06-25 08:24:50 -04:00
Jay Berkenbilt
1eb2f208ec
Use Pl_Function in qpdflogger C API implementation
2022-06-19 09:12:59 -04:00
Jay Berkenbilt
eae75dbe44
Add Pl_Function -- a generic function pipeline
2022-06-19 09:12:29 -04:00
Jay Berkenbilt
bb0ea2f8e7
Add qpdfjob_register_progress_reporter
2022-06-19 08:46:58 -04:00
Jay Berkenbilt
87412eb05b
Add QPDFJob::registerProgressReporter
2022-06-19 08:46:58 -04:00
Jay Berkenbilt
3a7ee7e938
Move C-based ProgressReporter helper into QPDFWriter
2022-06-19 08:46:58 -04:00
Jay Berkenbilt
8130d50e3b
Add C API to QPDFLogger
2022-06-19 08:46:58 -04:00
Jay Berkenbilt
daef4e8fb8
Add more flexible funtions to qpdfjob C API
2022-06-19 08:46:58 -04:00
Jay Berkenbilt
e0720eaa78
Use the default logger for other writes to stdout/stderr
...
When there is no context for writing output or error messages, use the
default logger.
2022-06-18 10:38:50 -04:00
Jay Berkenbilt
83be2191b4
Use "save" logger when saving data to standard output
...
This includes the output PDF, streams from --show-object and
attachments from --save-attachment. This also enables --verbose and
--progress to work with saving to stdout.
2022-06-18 09:54:40 -04:00
Jay Berkenbilt
641e92c6a7
QPDF, QPDFJob: use QPDFLogger instead of custom output streams
2022-06-18 09:02:55 -04:00
Jay Berkenbilt
f1f711963b
Add and test QPDFLogger class
2022-06-18 09:02:55 -04:00
Jay Berkenbilt
f588d74140
Add integer types to Pipeline::operator<<
2022-06-18 09:02:55 -04:00
m-holger
057bd659bc
Code tidy: remove redundant variable in QPDF::writeJSON
2022-06-05 18:46:21 -04:00
Jay Berkenbilt
0bd908b550
Update documentation for qpdf JSON v2
2022-05-30 20:03:08 -04:00
Jay Berkenbilt
b7bbf12e85
In json mode, reveal recovered user password when otherwise unavailable
2022-05-30 20:03:08 -04:00
Jay Berkenbilt
f049a77c59
Add additional information when listing attachments
2022-05-30 20:03:08 -04:00
Jay Berkenbilt
04fc7c4bea
Add conversions to ISO-8601 date format
2022-05-30 20:03:08 -04:00
Jay Berkenbilt
27a42c16c7
Change default decode level to "none" with --json-output
2022-05-21 17:51:34 -04:00
Jay Berkenbilt
752f43d4e4
Allow empty b: binary JSON strings
2022-05-21 17:36:32 -04:00
Jay Berkenbilt
05460d405c
Format code
2022-05-21 16:11:42 -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
c56a9ca7f6
JSON: Fix large file support
2022-05-21 09:43:45 -04:00
Jay Berkenbilt
47c093c48b
Replace std::regex with validators for better performance
2022-05-21 08:43:21 -04:00
Jay Berkenbilt
9b2eb01e25
Exercise object description in tests
2022-05-20 14:23:32 -04:00
Jay Berkenbilt
6c2fb5b8f0
Add test for bad data and bad datafile
2022-05-20 13:33:30 -04:00
Jay Berkenbilt
d065098089
Test --update-from-json
2022-05-20 11:10:12 -04:00
Jay Berkenbilt
ef955b04b5
Bug fix: don't clobber stream length with replaceDict
2022-05-20 11:09:45 -04:00
Jay Berkenbilt
3eb77a7004
JSON: detect duplicate dictionary keys while parsing
2022-05-20 10:13:15 -04:00
Jay Berkenbilt
6d4e3ba8a4
Test (and fix) handling of dangling references
2022-05-20 09:16:25 -04:00
Jay Berkenbilt
5a2aa59479
Bug fix: isReserved() true for indirect reference to reserved object
2022-05-20 09:16:25 -04:00
Jay Berkenbilt
35b1e1c493
Explicitly test ignoring unknown keys in JSON input
2022-05-20 09:16:25 -04:00
Jay Berkenbilt
dc8df962d8
Make version default to latest for --json-output (like --json)
2022-05-20 09:16:25 -04:00
Jay Berkenbilt
6c7326b290
JSON fix: correctly parse UTF-16 surrogate pairs
2022-05-20 09:16:25 -04:00
Jay Berkenbilt
6f43bf8de3
Major rework -- see long comments
...
* Replace --create-from-json=file with --json-input, which causes the
regular input to be treated as json.
* Eliminate --to-json
* In --json=2, bring back "objects" and eliminate "objectinfo". Stream
data is never present.
* In --json-output=2, write "qpdf-v2" with "objects" and include
stream data.
2022-05-20 09:16:25 -04:00