From 5a6c1398d0e559fb6a048cb0dca46ba9f9309a77 Mon Sep 17 00:00:00 2001 From: weili Date: Mon, 11 Jul 2016 14:43:40 -0700 Subject: Use smart pointers for class owned member variables Replace raw member variables to smart pointer type to better maintain the ownership and to ease the management. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2136683002 --- core/fpdfdoc/cpdf_variabletext.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'core/fpdfdoc/cpdf_variabletext.cpp') diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp index 010d426cf2..1ac36ade86 100644 --- a/core/fpdfdoc/cpdf_variabletext.cpp +++ b/core/fpdfdoc/cpdf_variabletext.cpp @@ -264,9 +264,9 @@ void CPDF_VariableText::Initialize() { if (!m_bInitial) { CPVT_SectionInfo secinfo; if (m_bRichText) { - secinfo.pSecProps = new CPVT_SecProps(0.0f, 0.0f, 0); - secinfo.pWordProps = new CPVT_WordProps( - GetDefaultFontIndex(), kDefaultFontSize, 0, ScriptType::Normal, 0); + secinfo.pSecProps.reset(new CPVT_SecProps(0.0f, 0.0f, 0)); + secinfo.pWordProps.reset(new CPVT_WordProps( + GetDefaultFontIndex(), kDefaultFontSize, 0, ScriptType::Normal, 0)); } CPVT_WordPlace place; place.nSecIndex = 0; @@ -333,9 +333,9 @@ CPVT_WordPlace CPDF_VariableText::InsertSection( CPVT_SectionInfo secinfo; if (m_bRichText) { if (pSecProps) - secinfo.pSecProps = new CPVT_SecProps(*pSecProps); + secinfo.pSecProps.reset(new CPVT_SecProps(*pSecProps)); if (pWordProps) - secinfo.pWordProps = new CPVT_WordProps(*pWordProps); + secinfo.pWordProps.reset(new CPVT_WordProps(*pWordProps)); } AddSection(NewPlace, secinfo); newplace = NewPlace; @@ -426,9 +426,9 @@ void CPDF_VariableText::SetText(const FX_WCHAR* text, CPVT_SectionInfo secinfo; if (m_bRichText) { if (pSecProps) - secinfo.pSecProps = new CPVT_SecProps(*pSecProps); + secinfo.pSecProps.reset(new CPVT_SecProps(*pSecProps)); if (pWordProps) - secinfo.pWordProps = new CPVT_WordProps(*pWordProps); + secinfo.pWordProps.reset(new CPVT_WordProps(*pWordProps)); } if (CSection* pSection = m_SectionArray.GetAt(0)) pSection->m_SecInfo = secinfo; -- cgit v1.2.3