From c675a2f4afdd7e54bc4b4638bd1ffcb2de0b7124 Mon Sep 17 00:00:00 2001 From: tsepez Date: Tue, 22 Nov 2016 13:02:43 -0800 Subject: Use more unique_ptrs in CPDF_SyntaxParser and CPDF_Annot Review-Url: https://codereview.chromium.org/2526543003 --- core/fpdfdoc/cpdf_annot.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'core/fpdfdoc') diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp index a7d2101364..70c6b8d3c4 100644 --- a/core/fpdfdoc/cpdf_annot.cpp +++ b/core/fpdfdoc/cpdf_annot.cpp @@ -6,6 +6,8 @@ #include "core/fpdfdoc/cpdf_annot.h" +#include + #include "core/fpdfapi/page/cpdf_form.h" #include "core/fpdfapi/page/cpdf_page.h" #include "core/fpdfapi/parser/cpdf_array.h" @@ -205,11 +207,13 @@ CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) { if (it != m_APMap.end()) return it->second.get(); - CPDF_Form* pNewForm = - new CPDF_Form(m_pDocument, pPage->m_pResources, pStream); + auto pNewForm = + pdfium::MakeUnique(m_pDocument, pPage->m_pResources, pStream); pNewForm->ParseContent(nullptr, nullptr, nullptr); - m_APMap[pStream] = pdfium::WrapUnique(pNewForm); - return pNewForm; + + CPDF_Form* pResult = pNewForm.get(); + m_APMap[pStream] = std::move(pNewForm); + return pResult; } // Static. -- cgit v1.2.3