[Libreoffice-commits] core.git: sw/inc sw/source
Michael Stahl
mstahl at redhat.com
Wed Feb 14 09:13:17 UTC 2018
sw/inc/undobj.hxx | 4 ++--
sw/source/core/undo/undobj.cxx | 22 +++++++++++-----------
2 files changed, 13 insertions(+), 13 deletions(-)
New commits:
commit c77429bc28e3baf2f20c5e3fa313abad943f2335
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Feb 13 17:30:47 2018 +0100
sw: replace DELETEZ with unique_ptr in SwUndoSaveSection
Change-Id: Ic57736a6d1349574f779afc26b8785caf575cf06
Reviewed-on: https://gerrit.libreoffice.org/49674
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index f71f8873e1e1..48a576dca537 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -185,13 +185,13 @@ public:
// Save a complete section in nodes-array.
class SwUndoSaveSection : private SwUndoSaveContent
{
- SwNodeIndex *pMvStt;
+ std::unique_ptr<SwNodeIndex> m_pMovedStart;
SwRedlineSaveDatas* pRedlSaveData;
sal_uLong nMvLen; // Index into UndoNodes-Array.
sal_uLong nStartPos;
protected:
- SwNodeIndex* GetMvSttIdx() const { return pMvStt; }
+ SwNodeIndex* GetMvSttIdx() const { return m_pMovedStart.get(); }
sal_uLong GetMvNodeCnt() const { return nMvLen; }
public:
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index bb6e1c50af90..4c624a6018f8 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1181,19 +1181,19 @@ void SwUndoSaveContent::DelContentIndex( const SwPosition& rMark,
// save a complete section into UndoNodes array
SwUndoSaveSection::SwUndoSaveSection()
- : pMvStt( nullptr ), pRedlSaveData( nullptr ), nMvLen( 0 ), nStartPos( ULONG_MAX )
+ : pRedlSaveData( nullptr ), nMvLen( 0 ), nStartPos( ULONG_MAX )
{
}
SwUndoSaveSection::~SwUndoSaveSection()
{
- if( pMvStt ) // delete also the section from UndoNodes array
+ if (m_pMovedStart) // delete also the section from UndoNodes array
{
// SaveSection saves the content in the PostIt section.
- SwNodes& rUNds = pMvStt->GetNode().GetNodes();
- rUNds.Delete( *pMvStt, nMvLen );
+ SwNodes& rUNds = m_pMovedStart->GetNode().GetNodes();
+ rUNds.Delete( *m_pMovedStart, nMvLen );
- delete pMvStt;
+ m_pMovedStart.reset();
}
delete pRedlSaveData;
}
@@ -1239,9 +1239,9 @@ void SwUndoSaveSection::SaveSection(
// Keep positions as SwIndex so that this section can be deleted in DTOR
sal_uLong nEnd;
- pMvStt = new SwNodeIndex( rRange.aStart );
- MoveToUndoNds(aPam, pMvStt, &nEnd);
- nMvLen = nEnd - pMvStt->GetIndex() + 1;
+ m_pMovedStart.reset(new SwNodeIndex(rRange.aStart));
+ MoveToUndoNds(aPam, m_pMovedStart.get(), &nEnd);
+ nMvLen = nEnd - m_pMovedStart->GetIndex() + 1;
}
void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, SwNodeIndex* pIdx,
@@ -1268,11 +1268,11 @@ void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, const SwNodeIndex& rInsPos
if( ULONG_MAX != nStartPos ) // was there any content?
{
SwPosition aInsPos( rInsPos );
- sal_uLong nEnd = pMvStt->GetIndex() + nMvLen - 1;
- MoveFromUndoNds(*pDoc, pMvStt->GetIndex(), aInsPos, &nEnd);
+ sal_uLong nEnd = m_pMovedStart->GetIndex() + nMvLen - 1;
+ MoveFromUndoNds(*pDoc, m_pMovedStart->GetIndex(), aInsPos, &nEnd);
// destroy indices again, content was deleted from UndoNodes array
- DELETEZ( pMvStt );
+ m_pMovedStart.reset();
nMvLen = 0;
if( pRedlSaveData )
More information about the Libreoffice-commits
mailing list