Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
index 1b341f8692388d0bd764a6c5bf2c68759e6c5e6d..f5ce44548aa962b5822c590698f27ad848f0d6a7 100644 |
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp |
@@ -839,11 +839,9 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() { |
(FX_DWORD)m_CrossRef.GetSize() > |
pRef->GetRefObjNum() && |
m_CrossRef.GetAt(pRef->GetRefObjNum()) != 0)) { |
- FX_POSITION pos = pTrailer->GetStartPos(); |
- while (pos) { |
- CFX_ByteString key; |
- CPDF_Object* pElement = |
- pTrailer->GetNextElement(pos, key); |
+ for (const auto& it : *pTrailer) { |
+ const CFX_ByteString& key = it.first; |
+ CPDF_Object* pElement = it.second; |
FX_DWORD dwObjNum = |
pElement ? pElement->GetObjNum() : 0; |
if (dwObjNum) { |
@@ -2119,13 +2117,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, |
continue; |
CFX_ByteStringC keyNoSlash(key.c_str() + 1, key.GetLength() - 1); |
- // TODO(thestig): Remove this conditional once CPDF_Dictionary has a |
- // better underlying map implementation. |
- if (nKeys < 32) { |
- pDict->SetAt(keyNoSlash, pObj); |
- } else { |
- pDict->AddValue(keyNoSlash, pObj); |
- } |
+ pDict->SetAt(keyNoSlash, pObj); |
} |
if (IsSignatureDict(pDict.get())) { |
@@ -2272,8 +2264,8 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( |
return nullptr; |
} |
if (key.GetLength() > 1) { |
- pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), |
- obj.release()); |
+ pDict->SetAt(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), |
+ obj.release()); |
} |
} |
if (pContext) { |
@@ -3024,11 +3016,9 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail( |
if (pDict && pDict->GetString("Type") == "Page" && !bParsePage) { |
continue; |
} |
- FX_POSITION pos = pDict->GetStartPos(); |
- while (pos) { |
- CPDF_Object* value; |
- CFX_ByteString key; |
- value = pDict->GetNextElement(pos, key); |
+ for (const auto& it : *pDict) { |
+ const CFX_ByteString& key = it.first; |
+ CPDF_Object* value = it.second; |
if (key != "Parent") { |
new_obj_array.Add(value); |
} |