summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_parser.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-21 16:22:10 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-21 16:22:10 -0800
commit06104a8abc71ecd824d6a461b6f6f31c32fd2135 (patch)
tree713f7dfacbdaec5e0ac25e8fe1d197a27453a725 /core/fpdfapi/parser/cpdf_parser.cpp
parentdc7ec035a6962b788e75f4beaa4cf8fbddd83d39 (diff)
downloadpdfium-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.cpp17
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);
}