From e7afd6407401014f9eee6cbce0f80da7c0491a4e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 1 Jun 2021 10:47:39 +0100 Subject: use std::make_unique instead of new MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Idb9dc1897b5617a6e12110638857e153e2ba56dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116525 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- editeng/source/rtf/rtfitem.cxx | 17 ++++++++--------- editeng/source/rtf/svxrtf.cxx | 9 ++++----- 2 files changed, 12 insertions(+), 14 deletions(-) (limited to 'editeng') diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index ef370d98995f..b6e0a93adee6 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -218,16 +218,15 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) pCurrent->nStyleNo ) { // Open a new Group - std::unique_ptr pNew(new SvxRTFItemStackType( - *pCurrent, *mxInsertPosition, true )); - pNew->SetRTFDefaults( GetRTFDefaults() ); + auto xNew(std::make_unique(*pCurrent, *mxInsertPosition, true)); + xNew->SetRTFDefaults( GetRTFDefaults() ); // "Set" all valid attributes up until this point AttrGroupEnd(); pCurrent = aAttrStack.empty() ? nullptr : aAttrStack.back().get(); // can be changed after AttrGroupEnd! - pNew->aAttrSet.SetParent( pCurrent ? &pCurrent->aAttrSet : nullptr ); + xNew->aAttrSet.SetParent( pCurrent ? &pCurrent->aAttrSet : nullptr ); - aAttrStack.push_back( std::move(pNew) ); + aAttrStack.push_back( std::move(xNew) ); pCurrent = aAttrStack.back().get(); } else @@ -1704,14 +1703,14 @@ void SvxRTFParser::RTFPardPlain( bool const bPard, SfxItemSet** ppSet ) if (pCurrent->aAttrSet.Count() || pCurrent->m_pChildList || pCurrent->nStyleNo) { // open a new group - std::unique_ptr pNew(new SvxRTFItemStackType( *pCurrent, *mxInsertPosition, true )); - pNew->SetRTFDefaults( GetRTFDefaults() ); + auto xNew(std::make_unique(*pCurrent, *mxInsertPosition, true)); + xNew->SetRTFDefaults( GetRTFDefaults() ); // Set all until here valid attributes AttrGroupEnd(); pCurrent = aAttrStack.empty() ? nullptr : aAttrStack.back().get(); // can be changed after AttrGroupEnd! - pNew->aAttrSet.SetParent( pCurrent ? &pCurrent->aAttrSet : nullptr ); - aAttrStack.push_back( std::move(pNew) ); + xNew->aAttrSet.SetParent( pCurrent ? &pCurrent->aAttrSet : nullptr ); + aAttrStack.push_back( std::move(xNew) ); pCurrent = aAttrStack.back().get(); } else diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index ac262af2e759..b2cc406b9980 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -811,15 +811,14 @@ void SvxRTFParser::AttrGroupEnd() // process the current, delete from Stack bCrsrBack = false; // Open a new Group. - std::unique_ptr pNew(new SvxRTFItemStackType( - *pCurrent, *mxInsertPosition, true )); - pNew->SetRTFDefaults( GetRTFDefaults() ); + auto xNew(std::make_unique(*pCurrent, *mxInsertPosition, true)); + xNew->SetRTFDefaults( GetRTFDefaults() ); // Set all until here valid Attributes AttrGroupEnd(); pCurrent = aAttrStack.empty() ? nullptr : aAttrStack.back().get(); // can be changed after AttrGroupEnd! - pNew->aAttrSet.SetParent( pCurrent ? &pCurrent->aAttrSet : nullptr ); - aAttrStack.push_back( std::move(pNew) ); + xNew->aAttrSet.SetParent( pCurrent ? &pCurrent->aAttrSet : nullptr ); + aAttrStack.push_back( std::move(xNew) ); } } else -- cgit