diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-29 11:08:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-05 07:50:28 +0100 |
commit | add8b7099394e0754693af5a89d148ddc118182e (patch) | |
tree | 4f10e9aa2e51a05b4fb525f7b41ef2a37cd62d75 /editeng | |
parent | 76643b208c7f0c43b0603e08a3b37f29878c42ea (diff) |
loplugin:useuniqueptr in SvxRTFItemStackType
Change-Id: I1677915d91fb151997d4bef18473f33ab2f09648
Reviewed-on: https://gerrit.libreoffice.org/49173
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/rtf/svxrtf.cxx | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx index 3e2b8da1fd6e..b9d6dd33a887 100644 --- a/editeng/source/rtf/svxrtf.cxx +++ b/editeng/source/rtf/svxrtf.cxx @@ -945,9 +945,9 @@ SvxRTFItemStackType::SvxRTFItemStackType( , m_pChildList( nullptr ) , nStyleNo( 0 ) { - pSttNd = rPos.MakeNodeIdx(); + pSttNd.reset( rPos.MakeNodeIdx() ); nSttCnt = rPos.GetCntIdx(); - pEndNd = pSttNd; + pEndNd = pSttNd.get(); nEndCnt = nSttCnt; } @@ -959,9 +959,9 @@ SvxRTFItemStackType::SvxRTFItemStackType( , m_pChildList( nullptr ) , nStyleNo( rCpy.nStyleNo ) { - pSttNd = rPos.MakeNodeIdx(); + pSttNd.reset( rPos.MakeNodeIdx() ); nSttCnt = rPos.GetCntIdx(); - pEndNd = pSttNd; + pEndNd = pSttNd.get(); nEndCnt = nSttCnt; aAttrSet.SetParent( &rCpy.aAttrSet ); @@ -971,26 +971,23 @@ SvxRTFItemStackType::SvxRTFItemStackType( SvxRTFItemStackType::~SvxRTFItemStackType() { - delete m_pChildList; - if( pSttNd != pEndNd ) + if( pSttNd.get() != pEndNd ) delete pEndNd; - delete pSttNd; } void SvxRTFItemStackType::Add(std::unique_ptr<SvxRTFItemStackType> pIns) { if (!m_pChildList) - m_pChildList = new SvxRTFItemStackList; + m_pChildList.reset( new SvxRTFItemStackList ); m_pChildList->push_back(std::move(pIns)); } void SvxRTFItemStackType::SetStartPos( const EditPosition& rPos ) { - if (pSttNd != pEndNd) + if (pSttNd.get() != pEndNd) delete pEndNd; - delete pSttNd; - pSttNd = rPos.MakeNodeIdx(); - pEndNd = pSttNd; + pSttNd.reset(rPos.MakeNodeIdx() ); + pEndNd = pSttNd.get(); nSttCnt = rPos.GetCntIdx(); } @@ -1074,8 +1071,7 @@ void SvxRTFItemStackType::Compress( const SvxRTFParser& rParser ) } if (m_pChildList->empty()) { - delete m_pChildList; - m_pChildList = nullptr; + m_pChildList.reset(); } } void SvxRTFItemStackType::SetRTFDefaults( const SfxItemSet& rDefaults ) |