diff options
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/source/matrix/b2dhommatrix.cxx | 10 | ||||
-rw-r--r-- | basegfx/source/matrix/b3dhommatrix.cxx | 10 |
2 files changed, 8 insertions, 12 deletions
diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx index 2dce96fb2379..7e228ca48dea 100644 --- a/basegfx/source/matrix/b2dhommatrix.cxx +++ b/basegfx/source/matrix/b2dhommatrix.cxx @@ -24,6 +24,7 @@ #include <basegfx/tuple/b2dtuple.hxx> #include <basegfx/vector/b2dvector.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <memory> namespace basegfx { @@ -123,18 +124,15 @@ namespace basegfx bool B2DHomMatrix::invert() { Impl2DHomMatrix aWork(*mpImpl); - sal_uInt16* pIndex = new sal_uInt16[Impl2DHomMatrix_Base::getEdgeLength()]; + std::unique_ptr<sal_uInt16[]> pIndex( new sal_uInt16[Impl2DHomMatrix_Base::getEdgeLength()] ); sal_Int16 nParity; - if(aWork.ludcmp(pIndex, nParity)) + if(aWork.ludcmp(pIndex.get(), nParity)) { - mpImpl->doInvert(aWork, pIndex); - delete[] pIndex; - + mpImpl->doInvert(aWork, pIndex.get()); return true; } - delete[] pIndex; return false; } diff --git a/basegfx/source/matrix/b3dhommatrix.cxx b/basegfx/source/matrix/b3dhommatrix.cxx index e0c049c5bf55..919a00c9fb50 100644 --- a/basegfx/source/matrix/b3dhommatrix.cxx +++ b/basegfx/source/matrix/b3dhommatrix.cxx @@ -21,6 +21,7 @@ #include <basegfx/matrix/b3dhommatrix.hxx> #include <hommatrixtemplate.hxx> #include <basegfx/vector/b3dvector.hxx> +#include <memory> namespace basegfx { @@ -94,18 +95,15 @@ namespace basegfx bool B3DHomMatrix::invert() { Impl3DHomMatrix aWork(*mpImpl); - sal_uInt16* pIndex = new sal_uInt16[Impl3DHomMatrix_Base::getEdgeLength()]; + std::unique_ptr<sal_uInt16[]> pIndex( new sal_uInt16[Impl3DHomMatrix_Base::getEdgeLength()] ); sal_Int16 nParity; - if(aWork.ludcmp(pIndex, nParity)) + if(aWork.ludcmp(pIndex.get(), nParity)) { - mpImpl->doInvert(aWork, pIndex); - delete[] pIndex; - + mpImpl->doInvert(aWork, pIndex.get()); return true; } - delete[] pIndex; return false; } |