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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Oct 5 06:08:00 UTC 2018


 sw/source/filter/ww8/docxattributeoutput.cxx |    4 ++--
 sw/source/filter/ww8/rtfattributeoutput.cxx  |    2 +-
 sw/source/filter/ww8/ww8par.cxx              |   12 ++++++------
 sw/source/filter/ww8/ww8par.hxx              |    6 +++---
 sw/source/filter/ww8/ww8par3.cxx             |    6 +++---
 sw/source/uibase/utlui/content.cxx           |    6 ++----
 6 files changed, 17 insertions(+), 19 deletions(-)

New commits:
commit d46061c3190b66cbf698f6ff5e97ec1fd9fe0d44
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Oct 4 11:56:06 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Oct 5 08:07:30 2018 +0200

    use more std::move in sw/
    
    Change-Id: Id2f063550db3a3110e4bae8e18d0e7b9a7bf5df3
    Reviewed-on: https://gerrit.libreoffice.org/61368
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index e65a71df4f98..6e2987cc67fe 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5301,8 +5301,8 @@ void DocxAttributeOutput::WritePostponedDMLDrawing()
         return;
 
     // Clear the list early, this method may be called recursively.
-    std::unique_ptr< std::vector<PostponedDrawing> > pPostponedDMLDrawings(m_pPostponedDMLDrawings.release());
-    std::unique_ptr< std::vector<PostponedOLE> > pPostponedOLEs(m_pPostponedOLEs.release());
+    std::unique_ptr< std::vector<PostponedDrawing> > pPostponedDMLDrawings(std::move(m_pPostponedDMLDrawings));
+    std::unique_ptr< std::vector<PostponedOLE> > pPostponedOLEs(std::move(m_pPostponedOLEs));
 
     for( const auto & rPostponedDrawing : *pPostponedDMLDrawings )
     {
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index c4e5e4f28498..efbec3e6cf0a 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1769,7 +1769,7 @@ void RtfAttributeOutput::writeTextFrame(const ww8::Frame& rFrame, bool bTextBox)
         // Save table state, in case the inner text also contains a table.
         ww8::WW8TableInfo::Pointer_t pTableInfoOrig = m_rExport.m_pTableInfo;
         m_rExport.m_pTableInfo = std::make_shared<ww8::WW8TableInfo>();
-        std::unique_ptr<SwWriteTable> pTableWrt(m_pTableWrt.release());
+        std::unique_ptr<SwWriteTable> pTableWrt(std::move(m_pTableWrt));
         sal_uInt32 nTableDepth = m_nTableDepth;
 
         m_nTableDepth = 0;
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index c603f48ed669..707953b16c5a 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1954,8 +1954,8 @@ WW8ReaderSave::WW8ReaderSave(SwWW8ImplReader* pRdr ,WW8_CP nStartCp) :
     mxOldAnchorStck(std::move(pRdr->m_xAnchorStck)),
     mxOldRedlines(std::move(pRdr->m_xRedlineStack)),
     mxOldPlcxMan(pRdr->m_xPlcxMan),
-    mpWFlyPara(pRdr->m_xWFlyPara.release()),
-    mpSFlyPara(pRdr->m_xSFlyPara.release()),
+    mpWFlyPara(std::move(pRdr->m_xWFlyPara)),
+    mpSFlyPara(std::move(pRdr->m_xSFlyPara)),
     mpPreviousNumPaM(pRdr->m_pPreviousNumPaM),
     mpPrevNumRule(pRdr->m_pPrevNumRule),
     mxTableDesc(std::move(pRdr->m_xTableDesc)),
@@ -2008,8 +2008,8 @@ WW8ReaderSave::WW8ReaderSave(SwWW8ImplReader* pRdr ,WW8_CP nStartCp) :
 
 void WW8ReaderSave::Restore( SwWW8ImplReader* pRdr )
 {
-    pRdr->m_xWFlyPara.reset(mpWFlyPara);
-    pRdr->m_xSFlyPara.reset(mpSFlyPara);
+    pRdr->m_xWFlyPara = std::move(mpWFlyPara);
+    pRdr->m_xSFlyPara = std::move(mpSFlyPara);
     pRdr->m_pPreviousNumPaM = mpPreviousNumPaM;
     pRdr->m_pPrevNumRule = mpPrevNumRule;
     pRdr->m_xTableDesc = std::move(mxTableDesc);
@@ -6533,10 +6533,10 @@ std::unique_ptr<SdrObjUserData> SwMacroInfo::Clone( SdrObject* /*pObj*/ ) const
    return std::unique_ptr<SdrObjUserData>(new SwMacroInfo( *this ));
 }
 
-std::unique_ptr<SfxItemSet> SwWW8ImplReader::SetCurrentItemSet(SfxItemSet* pItemSet)
+std::unique_ptr<SfxItemSet> SwWW8ImplReader::SetCurrentItemSet(std::unique_ptr<SfxItemSet> pItemSet)
 {
     std::unique_ptr<SfxItemSet> xRet(std::move(m_xCurrentItemSet));
-    m_xCurrentItemSet.reset(pItemSet);
+    m_xCurrentItemSet = std::move(pItemSet);
     return xRet;
 }
 
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 4809c7e5d136..5bee19873cb1 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -593,8 +593,8 @@ private:
     std::unique_ptr<SwWW8FltAnchorStack> mxOldAnchorStck;
     std::unique_ptr<sw::util::RedlineStack> mxOldRedlines;
     std::shared_ptr<WW8PLCFMan> mxOldPlcxMan;
-    WW8FlyPara* const mpWFlyPara;
-    WW8SwFlyPara* const mpSFlyPara;
+    std::unique_ptr<WW8FlyPara> mpWFlyPara;
+    std::unique_ptr<WW8SwFlyPara> mpSFlyPara;
     SwPaM* const mpPreviousNumPaM;
     const SwNumRule* mpPrevNumRule;
     std::unique_ptr<WW8TabDesc> mxTableDesc;
@@ -1879,7 +1879,7 @@ public:     // really private, but can only be done public
     SwDoc& GetDoc() const           { return m_rDoc; }
     sal_uInt16 GetCurrentColl()  const     { return m_nCurrentColl; }
     void SetNCurrentColl( sal_uInt16 nColl ) { m_nCurrentColl = nColl;    }
-    std::unique_ptr<SfxItemSet> SetCurrentItemSet(SfxItemSet* pItemSet);
+    std::unique_ptr<SfxItemSet> SetCurrentItemSet(std::unique_ptr<SfxItemSet> pItemSet);
     sal_uInt16 StyleUsingLFO( sal_uInt16 nLFOIndex ) const ;
     const SwFormat* GetStyleWithOrgWWName( OUString const & rName ) const ;
 
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index d74334b2c6c2..f8ec183e94ef 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -683,7 +683,7 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr<SfxItemSet
         rpItemSet.reset(new SfxItemSet( rDoc.GetAttrPool(), svl::Items<RES_CHRATR_BEGIN, RES_CHRATR_END - 1>{}));
 
         // Set Reader-ItemSet-Pointer to the newly created set
-        rReader.SetCurrentItemSet(rpItemSet.release());
+        rReader.SetCurrentItemSet(std::move(rpItemSet));
         // Set Reader-Style to Style of this Level
         sal_uInt16 nOldColl = rReader.GetCurrentColl();
         sal_uInt16 nNewColl = nLevelStyle;
@@ -1868,7 +1868,7 @@ void SwWW8ImplReader::RegisterNumFormatOnTextNode(sal_uInt16 nCurrentLFO,
                 */
                 if (short nLen = static_cast< short >(aParaSprms.size()))
                 {
-                    std::unique_ptr<SfxItemSet> xOldCurrentItemSet(SetCurrentItemSet(xListIndent.release()));
+                    std::unique_ptr<SfxItemSet> xOldCurrentItemSet(SetCurrentItemSet(std::move(xListIndent)));
 
                     sal_uInt8* pSprms1  = &aParaSprms[0];
                     while (0 < nLen)
@@ -1878,7 +1878,7 @@ void SwWW8ImplReader::RegisterNumFormatOnTextNode(sal_uInt16 nCurrentLFO,
                         pSprms1 += nL1;
                     }
 
-                    xListIndent = SetCurrentItemSet(xOldCurrentItemSet.release());
+                    xListIndent = SetCurrentItemSet(std::move(xOldCurrentItemSet));
                 }
 
                 if (const SvxLRSpaceItem *pLR = xListIndent->GetItem<SvxLRSpaceItem>(RES_LR_SPACE))
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index a0de7d4f3cfa..91b1024aa9d8 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -343,12 +343,12 @@ void SwContentType::Init(bool* pbInvalidateWindow)
         break;
         case ContentTypeId::REGION :
         {
-            SwContentArr*   pOldMember = nullptr;
+            std::unique_ptr<SwContentArr> pOldMember;
             if(!pMember)
                 pMember.reset( new SwContentArr );
             else if(!pMember->empty())
             {
-                pOldMember = pMember.release();
+                pOldMember = std::move(pMember);
                 pMember.reset( new SwContentArr );
             }
             const Point aNullPt;
@@ -398,8 +398,6 @@ void SwContentType::Init(bool* pbInvalidateWindow)
                         *pOldMember,
                         *pMember);
                 }
-
-                delete pOldMember;
             }
         }
         break;


More information about the Libreoffice-commits mailing list