[Libreoffice-commits] core.git: 2 commits - sc/inc sc/source sw/source
Noel Grandin
noel.grandin at collabora.co.uk
Wed Apr 4 06:30:38 UTC 2018
sc/inc/progress.hxx | 2 +-
sc/source/core/tool/progress.cxx | 6 +++---
sw/source/core/edit/acorrect.cxx | 7 +++----
sw/source/core/inc/acorrect.hxx | 2 +-
4 files changed, 8 insertions(+), 9 deletions(-)
New commits:
commit 4fa280ced35631d5b51a2ac426912090e26ab903
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Apr 3 14:35:14 2018 +0200
loplugin:useuniqueptr in SwAutoCorrDoc
Change-Id: I1ec0a760c10b7e1da9d1c2a106bba60d84ff23f4
Reviewed-on: https://gerrit.libreoffice.org/52343
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index d2595462212f..709db86d2b76 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -83,7 +83,7 @@ void PaMIntoCursorShellRing::RemoveFromRing( SwPaM& rPam, SwPaM const * pPrev )
SwAutoCorrDoc::SwAutoCorrDoc( SwEditShell& rEditShell, SwPaM& rPam,
sal_Unicode cIns )
- : rEditSh( rEditShell ), rCursor( rPam ), pIdx( nullptr )
+ : rEditSh( rEditShell ), rCursor( rPam )
, m_nEndUndoCounter(0)
, bUndoIdInitialized( cIns == 0 )
{
@@ -95,7 +95,6 @@ SwAutoCorrDoc::~SwAutoCorrDoc()
{
rEditSh.EndUndo();
}
- delete pIdx;
}
void SwAutoCorrDoc::DeleteSel( SwPaM& rDelPam )
@@ -276,7 +275,7 @@ OUString const* SwAutoCorrDoc::GetPrevPara(bool const bAtNormalPos)
OUString const* pStr(nullptr);
if( bAtNormalPos || !pIdx )
- pIdx = new SwNodeIndex( rCursor.GetPoint()->nNode, -1 );
+ pIdx.reset(new SwNodeIndex( rCursor.GetPoint()->nNode, -1 ));
else
--(*pIdx);
@@ -360,7 +359,7 @@ bool SwAutoCorrDoc::ChgAutoCorrWord( sal_Int32& rSttPos, sal_Int32 nEndPos,
if( pPara )
{
OSL_ENSURE( !pIdx, "who has not deleted his Index?" );
- pIdx = new SwNodeIndex( rCursor.GetPoint()->nNode, -1 );
+ pIdx.reset(new SwNodeIndex( rCursor.GetPoint()->nNode, -1 ));
}
SwDoc* pAutoDoc = aTBlks.GetDoc();
diff --git a/sw/source/core/inc/acorrect.hxx b/sw/source/core/inc/acorrect.hxx
index f2382dbeddde..caae1184e99f 100644
--- a/sw/source/core/inc/acorrect.hxx
+++ b/sw/source/core/inc/acorrect.hxx
@@ -48,7 +48,7 @@ class SwAutoCorrDoc : public SvxAutoCorrDoc
{
SwEditShell& rEditSh;
SwPaM& rCursor;
- SwNodeIndex* pIdx;
+ std::unique_ptr<SwNodeIndex> pIdx;
int m_nEndUndoCounter;
bool bUndoIdInitialized;
commit a9d6a2584fcd36fd9e91b7339b38cc6bd524361a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Apr 3 14:31:11 2018 +0200
loplugin:useuniqueptr in ScProgress
Change-Id: I92d3c3c52b5735de915db1a208cb7c0d68b4c7a0
Reviewed-on: https://gerrit.libreoffice.org/52342
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/inc/progress.hxx b/sc/inc/progress.hxx
index 89fe38a40340..68cda2341bfb 100644
--- a/sc/inc/progress.hxx
+++ b/sc/inc/progress.hxx
@@ -50,7 +50,7 @@ private:
static bool bIdleWasEnabled;
bool bEnabled;
- SfxProgress* pProgress;
+ std::unique_ptr<SfxProgress> pProgress;
ScProgress( const ScProgress& ) = delete;
ScProgress& operator=( const ScProgress& ) = delete;
diff --git a/sc/source/core/tool/progress.cxx b/sc/source/core/tool/progress.cxx
index b6b09e98bacb..12ac9d857d90 100644
--- a/sc/source/core/tool/progress.cxx
+++ b/sc/source/core/tool/progress.cxx
@@ -106,8 +106,8 @@ ScProgress::ScProgress(SfxObjectShell* pObjSh, const OUString& rText,
}
else
{
- pProgress = new SfxProgress( pObjSh, rText, nRange, bWait );
- pGlobalProgress = pProgress;
+ pProgress.reset(new SfxProgress( pObjSh, rText, nRange, bWait ));
+ pGlobalProgress = pProgress.get();
nGlobalRange = nRange;
nGlobalPercent = 0;
}
@@ -124,7 +124,7 @@ ScProgress::~ScProgress()
{
if ( pProgress )
{
- delete pProgress;
+ pProgress.reset();
pGlobalProgress = nullptr;
nGlobalRange = 0;
nGlobalPercent = 0;
More information about the Libreoffice-commits
mailing list