diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-10 13:36:34 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-11-11 07:16:20 +0000 |
commit | db17d3c17c40d6b0e92392cf3c6e343d1d17b771 (patch) | |
tree | 9d562fcf764e7717df9585ef0e735a12ea4aaa16 /sc/source/ui | |
parent | 2ce9e4be4a438203382cb9cca824ce3e90647f3a (diff) |
new loplugin: memoryvar
detect when we can convert a new/delete sequence on a local variable to
use std::unique_ptr
Change-Id: Iecae4e4197eccdfacfce2eed39aa4a69e4a660bc
Reviewed-on: https://gerrit.libreoffice.org/19884
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/unoobj/funcuno.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 5dc09a3d9c66..411f88beb1cb 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -45,6 +45,7 @@ #include "dociter.hxx" #include "stringutil.hxx" #include "tokenarray.hxx" +#include <memory> using namespace com::sun::star; @@ -148,12 +149,12 @@ static bool lcl_CopyData( ScDocument* pSrcDoc, const ScRange& rSrcRange, rSrcRange.aEnd.Row() - rSrcRange.aStart.Row() + rDestPos.Row(), nDestTab ) ); - ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP ); + std::unique_ptr<ScDocument> pClipDoc(new ScDocument( SCDOCMODE_CLIP )); ScMarkData aSourceMark; aSourceMark.SelectOneTable( nSrcTab ); // for CopyToClip aSourceMark.SetMarkArea( rSrcRange ); ScClipParam aClipParam(rSrcRange, false); - pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aSourceMark); + pSrcDoc->CopyToClip(aClipParam, pClipDoc.get(), &aSourceMark); if ( pClipDoc->HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab, HASATTR_MERGED | HASATTR_OVERLAPPED ) ) @@ -167,9 +168,8 @@ static bool lcl_CopyData( ScDocument* pSrcDoc, const ScRange& rSrcRange, ScMarkData aDestMark; aDestMark.SelectOneTable( nDestTab ); aDestMark.SetMarkArea( aNewRange ); - pDestDoc->CopyFromClip( aNewRange, aDestMark, InsertDeleteFlags::ALL & ~InsertDeleteFlags::FORMULA, nullptr, pClipDoc, false ); + pDestDoc->CopyFromClip( aNewRange, aDestMark, InsertDeleteFlags::ALL & ~InsertDeleteFlags::FORMULA, nullptr, pClipDoc.get(), false ); - delete pClipDoc; return true; } |