forms/source/component/DatabaseForm.cxx | 8 ++++---- sw/source/core/doc/docedt.cxx | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-)
New commits: commit 867cfc57d8bcca1e1c9ea8e63595b618c55fc840 Author: Noel Grandin <[email protected]> AuthorDate: Tue Sep 11 15:21:22 2018 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Wed Sep 12 09:00:07 2018 +0200 loplugin:useuniqueptr in ODatabaseForm::GetDataMultiPartEncoded Change-Id: Ica70b20b84a8ada5b37cb6d23ce67096bd9ced2d Reviewed-on: https://gerrit.libreoffice.org/60352 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index afdd2a5e78a3..3a18e057949f 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -495,13 +495,13 @@ Sequence<sal_Int8> ODatabaseForm::GetDataMultiPartEncoded(const Reference<XContr // Copy MessageStream to SvStream SvMemoryStream aMemStream; - char* pBuf = new char[1025]; + std::unique_ptr<char[]> pBuf(new char[1025]); int nRead; - while( (nRead = aMessStream.Read(pBuf, 1024)) > 0 ) + while( (nRead = aMessStream.Read(pBuf.get(), 1024)) > 0 ) { - aMemStream.WriteBytes(pBuf, nRead); + aMemStream.WriteBytes(pBuf.get(), nRead); } - delete[] pBuf; + pBuf.reset(); aMemStream.Flush(); aMemStream.Seek( 0 ); commit 790c1e3facc67f11e102b5ae2aa879b3430022cb Author: Noel Grandin <[email protected]> AuthorDate: Mon Sep 10 14:42:28 2018 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Wed Sep 12 08:59:53 2018 +0200 loplugin:useuniqueptr in SwDoc::Spell Change-Id: Ida21e57093b42b6ceec9236ca2ad3990da31bd89 Reviewed-on: https://gerrit.libreoffice.org/60350 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 89454ea879ae..c8c66ee4fc11 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -496,17 +496,17 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, { SwPosition* pSttPos = rPaM.Start(), *pEndPos = rPaM.End(); - SwSpellArgs *pSpellArgs = nullptr; + std::unique_ptr<SwSpellArgs> pSpellArgs; if (pConvArgs) { pConvArgs->SetStart(pSttPos->nNode.GetNode().GetTextNode(), pSttPos->nContent); pConvArgs->SetEnd( pEndPos->nNode.GetNode().GetTextNode(), pEndPos->nContent ); } else - pSpellArgs = new SwSpellArgs( xSpeller, + pSpellArgs.reset(new SwSpellArgs( xSpeller, pSttPos->nNode.GetNode().GetTextNode(), pSttPos->nContent, pEndPos->nNode.GetNode().GetTextNode(), pEndPos->nContent, - bGrammarCheck ); + bGrammarCheck )); sal_uLong nCurrNd = pSttPos->nNode.GetIndex(); sal_uLong nEndNd = pEndPos->nNode.GetIndex(); @@ -573,7 +573,7 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, } sal_Int32 nSpellErrorPosition = pNd->GetTextNode()->GetText().getLength(); - if( (!pConvArgs && pNd->GetTextNode()->Spell( pSpellArgs )) || + if( (!pConvArgs && pNd->GetTextNode()->Spell( pSpellArgs.get() )) || ( pConvArgs && pNd->GetTextNode()->Convert( *pConvArgs ))) { // Cancel and remember position @@ -663,7 +663,6 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, else aRet <<= pSpellArgs->xSpellAlt; } - delete pSpellArgs; return aRet; } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
