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; |
} |