summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_utils.cpp
diff options
context:
space:
mode:
authorOliver Chang <ochang@chromium.org>2016-01-11 08:30:17 -0800
committerOliver Chang <ochang@chromium.org>2016-01-11 08:30:17 -0800
commit14f39950451bb9c2a11fbc7173fd47367410f80f (patch)
treecec41364915b38e6a7709c76fc2fb02f6994990a /core/src/fpdfdoc/doc_utils.cpp
parent9adfbb0920a258e916003b1ee9515e97879db82a (diff)
downloadpdfium-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 'core/src/fpdfdoc/doc_utils.cpp')
-rw-r--r--core/src/fpdfdoc/doc_utils.cpp47
1 files changed, 17 insertions, 30 deletions
diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp
index 0f54198c6f..4856cb51e5 100644
--- a/core/src/fpdfdoc/doc_utils.cpp
+++ b/core/src/fpdfdoc/doc_utils.cpp
@@ -281,11 +281,8 @@ FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict) {
return 0;
}
FX_DWORD dwCount = 0;
- FX_POSITION pos = pFonts->GetStartPos();
- while (pos) {
- CPDF_Object* pObj = NULL;
- CFX_ByteString csKey;
- pObj = pFonts->GetNextElement(pos, csKey);
+ for (const auto& it : *pFonts) {
+ CPDF_Object* pObj = it.second;
if (!pObj) {
continue;
}
@@ -313,11 +310,9 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict,
return NULL;
}
FX_DWORD dwCount = 0;
- FX_POSITION pos = pFonts->GetStartPos();
- while (pos) {
- CPDF_Object* pObj = NULL;
- CFX_ByteString csKey;
- pObj = pFonts->GetNextElement(pos, csKey);
+ for (const auto& it : *pFonts) {
+ const CFX_ByteString& csKey = it.first;
+ CPDF_Object* pObj = it.second;
if (!pObj) {
continue;
}
@@ -373,11 +368,9 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict,
if (!pFonts) {
return NULL;
}
- FX_POSITION pos = pFonts->GetStartPos();
- while (pos) {
- CPDF_Object* pObj = NULL;
- CFX_ByteString csKey;
- pObj = pFonts->GetNextElement(pos, csKey);
+ for (const auto& it : *pFonts) {
+ const CFX_ByteString& csKey = it.first;
+ CPDF_Object* pObj = it.second;
if (!pObj) {
continue;
}
@@ -416,11 +409,9 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict,
if (!pFonts) {
return NULL;
}
- FX_POSITION pos = pFonts->GetStartPos();
- while (pos) {
- CPDF_Object* pObj = NULL;
- CFX_ByteString csKey;
- pObj = pFonts->GetNextElement(pos, csKey);
+ for (const auto& it : *pFonts) {
+ const CFX_ByteString& csKey = it.first;
+ CPDF_Object* pObj = it.second;
if (!pObj) {
continue;
}
@@ -474,11 +465,9 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict,
if (!pFonts) {
return FALSE;
}
- FX_POSITION pos = pFonts->GetStartPos();
- while (pos) {
- CPDF_Object* pObj = NULL;
- CFX_ByteString csKey;
- pObj = pFonts->GetNextElement(pos, csKey);
+ for (const auto& it : *pFonts) {
+ const CFX_ByteString& csKey = it.first;
+ CPDF_Object* pObj = it.second;
if (!pObj) {
continue;
}
@@ -514,11 +503,9 @@ FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict,
if (csFontName.GetLength() > 0) {
csFontName.Remove(' ');
}
- FX_POSITION pos = pFonts->GetStartPos();
- while (pos) {
- CPDF_Object* pObj = NULL;
- CFX_ByteString csKey, csTmp;
- pObj = pFonts->GetNextElement(pos, csKey);
+ for (const auto& it : *pFonts) {
+ const CFX_ByteString& csKey = it.first;
+ CPDF_Object* pObj = it.second;
if (!pObj) {
continue;
}