2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-31 17:30:54 +00:00
Commit Graph

869 Commits

Author SHA1 Message Date
Jay Berkenbilt
1308c45090 Implement --remove-restrictions (fixes #833) 2023-01-28 13:42:19 -05:00
Jay Berkenbilt
e4e0f40fc0 Fix annotations properly for page with no /Resources (fixes #827) 2023-01-09 07:31:39 -05:00
Jay Berkenbilt
bf477fbb96 Do double indirect test correctly 2023-01-01 07:33:34 -05:00
Jay Berkenbilt
ce8e63cb9a Add test case for broken indirect object reference
...where the first "number" is an indirect object that happens to be a
number.
2022-12-31 15:12:58 -05:00
m-holger
0ca44ef84c Fix QPDFObjectHandle::isScalar
Exclude uninitialized, destroyed and reserved objects.
2022-12-31 09:27:19 -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
19a8d3fea2 Add test case of dangling ref not found until xref reconstruction 2022-11-25 15:16:16 -05:00
Jay Berkenbilt
32251497c1 Temporary (revert after fix): mark test as expected failure 2022-11-25 15:16:16 -05:00
Jay Berkenbilt
bd337b8055 Preserve unreferenced objects in dangling test 2022-11-25 15:16:16 -05:00
Jay Berkenbilt
f6367bbada Dangling ref test: show new object ID 2022-11-25 15:16:16 -05:00
Jay Berkenbilt
5489f1d8d6 Code formatting updates 2022-11-25 15:16:16 -05:00
m-holger
b1eb1a9584 Refactor QPDFObjectHandle::copyObject1 2022-11-20 12:07:22 -05:00
Jay Berkenbilt
e9980efec8 Correctly handle reuse of xref stream (fixes #809) 2022-11-19 17:03:17 -05:00
m-holger
f69ed209d0 Use QPDF::newStream in examples 2022-11-19 14:10:42 -05:00
Jay Berkenbilt
db6598b449 Attempt to test for QPDFNameTreeObjectHelper's vtable
It has disappeared from the DLL on Windows a few times.
2022-10-06 08:40:08 -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
Jay Berkenbilt
77111086eb Add code to CI to verify signed/unsigned char
Make sure that our attempt to test both signed and unsigned char is
actually right.
2022-09-23 17:44:16 -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
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
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
Andreas Stieger
7049588bff Fix tests with GNU grep 3.8
GNU grep 3.8 started to emit warnings when invoking egrep.
Convert all calls to grep -E.
2022-09-09 06:57:38 -04:00
Jay Berkenbilt
f1a2d3160a Add JSON v2 support to C API 2022-09-09 06:19:09 -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
a615985865 Update QPDFObject with comment
Also, since it's just there for compatibility, we don't need to add
new object types to it.
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
bac559559e Fix typo 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
55cc2ab680 Re-introduce QPDFObject.hh as deprecated
* Just removing a header file would cause build errors with no hint as
  to what happened. This way, people get a warning rather than error
  for the life of qpdf 11, and the warning tells them what to do.

* This avoids build surprises resulting from having two versions of
  QPDF headers installed at once. If you were building code out of a
  checkout of qpdf but had an older version installed on your system,
  if your code included <qpdf/QPDFObject.hh>, everything would work,
  but then your code would break without QPDFObject.hh later.
2022-09-05 18:52:59 -04:00
Jay Berkenbilt
a5ae042e2b Add workaround for bug in ghostscript 9.56 (fixes #732) 2022-09-02 11:51:38 -04: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
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
4f4b908605 Add a file with arrays with lots of nulls to the test suite
A bug was fixed between qpdf 8.4.2 and 9.0.0 regarding this type of
file (see #305 and #311), but it was necessary to retest after some
major refactoring work at the lexical and parsing layers. This lays
the groundwork for including this in performance benchmarks and in the
qpdf test suite rather than having to keep a large,
non-redistributable file around.

20 arrays of 20K nulls is plenty for performance memory testing and
doesn't take too long to run. Compared to qpdf 8.4.2, in qpdf 11.0.0,
the file generated here uses 3% of the RAM and runs over 4 times
faster.
2022-09-01 16:15:54 -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
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
6670c685ab Move QPDFObjectHandle::parseInternal to new class QPDFParser
Part of #729
2022-08-30 05:56:23 +01:00
m-holger
931fbb6156 Integrate names into state machine in QPDFTokenizer 2022-08-25 11:26:38 +01:00
m-holger
e4fe0d5cf5 Refactor QPDFTokenizer::inHexstring 2022-08-25 10:50:06 +01:00
m-holger
ff69773b35 Fix warnings in QPDF::getAllPagesInternal 2022-08-01 13:29:14 +01:00