[Libreoffice-commits] core.git: 2 commits - sw/source xmloff/source

Caolán McNamara caolanm at redhat.com
Thu Jun 4 12:59:03 PDT 2015


 sw/source/core/unocore/unochart.cxx |    4 ++--
 xmloff/source/core/nmspmap.cxx      |   12 ++++++++----
 2 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 4cc2fb2db34337880393d692d0e9ea8d6496fcbf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 4 20:30:21 2015 +0100

    coverity#1302607 Logically dead code
    
    also
    
    coverity#1302606 Logically dead code
    
    Change-Id: I510f17e93f7caf5f1c35becdf6b7d626c0160b66

diff --git a/xmloff/source/core/nmspmap.cxx b/xmloff/source/core/nmspmap.cxx
index 6a97160..b355f03 100644
--- a/xmloff/source/core/nmspmap.cxx
+++ b/xmloff/source/core/nmspmap.cxx
@@ -102,10 +102,12 @@ sal_uInt16 SvXMLNamespaceMap::Add( const OUString& rPrefix, const OUString& rNam
     if( XML_NAMESPACE_UNKNOWN == nKey )
         nKey = GetKeyByName( rName );
 
-    assert(XML_NAMESPACE_NONE != nKey);
-
+#ifdef NDEBUG
     if( XML_NAMESPACE_NONE == nKey )
         return USHRT_MAX;
+#else
+    assert(XML_NAMESPACE_NONE != nKey);
+#endif
 
     if ( aNameHash.find ( rPrefix ) == aNameHash.end() )
         nKey = _Add( rPrefix, rName, nKey );
@@ -117,10 +119,12 @@ sal_uInt16 SvXMLNamespaceMap::AddIfKnown( const OUString& rPrefix, const OUStrin
 {
     sal_uInt16 nKey = GetKeyByName( rName );
 
-    assert(nKey != XML_NAMESPACE_NONE);
-
+#ifdef NDEBUG
     if( XML_NAMESPACE_NONE == nKey )
         return XML_NAMESPACE_UNKNOWN;
+#else
+    assert(nKey != XML_NAMESPACE_NONE);
+#endif
 
     if( XML_NAMESPACE_UNKNOWN != nKey )
     {
commit a6b6bb2aac59db3b390a3155ee4b25ebfef76ce9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 4 20:26:45 2015 +0100

    coverity#1302656 Unchecked dynamic_cast
    
    Change-Id: If84fc54892bbe65799b3bc344c700bb43bedc0cd

diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 33a0b27..bf96c15 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -1947,7 +1947,7 @@ SwChartDataSequence::SwChartDataSequence( const SwChartDataSequence &rObj ) :
     aColLabelText( SW_RES(STR_CHART2_COL_LABEL_TEXT) ),
     xDataProvider( rObj.pDataProvider ),
     pDataProvider( rObj.pDataProvider ),
-    pTableCrsr( dynamic_cast<SwUnoTableCrsr*>(rObj.pTableCrsr.get())->Clone() ),
+    pTableCrsr( dynamic_cast<SwUnoTableCrsr&>(*rObj.pTableCrsr.get()).Clone() ),
     aCursorDepend( this, pTableCrsr.get() ),
     _pPropSet( rObj._pPropSet )
 {
@@ -2032,7 +2032,7 @@ uno::Sequence< uno::Any > SAL_CALL SwChartDataSequence::getData()
                 // keep original cursor and make copy of it that gets handed
                 // over to the SwXCellRange object which takes ownership and
                 // thus will destroy the copy later.
-                SwXCellRange aRange( dynamic_cast<SwUnoTableCrsr*>(pTableCrsr.get())->Clone(), *pTableFormat, aDesc );
+                SwXCellRange aRange( dynamic_cast<SwUnoTableCrsr&>(*pTableCrsr.get()).Clone(), *pTableFormat, aDesc );
                 aRange.GetDataSequence( &aRes, 0, 0 );
             }
         }


More information about the Libreoffice-commits mailing list