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) { ...@@ -637,12 +637,12 @@ LinkMovie::LinkMovie(const Object *obj) {
annotRef.num = -1; annotRef.num = -1;
annotTitle = nullptr; annotTitle = nullptr;
Object tmp = obj->dictLookupNF("Annotation").copy(); const Object &annotationObj = obj->dictLookupNF("Annotation");
if (tmp.isRef()) { if (annotationObj.isRef()) {
annotRef = tmp.getRef(); annotRef = annotationObj.getRef();
} }
tmp = obj->dictLookup("T"); Object tmp = obj->dictLookup("T");
if (tmp.isString()) { if (tmp.isString()) {
annotTitle = tmp.getString()->copy(); annotTitle = tmp.getString()->copy();
} }
...@@ -729,6 +729,8 @@ LinkRendition::LinkRendition(const Object *obj) { ...@@ -729,6 +729,8 @@ LinkRendition::LinkRendition(const Object *obj) {
js = nullptr; js = nullptr;
int operationCode = -1; int operationCode = -1;
screenRef.num = -1;
if (obj->isDict()) { if (obj->isDict()) {
Object tmp = obj->dictLookup("JS"); Object tmp = obj->dictLookup("JS");
if (!tmp.isNull()) { if (!tmp.isNull()) {
...@@ -758,10 +760,11 @@ LinkRendition::LinkRendition(const Object *obj) { ...@@ -758,10 +760,11 @@ LinkRendition::LinkRendition(const Object *obj) {
renditionObj.setToNull(); renditionObj.setToNull();
} }
screenRef = obj->dictLookupNF("AN").copy(); const Object &anObj = obj->dictLookupNF("AN");
if (!screenRef.isRef() && operation >= 0 && operation <= 4) { 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); error(errSyntaxWarning, -1, "Invalid Rendition Action: no AN field with op = {0:d}", operationCode);
screenRef.setToNull();
} }
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
// Copyright (C) 2008 Hugo Mercier <hmercier31@gmail.com> // Copyright (C) 2008 Hugo Mercier <hmercier31@gmail.com>
// Copyright (C) 2010, 2011 Carlos Garcia Campos <carlosgc@gnome.org> // Copyright (C) 2010, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2012 Tobias Koening <tobias.koenig@kdab.com> // 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 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> // Copyright (C) 2018 Intevation GmbH <intevation@intevation.de>
// //
...@@ -360,8 +360,8 @@ public: ...@@ -360,8 +360,8 @@ public:
bool hasRenditionObject() const { return renditionObj.isDict(); } bool hasRenditionObject() const { return renditionObj.isDict(); }
const Object* getRenditionObject() const { return &renditionObj; } const Object* getRenditionObject() const { return &renditionObj; }
bool hasScreenAnnot() const { return screenRef.isRef(); } bool hasScreenAnnot() const { return screenRef.num != -1; }
Ref getScreenAnnot() const { return screenRef.getRef(); } Ref getScreenAnnot() const { return screenRef; }
RenditionOperation getOperation() const { return operation; } RenditionOperation getOperation() const { return operation; }
...@@ -371,7 +371,7 @@ public: ...@@ -371,7 +371,7 @@ public:
private: private:
Object screenRef; Ref screenRef;
Object renditionObj; Object renditionObj;
RenditionOperation operation; 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