diff options
author | julien2412 <serval2412@yahoo.fr> | 2011-09-08 10:15:15 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-08 10:17:31 +0100 |
commit | 10094dc88bc3b16eb25454205e5db1f556f675dd (patch) | |
tree | f7772bd0486186930851e5e46fb7abc97e43a502 | |
parent | b66db1c73f494e74a8bf6c94544eccc01095528e (diff) |
fix dodgy assigns to const array param
-rw-r--r-- | filter/source/svg/svgwriter.cxx | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 1d04bbcfb7c9..2267b928820f 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -1118,8 +1118,6 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText, { sal_Int32 nLen = rText.Len(); Size aNormSize; - boost::shared_array<sal_Int32> xTmpArray; - sal_Int32* pDX; Point aPos; Point aBaseLinePos( rPos ); const FontMetric aMetric( mpVDev->GetFontMetric() ); @@ -1135,18 +1133,18 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText, else aPos = rPos; + boost::shared_array<sal_Int32> xTmpArray(new sal_Int32[nLen]); // get text sizes if( pDXArray ) { aNormSize = Size( mpVDev->GetTextWidth( rText ), 0 ); - pDX = const_cast< sal_Int32* >( pDXArray ); + memcpy(xTmpArray.get(), pDXArray, nLen * sizeof(sal_Int32)); } else { - xTmpArray.reset(new sal_Int32[ nLen ]); aNormSize = Size( mpVDev->GetTextArray( rText, xTmpArray.get() ), 0 ); - pDX = xTmpArray.get(); } + sal_Int32* pDX = xTmpArray.get(); // if text is rotated, set transform matrix at new g element if( rFont.GetOrientation() ) @@ -1253,7 +1251,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText, } if( bCont ) - nX = aPos.X() + pDXArray[ nCurPos - 1 ]; + nX = aPos.X() + pDX[ nCurPos - 1 ]; } } } |