summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-28 13:33:31 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-28 21:00:54 +0000
commit3b91290ba31e1d5bd0147f44f9cc723a72b6eb9a (patch)
tree00cd60823d9e24d64321bdfe7ecdc383c3923ad9 /xfa
parent7e93a2c4f3279677ea31db81d85af70c7b3bff5a (diff)
downloadpdfium-3b91290ba31e1d5bd0147f44f9cc723a72b6eb9a.tar.xz
Remove more |new|s, part 3
These are already unique_ptr's, we should make them as such. Change-Id: I576396d73c1d39e7a3bc8f91e8530d2e08883213 Reviewed-on: https://pdfium-review.googlesource.com/4614 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/cfde_renderdevice.cpp6
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_localemgr.cpp6
3 files changed, 9 insertions, 7 deletions
diff --git a/xfa/fde/cfde_renderdevice.cpp b/xfa/fde/cfde_renderdevice.cpp
index 839ffac019..7fb5b0352e 100644
--- a/xfa/fde/cfde_renderdevice.cpp
+++ b/xfa/fde/cfde_renderdevice.cpp
@@ -8,12 +8,14 @@
#include <algorithm>
#include <memory>
+#include <utility>
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/cfx_substfont.h"
#include "core/fxge/dib/cfx_imagerenderer.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fde/cfde_brush.h"
#include "xfa/fde/cfde_path.h"
#include "xfa/fde/cfde_pen.h"
@@ -150,12 +152,12 @@ bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush,
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
uint32_t dwFontStyle = pFont->GetFontStyles();
CFX_Font FxFont;
- CFX_SubstFont* SubstFxFont = new CFX_SubstFont();
- FxFont.SetSubstFont(std::unique_ptr<CFX_SubstFont>(SubstFxFont));
+ auto SubstFxFont = pdfium::MakeUnique<CFX_SubstFont>();
SubstFxFont->m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400;
SubstFxFont->m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0;
SubstFxFont->m_WeightCJK = SubstFxFont->m_Weight;
SubstFxFont->m_bItalicCJK = !!(dwFontStyle & FX_FONTSTYLE_Italic);
+ FxFont.SetSubstFont(std::move(SubstFxFont));
#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
for (int32_t i = 0; i < iCount; ++i) {
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index ad8f4bf5fa..23327b7691 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -108,8 +108,8 @@ class CXFA_FieldLayoutData : public CXFA_WidgetLayoutData {
CXFA_Caption caption = pAcc->GetCaption();
if (!caption || caption.GetPresence() == XFA_ATTRIBUTEENUM_Hidden)
return false;
- m_pCapTextProvider.reset(
- new CXFA_TextProvider(pAcc, XFA_TEXTPROVIDERTYPE_Caption));
+ m_pCapTextProvider = pdfium::MakeUnique<CXFA_TextProvider>(
+ pAcc, XFA_TEXTPROVIDERTYPE_Caption);
m_pCapTextLayout =
pdfium::MakeUnique<CXFA_TextLayout>(m_pCapTextProvider.get());
return true;
diff --git a/xfa/fxfa/parser/cxfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp
index 0f50803763..0a691a6ceb 100644
--- a/xfa/fxfa/parser/cxfa_localemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_localemgr.cpp
@@ -14,6 +14,7 @@
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/xml/cxml_element.h"
#include "core/fxge/cfx_gemodule.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fxfa/parser/cxfa_node.h"
#include "xfa/fxfa/parser/cxfa_nodelocale.h"
#include "xfa/fxfa/parser/cxfa_xmllocale.h"
@@ -1072,8 +1073,7 @@ static std::unique_ptr<IFX_Locale> XFA_GetLocaleFromBuffer(const uint8_t* pBuf,
pLocale = CXML_Element::Parse(pOut, dwSize);
FX_Free(pOut);
}
- return pLocale ? std::unique_ptr<IFX_Locale>(
- new CXFA_XMLLocale(std::move(pLocale)))
+ return pLocale ? pdfium::MakeUnique<CXFA_XMLLocale>(std::move(pLocale))
: nullptr;
}
@@ -1127,7 +1127,7 @@ CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid)
if (pLocaleSet) {
CXFA_Node* pNodeLocale = pLocaleSet->GetNodeItem(XFA_NODEITEM_FirstChild);
while (pNodeLocale) {
- m_LocaleArray.emplace_back(new CXFA_NodeLocale(pNodeLocale));
+ m_LocaleArray.push_back(pdfium::MakeUnique<CXFA_NodeLocale>(pNodeLocale));
pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling);
}
}