[Libreoffice-commits] core.git: 2 commits - chart2/source connectivity/source cppcanvas/source cui/source dbaccess/source hwpfilter/source

Caolán McNamara caolanm at redhat.com
Sat Jan 2 12:45:53 PST 2016


 chart2/source/view/main/DummyXShape.hxx                |    2 
 connectivity/source/commontools/RowFunctionParser.cxx  |    4 -
 cppcanvas/source/mtfrenderer/emfplus.cxx               |   15 +++----
 cui/source/options/optgenrl.cxx                        |    2 
 dbaccess/source/core/dataaccess/myucp_datasupplier.cxx |    8 ++-
 dbaccess/source/core/dataaccess/myucp_datasupplier.hxx |    2 
 hwpfilter/source/grammar.cxx                           |   35 +----------------
 7 files changed, 21 insertions(+), 47 deletions(-)

New commits:
commit aa330a9ddcbb4e1b2ca091f33c9d3573555aa475
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 2 20:27:09 2016 +0000

    cppcheck: allocaCalled
    
    Change-Id: I253f71f851621d8a3d1244468b9da63ba2d10b09

diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index e165e9e..0b31a3a 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);
                 }
             }
         };
diff --git a/hwpfilter/source/grammar.cxx b/hwpfilter/source/grammar.cxx
index b72e404..2821458 100644
--- a/hwpfilter/source/grammar.cxx
+++ b/hwpfilter/source/grammar.cxx
@@ -362,33 +362,6 @@ static const short yycheck[] = {    11,
   It was written by Richard Stallman by simplifying the hairy parser
   used when %semantic_parser is specified.  */
 
-#ifndef YYSTACK_USE_ALLOCA
-#ifdef alloca
-#define YYSTACK_USE_ALLOCA
-#else /* alloca not defined */
-#ifdef __GNUC__
-#define YYSTACK_USE_ALLOCA
-#define alloca __builtin_alloca
-#else /* not GNU C.  */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || (defined (__sun) && defined (__i386))
-#define YYSTACK_USE_ALLOCA
-#include <sal/alloca.h>
-#else /* not sparc */
-#if defined(_AIX)
- #pragma alloca
-#define YYSTACK_USE_ALLOCA
-#endif /* not _AIX */
-#endif /* not sparc */
-#endif /* not GNU C */
-#endif /* alloca not defined */
-#endif /* YYSTACK_USE_ALLOCA not defined */
-
-#ifdef YYSTACK_USE_ALLOCA
-#define YYSTACK_ALLOC alloca
-#else
-#define YYSTACK_ALLOC malloc
-#endif
-
 /* Note: there must be only one dollar sign in this file.
    It is replaced by the list of actions, each action
    as one case of the switch.  */
@@ -612,17 +585,15 @@ yynewstate:
       yystacksize *= 2;
       if (yystacksize > YYMAXDEPTH)
     yystacksize = YYMAXDEPTH;
-#ifndef YYSTACK_USE_ALLOCA
       yyfree_stacks = 1;
-#endif
-      yyss = static_cast<short *>(YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)));
+      yyss = static_cast<short *>(malloc (yystacksize * sizeof (*yyssp)));
       memcpy (yyss, yyss1,
            size * (unsigned int) sizeof (*yyssp));
-      yyvs = static_cast<YYSTYPE *>(YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)));
+      yyvs = static_cast<YYSTYPE *>(malloc (yystacksize * sizeof (*yyvsp)));
       memcpy (yyvs, yyvs1,
            size * (unsigned int) sizeof (*yyvsp));
 #ifdef YYLSP_NEEDED
-      yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
+      yyls = (YYLTYPE *) malloc (yystacksize * sizeof (*yylsp));
       memcpy ((char *)yyls, (char *)yyls1,
            size * (unsigned int) sizeof (*yylsp));
 #endif
commit f61d3bc92c5a3556f59347a84769ce04d3b22752
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 2 20:24:38 2016 +0000

    cppcheck: noExplicitConstructor
    
    Change-Id: Ic6407a57440fbd887f9ec9d5963e5748aa89a29e

diff --git a/chart2/source/view/main/DummyXShape.hxx b/chart2/source/view/main/DummyXShape.hxx
index 993b96e..67bcb80 100644
--- a/chart2/source/view/main/DummyXShape.hxx
+++ b/chart2/source/view/main/DummyXShape.hxx
@@ -276,7 +276,7 @@ public:
 class DummyLine3D : public DummyXShape
 {
 public:
-    DummyLine3D(const VLineProperties& rProperties);
+    explicit DummyLine3D(const VLineProperties& rProperties);
 };
 
 class DummyLine2D : public DummyXShape
diff --git a/connectivity/source/commontools/RowFunctionParser.cxx b/connectivity/source/commontools/RowFunctionParser.cxx
index 9490b67..d287b3a 100644
--- a/connectivity/source/commontools/RowFunctionParser.cxx
+++ b/connectivity/source/commontools/RowFunctionParser.cxx
@@ -247,8 +247,8 @@ class UnaryFunctionFunctor
 
 public:
 
-    UnaryFunctionFunctor( const ParserContextSharedPtr& rContext ) :
-        mpContext( rContext )
+    explicit UnaryFunctionFunctor(const ParserContextSharedPtr& rContext)
+        : mpContext(rContext)
     {
     }
     void operator()( StringIteratorT, StringIteratorT ) const
diff --git a/cui/source/options/optgenrl.cxx b/cui/source/options/optgenrl.cxx
index 8703b98..bd67adb 100644
--- a/cui/source/options/optgenrl.cxx
+++ b/cui/source/options/optgenrl.cxx
@@ -166,7 +166,7 @@ struct SvxGeneralTabPage::Row
     unsigned nFirstField, nLastField;
 
 public:
-    Row (FixedText *pLabel_)
+    explicit Row (FixedText *pLabel_)
         : pLabel(pLabel_)
         , nFirstField(0)
         , nLastField(0)
diff --git a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
index ec36d0f..a9ea47f 100644
--- a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
+++ b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx
@@ -65,9 +65,11 @@ struct DataSupplier_Impl
     rtl::Reference< ODocumentContainer >         m_xContent;
     bool                                         m_bCountFinal;
 
-    DataSupplier_Impl( const rtl::Reference< ODocumentContainer >& rContent )
-    : m_xContent(rContent)
-    , m_bCountFinal( false ) {}
+    explicit DataSupplier_Impl(const rtl::Reference< ODocumentContainer >& rContent)
+        : m_xContent(rContent)
+        , m_bCountFinal(false)
+    {
+    }
     ~DataSupplier_Impl();
 };
 
diff --git a/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx b/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx
index 0fe8603..c7f139e 100644
--- a/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx
+++ b/dbaccess/source/core/dataaccess/myucp_datasupplier.hxx
@@ -34,7 +34,7 @@ class DataSupplier : public ucbhelper::ResultSetDataSupplier
     ::std::unique_ptr<DataSupplier_Impl> m_pImpl;
 
 public:
-    DataSupplier( const rtl::Reference< ODocumentContainer >& rxContent );
+    explicit DataSupplier( const rtl::Reference< ODocumentContainer >& rxContent );
     virtual ~DataSupplier();
 
     virtual OUString queryContentIdentifierString( sal_uInt32 nIndex ) override;


More information about the Libreoffice-commits mailing list