diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-17 16:47:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-01-18 07:49:38 +0100 |
commit | a7fea048dddab17989eaf1097d400aa5bfadf78f (patch) | |
tree | 7e09492e0e150a2e650029359ebe44106c9df8bb /starmath/source/accessibility.cxx | |
parent | a7ea04397bf8c6749c84fe8f0d9afc80e4cf6bb2 (diff) |
use unique_ptr in starmath
Change-Id: Ib9c555507d5271343424686f2321ae13efcbf41a
Reviewed-on: https://gerrit.libreoffice.org/66550
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath/source/accessibility.cxx')
-rw-r--r-- | starmath/source/accessibility.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/starmath/source/accessibility.cxx b/starmath/source/accessibility.cxx index 85daa5092843..5c3a1a15314e 100644 --- a/starmath/source/accessibility.cxx +++ b/starmath/source/accessibility.cxx @@ -486,12 +486,12 @@ awt::Rectangle SAL_CALL SmGraphicAccessible::getCharacterBounds( sal_Int32 nInde Point aTLPos (pWin->GetFormulaDrawPos() + aOffset); Size aSize (pNode->GetSize()); - long* pXAry = new long[ aNodeText.getLength() ]; + std::unique_ptr<long[]> pXAry(new long[ aNodeText.getLength() ]); pWin->SetFont( pNode->GetFont() ); - pWin->GetTextArray( aNodeText, pXAry, 0, aNodeText.getLength() ); + pWin->GetTextArray( aNodeText, pXAry.get(), 0, aNodeText.getLength() ); aTLPos.AdjustX(nNodeIndex > 0 ? pXAry[nNodeIndex - 1] : 0 ); aSize.setWidth( nNodeIndex > 0 ? pXAry[nNodeIndex] - pXAry[nNodeIndex - 1] : pXAry[nNodeIndex] ); - delete[] pXAry; + pXAry.reset(); aTLPos = pWin->LogicToPixel( aTLPos ); aSize = pWin->LogicToPixel( aSize ); @@ -556,15 +556,15 @@ sal_Int32 SAL_CALL SmGraphicAccessible::getIndexAtPoint( const awt::Point& aPoin long nNodeX = pNode->GetLeft(); - long* pXAry = new long[ aTxt.getLength() ]; + std::unique_ptr<long[]> pXAry(new long[ aTxt.getLength() ]); pWin->SetFont( pNode->GetFont() ); - pWin->GetTextArray( aTxt, pXAry, 0, aTxt.getLength() ); + pWin->GetTextArray( aTxt, pXAry.get(), 0, aTxt.getLength() ); for (sal_Int32 i = 0; i < aTxt.getLength() && nRes == -1; ++i) { if (pXAry[i] + nNodeX > aPos.X()) nRes = i; } - delete[] pXAry; + pXAry.reset(); OSL_ENSURE( nRes >= 0 && nRes < aTxt.getLength(), "index out of range" ); OSL_ENSURE( pNode->GetAccessibleIndex() >= 0, "invalid accessible index" ); |