diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-01-02 20:27:09 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-01-02 20:32:43 +0000 |
commit | aa330a9ddcbb4e1b2ca091f33c9d3573555aa475 (patch) | |
tree | 42c20e9fca9f2236b5423607baf329fd656efc0d /cppcanvas | |
parent | cppcheck: noExplicitConstructor (diff) | |
download | core-aa330a9ddcbb4e1b2ca091f33c9d3573555aa475.tar.gz core-aa330a9ddcbb4e1b2ca091f33c9d3573555aa475.zip |
cppcheck: allocaCalled
Change-Id: I253f71f851621d8a3d1244468b9da63ba2d10b09
Diffstat (limited to 'cppcanvas')
-rw-r--r-- | cppcanvas/source/mtfrenderer/emfplus.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index e165e9e4a098..0b31a3a96a87 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -35,7 +35,6 @@ #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <vcl/canvastools.hxx> #include <rtl/ustring.hxx> -#include <sal/alloca.h> #include <com/sun/star/rendering/PathCapType.hpp> #include <com/sun/star/rendering/PathJoinType.hpp> @@ -1180,14 +1179,16 @@ namespace cppcanvas SAL_INFO("cppcanvas.emf", "EMF+\tfont\nEMF+\theader: 0x" << std::hex << (header >> 12) << " version: 0x" << (header & 0x1fff) << " size: " << std::dec << emSize << " unit: 0x" << std::hex << sizeUnit << std::dec); SAL_INFO("cppcanvas.emf", "EMF+\tflags: 0x" << std::hex << fontFlags << " reserved: 0x" << reserved << " length: 0x" << std::hex << length << std::dec); - if( length > 0 && length < 0x4000 ) { - sal_Unicode *chars = static_cast<sal_Unicode *>(alloca( sizeof( sal_Unicode ) * length )); + if (length > 0 && length < 0x4000) + { + rtl_uString *pStr = rtl_uString_alloc(length); + sal_Unicode *chars = pStr->buffer; - for( sal_uInt32 i = 0; i < length; i++ ) - s.ReadUtf16( chars[ i ] ); + for (sal_uInt32 i = 0; i < length; ++i) + s.ReadUtf16(chars[i]); - family = OUString( chars, length ); - SAL_INFO("cppcanvas.emf", "EMF+\tfamily: " << OUStringToOString( family, RTL_TEXTENCODING_UTF8).getStr()); // TODO: can we just use family? + family = OUString(pStr, SAL_NO_ACQUIRE); + SAL_INFO("cppcanvas.emf", "EMF+\tfamily: " << family); } } }; |