Commit ff77c618 authored by Albert Astals Cid's avatar Albert Astals Cid

Link: Remove unneeded copy() calls

parent d57ceff1
......@@ -637,12 +637,12 @@ LinkMovie::LinkMovie(const Object *obj) {
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 @@ LinkRendition::LinkRendition(const Object *obj) {
js = nullptr;
int operationCode = -1;
screenRef.num = -1;
if (obj->isDict()) {
Object tmp = obj->dictLookup("JS");
if (!tmp.isNull()) {
......@@ -758,10 +760,11 @@ LinkRendition::LinkRendition(const Object *obj) {
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();
}
}
......
......@@ -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 @@ public:
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 @@ public:
private:
Object screenRef;
Ref screenRef;
Object renditionObj;
RenditionOperation operation;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment