summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp7
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp14
3 files changed, 12 insertions, 17 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
index c9eee8e380..168cbf3a61 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -1213,11 +1213,9 @@ CPDF_ColorSpace* CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj) {
if (!pDict)
return nullptr;
- CPDF_ColorSpace* pRet = nullptr;
- FX_POSITION pos = pDict->GetStartPos();
- while (pos) {
- CFX_ByteString bsKey;
- CPDF_Object* pValue = pDict->GetNextElement(pos, bsKey);
+ for (const auto& it : *pDict) {
+ CPDF_ColorSpace* pRet = nullptr;
+ CPDF_Object* pValue = it.second;
if (ToName(pValue))
pRet = _CSFromName(pValue->GetString());
if (pRet)
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
index d8f21c692d..dd16aa85ce 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
@@ -458,10 +458,9 @@ void CPDF_AllStates::SetLineDash(CPDF_Array* pArray,
void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
CPDF_StreamContentParser* pParser) {
CPDF_GeneralStateData* pGeneralState = m_GeneralState.GetModify();
- FX_POSITION pos = pGS->GetStartPos();
- while (pos) {
- CFX_ByteString key_str;
- CPDF_Object* pElement = pGS->GetNextElement(pos, key_str);
+ for (const auto& it : *pGS) {
+ const CFX_ByteString& key_str = it.first;
+ CPDF_Object* pElement = it.second;
CPDF_Object* pObject = pElement ? pElement->GetDirect() : nullptr;
if (!pObject)
continue;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index d0cf9ed719..3fbd3e486e 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -496,10 +496,9 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) {
switch (pObj->GetType()) {
case PDFOBJ_DICTIONARY: {
CPDF_Dictionary* pDict = pObj->AsDictionary();
- FX_POSITION pos = pDict->GetStartPos();
- while (pos) {
- CFX_ByteString key;
- CPDF_Object* value = pDict->GetNextElement(pos, key);
+ for (const auto& it : *pDict) {
+ CFX_ByteString key = it.first;
+ CPDF_Object* value = it.second;
CFX_ByteStringC fullname = PDF_FindFullName(
PDF_InlineKeyAbbr, FX_ArraySize(PDF_InlineKeyAbbr), key);
if (!fullname.IsEmpty()) {
@@ -544,10 +543,9 @@ void PDF_ReplaceFull(CPDF_Object* pObj) {
switch (pObj->GetType()) {
case PDFOBJ_DICTIONARY: {
CPDF_Dictionary* pDict = pObj->AsDictionary();
- FX_POSITION pos = pDict->GetStartPos();
- while (pos) {
- CFX_ByteString key;
- CPDF_Object* value = pDict->GetNextElement(pos, key);
+ for (const auto& it : *pDict) {
+ CFX_ByteString key = it.first;
+ CPDF_Object* value = it.second;
CFX_ByteStringC abbrName = PDF_FindAbbrName(
PDF_InlineKeyAbbr, FX_ArraySize(PDF_InlineKeyAbbr), key);
if (!abbrName.IsEmpty()) {