[Libreoffice-commits] core.git: editeng/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 3 09:48:37 UTC 2021


 editeng/source/rtf/svxrtf.cxx |   29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

New commits:
commit 4bd56577ec4a3da5dae151ff82d957673fc8031d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Jun 3 09:39:06 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Jun 3 11:47:49 2021 +0200

    use std::make_unique instead of new
    
    Change-Id: Icc5cb2f5fa5720eb9f6e22ec380397bb88542689
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116644
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

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<SvxRTFItemStackType> pNew(
-                        new SvxRTFItemStackType(*pOld, *mxInsertPosition, true));
-                    pNew->aAttrSet.SetParent( pOld->aAttrSet.GetParent() );
+                    auto xNew = std::make_unique<SvxRTFItemStackType>(*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<sal_uInt16*>(&aPardMap)[n] )
-                            pNew->aAttrSet.ClearItem( reinterpret_cast<sal_uInt16*>(&aPardMap)[n] );
-                    pNew->SetRTFDefaults( GetRTFDefaults() );
+                            xNew->aAttrSet.ClearItem( reinterpret_cast<sal_uInt16*>(&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;
                     }


More information about the Libreoffice-commits mailing list