[Libreoffice-commits] core.git: 4 commits - idl/source libreofficekit/qa sd/source sw/source

Caolán McNamara caolanm at redhat.com
Fri May 12 08:28:53 UTC 2017


 idl/source/objects/slot.cxx                         |    2 +-
 libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx |    1 +
 sd/source/ui/table/TableDesignPane.cxx              |    4 ----
 sw/source/core/doc/doclay.cxx                       |   12 ++++++++----
 sw/source/core/undo/unattr.cxx                      |    5 +++--
 sw/source/core/undo/undobj1.cxx                     |    5 +++--
 sw/source/core/unocore/unodraw.cxx                  |    5 +++--
 7 files changed, 19 insertions(+), 15 deletions(-)

New commits:
commit 510b667023ac2069021f9ccd76efd4989e09a1ce
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 12 09:09:56 2017 +0100

    coverity#1406101 Dereference null return value
    
    and
    
    coverity#1406100 Dereference null return value
    coverity#1406099 Dereference null return value
    coverity#1406098 Dereference null return value
    coverity#1406097 Dereference null return value
    
    Change-Id: I26d5c0f2e69dc049a87a607ca28586dc575a8ca3

diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 0685cf164a9f..1d9859554c29 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -800,9 +800,11 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable,
                     SwTextAttr * const pHint =
                         pTextNode->GetTextAttrForCharAt(nIdx, RES_TXTATR_FLYCNT);
 
-                    OSL_ENSURE( pHint && pHint->Which() == RES_TXTATR_FLYCNT,
+                    assert(pHint && "Missing Hint.");
+
+                    OSL_ENSURE( pHint->Which() == RES_TXTATR_FLYCNT,
                                 "Missing FlyInCnt-Hint." );
-                    OSL_ENSURE( pHint && pHint->GetFlyCnt().GetFrameFormat() == pOldFormat,
+                    OSL_ENSURE( pHint->GetFlyCnt().GetFrameFormat() == pOldFormat,
                                 "Wrong TextFlyCnt-Hint." );
 
                     const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt()).SetFlyFormat(
@@ -1117,10 +1119,12 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable
         SwTextAttr * const pHint =
             pTextNode->GetTextAttrForCharAt( nIdx, RES_TXTATR_FLYCNT );
 
+        assert(pHint && "Missing Hint.");
+
 #if OSL_DEBUG_LEVEL > 0
-        OSL_ENSURE( pHint && pHint->Which() == RES_TXTATR_FLYCNT,
+        OSL_ENSURE( pHint->Which() == RES_TXTATR_FLYCNT,
                     "Missing FlyInCnt-Hint." );
-        OSL_ENSURE( pHint && pHint->GetFlyCnt().
+        OSL_ENSURE( pHint->GetFlyCnt().
                     GetFrameFormat() == static_cast<SwFrameFormat*>(pOldFormat),
                     "Wrong TextFlyCnt-Hint." );
 #endif
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 96dbd48c54ec..deaf037a82fd 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -463,9 +463,10 @@ bool SwUndoFormatAttr::RestoreFlyAnchor(::sw::UndoRedoContext & rContext)
         const sal_Int32 nIdx = pPos->nContent.GetIndex();
         SwTextAttr * const pHint =
             pTextNode->GetTextAttrForCharAt( nIdx, RES_TXTATR_FLYCNT );
-        OSL_ENSURE( pHint && pHint->Which() == RES_TXTATR_FLYCNT,
+        assert(pHint && "Missing Hint.");
+        OSL_ENSURE( pHint->Which() == RES_TXTATR_FLYCNT,
                     "Missing FlyInCnt-Hint." );
-        OSL_ENSURE( pHint && pHint->GetFlyCnt().GetFrameFormat() == pFrameFormat,
+        OSL_ENSURE( pHint->GetFlyCnt().GetFrameFormat() == pFrameFormat,
                     "Wrong TextFlyCnt-Hint." );
         const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt()).SetFlyFormat();
 
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index 2379b521afa6..65b6db6aad38 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -557,9 +557,10 @@ void SwUndoSetFlyFormat::UndoImpl(::sw::UndoRedoContext & rContext)
                 const sal_Int32 nIdx = pPos->nContent.GetIndex();
                 SwTextAttr * pHint = pTextNode->GetTextAttrForCharAt(
                         nIdx, RES_TXTATR_FLYCNT );
-                OSL_ENSURE( pHint && pHint->Which() == RES_TXTATR_FLYCNT,
+                assert(pHint && "Missing Hint.");
+                OSL_ENSURE( pHint->Which() == RES_TXTATR_FLYCNT,
                             "Missing FlyInCnt-Hint." );
-                OSL_ENSURE( pHint && pHint->GetFlyCnt().GetFrameFormat() == pFrameFormat,
+                OSL_ENSURE( pHint->GetFlyCnt().GetFrameFormat() == pFrameFormat,
                             "Wrong TextFlyCnt-Hint." );
                 const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt()).SetFlyFormat();
 
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 6f4c5d2de9d2..b155e81b2c0d 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1273,9 +1273,10 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
                             SwTextAttr * const pHint =
                                 pTextNode->GetTextAttrForCharAt(
                                     nIdx, RES_TXTATR_FLYCNT );
-                            SAL_WARN_IF( !pHint || pHint->Which() != RES_TXTATR_FLYCNT,
+                            assert(pHint && "Missing Hint.");
+                            SAL_WARN_IF( pHint->Which() != RES_TXTATR_FLYCNT,
                                         "sw.uno", "Missing FlyInCnt-Hint." );
-                            SAL_WARN_IF( !pHint || pHint->GetFlyCnt().GetFrameFormat() != pFlyFormat,
+                            SAL_WARN_IF( pHint->GetFlyCnt().GetFrameFormat() != pFlyFormat,
                                         "sw.uno", "Wrong TextFlyCnt-Hint." );
                             const_cast<SwFormatFlyCnt&>(pHint->GetFlyCnt())
                                 .SetFlyFormat();
commit a31874f38a179d89dcc9eaedcbcf21dc34f3b9fe
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 12 09:06:15 2017 +0100

    Revert "coverity#1399034 Unrecoverable parse warning"
    
    that didn't work
    
    This reverts commit 9905eb90b3bfe9e7281642b7915db177c5143ff0.

diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx
index 5dccf80c63cd..a1356f40d83e 100644
--- a/sd/source/ui/table/TableDesignPane.cxx
+++ b/sd/source/ui/table/TableDesignPane.cxx
@@ -110,11 +110,7 @@ TableDesignWidget::TableDesignWidget( VclBuilderContainer* pParent, ViewShellBas
 
     for (sal_uInt16 i = CB_HEADER_ROW; i <= CB_BANDED_COLUMNS; ++i)
     {
-#if defined(__COVERITY__)
-        pParent->get(m_aCheckBoxes[i], OUStringToOString(gPropNames[i], RTL_TEXTENCODING_ASCII_US));
-#else
         pParent->get(m_aCheckBoxes[i], OString(gPropNames[i].data, gPropNames[i].size));
-#endif
         m_aCheckBoxes[i]->SetClickHdl( LINK( this, TableDesignWidget, implCheckBoxHdl ) );
     }
 
commit fd24dd469dcc17063b3126d1d73dcceaae97a984
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 12 09:03:36 2017 +0100

    coverity#1403731 Explicit null dereferenced
    
    Change-Id: Ia8d183fbf1c80964eabc10f1e363333133a4181c

diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx
index dec49c26bd8a..d68b366cdfd0 100644
--- a/idl/source/objects/slot.cxx
+++ b/idl/source/objects/slot.cxx
@@ -461,7 +461,7 @@ void SvMetaSlot::WriteSlot( const OString& rShellName, sal_uInt16 nCount,
         i = 0;
         pEle = rSlotList.empty() ? nullptr : rSlotList[ i ];
         pNextSlot = pEle;
-        while ( pNextSlot != this )
+        while (pNextSlot && pNextSlot != this)
         {
             if ( pNextSlot->GetStateMethod() == GetStateMethod() )
                 break;
commit 61bfd5eb66953d61eaaa7c87b372e616b6e5f793
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 12 09:00:23 2017 +0100

    coverity#1351757 Uninitialized pointer field
    
    Change-Id: I99211e2dc016fb97b6744799b35e05acd7470464

diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
index 14bb2c1a2b6d..cf6bc02e96f8 100644
--- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
+++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx
@@ -193,6 +193,7 @@ public:
         m_pInsertAnnotation(nullptr),
         m_pDeleteComment(nullptr),
         m_pTrackChanges(nullptr),
+        m_pAddressbarEntry(nullptr),
         m_pFormulabarEntry(nullptr),
         m_pScrolledWindow(nullptr),
         m_bToolItemBroadcast(true),


More information about the Libreoffice-commits mailing list