From 4bd56577ec4a3da5dae151ff82d957673fc8031d Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 3 Jun 2021 09:39:06 +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: Icc5cb2f5fa5720eb9f6e22ec380397bb88542689 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116644 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- editeng/source/rtf/svxrtf.cxx | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'editeng') diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index 9c3f4cd2af17..1e85b415828c 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -735,40 +735,39 @@ void SvxRTFParser::AttrGroupEnd() // process the current, delete from Stack // - all character attributes sre keep the area // - all paragraph attributes to get the area // up to the previous paragraph - std::unique_ptr pNew( - new SvxRTFItemStackType(*pOld, *mxInsertPosition, true)); - pNew->aAttrSet.SetParent( pOld->aAttrSet.GetParent() ); + auto xNew = std::make_unique(*pOld, *mxInsertPosition, true); + xNew->aAttrSet.SetParent( pOld->aAttrSet.GetParent() ); - // Delete all paragraph attributes from pNew + // Delete all paragraph attributes from xNew for( sal_uInt16 n = 0; n < (sizeof(aPardMap) / sizeof(sal_uInt16)) && - pNew->aAttrSet.Count(); ++n ) + xNew->aAttrSet.Count(); ++n ) if( reinterpret_cast(&aPardMap)[n] ) - pNew->aAttrSet.ClearItem( reinterpret_cast(&aPardMap)[n] ); - pNew->SetRTFDefaults( GetRTFDefaults() ); + xNew->aAttrSet.ClearItem( reinterpret_cast(&aPardMap)[n] ); + xNew->SetRTFDefaults( GetRTFDefaults() ); // Were there any? - if( pNew->aAttrSet.Count() == pOld->aAttrSet.Count() ) + if( xNew->aAttrSet.Count() == pOld->aAttrSet.Count() ) { - pNew.reset(); + xNew.reset(); } else { - pNew->nStyleNo = 0; + xNew->nStyleNo = 0; - // Now span the real area of pNew from old + // Now span the real area of xNew from old SetEndPrevPara( pOld->mxEndNodeIdx, pOld->nEndCnt ); - pNew->nSttCnt = 0; + xNew->nSttCnt = 0; if( IsChkStyleAttr() ) { ClearStyleAttr_( *pOld ); - ClearStyleAttr_( *pNew ); //#i10381#, methinks. + ClearStyleAttr_( *xNew ); //#i10381#, methinks. } if( pCurrent ) { pCurrent->Add(std::move(pOld)); - pCurrent->Add(std::move(pNew)); + pCurrent->Add(std::move(xNew)); } else { @@ -776,7 +775,7 @@ void SvxRTFParser::AttrGroupEnd() // process the current, delete from Stack // read. (Span no attributes!) m_AttrSetList.push_back(std::move(pOld)); - m_AttrSetList.push_back(std::move(pNew)); + m_AttrSetList.push_back(std::move(xNew)); } break; } -- cgit