From f3480661a20c259581e7c100b0d5d06950a9559b Mon Sep 17 00:00:00 2001 From: thestig Date: Thu, 10 Nov 2016 10:47:21 -0800 Subject: Use more unique_ptrs for CPDF_Annot and friends. Review-Url: https://codereview.chromium.org/2494583002 --- core/fpdfdoc/cpdf_annotlist.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'core/fpdfdoc/cpdf_annotlist.cpp') diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp index e89b47705e..91cff454e3 100644 --- a/core/fpdfdoc/cpdf_annotlist.cpp +++ b/core/fpdfdoc/cpdf_annotlist.cpp @@ -18,6 +18,7 @@ #include "core/fpdfdoc/cpdf_occontext.h" #include "core/fpdfdoc/cpvt_generateap.h" #include "core/fxge/cfx_renderdevice.h" +#include "third_party/base/ptr_util.h" namespace { @@ -33,8 +34,8 @@ std::unique_ptr CreatePopupAnnot(CPDF_Annot* pAnnot, if (sContents.IsEmpty()) return nullptr; - CPDF_Dictionary* pAnnotDict = - new CPDF_Dictionary(pDocument->GetByteStringPool()); + auto pAnnotDict = + pdfium::MakeUnique(pDocument->GetByteStringPool()); pAnnotDict->SetNameFor("Type", "Annot"); pAnnotDict->SetNameFor("Subtype", "Popup"); pAnnotDict->SetStringFor("T", pParentDict->GetStringFor("T")); @@ -48,8 +49,8 @@ std::unique_ptr CreatePopupAnnot(CPDF_Annot* pAnnot, pAnnotDict->SetRectFor("Rect", popupRect); pAnnotDict->SetIntegerFor("F", 0); - std::unique_ptr pPopupAnnot( - new CPDF_Annot(pAnnotDict, pDocument, true)); + auto pPopupAnnot = + pdfium::MakeUnique(std::move(pAnnotDict), pDocument); pAnnot->SetPopupAnnot(pPopupAnnot.get()); return pPopupAnnot; } @@ -79,8 +80,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) continue; } pAnnots->ConvertToIndirectObjectAt(i, m_pDocument); - m_AnnotList.push_back( - std::unique_ptr(new CPDF_Annot(pDict, m_pDocument, false))); + m_AnnotList.push_back(pdfium::MakeUnique(pDict, m_pDocument)); if (bRegenerateAP && subtype == "Widget" && CPDF_InterForm::IsUpdateAPEnabled()) { FPDF_GenerateAP(m_pDocument, pDict); -- cgit v1.2.3