[poppler] poppler/Array.cc poppler/Array.h poppler/Page.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Dec 8 22:19:57 UTC 2019


 poppler/Array.cc |    4 ++--
 poppler/Array.h  |    2 +-
 poppler/Page.cc  |   10 ++++------
 3 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 8ee4f32cce32c3253c6be66d85d1191c1784bebd
Author: Adam Reichold <adam.reichold at t-online.de>
Date:   Fri Dec 6 18:58:49 2019 +0100

    Align signature of Array::copy with Dict::copy as a preparation for implicit sharing

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;
 }


More information about the poppler mailing list