Remove Object::dictGetKey
diff --git a/poppler/Annot.cc b/poppler/Annot.cc index 20a1445..6f8b604 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc
@@ -990,7 +990,7 @@ { const Object &obj1 = appearDict.dictLookupNF("N"); if (obj1.isDict()) { - return std::make_unique<GooString>(obj1.dictGetKey(i)); + return std::make_unique<GooString>(obj1.getDict()->getKey(i)); } return nullptr; }
diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc index cf857b4..2f002eb 100644 --- a/poppler/Catalog.cc +++ b/poppler/Catalog.cc
@@ -470,7 +470,7 @@ if (!obj->isDict()) { return nullptr; } - return obj->dictGetKey(i); + return obj->getDict()->getKey(i); } std::unique_ptr<LinkDest> Catalog::getDestsDest(int i)
diff --git a/poppler/Dict.h b/poppler/Dict.h index 504c2a6..5bd13b9 100644 --- a/poppler/Dict.h +++ b/poppler/Dict.h
@@ -167,12 +167,6 @@ return std::get<std::shared_ptr<Dict>>(data)->lookupNF(key); } -inline const char *Object::dictGetKey(int i) const -{ - OBJECT_TYPE_CHECK(objDict); - return std::get<std::shared_ptr<Dict>>(data)->getKey(i); -} - inline Object Object::dictGetVal(int i) const { OBJECT_TYPE_CHECK(objDict);
diff --git a/poppler/Form.cc b/poppler/Form.cc index 805a137..062b3fe 100644 --- a/poppler/Form.cc +++ b/poppler/Form.cc
@@ -236,8 +236,9 @@ if (obj1.isDict()) { Object obj2 = obj1.dictLookup("N"); if (obj2.isDict()) { - for (int i = 0; i < obj2.dictGetLength(); i++) { - const char *key = obj2.dictGetKey(i); + Dict *dictN = obj2.getDict(); + for (int i = 0; i < dictN->getLength(); i++) { + const char *key = dictN->getKey(i); if (strcmp(key, "Off") != 0) { onStr = std::make_unique<GooString>(key); break;
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc index cb8b39b..a28f4b0 100644 --- a/poppler/GfxFont.cc +++ b/poppler/GfxFont.cc
@@ -2395,17 +2395,19 @@ hashFontObject1(&obj2, h); } break; - case objDict: + case objDict: { + Dict *dict = obj->getDict(); h->hash('d'); - n = obj->dictGetLength(); + n = dict->getLength(); h->hash(reinterpret_cast<char *>(&n), sizeof(int)); for (i = 0; i < n; ++i) { - p = obj->dictGetKey(i); + p = dict->getKey(i); h->hash(p, static_cast<int>(strlen(p))); const Object &obj2 = obj->dictGetValNF(i); hashFontObject1(&obj2, h); } break; + } case objStream: // this should never happen - streams must be indirect refs break;
diff --git a/poppler/Object.cc b/poppler/Object.cc index 53a08dc..fba76d7 100644 --- a/poppler/Object.cc +++ b/poppler/Object.cc
@@ -117,15 +117,17 @@ } fprintf(f, "]"); break; - case objDict: + case objDict: { + Dict *dict = getDict(); fprintf(f, "<<"); - for (int i = 0; i < dictGetLength(); ++i) { - fprintf(f, " /%s ", dictGetKey(i)); - const Object &obj = dictGetValNF(i); + for (int i = 0; i < dict->getLength(); ++i) { + fprintf(f, " /%s ", dict->getKey(i)); + const Object &obj = dict->getValNF(i); obj.print(f); } fprintf(f, " >>"); break; + } case objStream: fprintf(f, "<stream>"); break;
diff --git a/poppler/Object.h b/poppler/Object.h index b575aa8..ec06a02 100644 --- a/poppler/Object.h +++ b/poppler/Object.h
@@ -500,7 +500,6 @@ // Dict accessors. int dictGetLength() const; - const char *dictGetKey(int i) const; void dictAdd(std::string_view key, Object &&val); void dictSet(std::string_view key, Object &&val); void dictRemove(std::string_view key);