Link: Remove unneeded copy() calls
diff --git a/poppler/Link.cc b/poppler/Link.cc
index 428e8b6..4ee8b78 100644
--- a/poppler/Link.cc
+++ b/poppler/Link.cc
@@ -637,12 +637,12 @@
annotRef.num = -1;
annotTitle = nullptr;
- Object tmp = obj->dictLookupNF("Annotation").copy();
- if (tmp.isRef()) {
- annotRef = tmp.getRef();
+ const Object &annotationObj = obj->dictLookupNF("Annotation");
+ if (annotationObj.isRef()) {
+ annotRef = annotationObj.getRef();
}
- tmp = obj->dictLookup("T");
+ Object tmp = obj->dictLookup("T");
if (tmp.isString()) {
annotTitle = tmp.getString()->copy();
}
@@ -729,6 +729,8 @@
js = nullptr;
int operationCode = -1;
+ screenRef.num = -1;
+
if (obj->isDict()) {
Object tmp = obj->dictLookup("JS");
if (!tmp.isNull()) {
@@ -758,10 +760,11 @@
renditionObj.setToNull();
}
- screenRef = obj->dictLookupNF("AN").copy();
- if (!screenRef.isRef() && operation >= 0 && operation <= 4) {
+ const Object &anObj = obj->dictLookupNF("AN");
+ if (anObj.isRef()) {
+ screenRef = anObj.getRef();
+ } else if (operation >= 0 && operation <= 4) {
error(errSyntaxWarning, -1, "Invalid Rendition Action: no AN field with op = {0:d}", operationCode);
- screenRef.setToNull();
}
}
diff --git a/poppler/Link.h b/poppler/Link.h
index d0e3cc3..5fea9a6 100644
--- a/poppler/Link.h
+++ b/poppler/Link.h
@@ -17,7 +17,7 @@
// Copyright (C) 2008 Hugo Mercier <hmercier31@gmail.com>
// Copyright (C) 2010, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2012 Tobias Koening <tobias.koenig@kdab.com>
-// Copyright (C) 2018 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2018, 2019 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich
// Copyright (C) 2018 Intevation GmbH <intevation@intevation.de>
//
@@ -360,8 +360,8 @@
bool hasRenditionObject() const { return renditionObj.isDict(); }
const Object* getRenditionObject() const { return &renditionObj; }
- bool hasScreenAnnot() const { return screenRef.isRef(); }
- Ref getScreenAnnot() const { return screenRef.getRef(); }
+ bool hasScreenAnnot() const { return screenRef.num != -1; }
+ Ref getScreenAnnot() const { return screenRef; }
RenditionOperation getOperation() const { return operation; }
@@ -371,7 +371,7 @@
private:
- Object screenRef;
+ Ref screenRef;
Object renditionObj;
RenditionOperation operation;