[Libreoffice-commits] core.git: 20 commits - chart2/source extensions/source sd/source svx/source sw/source

Caolán McNamara caolanm at redhat.com
Thu May 8 02:01:09 PDT 2014


 chart2/source/controller/main/ChartController.cxx |    4 
 extensions/source/bibliography/bibload.cxx        |    9 
 sd/source/filter/sdpptwrp.cxx                     |    3 
 svx/source/form/navigatortreemodel.cxx            |    4 
 sw/source/core/doc/docnum.cxx                     |    4 
 sw/source/core/table/swtable.cxx                  |    5 
 sw/source/core/tox/tox.cxx                        |    9 
 sw/source/filter/html/htmlforw.cxx                |   13 
 sw/source/filter/html/htmlsect.cxx                |    2 
 sw/source/filter/ww8/wrtw8esh.cxx                 |    3 
 sw/source/filter/xml/xmlexpit.cxx                 |  613 +++++++++++-----------
 11 files changed, 353 insertions(+), 316 deletions(-)

New commits:
commit 8ef22b95059f2158434eeebb567bd04fc8477b32
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 17:01:31 2014 +0100

    coverity#1209298 Logically dead code
    
    Change-Id: I370f1ff7df1c19e23560599b86b2274649bd5f73

diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx
index b943098..8c10ed1 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -704,7 +704,7 @@ void SwHTMLParser::NewMultiCol( sal_uInt16 columnsFromCss )
         SwFmtCol aFmtCol;
         nPrcWidth = 100;
 
-        aFmtCol.Init( nCols, nGutter, nPrcWidth ? USHRT_MAX : nTwipWidth );
+        aFmtCol.Init( nCols, nGutter, USHRT_MAX );
         aFrmItemSet.Put( aFmtCol );
 
         const SfxPoolItem *pItem;
commit 791f3f9db94c0b849f517cbda3878f2d156dbca7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:58:32 2014 +0100

    coverity#1209146 Logically dead code
    
    Change-Id: I6777dffb436471b5df69d40a15bd32b473dcfc40

diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index 1b1024d..abcfc80 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -417,10 +417,9 @@ void SwForm::AdjustTabStops( SwDoc& rDoc ) // #i21237#
             continue;
         }
 
-        const SvxTabStopItem* pTabStops = pColl != NULL ? &pColl->GetTabStops(false) : 0;
-        const sal_uInt16 nTabCount = pTabStops != NULL ? pTabStops->Count() : 0;
-        if( pTabStops != NULL
-            && nTabCount != 0 )
+        const SvxTabStopItem& rTabStops = pColl->GetTabStops(false);
+        const sal_uInt16 nTabCount = rTabStops.Count();
+        if (nTabCount != 0)
         {
             SwFormTokens aCurrentPattern = GetPattern(nLevel);
             SwFormTokens::iterator aIt = aCurrentPattern.begin();
@@ -428,7 +427,7 @@ void SwForm::AdjustTabStops( SwDoc& rDoc ) // #i21237#
             bool bChanged = false;
             for(sal_uInt16 nTab = 0; nTab < nTabCount; ++nTab)
             {
-                const SvxTabStop& rTab = (*pTabStops)[nTab];
+                const SvxTabStop& rTab = rTabStops[nTab];
 
                 if ( rTab.GetAdjustment() == SVX_TAB_ADJUST_DEFAULT )
                     continue; // ignore the default tab stop
commit f6012f6c5d40857ea7a9490da90ae5541d859563
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:52:58 2014 +0100

    coverity#736452 Resource leak
    
    Change-Id: I7880007562e6706c2a4439fbda3063dc70fe13a3

diff --git a/sd/source/filter/sdpptwrp.cxx b/sd/source/filter/sdpptwrp.cxx
index 52c8f7f..a8bebf0 100644
--- a/sd/source/filter/sdpptwrp.cxx
+++ b/sd/source/filter/sdpptwrp.cxx
@@ -116,6 +116,8 @@ bool SdPPTFilter::Import()
 
                     if ( !bRet )
                         mrMedium.SetError( SVSTREAM_WRONGVERSION, OSL_LOG_PREFIX );
+
+                    delete pLibrary;
                 }
 #else
                 bRet = ImportPPT( &mrDocument, *pDocStream, *pStorage, mrMedium );
commit e3193eb37a2fa75261746c1bdea836889d71a55f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:52:20 2014 +0100

    coverity#736451 Resource leak
    
    Change-Id: Ifd806074e31a4d7f91023d5baf22bc465e52019c

diff --git a/sd/source/filter/sdpptwrp.cxx b/sd/source/filter/sdpptwrp.cxx
index cfeaeeb..52c8f7f 100644
--- a/sd/source/filter/sdpptwrp.cxx
+++ b/sd/source/filter/sdpptwrp.cxx
@@ -205,6 +205,7 @@ void SdPPTFilter::PreSaveBasic()
             {
                 pSaveVBA( (SfxObjectShell&) mrDocShell, pBas );
             }
+            delete pLibrary;
         }
 #else
         SaveVBA( (SfxObjectShell&) mrDocShell, pBas );
commit 50511afead5d0c30ea9f04e6d80e591678bdde29
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:41:05 2014 +0100

    coverity#736155 Dereference null return value
    
    Change-Id: I781a949abb47b6e845a222a4fa8f685e9a620693

diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index db10a84..5c3d3f6 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2581,11 +2581,12 @@ public:
 
     ~Impl() {}
 
-    void setTable(const SwTable * pTable) {
+    void setTable(const SwTable * pTable)
+    {
         m_pTable = pTable;
         SwFrmFmt * pFrmFmt = m_pTable->GetFrmFmt();
         m_pTabFrm = SwIterator<SwTabFrm,SwFmt>::FirstElement(*pFrmFmt);
-        if (m_pTabFrm->IsFollow())
+        if (m_pTabFrm && m_pTabFrm->IsFollow())
             m_pTabFrm = m_pTabFrm->FindMaster(true);
     }
 
commit 7984ab6b2a78fd859525621ad45db264a354e0fc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:33:27 2014 +0100

    coverity#736152 Dereference null return value
    
    Change-Id: I5582d0481c0b99f92e7a3a07fbe7a904a1696442

diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index a19075d..bf7b4f2 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -757,7 +757,9 @@ bool SwDoc::GotoOutline( SwPosition& rPos, const OUString& rName ) const
 static void lcl_ChgNumRule( SwDoc& rDoc, const SwNumRule& rRule )
 {
     SwNumRule* pOld = rDoc.FindNumRulePtr( rRule.GetName() );
-    OSL_ENSURE( pOld, "we cannot proceed without the old NumRule" );
+    assert(pOld); //we cannot proceed without the old NumRule
+    if (!pOld)
+        return;
 
     sal_uInt16 nChgFmtLevel = 0;
     sal_uInt16 nMask = 1;
commit ff97a873c3f09e03e93b095c23c7930744d88705
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:28:39 2014 +0100

    coverity#736151 Dereference null return value
    
    Change-Id: If5bc9d3a5c425ed56c27fa6b43aa7049cd5b2a06

diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx
index 5f9b8ca..213eef9 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -635,7 +635,9 @@ namespace svxform
     )
     {
         FmEntryData* pData = FindData(xOld, GetRootList(), true);
-        DBG_ASSERT(pData && pData->ISA(FmControlData), "NavigatorTreeModel::ReplaceFormComponent : invalid argument !");
+        assert(pData && pData->ISA(FmControlData)); //NavigatorTreeModel::ReplaceFormComponent : invalid argument
+        if (!pData || !pData->ISA(FmControlData))
+            return;
         ((FmControlData*)pData)->ModelReplaced( xNew, m_aNormalImages );
 
         FmNavModelReplacedHint aReplacedHint( pData );
commit 43d684af310266d454bd888da4f94df2c7714fc1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:27:21 2014 +0100

    coverity#736141 Dereference null return value
    
    Change-Id: I1b4aadd64a8695142685ca49378e3c45ef2db28d

diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx
index f6876cb..90ba39f 100644
--- a/extensions/source/bibliography/bibload.cxx
+++ b/extensions/source/bibliography/bibload.cxx
@@ -270,6 +270,7 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const OUSt
 
     Reference< awt::XWindow >  aWindow = rFrame->getContainerWindow();
     VCLXWindow* pParentComponent = VCLXWindow::GetImplementation(aWindow);
+    assert(pParentComponent);
 
     Window* pParent = VCLUnoHelper::GetWindow( aWindow );
 
@@ -293,10 +294,12 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const OUSt
     xCtrRef->attachFrame(rFrame);
     rFrame->setComponent( xWin, xCtrRef);
     pBeamer->SetXController(xCtrRef);
-    //!
 
-    // not earlier because SetFocus() is triggered in setVisible()
-    pParentComponent->setVisible(sal_True);
+    if (pParentComponent)
+    {
+        // not earlier because SetFocus() is triggered in setVisible()
+        pParentComponent->setVisible(sal_True);
+    }
 
     m_xDatMan->load();
     // #100312# ----------
commit 7209f84fd3cfd10c85d334fb93f6b57e7547c99e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:26:13 2014 +0100

    coverity#736136 Dereference null return value
    
    Change-Id: I7668c95e2d40bb4e1e8e24627038b92f93b0008f

diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 9a2e97b..79029e6 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -356,7 +356,9 @@ void SAL_CALL ChartController::attachFrame(
     {
         uno::Reference< awt::XWindow > xContainerWindow = xFrame->getContainerWindow();
         VCLXWindow* pParentComponent = VCLXWindow::GetImplementation(xContainerWindow);
-        pParentComponent->setVisible(sal_True);
+        assert(pParentComponent);
+        if (pParentComponent)
+            pParentComponent->setVisible(sal_True);
 
         pParent = VCLUnoHelper::GetWindow( xContainerWindow );
     }
commit fdd186c4cdd95b149e800569c3e66069a9bff974
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:22:42 2014 +0100

    coverity#735960 Explicit null dereferenced
    
    Change-Id: I04ef56efe1e6e164de5ceaa2840a43271102d108

diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index ac5ae64..8898ffd 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -1024,10 +1024,12 @@ bool SvXMLExportItemMapper::QueryXMLValue(
         case RES_ROW_SPLIT:
         {
             const SfxBoolItem* pSplit = PTR_CAST(SfxBoolItem, &rItem);
-            OSL_ENSURE( pSplit != NULL, "Wrong Which-ID" );
-
-            ::sax::Converter::convertBool( aOut, pSplit->GetValue() );
-            bOk = true;
+            assert(pSplit); //Wrong Which-ID
+            if (pSplit)
+            {
+                ::sax::Converter::convertBool( aOut, pSplit->GetValue() );
+                bOk = true;
+            }
         }
         break;
 
commit c9445734e5116b9c8e377d027bb02508baeb48c9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:20:57 2014 +0100

    coverity#735959 Explicit null dereferenced
    
    Change-Id: I9ba5a7ab1938174f083fdc81c046b286fc73a4e9

diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index 16d4dc5..ac5ae64 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -493,39 +493,41 @@ bool SvXMLExportItemMapper::QueryXMLValue(
         case RES_SHADOW:
         {
             const SvxShadowItem* pShadow = PTR_CAST(SvxShadowItem, &rItem);
-            OSL_ENSURE( pShadow != NULL, "Wrong Which-ID" );
-
-            sal_Int32 nX = 1, nY = 1;
-            switch( pShadow->GetLocation() )
+            assert(pShadow); //Wrong Which-ID
+            if (pShadow)
+            {
+                sal_Int32 nX = 1, nY = 1;
+                switch( pShadow->GetLocation() )
                 {
-                case SVX_SHADOW_TOPLEFT:
-                    nX = -1;
-                    nY = -1;
-                    break;
-                case SVX_SHADOW_TOPRIGHT:
-                    nY = -1;
-                    break;
-                case SVX_SHADOW_BOTTOMLEFT:
-                    nX = -1;
-                    break;
-                case SVX_SHADOW_BOTTOMRIGHT:
-                    break;
-                case SVX_SHADOW_NONE:
-                default:
-                    rValue = GetXMLToken(XML_NONE);
-                    return true;
+                    case SVX_SHADOW_TOPLEFT:
+                        nX = -1;
+                        nY = -1;
+                        break;
+                    case SVX_SHADOW_TOPRIGHT:
+                        nY = -1;
+                        break;
+                    case SVX_SHADOW_BOTTOMLEFT:
+                        nX = -1;
+                        break;
+                    case SVX_SHADOW_BOTTOMRIGHT:
+                        break;
+                    case SVX_SHADOW_NONE:
+                    default:
+                        rValue = GetXMLToken(XML_NONE);
+                        return true;
                 }
 
-            nX *= pShadow->GetWidth();
-            nY *= pShadow->GetWidth();
+                nX *= pShadow->GetWidth();
+                nY *= pShadow->GetWidth();
 
-            ::sax::Converter::convertColor(aOut, pShadow->GetColor().GetColor());
-            aOut.append( ' ' );
-            rUnitConverter.convertMeasureToXML( aOut, nX );
-            aOut.append( ' ' );
-            rUnitConverter.convertMeasureToXML( aOut, nY );
+                ::sax::Converter::convertColor(aOut, pShadow->GetColor().GetColor());
+                aOut.append( ' ' );
+                rUnitConverter.convertMeasureToXML( aOut, nX );
+                aOut.append( ' ' );
+                rUnitConverter.convertMeasureToXML( aOut, nY );
 
-            bOk = true;
+                bOk = true;
+            }
         }
         break;
 
commit a0118b26308844c27547073c14c26458492ef4b9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:18:35 2014 +0100

    coverity#735958 Explicit null dereferenced
    
    Change-Id: I78e3e2cce461b098dd3f56289bf5e30c977fca2f

diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index 05302f2..16d4dc5 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -1032,11 +1032,13 @@ bool SvXMLExportItemMapper::QueryXMLValue(
         case RES_HORI_ORIENT:
         {
             SwFmtHoriOrient* pHoriOrient = PTR_CAST(SwFmtHoriOrient, &rItem);
-            OSL_ENSURE( pHoriOrient != NULL, "Wrong Which-ID" );
-
-            rUnitConverter.convertEnum( aOut, pHoriOrient->GetHoriOrient(),
-                                        aXMLTableAlignMap );
-            bOk = true;
+            assert(pHoriOrient); //Wrong Which-ID
+            if (pHoriOrient)
+            {
+                rUnitConverter.convertEnum( aOut, pHoriOrient->GetHoriOrient(),
+                                            aXMLTableAlignMap );
+                bOk = true;
+            }
         }
         break;
 
commit e3ae233c62adf8b1719421bee37d737caad7472a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:15:29 2014 +0100

    coverity#735957 Explicit null dereferenced
    
    Change-Id: I70a46f251faa6a1d6e52bc816473a29416953ded

diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index d1d7837..05302f2 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -870,12 +870,14 @@ bool SvXMLExportItemMapper::QueryXMLValue(
         case RES_KEEP:
         {
             SvxFmtKeepItem* pFmtKeep = PTR_CAST(SvxFmtKeepItem, &rItem);
-            OSL_ENSURE( pFmtKeep != NULL, "Wrong Which-ID" );
-
-            aOut.append( pFmtKeep->GetValue()
-                         ? GetXMLToken( XML_ALWAYS )
-                         : GetXMLToken( XML_AUTO ) );
-            bOk = true;
+            assert(pFmtKeep); //Wrong Which-ID
+            if (pFmtKeep)
+            {
+                aOut.append( pFmtKeep->GetValue()
+                             ? GetXMLToken( XML_ALWAYS )
+                             : GetXMLToken( XML_AUTO ) );
+                bOk = true;
+            }
         }
         break;
 
commit ef4f94028d4eb6b8bb75291b185ae9101bcd2056
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:12:22 2014 +0100

    coverity#735956 Explicit null dereferenced
    
    Change-Id: Ic55ef095bb4867c9e5e98bc4c2ded3e9b0c95253

diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index 493221a..d1d7837 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -532,290 +532,291 @@ bool SvXMLExportItemMapper::QueryXMLValue(
         case RES_BOX:
         {
             SvxBoxItem* pBox = PTR_CAST(SvxBoxItem, &rItem);
-            OSL_ENSURE( pBox != NULL, "Wrong WHich-ID" );
-
-            /**
-               xml -> MemberId
-
-               border-padding           ALL_BORDER_PADDING
-               border-padding-before    LEFT_BORDER_PADDING
-               border-padding-after RIGHT_BORDER_PADDING
-               border-padding-start TOP_BORDER_PADDING
-               border-padding-end       BOTTOM_BORDER_PADDING
-
-               border                   ALL_BORDER
-               border-before            LEFT_BORDER
-               border-after         RIGHT_BORDER
-               border-start         TOP_BORDER
-               border-end               BOTTOM_BORDER
-
-               border-line-width            ALL_BORDER_LINE_WIDTH
-               border-line-width-before LEFT_BORDER_LINE_WIDTH
-               border-line-width-after      RIGHT_BORDER_LINE_WIDTH
-               border-line-width-start      TOP_BORDER_LINE_WIDTH
-               border-line-width-end        BOTTOM_BORDER_LINE_WIDTH
-            */
-
-            const SvxBorderLine* pLeft    = pBox->GetLeft();
-            const SvxBorderLine* pRight   = pBox->GetRight();
-            const SvxBorderLine* pTop     = pBox->GetTop();
-            const SvxBorderLine* pBottom  = pBox->GetBottom();
-            const sal_uInt16 nTopDist     = pBox->GetDistance( BOX_LINE_TOP );
-            const sal_uInt16 nBottomDist  = pBox->GetDistance( BOX_LINE_BOTTOM );
-            const sal_uInt16 nLeftDist    = pBox->GetDistance( BOX_LINE_LEFT );
-            const sal_uInt16 nRightDist   = pBox->GetDistance( BOX_LINE_RIGHT );
-
-            // check if we need to export it
-            switch( nMemberId )
+            assert(pBox); //Wrong WHich-ID
+            if (pBox)
             {
-                case ALL_BORDER_PADDING:
-                case LEFT_BORDER_PADDING:
-                case RIGHT_BORDER_PADDING:
-                case TOP_BORDER_PADDING:
-                case BOTTOM_BORDER_PADDING:
-                {
-                    bool bEqual = nLeftDist == nRightDist &&
-                                      nLeftDist == nTopDist &&
-                                      nLeftDist == nBottomDist;
-                    // don't export individual paddings if all paddings are equal and
-                    // don't export all padding if some paddings are not equal
-                    if( (bEqual && ALL_BORDER_PADDING != nMemberId) ||
-                        (!bEqual && ALL_BORDER_PADDING == nMemberId) )
-                        return false;
-                }
-                break;
-                case ALL_BORDER:
-                case LEFT_BORDER:
-                case RIGHT_BORDER:
-                case TOP_BORDER:
-                case BOTTOM_BORDER:
+                /**
+                   xml -> MemberId
+
+                   border-padding           ALL_BORDER_PADDING
+                   border-padding-before    LEFT_BORDER_PADDING
+                   border-padding-after RIGHT_BORDER_PADDING
+                   border-padding-start TOP_BORDER_PADDING
+                   border-padding-end       BOTTOM_BORDER_PADDING
+
+                   border                   ALL_BORDER
+                   border-before            LEFT_BORDER
+                   border-after         RIGHT_BORDER
+                   border-start         TOP_BORDER
+                   border-end               BOTTOM_BORDER
+
+                   border-line-width            ALL_BORDER_LINE_WIDTH
+                   border-line-width-before LEFT_BORDER_LINE_WIDTH
+                   border-line-width-after      RIGHT_BORDER_LINE_WIDTH
+                   border-line-width-start      TOP_BORDER_LINE_WIDTH
+                   border-line-width-end        BOTTOM_BORDER_LINE_WIDTH
+                */
+
+                const SvxBorderLine* pLeft    = pBox->GetLeft();
+                const SvxBorderLine* pRight   = pBox->GetRight();
+                const SvxBorderLine* pTop     = pBox->GetTop();
+                const SvxBorderLine* pBottom  = pBox->GetBottom();
+                const sal_uInt16 nTopDist     = pBox->GetDistance( BOX_LINE_TOP );
+                const sal_uInt16 nBottomDist  = pBox->GetDistance( BOX_LINE_BOTTOM );
+                const sal_uInt16 nLeftDist    = pBox->GetDistance( BOX_LINE_LEFT );
+                const sal_uInt16 nRightDist   = pBox->GetDistance( BOX_LINE_RIGHT );
+
+                // check if we need to export it
+                switch( nMemberId )
                 {
-                    bool bEqual = ( NULL == pTop && NULL == pBottom &&
-                                        NULL == pLeft && NULL == pRight ) ||
-                                      ( pTop && pBottom && pLeft && pRight &&
-                                       *pTop == *pBottom  && *pTop == *pLeft &&
-                                        *pTop == *pRight );
-
-                    // don't export individual borders if all are the same and
-                    // don't export all borders if some are not equal
-                    if( (bEqual && ALL_BORDER != nMemberId) ||
-                        (!bEqual && ALL_BORDER == nMemberId) )
-                        return false;
-                }
-                break;
-                case ALL_BORDER_LINE_WIDTH:
-                case LEFT_BORDER_LINE_WIDTH:
-                case RIGHT_BORDER_LINE_WIDTH:
-                case TOP_BORDER_LINE_WIDTH:
-                case BOTTOM_BORDER_LINE_WIDTH:
-                {
-                    // if no line is set, there is nothing to export
-                    if( !pTop && !pBottom && !pLeft && !pRight )
-                        return false;
-
-                    bool bEqual = NULL != pTop &&
-                                      NULL != pBottom &&
-                                      NULL != pLeft &&
-                                      NULL != pRight;
-
-                    if( bEqual )
-                    {
-                        const sal_uInt16 nDistance = pTop->GetDistance();
-                        const sal_uInt16 nInWidth  = pTop->GetInWidth();
-                        const sal_uInt16 nOutWidth = pTop->GetOutWidth();
-                        const long nWidth = pTop->GetWidth();
-
-                        bEqual = nDistance == pLeft->GetDistance() &&
-                                 nInWidth  == pLeft->GetInWidth()  &&
-                                 nOutWidth == pLeft->GetOutWidth() &&
-                                 nWidth == pLeft->GetWidth() &&
-                                 nDistance == pRight->GetDistance()  &&
-                                 nInWidth  == pRight->GetInWidth()   &&
-                                 nOutWidth == pRight->GetOutWidth()  &&
-                                 nWidth == pRight->GetWidth()  &&
-                                 nDistance == pBottom->GetDistance()  &&
-                                 nInWidth  == pBottom->GetInWidth()   &&
-                                 nOutWidth == pBottom->GetOutWidth() &&
-                                 nWidth == pBottom->GetWidth();
-                    }
-
-                    switch( nMemberId )
+                    case ALL_BORDER_PADDING:
+                    case LEFT_BORDER_PADDING:
+                    case RIGHT_BORDER_PADDING:
+                    case TOP_BORDER_PADDING:
+                    case BOTTOM_BORDER_PADDING:
                     {
-                        case ALL_BORDER_LINE_WIDTH:
-                            if( !bEqual || pTop->GetDistance() == 0 ||
-                                !lcl_isOdfDoubleLine( pTop ) )
-                                return false;
-                            break;
-                        case LEFT_BORDER_LINE_WIDTH:
-                            if( bEqual || NULL == pLeft ||
-                                0 == pLeft->GetDistance() ||
-                                !lcl_isOdfDoubleLine( pLeft ) )
-                                return false;
-                            break;
-                        case RIGHT_BORDER_LINE_WIDTH:
-                            if( bEqual || NULL == pRight ||
-                                0 == pRight->GetDistance() ||
-                                !lcl_isOdfDoubleLine( pRight ) )
-                                return false;
-                            break;
-                        case TOP_BORDER_LINE_WIDTH:
-                            if( bEqual || NULL == pTop ||
-                                0 == pTop->GetDistance() ||
-                                !lcl_isOdfDoubleLine( pTop ) )
-                                return false;
-                            break;
-                        case BOTTOM_BORDER_LINE_WIDTH:
-                            if( bEqual || NULL == pBottom ||
-                                0 == pBottom->GetDistance() ||
-                                !lcl_isOdfDoubleLine( pBottom ) )
-                                return false;
-                            break;
+                        bool bEqual = nLeftDist == nRightDist &&
+                                          nLeftDist == nTopDist &&
+                                          nLeftDist == nBottomDist;
+                        // don't export individual paddings if all paddings are equal and
+                        // don't export all padding if some paddings are not equal
+                        if( (bEqual && ALL_BORDER_PADDING != nMemberId) ||
+                            (!bEqual && ALL_BORDER_PADDING == nMemberId) )
+                            return false;
                     }
-                }
-                break;
-            }
-
-            // now export it export
-            switch( nMemberId )
-                {
-                    // padding
-                case ALL_BORDER_PADDING:
-                case LEFT_BORDER_PADDING:
-                    rUnitConverter.convertMeasureToXML( aOut, nLeftDist );
-                    break;
-                case RIGHT_BORDER_PADDING:
-                    rUnitConverter.convertMeasureToXML( aOut, nRightDist );
-                    break;
-                case TOP_BORDER_PADDING:
-                    rUnitConverter.convertMeasureToXML( aOut, nTopDist );
                     break;
-                case BOTTOM_BORDER_PADDING:
-                    rUnitConverter.convertMeasureToXML( aOut, nBottomDist );
-                    break;
-
-                    // border
-                case ALL_BORDER:
-                case LEFT_BORDER:
-                case RIGHT_BORDER:
-                case TOP_BORDER:
-                case BOTTOM_BORDER:
-                {
-                    const SvxBorderLine* pLine;
-                    switch( nMemberId )
-                    {
                     case ALL_BORDER:
                     case LEFT_BORDER:
-                        pLine = pLeft;
-                        break;
                     case RIGHT_BORDER:
-                        pLine = pRight;
-                        break;
                     case TOP_BORDER:
-                        pLine = pTop;
-                        break;
                     case BOTTOM_BORDER:
-                        pLine = pBottom;
-                        break;
-                    default:
-                        pLine = NULL;
-                        break;
+                    {
+                        bool bEqual = ( NULL == pTop && NULL == pBottom &&
+                                            NULL == pLeft && NULL == pRight ) ||
+                                          ( pTop && pBottom && pLeft && pRight &&
+                                           *pTop == *pBottom  && *pTop == *pLeft &&
+                                            *pTop == *pRight );
+
+                        // don't export individual borders if all are the same and
+                        // don't export all borders if some are not equal
+                        if( (bEqual && ALL_BORDER != nMemberId) ||
+                            (!bEqual && ALL_BORDER == nMemberId) )
+                            return false;
                     }
-
-                    if( NULL != pLine )
+                    break;
+                    case ALL_BORDER_LINE_WIDTH:
+                    case LEFT_BORDER_LINE_WIDTH:
+                    case RIGHT_BORDER_LINE_WIDTH:
+                    case TOP_BORDER_LINE_WIDTH:
+                    case BOTTOM_BORDER_LINE_WIDTH:
                     {
-                        sal_Int32 nWidth = pLine->GetWidth();
+                        // if no line is set, there is nothing to export
+                        if( !pTop && !pBottom && !pLeft && !pRight )
+                            return false;
+
+                        bool bEqual = NULL != pTop &&
+                                          NULL != pBottom &&
+                                          NULL != pLeft &&
+                                          NULL != pRight;
 
-                        enum XMLTokenEnum eStyle = XML_SOLID;
-                        bool bNoBorder = false;
-                        switch (pLine->GetBorderLineStyle())
+                        if( bEqual )
                         {
-                            case table::BorderLineStyle::SOLID:
-                                eStyle = XML_SOLID;
-                                break;
-                            case table::BorderLineStyle::DOTTED:
-                                eStyle = XML_DOTTED;
-                                break;
-                            case table::BorderLineStyle::DASHED:
-                                eStyle = XML_DASHED;
-                                break;
-                            case table::BorderLineStyle::DOUBLE:
-                            case table::BorderLineStyle::THINTHICK_SMALLGAP:
-                            case table::BorderLineStyle::THINTHICK_MEDIUMGAP:
-                            case table::BorderLineStyle::THINTHICK_LARGEGAP:
-                            case table::BorderLineStyle::THICKTHIN_SMALLGAP:
-                            case table::BorderLineStyle::THICKTHIN_MEDIUMGAP:
-                            case table::BorderLineStyle::THICKTHIN_LARGEGAP:
-                                eStyle = XML_DOUBLE;
+                            const sal_uInt16 nDistance = pTop->GetDistance();
+                            const sal_uInt16 nInWidth  = pTop->GetInWidth();
+                            const sal_uInt16 nOutWidth = pTop->GetOutWidth();
+                            const long nWidth = pTop->GetWidth();
+
+                            bEqual = nDistance == pLeft->GetDistance() &&
+                                     nInWidth  == pLeft->GetInWidth()  &&
+                                     nOutWidth == pLeft->GetOutWidth() &&
+                                     nWidth == pLeft->GetWidth() &&
+                                     nDistance == pRight->GetDistance()  &&
+                                     nInWidth  == pRight->GetInWidth()   &&
+                                     nOutWidth == pRight->GetOutWidth()  &&
+                                     nWidth == pRight->GetWidth()  &&
+                                     nDistance == pBottom->GetDistance()  &&
+                                     nInWidth  == pBottom->GetInWidth()   &&
+                                     nOutWidth == pBottom->GetOutWidth() &&
+                                     nWidth == pBottom->GetWidth();
+                        }
+
+                        switch( nMemberId )
+                        {
+                            case ALL_BORDER_LINE_WIDTH:
+                                if( !bEqual || pTop->GetDistance() == 0 ||
+                                    !lcl_isOdfDoubleLine( pTop ) )
+                                    return false;
                                 break;
-                            case table::BorderLineStyle::EMBOSSED:
-                                eStyle = XML_RIDGE;
+                            case LEFT_BORDER_LINE_WIDTH:
+                                if( bEqual || NULL == pLeft ||
+                                    0 == pLeft->GetDistance() ||
+                                    !lcl_isOdfDoubleLine( pLeft ) )
+                                    return false;
                                 break;
-                            case table::BorderLineStyle::ENGRAVED:
-                                eStyle = XML_GROOVE;
+                            case RIGHT_BORDER_LINE_WIDTH:
+                                if( bEqual || NULL == pRight ||
+                                    0 == pRight->GetDistance() ||
+                                    !lcl_isOdfDoubleLine( pRight ) )
+                                    return false;
                                 break;
-                            case table::BorderLineStyle::INSET:
-                                eStyle = XML_INSET;
+                            case TOP_BORDER_LINE_WIDTH:
+                                if( bEqual || NULL == pTop ||
+                                    0 == pTop->GetDistance() ||
+                                    !lcl_isOdfDoubleLine( pTop ) )
+                                    return false;
                                 break;
-                            case table::BorderLineStyle::OUTSET:
-                                eStyle = XML_OUTSET;
+                            case BOTTOM_BORDER_LINE_WIDTH:
+                                if( bEqual || NULL == pBottom ||
+                                    0 == pBottom->GetDistance() ||
+                                    !lcl_isOdfDoubleLine( pBottom ) )
+                                    return false;
                                 break;
-                            default:
-                                bNoBorder = true;
+                        }
+                    }
+                    break;
+                }
+
+                // now export it export
+                switch( nMemberId )
+                {
+                    // padding
+                    case ALL_BORDER_PADDING:
+                    case LEFT_BORDER_PADDING:
+                        rUnitConverter.convertMeasureToXML( aOut, nLeftDist );
+                        break;
+                    case RIGHT_BORDER_PADDING:
+                        rUnitConverter.convertMeasureToXML( aOut, nRightDist );
+                        break;
+                    case TOP_BORDER_PADDING:
+                        rUnitConverter.convertMeasureToXML( aOut, nTopDist );
+                        break;
+                    case BOTTOM_BORDER_PADDING:
+                        rUnitConverter.convertMeasureToXML( aOut, nBottomDist );
+                        break;
+
+                        // border
+                    case ALL_BORDER:
+                    case LEFT_BORDER:
+                    case RIGHT_BORDER:
+                    case TOP_BORDER:
+                    case BOTTOM_BORDER:
+                    {
+                        const SvxBorderLine* pLine;
+                        switch( nMemberId )
+                        {
+                        case ALL_BORDER:
+                        case LEFT_BORDER:
+                            pLine = pLeft;
+                            break;
+                        case RIGHT_BORDER:
+                            pLine = pRight;
+                            break;
+                        case TOP_BORDER:
+                            pLine = pTop;
+                            break;
+                        case BOTTOM_BORDER:
+                            pLine = pBottom;
+                            break;
+                        default:
+                            pLine = NULL;
+                            break;
                         }
 
-                        if ( !bNoBorder )
+                        if( NULL != pLine )
                         {
-                            ::sax::Converter::convertMeasure(aOut, nWidth,
-                                   util::MeasureUnit::TWIP,
-                                   util::MeasureUnit::POINT);
-                            aOut.append( ' ' );
-                            aOut.append( GetXMLToken( eStyle ) );
-                            aOut.append( ' ' );
-                            ::sax::Converter::convertColor(aOut,
-                                    pLine->GetColor().GetColor());
+                            sal_Int32 nWidth = pLine->GetWidth();
+
+                            enum XMLTokenEnum eStyle = XML_SOLID;
+                            bool bNoBorder = false;
+                            switch (pLine->GetBorderLineStyle())
+                            {
+                                case table::BorderLineStyle::SOLID:
+                                    eStyle = XML_SOLID;
+                                    break;
+                                case table::BorderLineStyle::DOTTED:
+                                    eStyle = XML_DOTTED;
+                                    break;
+                                case table::BorderLineStyle::DASHED:
+                                    eStyle = XML_DASHED;
+                                    break;
+                                case table::BorderLineStyle::DOUBLE:
+                                case table::BorderLineStyle::THINTHICK_SMALLGAP:
+                                case table::BorderLineStyle::THINTHICK_MEDIUMGAP:
+                                case table::BorderLineStyle::THINTHICK_LARGEGAP:
+                                case table::BorderLineStyle::THICKTHIN_SMALLGAP:
+                                case table::BorderLineStyle::THICKTHIN_MEDIUMGAP:
+                                case table::BorderLineStyle::THICKTHIN_LARGEGAP:
+                                    eStyle = XML_DOUBLE;
+                                    break;
+                                case table::BorderLineStyle::EMBOSSED:
+                                    eStyle = XML_RIDGE;
+                                    break;
+                                case table::BorderLineStyle::ENGRAVED:
+                                    eStyle = XML_GROOVE;
+                                    break;
+                                case table::BorderLineStyle::INSET:
+                                    eStyle = XML_INSET;
+                                    break;
+                                case table::BorderLineStyle::OUTSET:
+                                    eStyle = XML_OUTSET;
+                                    break;
+                                default:
+                                    bNoBorder = true;
+                            }
+
+                            if ( !bNoBorder )
+                            {
+                                ::sax::Converter::convertMeasure(aOut, nWidth,
+                                       util::MeasureUnit::TWIP,
+                                       util::MeasureUnit::POINT);
+                                aOut.append( ' ' );
+                                aOut.append( GetXMLToken( eStyle ) );
+                                aOut.append( ' ' );
+                                ::sax::Converter::convertColor(aOut,
+                                        pLine->GetColor().GetColor());
+                            }
+                        }
+                        else
+                        {
+                            aOut.append( GetXMLToken(XML_NONE) );
                         }
                     }
-                    else
-                    {
-                        aOut.append( GetXMLToken(XML_NONE) );
-                    }
-                }
-                break;
+                    break;
 
-                // width
-                case ALL_BORDER_LINE_WIDTH:
-                case LEFT_BORDER_LINE_WIDTH:
-                case RIGHT_BORDER_LINE_WIDTH:
-                case TOP_BORDER_LINE_WIDTH:
-                case BOTTOM_BORDER_LINE_WIDTH:
-                    const SvxBorderLine* pLine;
-                    switch( nMemberId )
-                    {
+                    // width
                     case ALL_BORDER_LINE_WIDTH:
                     case LEFT_BORDER_LINE_WIDTH:
-                        pLine = pLeft;
-                        break;
                     case RIGHT_BORDER_LINE_WIDTH:
-                        pLine = pRight;
-                        break;
                     case TOP_BORDER_LINE_WIDTH:
-                        pLine = pTop;
-                        break;
                     case BOTTOM_BORDER_LINE_WIDTH:
-                        pLine = pBottom;
+                        const SvxBorderLine* pLine;
+                        switch( nMemberId )
+                        {
+                        case ALL_BORDER_LINE_WIDTH:
+                        case LEFT_BORDER_LINE_WIDTH:
+                            pLine = pLeft;
+                            break;
+                        case RIGHT_BORDER_LINE_WIDTH:
+                            pLine = pRight;
+                            break;
+                        case TOP_BORDER_LINE_WIDTH:
+                            pLine = pTop;
+                            break;
+                        case BOTTOM_BORDER_LINE_WIDTH:
+                            pLine = pBottom;
+                            break;
+                        default:
+                            return false;
+                        }
+                        rUnitConverter.convertMeasureToXML( aOut, pLine->GetInWidth() );
+                        aOut.append( ' ' );
+                        rUnitConverter.convertMeasureToXML( aOut, pLine->GetDistance() );
+                        aOut.append( ' ' );
+                        rUnitConverter.convertMeasureToXML( aOut, pLine->GetOutWidth() );
                         break;
-                    default:
-                        return false;
-                    }
-                    rUnitConverter.convertMeasureToXML( aOut, pLine->GetInWidth() );
-                    aOut.append( ' ' );
-                    rUnitConverter.convertMeasureToXML( aOut, pLine->GetDistance() );
-                    aOut.append( ' ' );
-                    rUnitConverter.convertMeasureToXML( aOut, pLine->GetOutWidth() );
-                    break;
                 }
-
-            bOk = true;
+                bOk = true;
+            }
         }
         break;
 
commit af598ec1d340f1c46c0568f79ab45653eda78620
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:09:29 2014 +0100

    coverity#735955 Explicit null dereferenced
    
    Change-Id: Ice64f610901ae9a5ee103fa1e4fec46a1142158d

diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index 499dc3f..493221a 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -1105,12 +1105,14 @@ bool SvXMLExportItemMapper::QueryXMLValue(
         case RES_COLLAPSING_BORDERS:
         {
             const SfxBoolItem* pBorders = PTR_CAST(SfxBoolItem, &rItem);
-            OSL_ENSURE( pBorders != NULL, "Wrong RES-ID" );
-
-            aOut.append( pBorders->GetValue()
-                         ? GetXMLToken( XML_COLLAPSING )
-                         : GetXMLToken( XML_SEPARATING ) );
-            bOk = true;
+            assert(pBorders); //Wrong RES-ID
+            if (pBorders)
+            {
+                aOut.append( pBorders->GetValue()
+                             ? GetXMLToken( XML_COLLAPSING )
+                             : GetXMLToken( XML_SEPARATING ) );
+                bOk = true;
+            }
         }
         break;
 
commit 4041263bde64dcc9a9a225d7f5a171f3b0455724
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:08:25 2014 +0100

    coverity#735943 Explicit null dereferenced
    
    Change-Id: I268ec2db2e8ec4a40dd8537989d2afe767207d40

diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index db16558..0e0b141 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -3155,6 +3155,9 @@ bool SwMSConvertControls::ExportControl(WW8Export &rWW8Wrt, const SdrObject *pOb
         return false;
 
     SdrUnoObj *pFormObj = PTR_CAST(SdrUnoObj,pObj);
+    assert(pFormObj);
+    if (!pFormObj)
+        return false;
     uno::Reference< awt::XControlModel > xControlModel =
     pFormObj->GetUnoControlModel();
 
commit 6fd5a490ffa15e4758e29dbb219b5b3fce39cf46
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:06:03 2014 +0100

    coverity#735938 Explicit null dereferenced
    
    Change-Id: Ia95f3ec5817035a596a8d64b0a7e9dc4445ec648

diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index 5b89745..3dbf7a3 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -648,6 +648,9 @@ const SdrObject *SwHTMLWriter::GetHTMLControl( const SwDrawFrmFmt& rFmt )
         return 0;
 
     SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pObj );
+    assert(pFormObj);
+    if (!pFormObj)
+        return 0;
     uno::Reference< awt::XControlModel >  xControlModel =
             pFormObj->GetUnoControlModel();
 
commit d9bf0107273c12316a22e655812f2efbaf0c5b6d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 16:05:13 2014 +0100

    coverity#735937 Explicit null dereferenced
    
    Change-Id: Ic8d177dcf565fca8cf1f238c12b16c5cea2066a6

diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index cda0bbd..5b89745 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -680,6 +680,9 @@ static void GetControlSize( const SdrObject& rSdrObj, Size& rSz,
         return;
 
     SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, &rSdrObj );
+    assert(pFormObj);
+    if (!pFormObj)
+        return;
     uno::Reference< awt::XControl >  xControl;
     SdrView* pDrawView = pVSh->GetDrawView();
     OSL_ENSURE( pDrawView && pVSh->GetWin(), "no DrawView or window!" );
commit 7afdd1baedc7f5f6d9d75d2e4df12c509c715927
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 15:59:59 2014 +0100

    coverity#735936 Explicit null dereferenced
    
    Change-Id: If85ed1e4c9aa4e1d816515264f21154d5661051c

diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index e4fcc42..cda0bbd 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -704,6 +704,9 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt,
     SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
 
     SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, &rSdrObject );
+    assert(pFormObj);
+    if (!pFormObj)
+        return rWrt;
     uno::Reference< awt::XControlModel > xControlModel =
         pFormObj->GetUnoControlModel();
 
commit 20d078326d37f3939eb83d5b2bfa4b108b497a90
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 7 15:58:37 2014 +0100

    coverity#735935 Explicit null dereferenced
    
    Change-Id: Ic67e0d06402ae28d4cffb817262a5adb23afc3ee

diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index bdd906b..e4fcc42 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -1316,7 +1316,9 @@ static void AddControl( HTMLControls& rControls,
                         sal_uInt32 nNodeIdx )
 {
     SdrUnoObj *pFormObj = PTR_CAST( SdrUnoObj, pSdrObj );
-    OSL_ENSURE( pFormObj, "Doch kein FormObj" );
+    assert(pFormObj); //Doch kein FormObj
+    if (!pFormObj)
+        return;
     uno::Reference< awt::XControlModel > xControlModel =
             pFormObj->GetUnoControlModel();
     if( !xControlModel.is() )


More information about the Libreoffice-commits mailing list