diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-09-28 23:23:47 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-09-29 14:57:40 +0200 |
commit | 8f3d411f46e1bdd1543633cf9b5a729cf89f79f3 (patch) | |
tree | 014653d8537b63cb0e08b179ecb63b3e37c940c1 /toolkit | |
parent | 54bb97aa30d29865bf4b9826db7c7ec0607e7992 (diff) |
toolkit: convert alloca() to std::unique_ptr
Change-Id: Ie50b4a1a189fffdaa6a0b26040c2e7c4cc42cd69
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/awt/vclxfont.cxx | 5 | ||||
-rw-r--r-- | toolkit/source/awt/vclxgraphics.cxx | 5 |
2 files changed, 4 insertions, 6 deletions
diff --git a/toolkit/source/awt/vclxfont.cxx b/toolkit/source/awt/vclxfont.cxx index a4b0c73a2d2a..acdae579408d 100644 --- a/toolkit/source/awt/vclxfont.cxx +++ b/toolkit/source/awt/vclxfont.cxx @@ -26,7 +26,6 @@ #include <cppuhelper/queryinterface.hxx> #include <rtl/uuid.h> #include <rtl/ustring.h> -#include <sal/alloca.h> #include <vcl/outdev.hxx> #include <vcl/svapp.hxx> @@ -179,8 +178,8 @@ sal_Int32 VCLXFont::getStringWidthArray( const OUString& str, ::com::sun::star:: { vcl::Font aOldFont = pOutDev->GetFont(); pOutDev->SetFont( maFont ); - long* pDXA = static_cast<long*>(alloca(str.getLength() * sizeof(long))); - nRet = pOutDev->GetTextArray( str, pDXA ); + std::unique_ptr<long []> pDXA(new long[str.getLength()]); + nRet = pOutDev->GetTextArray( str, pDXA.get() ); rDXArray = ::com::sun::star::uno::Sequence<sal_Int32>( str.getLength() ); for(int i = 0; i < str.getLength(); i++) { diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx index 482e29c47021..4e2268f9dc73 100644 --- a/toolkit/source/awt/vclxgraphics.cxx +++ b/toolkit/source/awt/vclxgraphics.cxx @@ -26,7 +26,6 @@ #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/queryinterface.hxx> #include <rtl/uuid.h> -#include <sal/alloca.h> #include <vcl/svapp.hxx> #include <vcl/outdev.hxx> @@ -497,12 +496,12 @@ void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const OUString& rTex if( mpOutputDevice ) { InitOutputDevice( InitOutDevFlags::CLIPREGION|InitOutDevFlags::RASTEROP|InitOutDevFlags::COLORS|InitOutDevFlags::FONT ); - long* pDXA = static_cast<long*>(alloca(rText.getLength() * sizeof(long))); + std::unique_ptr<long []> pDXA(new long[rText.getLength()]); for(int i = 0; i < rText.getLength(); i++) { pDXA[i] = rLongs[i]; } - mpOutputDevice->DrawTextArray( Point( x, y ), rText, pDXA ); + mpOutputDevice->DrawTextArray( Point( x, y ), rText, pDXA.get() ); } } |