Index: core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp |
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp |
index 2dc985413b1cbab90a11ff9857d29f85f34766c0..8173461fd86a65d9c026aad8af58845a9bd36d23 100644 |
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp |
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp |
@@ -108,10 +108,9 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, |
} |
offset += 2; |
const CPDF_Dictionary* p = pObj->AsDictionary(); |
- FX_POSITION pos = p->GetStartPos(); |
- while (pos) { |
- CFX_ByteString key; |
- CPDF_Object* pValue = p->GetNextElement(pos, key); |
+ for (const auto& it : *p) { |
+ const CFX_ByteString& key = it.first; |
+ CPDF_Object* pValue = it.second; |
if (pFile->AppendString("/") < 0) { |
return -1; |
} |
@@ -179,10 +178,9 @@ int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument, |
CPDF_Parser* pParser = (CPDF_Parser*)pDocument->GetParser(); |
if (pParser) { |
CPDF_Dictionary* p = pParser->GetTrailer(); |
- FX_POSITION pos = p->GetStartPos(); |
- while (pos) { |
- CFX_ByteString key; |
- CPDF_Object* pValue = p->GetNextElement(pos, key); |
+ for (const auto& it : *p) { |
+ const CFX_ByteString& key = it.first; |
+ CPDF_Object* pValue = it.second; |
if (key == "Encrypt" || key == "Size" || key == "Filter" || |
key == "Index" || key == "Length" || key == "Prev" || key == "W" || |
key == "XRefStm" || key == "Type" || key == "ID") { |
@@ -1208,11 +1206,10 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum, |
m_Offset += 2; |
const CPDF_Dictionary* p = pObj->AsDictionary(); |
bool bSignDict = IsSignatureDict(p); |
- FX_POSITION pos = p->GetStartPos(); |
- while (pos) { |
+ for (const auto& it : *p) { |
FX_BOOL bSignValue = FALSE; |
- CFX_ByteString key; |
- CPDF_Object* pValue = p->GetNextElement(pos, key); |
+ const CFX_ByteString& key = it.first; |
+ CPDF_Object* pValue = it.second; |
if (m_File.AppendString("/") < 0) { |
return -1; |
} |
@@ -1777,10 +1774,9 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) { |
} |
if (m_pParser) { |
CPDF_Dictionary* p = m_pParser->m_pTrailer; |
- FX_POSITION pos = p->GetStartPos(); |
- while (pos) { |
- CFX_ByteString key; |
- CPDF_Object* pValue = p->GetNextElement(pos, key); |
+ for (const auto& it : *p) { |
+ const CFX_ByteString& key = it.first; |
+ CPDF_Object* pValue = it.second; |
if (key == "Encrypt" || key == "Size" || key == "Filter" || |
Tom Sepez
2016/01/08 00:33:52
NB: similar to line 184, but missing "Type". Wond
Oliver Chang
2016/01/08 23:14:58
ack. added a TODO.
|
key == "Index" || key == "Length" || key == "Prev" || key == "W" || |
key == "XRefStm" || key == "ID") { |