summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-09-14 23:15:08 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-14 23:15:08 +0000
commit75560afd066b5a7e8f050232964bb013fa355f83 (patch)
tree5595ce25bad877b9d7e291f42bf084e0bf3ce391
parent8abd0dfe538fcf55c7c8571791b409d7e036ef54 (diff)
downloadpdfium-75560afd066b5a7e8f050232964bb013fa355f83.tar.xz
Use MakeUnique() in CFFL_InteractiveFormFiller.
Remove more bare |new|s. Change-Id: Ia26bb8150d5bb0004c6a8e6ff89b4694b9ef2865 Reviewed-on: https://pdfium-review.googlesource.com/42552 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index c1cc355156..7feda490ba 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -476,37 +476,43 @@ CFFL_FormFiller* CFFL_InteractiveFormFiller::GetFormFiller(
CPDFSDK_Widget* pWidget = ToCPDFSDKWidget(pAnnot);
FormFieldType fieldType = pWidget->GetFieldType();
- CFFL_FormFiller* pFormFiller;
+ std::unique_ptr<CFFL_FormFiller> pFormFiller;
switch (fieldType) {
case FormFieldType::kPushButton:
- pFormFiller = new CFFL_PushButton(m_pFormFillEnv.Get(), pWidget);
+ pFormFiller =
+ pdfium::MakeUnique<CFFL_PushButton>(m_pFormFillEnv.Get(), pWidget);
break;
case FormFieldType::kCheckBox:
- pFormFiller = new CFFL_CheckBox(m_pFormFillEnv.Get(), pWidget);
+ pFormFiller =
+ pdfium::MakeUnique<CFFL_CheckBox>(m_pFormFillEnv.Get(), pWidget);
break;
case FormFieldType::kRadioButton:
- pFormFiller = new CFFL_RadioButton(m_pFormFillEnv.Get(), pWidget);
+ pFormFiller =
+ pdfium::MakeUnique<CFFL_RadioButton>(m_pFormFillEnv.Get(), pWidget);
break;
case FormFieldType::kTextField:
- pFormFiller = new CFFL_TextField(m_pFormFillEnv.Get(), pWidget);
+ pFormFiller =
+ pdfium::MakeUnique<CFFL_TextField>(m_pFormFillEnv.Get(), pWidget);
break;
case FormFieldType::kListBox:
- pFormFiller = new CFFL_ListBox(m_pFormFillEnv.Get(), pWidget);
+ pFormFiller =
+ pdfium::MakeUnique<CFFL_ListBox>(m_pFormFillEnv.Get(), pWidget);
break;
case FormFieldType::kComboBox:
- pFormFiller = new CFFL_ComboBox(m_pFormFillEnv.Get(), pWidget);
+ pFormFiller =
+ pdfium::MakeUnique<CFFL_ComboBox>(m_pFormFillEnv.Get(), pWidget);
break;
case FormFieldType::kUnknown:
default:
- pFormFiller = nullptr;
break;
}
if (!pFormFiller)
return nullptr;
- m_Maps[pAnnot].reset(pFormFiller);
- return pFormFiller;
+ CFFL_FormFiller* result = pFormFiller.get();
+ m_Maps[pAnnot] = std::move(pFormFiller);
+ return result;
}
WideString CFFL_InteractiveFormFiller::GetText(CPDFSDK_Annot* pAnnot) {