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

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

Issue 1576033002: Merge to XFA: Use std::map as CPDF_Dictionary's underlying store. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: 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 d0cf9ed719fe36561f7391903fd8a67371cb7fa2..3fbd3e486e208661f7a6777eff6d485cb540b560 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()) {
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698