diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-29 10:56:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-06 10:36:09 +0100 |
commit | 6c9cae12f63ed2e48c7167782c13c6721990f393 (patch) | |
tree | 429eb7f6ec28b8537ac465902f726a975e2d42ef /editeng | |
parent | 1692bda118f234608ccec0697f9d7b6f6bd86b6d (diff) |
loplugin:useuniqueptr in TextRanger
Change-Id: I176da69a399eab0169c5fdddd454912672a92fba
Reviewed-on: https://gerrit.libreoffice.org/49267
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/misc/txtrange.cxx | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx index d7805ba40559..312d642f3d95 100644 --- a/editeng/source/misc/txtrange.cxx +++ b/editeng/source/misc/txtrange.cxx @@ -44,7 +44,7 @@ TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, bVertical( bVert ) { sal_uInt32 nCount(rPolyPolygon.count()); - mpPolyPolygon = new tools::PolyPolygon( static_cast<sal_uInt16>(nCount) ); + mpPolyPolygon.reset( new tools::PolyPolygon( static_cast<sal_uInt16>(nCount) ) ); for(sal_uInt32 i(0); i < nCount; i++) { @@ -56,7 +56,7 @@ TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, if( pLinePolyPolygon ) { nCount = pLinePolyPolygon->count(); - mpLinePolyPolygon = new tools::PolyPolygon(); + mpLinePolyPolygon.reset( new tools::PolyPolygon() ); for(sal_uInt32 i(0); i < nCount; i++) { @@ -73,9 +73,6 @@ TextRanger::TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon, TextRanger::~TextRanger() { mRangeCache.clear(); - delete mpPolyPolygon; - delete mpLinePolyPolygon; - delete pBound; } /* TextRanger::SetVertical(..) @@ -646,7 +643,7 @@ LongDqPtr TextRanger::GetTextRanges( const Range& rRange ) SvxBoundArgs aArg( this, &(rngCache.results), rRange ); aArg.Calc( *mpPolyPolygon ); if( mpLinePolyPolygon ) - aArg.Concat( mpLinePolyPolygon ); + aArg.Concat( mpLinePolyPolygon.get() ); //Add new result to the cache mRangeCache.push_back(rngCache); if (mRangeCache.size() > nCacheSize) @@ -657,7 +654,7 @@ LongDqPtr TextRanger::GetTextRanges( const Range& rRange ) const tools::Rectangle& TextRanger::GetBoundRect_() { DBG_ASSERT( nullptr == pBound, "Don't call twice." ); - pBound = new tools::Rectangle( mpPolyPolygon->GetBoundRect() ); + pBound.reset( new tools::Rectangle( mpPolyPolygon->GetBoundRect() ) ); return *pBound; } |