Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: fpdfsdk/src/fpdfppo.cpp

Issue 1541703003: Use std::map as CPDF_Dictionary's underlying store. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: XFA still uses CFX_CMapByteStringToPtr :( Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: fpdfsdk/src/fpdfppo.cpp
diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp
index 2fce7adfc43787649efa9a786e2d5177754f073e..04a6b2b6ced70963c98b9d0ec0c962e02f3f22bb 100644
--- a/fpdfsdk/src/fpdfppo.cpp
+++ b/fpdfsdk/src/fpdfppo.cpp
@@ -100,10 +100,9 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
return FALSE;
// Clone the page dictionary
- FX_POSITION SrcPos = pSrcPageDict->GetStartPos();
- while (SrcPos) {
- CFX_ByteString cbSrcKeyStr;
- CPDF_Object* pObj = pSrcPageDict->GetNextElement(SrcPos, cbSrcKeyStr);
+ for (const auto& it : *pSrcPageDict) {
+ const CFX_ByteString& cbSrcKeyStr = it.first;
+ CPDF_Object* pObj = it.second;
if (cbSrcKeyStr.Compare(("Type")) && cbSrcKeyStr.Compare(("Parent"))) {
if (pCurPageDict->KeyExist(cbSrcKeyStr))
pCurPageDict->RemoveAt(cbSrcKeyStr);
@@ -213,11 +212,9 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
}
case PDFOBJ_DICTIONARY: {
CPDF_Dictionary* pDict = pObj->AsDictionary();
-
- FX_POSITION pos = pDict->GetStartPos();
- while (pos) {
- CFX_ByteString key("");
- CPDF_Object* pNextObj = pDict->GetNextElement(pos, key);
+ for (const auto& it : *pDict) {
+ const CFX_ByteString& key = it.first;
+ CPDF_Object* pNextObj = it.second;
if (!FXSYS_strcmp(key, "Parent") || !FXSYS_strcmp(key, "Prev") ||
!FXSYS_strcmp(key, "First")) {
continue;

Powered by Google App Engine
This is Rietveld 408576698