[poppler] poppler/Catalog.cc poppler/Catalog.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 29 23:36:20 UTC 2021


 poppler/Catalog.cc |    4 ++--
 poppler/Catalog.h  |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 9af5896fcf8d3c426cd958c662765411f05c1498
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Oct 30 01:31:33 2021 +0200

    Add const to NameTree::getName

diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index f830c7a9..29e93b5b 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -490,7 +490,7 @@ void Catalog::addEmbeddedFile(GooFile *file, const std::string &fileName)
     NameTree *ef = getEmbeddedFileNameTree();
     bool fileAlreadyAdded = false;
     for (int i = 0; i < ef->numEntries(); ++i) {
-        GooString *efNameI = ef->getName(i);
+        const GooString *efNameI = ef->getName(i);
 
         // we need to add the file if it has not been added yet and the name is smaller or equal lexicographically
         // than the current item
@@ -768,7 +768,7 @@ Object *NameTree::getValue(int index)
     }
 }
 
-GooString *NameTree::getName(int index)
+const GooString *NameTree::getName(int index) const
 {
     if (index < length) {
         return &entries[index]->name;
diff --git a/poppler/Catalog.h b/poppler/Catalog.h
index 7a30ebbf..b44afcca 100644
--- a/poppler/Catalog.h
+++ b/poppler/Catalog.h
@@ -80,7 +80,7 @@ public:
     int numEntries() { return length; };
     // iterator accessor, note it returns a pointer to the internal object, do not free nor delete it
     Object *getValue(int i);
-    GooString *getName(int i);
+    const GooString *getName(int i) const;
 
 private:
     struct Entry
@@ -174,7 +174,7 @@ public:
     int numDestNameTree() { return getDestNameTree()->numEntries(); }
 
     // Get the i'th named destination name in name-tree
-    GooString *getDestNameTreeName(int i) { return getDestNameTree()->getName(i); }
+    const GooString *getDestNameTreeName(int i) { return getDestNameTree()->getName(i); }
 
     // Get the i'th named destination link destination in name-tree
     std::unique_ptr<LinkDest> getDestNameTreeDest(int i);
@@ -195,7 +195,7 @@ public:
 
     // Get the number of javascript scripts
     int numJS() { return getJSNameTree()->numEntries(); }
-    GooString *getJSName(int i) { return getJSNameTree()->getName(i); }
+    const GooString *getJSName(int i) { return getJSNameTree()->getName(i); }
 
     // Get the i'th JavaScript script (at the Document level) in the document
     GooString *getJS(int i);


More information about the poppler mailing list