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

Unified Diff: core/fpdfapi/parser/cpdf_parser.cpp

Issue 2510223002: Make CPDF_Dictionary use unique pointers. (Closed)
Patch Set: rebase Created 4 years, 1 month 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
« no previous file with comments | « core/fpdfapi/parser/cpdf_object_unittest.cpp ('k') | core/fpdfapi/parser/cpdf_security_handler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/parser/cpdf_parser.cpp
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index c43614f6286de49d4132014380db4d0ac3b319ec..5354417eda857de70bdb4de856e8fa75506e5192 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -6,6 +6,8 @@
#include "core/fpdfapi/parser/cpdf_parser.h"
+#include <algorithm>
+#include <utility>
#include <vector>
#include "core/fpdfapi/parser/cpdf_array.h"
@@ -802,16 +804,15 @@ bool CPDF_Parser::RebuildCrossRef() {
auto it = pTrailer->begin();
while (it != pTrailer->end()) {
const CFX_ByteString& key = it->first;
- CPDF_Object* pElement = it->second;
+ CPDF_Object* pElement = it->second.get();
++it;
uint32_t dwObjNum =
pElement ? pElement->GetObjNum() : 0;
if (dwObjNum) {
- m_pTrailer->SetReferenceFor(key, m_pDocument,
- dwObjNum);
+ m_pTrailer->SetNewFor<CPDF_Reference>(
+ key, m_pDocument, dwObjNum);
} else {
- m_pTrailer->SetFor(key,
- pElement->Clone().release());
+ m_pTrailer->SetFor(key, pElement->Clone());
}
}
}
@@ -1075,7 +1076,7 @@ CPDF_Array* CPDF_Parser::GetIDArray() {
if (CPDF_Reference* pRef = pID->AsReference()) {
pID = ParseIndirectObject(nullptr, pRef->GetRefObjNum()).release();
- m_pTrailer->SetFor("ID", pID);
+ m_pTrailer->SetFor("ID", pdfium::WrapUnique(pID));
}
return ToArray(pID);
}
« no previous file with comments | « core/fpdfapi/parser/cpdf_object_unittest.cpp ('k') | core/fpdfapi/parser/cpdf_security_handler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698