diff options
author | tsepez <tsepez@chromium.org> | 2016-11-21 16:22:10 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-21 16:22:10 -0800 |
commit | 06104a8abc71ecd824d6a461b6f6f31c32fd2135 (patch) | |
tree | 713f7dfacbdaec5e0ac25e8fe1d197a27453a725 /core/fpdfapi/parser/cpdf_parser.cpp | |
parent | dc7ec035a6962b788e75f4beaa4cf8fbddd83d39 (diff) | |
download | pdfium-06104a8abc71ecd824d6a461b6f6f31c32fd2135.tar.xz |
Remove some WrapUnique() calls by returing unique_ptrs
Return these from underlying methods as appropriate.
Review-Url: https://codereview.chromium.org/2520133002
Diffstat (limited to 'core/fpdfapi/parser/cpdf_parser.cpp')
-rw-r--r-- | core/fpdfapi/parser/cpdf_parser.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index 5354417eda..2f432ed9f9 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -1070,14 +1070,21 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, bool bMainXRef) { } CPDF_Array* CPDF_Parser::GetIDArray() { - CPDF_Object* pID = m_pTrailer ? m_pTrailer->GetObjectFor("ID") : nullptr; + if (!m_pTrailer) + return nullptr; + + CPDF_Object* pID = m_pTrailer->GetObjectFor("ID"); if (!pID) return nullptr; - if (CPDF_Reference* pRef = pID->AsReference()) { - pID = ParseIndirectObject(nullptr, pRef->GetRefObjNum()).release(); - m_pTrailer->SetFor("ID", pdfium::WrapUnique(pID)); - } + CPDF_Reference* pRef = pID->AsReference(); + if (!pRef) + return ToArray(pID); + + std::unique_ptr<CPDF_Object> pNewObj = + ParseIndirectObject(nullptr, pRef->GetRefObjNum()); + pID = pNewObj.get(); + m_pTrailer->SetFor("ID", std::move(pNewObj)); return ToArray(pID); } |