[Libreoffice-commits] core.git: vcl/generic

Stephan Bergmann sbergman at redhat.com
Tue Jan 27 04:57:09 PST 2015


 vcl/generic/print/genpspgraphics.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit aedcd7684b23166e700ef816c68d6d049f5cf0fa
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 27 13:56:27 2015 +0100

    error: variable length array of non-POD element type
    
    Change-Id: I65fa98537d883057285c24608582d1facbed2ca0

diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index 2269bcb..f5c24af 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -17,6 +17,10 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <vector>
+
 #include <sal/types.h>
 
 // for mmap etc.
@@ -1243,7 +1247,7 @@ const void* GenPspGraphics::DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs
     int xMin, yMin, xMax, yMax;
     rMgr.getFontBoundingBox( aFont, xMin, yMin, xMax, yMax );
 
-    psp::CharacterMetric aMetrics[nLen];
+    std::vector<psp::CharacterMetric> aMetrics(nLen);
     sal_Ucs aUnicodes[nLen];
     if( aFontInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL && aFontInfo.m_eType == psp::fonttype::Type1 )
     {
@@ -1251,7 +1255,8 @@ const void* GenPspGraphics::DoGetEmbedFontData( psp::fontID aFont, const sal_Ucs
             aUnicodes[i] = pUnicodes[i] < 0x0100 ? pUnicodes[i] + 0xf000 : pUnicodes[i];
         pUnicodes = aUnicodes;
     }
-    if (!rMgr.getMetrics(aFont, pUnicodes, nLen, aMetrics))
+    if (!rMgr.getMetrics(
+            aFont, pUnicodes, nLen, nLen == 0 ? nullptr : &aMetrics[0]))
         return NULL;
 
     OString aSysPath = rMgr.getFontFileSysPath( aFont );


More information about the Libreoffice-commits mailing list