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

Unified Diff: core/src/fpdfdoc/doc_formcontrol.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_action.cpp ('k') | core/src/fpdfdoc/doc_utils.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfdoc/doc_formcontrol.cpp
diff --git a/core/src/fpdfdoc/doc_formcontrol.cpp b/core/src/fpdfdoc/doc_formcontrol.cpp
index 93e837feafb7af497997a6c14f89c69cbdb49f67..bd339e375c3d72cca18ecaa605fb66ee96122e6f 100644
--- a/core/src/fpdfdoc/doc_formcontrol.cpp
+++ b/core/src/fpdfdoc/doc_formcontrol.cpp
@@ -27,11 +27,9 @@ CFX_ByteString CPDF_FormControl::GetOnStateName() {
if (!pN) {
return csOn;
}
- FX_POSITION pos = pN->GetStartPos();
- while (pos) {
- pN->GetNextElement(pos, csOn);
- if (csOn != "Off") {
- return csOn;
+ for (const auto& it : *pN) {
+ if (it.first != "Off") {
+ return it.first;
}
}
return CFX_ByteString();
@@ -54,10 +52,8 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) {
if (!pAP) {
return;
}
- FX_POSITION pos1 = pAP->GetStartPos();
- while (pos1) {
- CFX_ByteString csKey1;
- CPDF_Object* pObj1 = pAP->GetNextElement(pos1, csKey1);
+ for (const auto& it : *pAP) {
+ CPDF_Object* pObj1 = it.second;
if (!pObj1) {
continue;
}
@@ -66,10 +62,9 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) {
if (!pSubDict)
continue;
- FX_POSITION pos2 = pSubDict->GetStartPos();
- while (pos2) {
- CFX_ByteString csKey2;
- CPDF_Object* pObj2 = pSubDict->GetNextElement(pos2, csKey2);
+ for (const auto& subdict_it : *pSubDict) {
+ const CFX_ByteString& csKey2 = subdict_it.first;
+ CPDF_Object* pObj2 = subdict_it.second;
if (!pObj2) {
continue;
}
« no previous file with comments | « core/src/fpdfdoc/doc_action.cpp ('k') | core/src/fpdfdoc/doc_utils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698