Commit 063eda5f authored by Albert Astals Cid's avatar Albert Astals Cid

OptionalContent: Remove some unnecessary copy()

parent 32c7d743
......@@ -194,7 +194,7 @@ bool OCGs::optContentIsVisible( Object *dictRef )
return result;
}
bool OCGs::evalOCVisibilityExpr(Object *expr, int recursion) {
bool OCGs::evalOCVisibilityExpr(const Object *expr, int recursion) {
OptionalContentGroup *ocg;
bool ret;
......@@ -217,7 +217,7 @@ bool OCGs::evalOCVisibilityExpr(Object *expr, int recursion) {
Object op = expr2.arrayGet(0);
if (op.isName("Not")) {
if (expr2.arrayGetLength() == 2) {
Object obj = expr2.arrayGetNF(1).copy();
const Object &obj = expr2.arrayGetNF(1);
ret = !evalOCVisibilityExpr(&obj, recursion + 1);
} else {
error(errSyntaxError, -1,
......@@ -227,13 +227,13 @@ bool OCGs::evalOCVisibilityExpr(Object *expr, int recursion) {
} else if (op.isName("And")) {
ret = true;
for (int i = 1; i < expr2.arrayGetLength() && ret; ++i) {
Object obj = expr2.arrayGetNF(i).copy();
const Object &obj = expr2.arrayGetNF(i);
ret = evalOCVisibilityExpr(&obj, recursion + 1);
}
} else if (op.isName("Or")) {
ret = false;
for (int i = 1; i < expr2.arrayGetLength() && !ret; ++i) {
Object obj = expr2.arrayGetNF(i).copy();
const Object &obj = expr2.arrayGetNF(i);
ret = evalOCVisibilityExpr(&obj, recursion + 1);
}
} else {
......
......@@ -4,7 +4,7 @@
//
// Copyright 2007 Brad Hards <bradh@kde.org>
// Copyright 2008 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright 2013, 2018 Albert Astals Cid <aacid@kde.org>
// Copyright 2013, 2018, 2019 Albert Astals Cid <aacid@kde.org>
// Copyright 2018 Adam Reichold <adam.reichold@t-online.de>
//
// Released under the GPL (version 2, or later, at your option)
......@@ -58,7 +58,7 @@ public:
private:
bool ok;
bool evalOCVisibilityExpr(Object *expr, int recursion);
bool evalOCVisibilityExpr(const Object *expr, int recursion);
bool allOn( Array *ocgArray );
bool allOff( Array *ocgArray );
bool anyOn( Array *ocgArray );
......
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