summaryrefslogtreecommitdiff
path: root/cppcanvas/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-09-02 20:05:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-09-04 08:17:06 +0200
commitd4dc6b5cfdb02ad00a06ad32650948648abe010d (patch)
tree02446cd93e68aba9b78db6eb7fc902e782c6faf9 /cppcanvas/source
parent86fa9c907387e96c9c93f1e17239730271fedbfd (diff)
use std::vector for fetching DX array data
because I'm trying to track down a related heap corruption, and that is much easier if the access to the array is checked by the std::vector debug runtime Change-Id: Ia665f5cebb7f14d88942e88b4b400ad3c28ef5d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121527 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cppcanvas/source')
-rw-r--r--cppcanvas/source/mtfrenderer/implrenderer.cxx10
-rw-r--r--cppcanvas/source/mtfrenderer/textaction.cxx7
2 files changed, 8 insertions, 9 deletions
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 667e78546588..64ac3a164c86 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -2567,15 +2567,15 @@ namespace cppcanvas::internal
// generating a DX array, and uniformly
// distributing the excess/insufficient width
// to every logical character.
- std::unique_ptr< ::tools::Long []> pDXArray( new ::tools::Long[nLen] );
+ std::vector<::tools::Long> aDXArray;
- rVDev.GetTextArray( pAct->GetText(), pDXArray.get(),
+ rVDev.GetTextArray( pAct->GetText(), &aDXArray,
pAct->GetIndex(), pAct->GetLen() );
- const sal_Int32 nWidthDifference( pAct->GetWidth() - pDXArray[ nLen-1 ] );
+ const sal_Int32 nWidthDifference( pAct->GetWidth() - aDXArray[ nLen-1 ] );
// Last entry of pDXArray contains total width of the text
- ::tools::Long* p = pDXArray.get();
+ ::tools::Long* p = aDXArray.data();
for (sal_Int32 i = 1; i <= nLen; ++i)
{
// calc ratio for every array entry, to
@@ -2592,7 +2592,7 @@ namespace cppcanvas::internal
sText,
pAct->GetIndex(),
nLen,
- pDXArray.get(),
+ aDXArray.data(),
rFactoryParms,
bSubsettableActions );
}
diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx
index 0ffe14e3c04b..6af8984534e0 100644
--- a/cppcanvas/source/mtfrenderer/textaction.cxx
+++ b/cppcanvas/source/mtfrenderer/textaction.cxx
@@ -186,12 +186,11 @@ namespace cppcanvas::internal
{
// no external DX array given, create one from given
// string
- std::unique_ptr< ::tools::Long []> pCharWidths( new ::tools::Long[nLen] );
+ std::vector<::tools::Long> aCharWidths;
- rVDev.GetTextArray( rText, pCharWidths.get(),
- nStartPos, nLen );
+ rVDev.GetTextArray( rText, &aCharWidths, nStartPos, nLen );
- return setupDXArray( pCharWidths.get(), nLen, rState );
+ return setupDXArray( aCharWidths.data(), nLen, rState );
}
::basegfx::B2DPoint adaptStartPoint( const ::basegfx::B2DPoint& rStartPoint,