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

Unified Diff: core/src/fpdfdoc/doc_utils.cpp

Issue 1541703003: Use std::map as CPDF_Dictionary's underlying store. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments, rebase, fix embedder test Created 4 years, 11 months 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
« no previous file with comments | « core/src/fpdfdoc/doc_formcontrol.cpp ('k') | fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfdoc/doc_utils.cpp
diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp
index 01a7470ef0cbcc5bdeabc6fc5337af348458c1c6..89836739b34bb211da9371869bcfe76859d5e128 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;
}
« no previous file with comments | « core/src/fpdfdoc/doc_formcontrol.cpp ('k') | fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698