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

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

Issue 2484033002: Return unique_ptr from CPDF_Object::Clone(). (Closed)
Patch Set: Be painfully obvious about hidden expression 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
Index: core/fpdfapi/parser/cpdf_parser.cpp
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index ed20cf73f4f43ce2dd9aa8d12c68486e109ea813..2d96834964713183a80f5fcd1a4626c2be80d04a 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -737,8 +737,7 @@ bool CPDF_Parser::RebuildCrossRef() {
CPDF_Object* pRoot = pDict->GetObjectFor("Root");
if (pRoot && pRoot->GetDict() &&
pRoot->GetDict()->GetObjectFor("Pages")) {
- m_pTrailer =
- ToDictionary(pdfium::WrapUnique(pDict->Clone()));
+ m_pTrailer = ToDictionary(pDict->Clone());
}
}
}
@@ -811,14 +810,14 @@ bool CPDF_Parser::RebuildCrossRef() {
m_pTrailer->SetReferenceFor(key, m_pDocument,
dwObjNum);
} else {
- m_pTrailer->SetFor(key, pElement->Clone());
+ m_pTrailer->SetFor(key,
+ pElement->Clone().release());
}
}
}
} else {
if (pObj->IsStream()) {
- m_pTrailer =
- ToDictionary(pdfium::WrapUnique(pTrailer->Clone()));
+ m_pTrailer = ToDictionary(pTrailer->Clone());
} else {
m_pTrailer = ToDictionary(std::move(pObj));
}
@@ -959,8 +958,7 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, bool bMainXRef) {
if (size < 0)
return false;
- std::unique_ptr<CPDF_Dictionary> pNewTrailer =
- ToDictionary(pdfium::WrapUnique(pDict->Clone()));
+ std::unique_ptr<CPDF_Dictionary> pNewTrailer = ToDictionary(pDict->Clone());
if (bMainXRef) {
m_pTrailer = std::move(pNewTrailer);
ShrinkObjectMap(size);

Powered by Google App Engine
This is Rietveld 408576698