summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Reichold <adam.reichold@t-online.de>2019-12-06 18:58:49 +0100
committerAdam Reichold <adam.reichold@t-online.de>2019-12-06 19:00:33 +0100
commit8ee4f32cce32c3253c6be66d85d1191c1784bebd (patch)
tree22a428fb1c30d78370c89a75ded1387c28343b88
parent3955fe7fae320f3122f663efa1d66a5296db7e6d (diff)
Align signature of Array::copy with Dict::copy as a preparation for implicit sharing
-rw-r--r--poppler/Array.cc4
-rw-r--r--poppler/Array.h2
-rw-r--r--poppler/Page.cc10
3 files changed, 7 insertions, 9 deletions
diff --git a/poppler/Array.cc b/poppler/Array.cc
index a6cf4bcc..f32dc38a 100644
--- a/poppler/Array.cc
+++ b/poppler/Array.cc
@@ -46,14 +46,14 @@ Array::Array(XRef *xrefA) {
Array::~Array() {
}
-Object Array::copy(XRef *xrefA) const {
+Array *Array::copy(XRef *xrefA) const {
arrayLocker();
Array *a = new Array(xrefA);
a->elems.reserve(elems.size());
for (const auto& elem : elems) {
a->elems.push_back(elem.copy());
}
- return Object(a);
+ return a;
}
void Array::add(Object &&elem) {
diff --git a/poppler/Array.h b/poppler/Array.h
index be1123cf..9232423a 100644
--- a/poppler/Array.h
+++ b/poppler/Array.h
@@ -57,7 +57,7 @@ public:
int getLength() const { return elems.size(); }
// Copy array with new xref
- Object copy(XRef *xrefA) const;
+ Array *copy(XRef *xrefA) const;
// Add an element
// elem becomes a dead object after this call
diff --git a/poppler/Page.cc b/poppler/Page.cc
index 26537eb9..f642018a 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -337,21 +337,19 @@ Dict *Page::getResourceDictCopy(XRef *xrefA) {
}
void Page::replaceXRef(XRef *xrefA) {
- Object obj1;
Dict *pageDict = pageObj.getDict()->copy(xrefA);
xref = xrefA;
trans = pageDict->lookupNF("Trans").copy();
annotsObj = pageDict->lookupNF("Annots").copy();
contents = pageDict->lookupNF("Contents").copy();
if (contents.isArray()) {
- obj1 = pageDict->lookupNF("Contents").copy();
- contents = obj1.getArray()->copy(xrefA);
+ contents = Object(contents.getArray()->copy(xrefA));
}
thumb = pageDict->lookupNF("Thumb").copy();
actions = pageDict->lookupNF("AA").copy();
- obj1 = pageDict->lookup("Resources");
- if (obj1.isDict()) {
- attrs->replaceResource(std::move(obj1));
+ Object resources = pageDict->lookup("Resources");
+ if (resources.isDict()) {
+ attrs->replaceResource(std::move(resources));
}
delete pageDict;
}