diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-09 12:24:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-10 08:16:19 +0100 |
commit | 50887c9010515fe9fe61b3067f502cd28333773a (patch) | |
tree | bf927a1dc6a920c7ca299ef10020b7717787bda6 /sc/source/core | |
parent | 6d8594950bea25175e62f38981d84811cff64b8b (diff) |
use unique_ptr in ScRangeUtil::IsAbsTabArea
Change-Id: I3a5f88eef1e7a8241921f2fed15a1ebc2c4c3445
Reviewed-on: https://gerrit.libreoffice.org/66006
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/core')
-rw-r--r-- | sc/source/core/tool/rangeutl.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx index 5d6f74ef5b71..a29b33907869 100644 --- a/sc/source/core/tool/rangeutl.cxx +++ b/sc/source/core/tool/rangeutl.cxx @@ -86,7 +86,7 @@ void ScRangeUtil::CutPosString( const OUString& theAreaStr, bool ScRangeUtil::IsAbsTabArea( const OUString& rAreaStr, const ScDocument* pDoc, - ScArea*** pppAreas, + std::unique_ptr<ScArea[]>* ppAreas, sal_uInt16* pAreaCount, bool /* bAcceptCellRef */, ScAddress::Details const & rDetails ) @@ -143,12 +143,12 @@ bool ScRangeUtil::IsAbsTabArea( const OUString& rAreaStr, bStrOk = true; - if ( pppAreas && pAreaCount ) // Array returned ? + if ( ppAreas && pAreaCount ) // Array returned ? { SCTAB nStartTab = aStartPos.Tab(); SCTAB nEndTab = aEndPos.Tab(); sal_uInt16 nTabCount = static_cast<sal_uInt16>(nEndTab-nStartTab+1); - ScArea** theAreas = new ScArea*[nTabCount]; + ppAreas->reset(new ScArea[nTabCount]); SCTAB nTab = 0; sal_uInt16 i = 0; ScArea theArea( 0, aStartPos.Col(), aStartPos.Row(), @@ -157,11 +157,10 @@ bool ScRangeUtil::IsAbsTabArea( const OUString& rAreaStr, nTab = nStartTab; for ( i=0; i<nTabCount; i++ ) { - theAreas[i] = new ScArea( theArea ); - theAreas[i]->nTab = nTab; + (*ppAreas)[i] = theArea; + (*ppAreas)[i].nTab = nTab; nTab++; } - *pppAreas = theAreas; *pAreaCount = nTabCount; } } |