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

Unified Diff: core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp

Issue 1541703003: Use std::map as CPDF_Dictionary's underlying store. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase + address comments 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
Index: core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 264b6fb36f2e6fd386ab77a266b3c1139f21f03e..6b870e1ae2bb7c97859f297afdd7283b18abf795 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -488,10 +488,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, sizeof _PDF_InlineKeyAbbr / sizeof(_FX_BSTR),
key);
@@ -552,10 +551,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, sizeof(_PDF_InlineKeyAbbr) / sizeof(_FX_BSTR),
key);

Powered by Google App Engine
This is Rietveld 408576698