summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_utils.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/fpdfdoc/doc_utils.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/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 01a7470ef0..89836739b3 100644
--- a/core/src/fpdfdoc/doc_utils.cpp
+++ b/core/src/fpdfdoc/doc_utils.cpp
@@ -279,11 +279,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;
}
@@ -311,11 +308,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;
}
@@ -371,11 +366,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;
}
@@ -414,11 +407,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;
}
@@ -472,11 +463,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;
}
@@ -512,11 +501,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;
}