diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-06-01 10:47:39 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-06-01 13:46:27 +0200 |
commit | e7afd6407401014f9eee6cbce0f80da7c0491a4e (patch) | |
tree | b9c7a3312ebede6721093f487f03a7a87cb0d82e /editeng | |
parent | 2f78b2c4e8f82d9b5eb6fb5985a3f5e298b28499 (diff) |
use std::make_unique instead of new
Change-Id: Idb9dc1897b5617a6e12110638857e153e2ba56dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116525
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/rtf/rtfitem.cxx | 17 | ||||
-rw-r--r-- | editeng/source/rtf/svxrtf.cxx | 9 |
2 files changed, 12 insertions, 14 deletions
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<SvxRTFItemStackType> pNew(new SvxRTFItemStackType( - *pCurrent, *mxInsertPosition, true )); - pNew->SetRTFDefaults( GetRTFDefaults() ); + auto xNew(std::make_unique<SvxRTFItemStackType>(*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<SvxRTFItemStackType> pNew(new SvxRTFItemStackType( *pCurrent, *mxInsertPosition, true )); - pNew->SetRTFDefaults( GetRTFDefaults() ); + auto xNew(std::make_unique<SvxRTFItemStackType>(*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<SvxRTFItemStackType> pNew(new SvxRTFItemStackType( - *pCurrent, *mxInsertPosition, true )); - pNew->SetRTFDefaults( GetRTFDefaults() ); + auto xNew(std::make_unique<SvxRTFItemStackType>(*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 |