editeng/source/rtf/rtfitem.cxx |   17 ++++++++---------
 editeng/source/rtf/svxrtf.cxx  |    9 ++++-----
 2 files changed, 12 insertions(+), 14 deletions(-)

New commits:
commit e7afd6407401014f9eee6cbce0f80da7c0491a4e
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Jun 1 10:47:39 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Jun 1 13:46:27 2021 +0200

    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 <caol...@redhat.com>

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
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to