summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_annotlist.cpp
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-11-10 10:47:21 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-10 10:47:22 -0800
commitf3480661a20c259581e7c100b0d5d06950a9559b (patch)
tree5353bb1456069c191f7418ff91966f97f002c9b2 /core/fpdfdoc/cpdf_annotlist.cpp
parent69bbfa8fb536143e045a9dce3006ddd91785adbb (diff)
downloadpdfium-f3480661a20c259581e7c100b0d5d06950a9559b.tar.xz
Use more unique_ptrs for CPDF_Annot and friends.
Review-Url: https://codereview.chromium.org/2494583002
Diffstat (limited to 'core/fpdfdoc/cpdf_annotlist.cpp')
-rw-r--r--core/fpdfdoc/cpdf_annotlist.cpp12
1 files changed, 6 insertions, 6 deletions
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<CPDF_Annot> CreatePopupAnnot(CPDF_Annot* pAnnot,
if (sContents.IsEmpty())
return nullptr;
- CPDF_Dictionary* pAnnotDict =
- new CPDF_Dictionary(pDocument->GetByteStringPool());
+ auto pAnnotDict =
+ pdfium::MakeUnique<CPDF_Dictionary>(pDocument->GetByteStringPool());
pAnnotDict->SetNameFor("Type", "Annot");
pAnnotDict->SetNameFor("Subtype", "Popup");
pAnnotDict->SetStringFor("T", pParentDict->GetStringFor("T"));
@@ -48,8 +49,8 @@ std::unique_ptr<CPDF_Annot> CreatePopupAnnot(CPDF_Annot* pAnnot,
pAnnotDict->SetRectFor("Rect", popupRect);
pAnnotDict->SetIntegerFor("F", 0);
- std::unique_ptr<CPDF_Annot> pPopupAnnot(
- new CPDF_Annot(pAnnotDict, pDocument, true));
+ auto pPopupAnnot =
+ pdfium::MakeUnique<CPDF_Annot>(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<CPDF_Annot>(new CPDF_Annot(pDict, m_pDocument, false)));
+ m_AnnotList.push_back(pdfium::MakeUnique<CPDF_Annot>(pDict, m_pDocument));
if (bRegenerateAP && subtype == "Widget" &&
CPDF_InterForm::IsUpdateAPEnabled()) {
FPDF_GenerateAP(m_pDocument, pDict);