From 3ba098595ae56b64eacc0c25ab76b89a4d78d920 Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 14 Oct 2016 16:59:10 -0700 Subject: Update CPDF_IndirectObjectHolder APIs for unique objects. Doing so highlights a few places where ownership is dubious. Add convenience functions to return an unowned reference to a newly-created indirect object. Review-Url: https://codereview.chromium.org/2419173002 --- core/fpdfapi/parser/cpdf_parser.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'core/fpdfapi/parser/cpdf_parser.cpp') diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index 40a615fa47..d9c892f133 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -955,21 +955,18 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() { } FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) { - std::unique_ptr pObject( - ParseIndirectObjectAt(m_pDocument, *pos, 0)); + UniqueObject pObject(ParseIndirectObjectAt(m_pDocument, *pos, 0)); if (!pObject) return FALSE; CPDF_Object* pUnownedObject = pObject.get(); - if (m_pDocument) { CPDF_Dictionary* pRootDict = m_pDocument->GetRoot(); if (pRootDict && pRootDict->GetObjNum() == pObject->m_ObjNum) return FALSE; - // Takes ownership of object (std::move someday). uint32_t objnum = pObject->m_ObjNum; if (!m_pDocument->ReplaceIndirectObjectIfHigherGeneration( - objnum, pObject.release())) { + objnum, std::move(pObject))) { return FALSE; } } -- cgit v1.2.3