summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_array.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-15 11:33:44 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-15 11:33:44 -0800
commit70c4afd5c3c5c44cd24f814423a23a6ef05bba02 (patch)
treecbe593d0b6c0bfc6fd5038bf60a77a94e49c69c9 /core/fpdfapi/parser/cpdf_array.cpp
parentf16f6b8b52277348f5d571b7641bb0bbd5239589 (diff)
downloadpdfium-70c4afd5c3c5c44cd24f814423a23a6ef05bba02.tar.xz
Make AddIndirectObject() take a unique_ptr.
Add convenience routines to create and add object in one step. Review-Url: https://codereview.chromium.org/2489283003
Diffstat (limited to 'core/fpdfapi/parser/cpdf_array.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_array.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp
index af9b544f0a..f8ec46acc9 100644
--- a/core/fpdfapi/parser/cpdf_array.cpp
+++ b/core/fpdfapi/parser/cpdf_array.cpp
@@ -155,8 +155,8 @@ void CPDF_Array::ConvertToIndirectObjectAt(size_t i,
if (!pObj || pObj->IsReference())
return;
- uint32_t dwObjNum = pHolder->AddIndirectObject(pObj);
- m_Objects[i] = new CPDF_Reference(pHolder, dwObjNum);
+ CPDF_Object* pNew = pHolder->AddIndirectObject(pdfium::WrapUnique(pObj));
+ m_Objects[i] = new CPDF_Reference(pHolder, pNew->GetObjNum());
}
void CPDF_Array::SetAt(size_t i, CPDF_Object* pObj) {
@@ -209,3 +209,9 @@ void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc,
uint32_t objnum) {
Add(new CPDF_Reference(pDoc, objnum));
}
+
+void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc,
+ CPDF_Object* pObj) {
+ ASSERT(!pObj->IsInline());
+ Add(new CPDF_Reference(pDoc, pObj->GetObjNum()));
+}