Commit 099a09c5 authored by Albert Astals Cid's avatar Albert Astals Cid

pdf-fullrewrite: Save copy() calls

parent 1005f8ab
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "utils/parseargs.h" #include "utils/parseargs.h"
static bool compareDocuments(PDFDoc *origDoc, PDFDoc *newDoc); static bool compareDocuments(PDFDoc *origDoc, PDFDoc *newDoc);
static bool compareObjects(Object *objA, Object *objB); static bool compareObjects(const Object *objA, const Object *objB);
static char ownerPassword[33] = "\001"; static char ownerPassword[33] = "\001";
static char userPassword[33] = "\001"; static char userPassword[33] = "\001";
...@@ -125,8 +125,8 @@ static bool compareDictionaries(Dict *dictA, Dict *dictB) ...@@ -125,8 +125,8 @@ static bool compareDictionaries(Dict *dictA, Dict *dictB)
* in dictB is also contained in dictA */ * in dictB is also contained in dictA */
for (int i = 0; i < length; ++i) { for (int i = 0; i < length; ++i) {
const char *key = dictA->getKey(i); const char *key = dictA->getKey(i);
Object valA = dictA->getValNF(i).copy(); const Object &valA = dictA->getValNF(i);
Object valB = dictB->lookupNF(key).copy(); const Object &valB = dictB->lookupNF(key);
if (!compareObjects(&valA, &valB)) if (!compareObjects(&valA, &valB))
return false; return false;
} }
...@@ -134,7 +134,7 @@ static bool compareDictionaries(Dict *dictA, Dict *dictB) ...@@ -134,7 +134,7 @@ static bool compareDictionaries(Dict *dictA, Dict *dictB)
return true; return true;
} }
static bool compareObjects(Object *objA, Object *objB) static bool compareObjects(const Object *objA, const Object *objB)
{ {
switch (objA->getType()) { switch (objA->getType()) {
case objBool: case objBool:
...@@ -197,8 +197,8 @@ static bool compareObjects(Object *objA, Object *objB) ...@@ -197,8 +197,8 @@ static bool compareObjects(Object *objA, Object *objB)
return false; return false;
} else { } else {
for (int i = 0; i < length; ++i) { for (int i = 0; i < length; ++i) {
Object elemA = arrayA->getNF(i).copy(); const Object &elemA = arrayA->getNF(i);
Object elemB = arrayB->getNF(i).copy(); const Object &elemB = arrayB->getNF(i);
if (!compareObjects(&elemA, &elemB)) { if (!compareObjects(&elemA, &elemB)) {
return false; return false;
} }
......
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