[Libreoffice-commits] core.git: 2 commits - connectivity/source sal/qa

Caolán McNamara caolanm at redhat.com
Tue Apr 21 06:06:41 PDT 2015


 connectivity/source/drivers/evoab2/NTables.cxx |    2 +-
 sal/qa/rtl/oustring/rtl_ustr.cxx               |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 0a43d7c4859345d7d2aced1309175e974e6e75be
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 21 13:51:39 2015 +0100

    cppcheck: cstyleCast
    
    Change-Id: Iaf5c394a1cacaa6de9d10566dc6a1371361b40de

diff --git a/connectivity/source/drivers/evoab2/NTables.cxx b/connectivity/source/drivers/evoab2/NTables.cxx
index 5c4cfbe..fe20ab6 100644
--- a/connectivity/source/drivers/evoab2/NTables.cxx
+++ b/connectivity/source/drivers/evoab2/NTables.cxx
@@ -63,7 +63,7 @@ ObjectType OEvoabTables::createObject(const OUString& aName)
         {
             OEvoabTable* pRet = new OEvoabTable(
                     this,
-                    (OEvoabConnection *)static_cast<OEvoabCatalog&>(m_rParent).getConnection(),
+                    static_cast<OEvoabConnection*>(static_cast<OEvoabCatalog&>(m_rParent).getConnection()),
                     aName,
                     xRow->getString(4),
                     xRow->getString(5),
commit eea5ad99994d279adc3d5897080c58f90b374536
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Apr 21 13:40:51 2015 +0100

    cppcheck: redundantCopy
    
    Change-Id: I209b55a6ef962d4a350327e56c4d16c8180a21e0

diff --git a/sal/qa/rtl/oustring/rtl_ustr.cxx b/sal/qa/rtl/oustring/rtl_ustr.cxx
index bbf62f5..4fc33ea 100644
--- a/sal/qa/rtl/oustring/rtl_ustr.cxx
+++ b/sal/qa/rtl/oustring/rtl_ustr.cxx
@@ -518,8 +518,8 @@ namespace rtl_ustr
                 sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode);
                 sal_Unicode* pStr = (sal_Unicode*) malloc( nLength + sizeof(sal_Unicode)); // length + 1 (null terminator)
                 CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
-                memset(pStr, 0, nLength + sizeof(sal_Unicode));
                 memcpy(pStr, aStr1.getStr(), nLength);
+                pStr[aStr1.getLength()] = 0;
 
                 rtl_ustr_replaceChar( pStr, 'e', 'u' );
                 rtl::OUString suStr(pStr, aStr1.getLength());
@@ -614,8 +614,8 @@ namespace rtl_ustr
                 sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode);
                 sal_Unicode* pStr = (sal_Unicode*) malloc(nLength + sizeof(sal_Unicode) );  // we need to add '\0' so one more
                 CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
-                memset(pStr, 0, nLength + sizeof(sal_Unicode));                             // empty the sal_Unicode array
                 memcpy(pStr, aStr1.getStr(), nLength);
+                pStr[aStr1.getLength()] = 0;
 
                 rtl_ustr_toAsciiLowerCase( pStr );
                 rtl::OUString suStr(pStr, aStr1.getLength());
@@ -693,8 +693,8 @@ namespace rtl_ustr
                 sal_uInt32 nLength = aStr1.getLength() * sizeof(sal_Unicode);
                 sal_Unicode* pStr = (sal_Unicode*) malloc(nLength + sizeof(sal_Unicode)); // length + null terminator
                 CPPUNIT_ASSERT_MESSAGE("can't get memory for test", pStr != NULL);
-                memset(pStr, 0, nLength + sizeof(sal_Unicode));
                 memcpy(pStr, aStr1.getStr(), nLength);
+                pStr[aStr1.getLength()] = 0;
 
                 rtl_ustr_toAsciiUpperCase( pStr );
                 rtl::OUString suStr(pStr, aStr1.getLength());


More information about the Libreoffice-commits mailing list