diff options
author | Oliver Chang <ochang@chromium.org> | 2016-01-11 08:30:17 -0800 |
---|---|---|
committer | Oliver Chang <ochang@chromium.org> | 2016-01-11 08:30:17 -0800 |
commit | 14f39950451bb9c2a11fbc7173fd47367410f80f (patch) | |
tree | cec41364915b38e6a7709c76fc2fb02f6994990a /fpdfsdk/src/fpdfppo.cpp | |
parent | 9adfbb0920a258e916003b1ee9515e97879db82a (diff) | |
download | pdfium-14f39950451bb9c2a11fbc7173fd47367410f80f.tar.xz |
Use std::map as CPDF_Dictionary's underlying store.
Replaces CFX_CMapByteStringToPtr. XFA still uses CFX_CMapByteStringToPtr
so it's not completely removed just yet.
Adds begin()/end() to CPDF_Dictionary and removes the
GetStartPos()/GetNextElement() functions to traverse the dictionary.
Callers are changed accordingly. AddValue() is also removed.
R=tsepez@chromium.org, thestig@chromium.org
Review URL: https://codereview.chromium.org/1541703003 .
Diffstat (limited to 'fpdfsdk/src/fpdfppo.cpp')
-rw-r--r-- | fpdfsdk/src/fpdfppo.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp index 50ef262560..dac548131e 100644 --- a/fpdfsdk/src/fpdfppo.cpp +++ b/fpdfsdk/src/fpdfppo.cpp @@ -101,10 +101,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); @@ -214,11 +213,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; |