From d46061c3190b66cbf698f6ff5e97ec1fd9fe0d44 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 4 Oct 2018 11:56:06 +0200 Subject: use more std::move in sw/ Change-Id: Id2f063550db3a3110e4bae8e18d0e7b9a7bf5df3 Reviewed-on: https://gerrit.libreoffice.org/61368 Tested-by: Jenkins Reviewed-by: Noel Grandin --- 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(-) (limited to 'sw') 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 > pPostponedDMLDrawings(m_pPostponedDMLDrawings.release()); - std::unique_ptr< std::vector > pPostponedOLEs(m_pPostponedOLEs.release()); + std::unique_ptr< std::vector > pPostponedDMLDrawings(std::move(m_pPostponedDMLDrawings)); + std::unique_ptr< std::vector > 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(); - std::unique_ptr pTableWrt(m_pTableWrt.release()); + std::unique_ptr 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 SwMacroInfo::Clone( SdrObject* /*pObj*/ ) const return std::unique_ptr(new SwMacroInfo( *this )); } -std::unique_ptr SwWW8ImplReader::SetCurrentItemSet(SfxItemSet* pItemSet) +std::unique_ptr SwWW8ImplReader::SetCurrentItemSet(std::unique_ptr pItemSet) { std::unique_ptr 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 mxOldAnchorStck; std::unique_ptr mxOldRedlines; std::shared_ptr mxOldPlcxMan; - WW8FlyPara* const mpWFlyPara; - WW8SwFlyPara* const mpSFlyPara; + std::unique_ptr mpWFlyPara; + std::unique_ptr mpSFlyPara; SwPaM* const mpPreviousNumPaM; const SwNumRule* mpPrevNumRule; std::unique_ptr 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 SetCurrentItemSet(SfxItemSet* pItemSet); + std::unique_ptr SetCurrentItemSet(std::unique_ptr 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{})); // 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 xOldCurrentItemSet(SetCurrentItemSet(xListIndent.release())); + std::unique_ptr 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(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 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; -- cgit