2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-13 07:32:22 +00:00
Commit Graph

67 Commits

Author SHA1 Message Date
m-holger
41ec7eda54 Use auto when initialializing with new 2023-05-20 15:41:40 +01: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
m-holger
0aae54d383 Refactor QPDF_Array::setFromVector 2023-04-01 13:57:28 +01:00
m-holger
5072238867 Refactor QPDF_Array::getAsVector 2023-04-01 13:57:22 +01:00
m-holger
e186da1721 Remove SparseOHArray::at, setAt and append 2023-04-01 13:57:15 +01:00
m-holger
1c85e7ece4 Remove SparseOHArray::erase 2023-04-01 13:56:54 +01:00
m-holger
6295da436f Remove SparseOHArray::insert 2023-04-01 13:56:47 +01:00
m-holger
182c2480df Refactor QPDF_Array::setItem and rename to setAt 2023-04-01 13:56:29 +01:00
m-holger
4d37389bef Refactor QPDF_Array::eraseItem and rename to erase 2023-04-01 13:56:16 +01:00
m-holger
1bb23d0545 Refactor QPDF_Array::insertItem and rename to insert 2023-04-01 13:56:10 +01:00
m-holger
cedb37caa1 Refactor QPDF_Array::appendItem and rename to push_back 2023-04-01 13:55:14 +01:00
m-holger
c6179da961 Add new method QPDFValue::checkOwnership 2023-04-01 13:54:44 +01:00
m-holger
a1a8f35b63 Refactor QPDF_Array::getItem and rename to at 2023-04-01 13:54:17 +01:00
m-holger
51d350c98c Inline QPDF_Array::getNItems and rename to size 2023-04-01 12:25:15 +01:00
m-holger
e6db8ddeba Change SparseOHArray index type to int and elements type to map
There are no reasons other than historical to use size_t.
On balance, using map is more efficient. Hold shared pointers to
QPDFObjects rather than QPDFObjectHandles for consistencey with
QPDF_Array.
2023-04-01 12:25:06 +01:00
m-holger
ea5164938e Remove temporary OHArray 2023-04-01 12:24:52 +01:00
m-holger
9e30de8032 Remove temporary OHArray::erase, insert and copy 2023-03-29 13:15:39 +01:00
m-holger
0db65e7912 Remove temporary OHArray::disconnect and setAt 2023-03-29 13:06:26 +01:00
m-holger
1367226002 Remove temporary OHArray::at 2023-03-29 13:00:28 +01:00
m-holger
ad2875a4aa Remove temporary OHArray::size, append and remove_last
Also, add const overload of QPDFObjectHandle::getObj
2023-03-29 12:34:07 +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
18c1ffe0df Change underlying data structure of QPDF_Array in non-sparse mode to std::vector 2023-03-29 12:01:24 +01:00
m-holger
38cf7c1628 Add separate sparse mode to QPDF_Array
Add temporary clone of SparseOHArray  to implement non-sparse mode.
2023-03-29 11:48:21 +01:00
m-holger
de29fd56c4 Remove redundant QPDF_Array::addExplicitElementsToList 2023-03-29 10:47:37 +01: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
b1eb1a9584 Refactor QPDFObjectHandle::copyObject1 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
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
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
264e25f391 Clear owning QPDF information for all objects, not just indirect 2022-09-08 10:19:38 -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
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
m-holger
c7005e8a6d Remove virtual methods QPDFValue::getTypeCode and getTypeName 2022-09-01 14:29:02 +01:00
m-holger
431bd666c0 Split QPDFObject into QPDFObject and QPDFValue 2022-09-01 14:19:34 +01: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
9eda1fdc41 Remove redundant QPDF_Array::setDescription and QPDF_Dictionary::setDescription 2022-06-25 08:25:58 -04:00
Jay Berkenbilt
16f4f94cd9 Prepare code for JSON v2
Update getJSON() methods and calls to them
2022-05-07 11:12:01 -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
cdd0b4fb7d Use = default and = delete where possible in classes 2022-04-16 11:39:14 -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
cb769c62e5 WHITESPACE ONLY -- expand tabs in source code
This comment expands all tabs using an 8-character tab-width. You
should ignore this commit when using git blame or use git blame -w.

In the early days, I used to use tabs where possible for indentation,
since emacs did this automatically. In recent years, I have switched
to only using spaces, which means qpdf source code has been a mixture
of spaces and tabs. I have avoided cleaning this up because of not
wanting gratuitous whitespaces change to cloud the output of git
blame, but I changed my mind after discussing with users who view qpdf
source code in editors/IDEs that have other tab widths by default and
in light of the fact that I am planning to start applying automatic
code formatting soon.
2022-02-08 11:51:15 -05:00
Jay Berkenbilt
2229e37e88 Add a blank line after the first header included in each source 2022-02-04 16:31:31 -05:00
Jay Berkenbilt
1a7d3700a6 Fix unnecessary copies in auto iter (fixes #426)
Also switch to colon-style iteration in some cases. Thanks to Dean
Scarff for drawing this to my attention after detecting some
unnecessary copies with
https://clang.llvm.org/extra/clang-tidy/checks/performance-for-range-copy.html
2020-04-08 20:45:26 -04:00
Jay Berkenbilt
ee271fd2f2 Use auto for iterating over sparse array 2020-04-03 12:16:24 -04:00