summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
diff options
context:
space:
mode:
authorOliver Chang <ochang@chromium.org>2016-01-11 08:45:31 -0800
committerOliver Chang <ochang@chromium.org>2016-01-11 08:45:31 -0800
commit3f1c71f5a6ea058e3eec611c9dcc759b374dcb80 (patch)
treeb4ef8de26360979381c441cbdfaba94e493b09f6 /core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
parentc909ce872d999a17ffd44afdc88caf2de43e6cba (diff)
downloadpdfium-3f1c71f5a6ea058e3eec611c9dcc759b374dcb80.tar.xz
Merge to XFA: 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. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1541703003 . (cherry picked from commit 14f39950451bb9c2a11fbc7173fd47367410f80f) Review URL: https://codereview.chromium.org/1576033002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index d0cf9ed719..3fbd3e486e 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -496,10 +496,9 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) {
switch (pObj->GetType()) {
case PDFOBJ_DICTIONARY: {
CPDF_Dictionary* pDict = pObj->AsDictionary();
- FX_POSITION pos = pDict->GetStartPos();
- while (pos) {
- CFX_ByteString key;
- CPDF_Object* value = pDict->GetNextElement(pos, key);
+ for (const auto& it : *pDict) {
+ CFX_ByteString key = it.first;
+ CPDF_Object* value = it.second;
CFX_ByteStringC fullname = PDF_FindFullName(
PDF_InlineKeyAbbr, FX_ArraySize(PDF_InlineKeyAbbr), key);
if (!fullname.IsEmpty()) {
@@ -544,10 +543,9 @@ void PDF_ReplaceFull(CPDF_Object* pObj) {
switch (pObj->GetType()) {
case PDFOBJ_DICTIONARY: {
CPDF_Dictionary* pDict = pObj->AsDictionary();
- FX_POSITION pos = pDict->GetStartPos();
- while (pos) {
- CFX_ByteString key;
- CPDF_Object* value = pDict->GetNextElement(pos, key);
+ for (const auto& it : *pDict) {
+ CFX_ByteString key = it.first;
+ CPDF_Object* value = it.second;
CFX_ByteStringC abbrName = PDF_FindAbbrName(
PDF_InlineKeyAbbr, FX_ArraySize(PDF_InlineKeyAbbr), key);
if (!abbrName.IsEmpty()) {