[Libreoffice-commits] core.git: 38 commits - chart2/source codemaker/source formula/source sal/qa sc/source sd/source starmath/source svl/source sw/source ucb/source xmlsecurity/source

Caolán McNamara caolanm at redhat.com
Sun May 11 13:06:40 PDT 2014


 chart2/source/tools/AxisHelper.cxx                            |    6 
 codemaker/source/cppumaker/cpputype.cxx                       |    3 
 formula/source/ui/dlg/formula.cxx                             |    6 
 sal/qa/OStringBuffer/rtl_OStringBuffer.cxx                    |    8 
 sc/source/core/tool/chgtrack.cxx                              |    4 
 sc/source/ui/miscdlgs/crnrdlg.cxx                             |   28 --
 sc/source/ui/unoobj/fielduno.cxx                              |    9 
 sd/source/core/drawdoc.cxx                                    |    2 
 sd/source/core/sdpage.cxx                                     |    6 
 sd/source/ui/func/fuinsfil.cxx                                |    2 
 starmath/source/cursor.cxx                                    |   13 -
 svl/source/numbers/zformat.cxx                                |    4 
 sw/source/core/docnode/section.cxx                            |    2 
 sw/source/core/draw/dpage.cxx                                 |   53 ++--
 sw/source/core/layout/flycnt.cxx                              |    2 
 sw/source/core/layout/paintfrm.cxx                            |    2 
 sw/source/core/layout/tabfrm.cxx                              |  121 ++++------
 sw/source/core/layout/wsfrm.cxx                               |    4 
 sw/source/core/uibase/app/docsh.cxx                           |    2 
 sw/source/core/uibase/uiview/view.cxx                         |    8 
 sw/source/core/uibase/uiview/viewmdi.cxx                      |    4 
 sw/source/core/uibase/uiview/viewprt.cxx                      |    2 
 sw/source/core/unocore/unodraw.cxx                            |    2 
 sw/source/filter/ww8/rtfsdrexport.cxx                         |    2 
 sw/source/filter/ww8/wrtw8nds.cxx                             |   11 
 sw/source/filter/ww8/ww8graf.cxx                              |    2 
 sw/source/ui/fmtui/tmpdlg.cxx                                 |    2 
 sw/source/ui/misc/num.cxx                                     |    4 
 ucb/source/ucp/webdav-neon/webdavcontent.cxx                  |    6 
 ucb/source/ucp/webdav-neon/webdavcontent.hxx                  |    6 
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |   16 -
 31 files changed, 171 insertions(+), 171 deletions(-)

New commits:
commit a6b753db97b354043bc63a66634ca35436783dde
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:56:48 2014 +0100

    coverity#1209904 Uncaught exception
    
    Change-Id: Ida33270344c25ffc81dccfa7a619b2911d40ae24

diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 03e7b27..ff1b86c 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -1540,7 +1540,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues(
 uno::Sequence< uno::Any > Content::setPropertyValues(
                 const uno::Sequence< beans::PropertyValue >& rValues,
                 const uno::Reference< ucb::XCommandEnvironment >& xEnv )
-    throw ( uno::Exception )
+    throw ( uno::Exception, std::exception )
 {
     uno::Reference< ucb::XContentIdentifier >    xIdentifier;
     rtl::Reference< ContentProvider >            xProvider;
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.hxx b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
index 12a7e8a..55de0ce 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
@@ -120,7 +120,7 @@ private:
                            ::com::sun::star::beans::PropertyValue >& rValues,
                        const ::com::sun::star::uno::Reference<
                            ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
-        throw ( ::com::sun::star::uno::Exception );
+        throw ( ::com::sun::star::uno::Exception, std::exception );
 
     typedef rtl::Reference< Content > ContentRef;
     typedef std::list< ContentRef > ContentRefList;
commit 593c310182a1d4e57add8e83faea4478712d36c9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:55:57 2014 +0100

    coverity#1209903 Uncaught exception
    
    Change-Id: Ic1ef4158a2ec3796678314fcb7c87faba29dd035

diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 050f358..03e7b27 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -2930,7 +2930,7 @@ bool Content::exchangeIdentity(
 
 bool Content::isFolder(
             const uno::Reference< ucb::XCommandEnvironment >& xEnv )
-    throw( uno::Exception )
+    throw( uno::Exception, std::exception )
 {
     {
         osl::MutexGuard aGuard( m_aMutex );
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.hxx b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
index 30bdab1..12a7e8a 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
@@ -106,7 +106,7 @@ private:
 
     bool isFolder( const ::com::sun::star::uno::Reference<
                            ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
-        throw ( ::com::sun::star::uno::Exception );
+        throw ( ::com::sun::star::uno::Exception, std::exception );
 
     ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >
     getPropertyValues( const ::com::sun::star::uno::Sequence<
commit 619d349f4c4e7e5f9f24f0ad3de79824ab67cb12
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:55:16 2014 +0100

    coverity#1209902 Uncaught exception
    
    Change-Id: Ic2a4b97e7b2d1db4f37a10b9fbd153d025613bd3

diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 18d772f..050f358 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -3262,7 +3262,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
 
 Content::ResourceType Content::getResourceType(
                     const uno::Reference< ucb::XCommandEnvironment >& xEnv )
-    throw ( uno::Exception )
+    throw ( uno::Exception, std::exception )
 {
     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     std::auto_ptr< DAVResourceAccess > xResAccess;
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.hxx b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
index 9bb4f7a..30bdab1 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.hxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.hxx
@@ -138,7 +138,7 @@ private:
     ResourceType
     getResourceType( const ::com::sun::star::uno::Reference<
                          ::com::sun::star::ucb::XCommandEnvironment >& xEnv )
-        throw ( ::com::sun::star::uno::Exception );
+        throw ( ::com::sun::star::uno::Exception, std::exception );
 
     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     ResourceType
commit fe6308ac60fa4d83d7a236ce0d233e0bbaac95bd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:52:33 2014 +0100

    coverity#1158099 Unchecked dynamic_cast
    
    Change-Id: I7c294042a3f4d7293fb6d93d33687eb265871e76

diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx
index d5e6db4..6157fbb 100644
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -148,10 +148,14 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis(
     {
         bool bFormatSet = false;
         //check whether we have a percent scale -> use percent format
+        ChartModel* pModel = NULL;
         if( xNumberFormatsSupplier.is() )
         {
-            ChartModel* pModel = dynamic_cast<ChartModel*>( xChartDoc.get() );
+            pModel = dynamic_cast<ChartModel*>( xChartDoc.get() );
             assert(pModel);
+        }
+        if (pModel)
+        {
             ScaleData aData = AxisHelper::getDateCheckedScale( xAxis, *pModel );
             if( aData.AxisType==AxisType::PERCENT )
             {
commit 934a7925de64f93c09429fc8482245635937c271
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:50:09 2014 +0100

    coverity#1213117 Unchecked dynamic_cast
    
    Change-Id: I6f55030ea7bebce99537c7cdd5156c83c38a765a

diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx
index 3ffceb2..3d14ec8 100644
--- a/codemaker/source/cppumaker/cpputype.cxx
+++ b/codemaker/source/cppumaker/cpputype.cxx
@@ -2151,6 +2151,9 @@ sal_uInt32 PlainStructType::getTotalMemberCount(OUString const & base) const {
     rtl::Reference< unoidl::PlainStructTypeEntity > ent2(
         dynamic_cast< unoidl::PlainStructTypeEntity * >(ent.get()));
     assert(ent2.is());
+    if (!ent2.is()) {
+        return 0;
+    }
     return getTotalMemberCount(ent2->getDirectBase())
         + ent2->getDirectMembers().size(); //TODO: overflow
 }
commit bd29e582f5b17bd880889581e2d8af319069ffc2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:48:26 2014 +0100

    coverity#1213129 Dereference after null check
    
    Change-Id: I2d427a187e9a9554ffce6cedbc6cda087b838c96

diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index fd1519e..4926b6d 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -120,7 +120,7 @@ void SwFlyAtCntFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
             // check, if at found anchor frame candidate already a fly frame
             // of the given fly frame format is registered.
             bFound = aOldIdx == aNewIdx;
-            if ( bFound && pCntnt->GetDrawObjs() )
+            if (bFound && pCntnt && pCntnt->GetDrawObjs())
             {
                 SwFrmFmt* pMyFlyFrmFmt( &GetFrmFmt() );
                 SwSortedObjs &rObjs = *pCntnt->GetDrawObjs();
commit 0d3df937f44b35da0f1d9a3a859020438f58f490
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:47:34 2014 +0100

    coverity#1213133 Dereference after null check
    
    Change-Id: I6b4c1fb7001d7e85810e9c60eadcb378b79b48df

diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index 84daeec..5110cdb 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -345,7 +345,7 @@ bool FuInsertFile::InsSDDinDrMode(SfxMedium* pMedium)
         bool bLink = pDlg->IsLink();
         bool bReplace = false;
         SdPage* pPage = NULL;
-        ::sd::View* pView = mpViewShell->GetView();
+        ::sd::View* pView = mpViewShell ? mpViewShell->GetView() : NULL;
 
         if (pView->ISA(OutlineView))
         {
commit c47f9cc18769d253dc2d060011806195d247c288
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:37:47 2014 +0100

    coverity#705853 Dereference before null check
    
    Change-Id: I0ef6645725699004d3ec93737135fe18640b1079

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index e2f782a..477ea48 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -694,7 +694,7 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectang
             case SDRUSERCALL_MOVEONLY:
             case SDRUSERCALL_RESIZE:
             {
-                if( pModel->isLocked() )
+                if (!pModel || pModel->isLocked())
                     break;
 
                 SdrObject* pObj = (SdrObject*) &rObj;
@@ -705,7 +705,7 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectang
                     {
                         if( pObj->GetUserCall() )
                         {
-                            ::svl::IUndoManager* pUndoManager = pModel ? static_cast<SdDrawDocument*>(pModel)->GetUndoManager() : 0;
+                            ::svl::IUndoManager* pUndoManager = static_cast<SdDrawDocument*>(pModel)->GetUndoManager();
                             const bool bUndo = pUndoManager && pUndoManager->IsInListAction() && IsInserted();
 
                             if( bUndo )
@@ -715,7 +715,7 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectang
                             pObj->SetUserCall(0);
                         }
                     }
-                    else if (pModel)
+                    else
                     {
                         // Object of the master page changed, therefore adjust
                         // object on all pages
commit 00c6053bd337eee26453fb783a90346a41cb0f27
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:36:17 2014 +0100

    coverity#736795 Dereference before null check
    
    Change-Id: Ic96095d6c8bf6a0ecb05452f2411d025e3965a57

diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 5904a64..63d5158 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -753,7 +753,7 @@ void SdDrawDocument::NewOrLoadCompleted( SdPage* pPage, SdStyleSheetPool* pSPool
                     }
                 }
 
-                if (pObj->ISA(SdrTextObj) && pObj->IsEmptyPresObj() && pPage)
+                if (pObj->ISA(SdrTextObj) && pObj->IsEmptyPresObj())
                 {
                     PresObjKind ePresObjKind = pPage->GetPresObjKind(pObj);
                     OUString aString( pPage->GetPresObjText(ePresObjKind) );
commit 2c71bdd8fd84a6dae2977ddde00cf5321b19e9b3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:34:41 2014 +0100

    coverity#705842 Dereference before null check
    
    Change-Id: Ia1e62c3c491525ff96774add0a2e1b10c817ac30

diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 1b1c1cb..459561a 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -199,12 +199,9 @@ ScUnoEditEngine::ScUnoEditEngine(ScEditEngineDefaulter* pSource)
     , nFieldPos(0)
     , nFieldIndex(0)
 {
-    if (pSource)
-    {
-        EditTextObject* pData = pSource->CreateTextObject();
-        SetText( *pData );
-        delete pData;
-    }
+    EditTextObject* pData = pSource->CreateTextObject();
+    SetText( *pData );
+    delete pData;
 }
 
 ScUnoEditEngine::~ScUnoEditEngine()
commit 860061de92c4288da5f78353e8aebeb9ffb3a54d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:33:49 2014 +0100

    coverity#705841 Dereference before null check
    
    Change-Id: I3b0f7530739a084f22f66313c3e1ffe2d60768ea

diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx
index eaa3601..294cf79 100644
--- a/sc/source/ui/miscdlgs/crnrdlg.cxx
+++ b/sc/source/ui/miscdlgs/crnrdlg.cxx
@@ -160,7 +160,7 @@ void ScColRowNameRangesDlg::Init()
 
     UpdateNames();
 
-    if ( pViewData && pDoc )
+    if (pViewData)
     {
         SCCOL nStartCol = 0;
         SCROW nStartRow = 0;
commit 6074a4f72c05641fa471981f6a7ffbd19bc20c70
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:32:13 2014 +0100

    coverity#705840 Dereference before null check
    
    Change-Id: I732ded8a169b9bd0be85b193928a39c0a215ec36

diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx
index 7c01a70..eaa3601 100644
--- a/sc/source/ui/miscdlgs/crnrdlg.cxx
+++ b/sc/source/ui/miscdlgs/crnrdlg.cxx
@@ -515,16 +515,13 @@ void ScColRowNameRangesDlg::UpdateNames()
             if(q>nCol2) q=nCol2;
             //@008 Baue String zusammen
             strShow = " [";
-            if(pDoc!=NULL)
+            rString = pDoc->GetString(nCol1, nRow1, nTab1);
+            strShow += rString;
+            for(SCCOL i=nCol1+1;i<=q;i++)
             {
-                rString = pDoc->GetString(nCol1, nRow1, nTab1);
+                strShow += ", ";
+                rString = pDoc->GetString(i, nRow1, nTab1);
                 strShow += rString;
-                for(SCCOL i=nCol1+1;i<=q;i++)
-                {
-                    strShow += ", ";
-                    rString = pDoc->GetString(i, nRow1, nTab1);
-                    strShow += rString;
-                }
             }
             if(q<nCol2) // Zu lang? Ergaenzen um ",..."
             {
@@ -560,16 +557,13 @@ void ScColRowNameRangesDlg::UpdateNames()
             SCROW q=nRow1+3;
             if(q>nRow2) q=nRow2;
             strShow = " [";
-            if(pDoc!=NULL)
+            rString = pDoc->GetString(nCol1, nRow1, nTab1);
+            strShow += rString;
+            for(SCROW i=nRow1+1;i<=q;i++)
             {
-                rString = pDoc->GetString(nCol1, nRow1, nTab1);
+                strShow += ", ";
+                rString = pDoc->GetString(nCol1, i, nTab1);
                 strShow += rString;
-                for(SCROW i=nRow1+1;i<=q;i++)
-                {
-                    strShow += ", ";
-                    rString = pDoc->GetString(nCol1, i, nTab1);
-                    strShow += rString;
-                }
             }
             if(q<nRow2)
             {
commit 7adbc1c68c02407b31e864cc6aff484949e270fd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:30:32 2014 +0100

    coverity#1213310 Dereference before null check
    
    Change-Id: I8590afae1f7b74a250a550adfa010374a3533473

diff --git a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
index d31488b..d38a6a6 100644
--- a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
+++ b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
@@ -1510,19 +1510,13 @@ namespace rtl_OStringBuffer
 
         void getStr_002()
         {
-            // const sal_Char         tmpUC=0x0;
-            // const sal_Char*        expVal=&tmpUC;
             ::rtl::OStringBuffer   aStrBuf;
-            // sal_Int32              cmpLen = 1;
-
             const sal_Char* pstr = aStrBuf.getStr();
-            sal_Int32 nLen = strlen(pstr);
-
             CPPUNIT_ASSERT_MESSAGE
             (
                 "test empty string",
                 pstr != 0 &&
-                nLen == 0
+                strlen(pstr) == 0
             );
 
         }
commit 82335d982a66da64ada19b0ed72d8d12c95360e0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:05:19 2014 +0100

    coverity#736844 Dereference before null check
    
    Change-Id: I37e02d92590d7ac480b831a347bb9902febb8805

diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 6ef9a0d..4fea5d7 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -620,7 +620,7 @@ const SwTOXBase* SwSection::GetTOXBase() const
 {
     const SwTOXBase* pRet = 0;
     if( TOX_CONTENT_SECTION == GetType() )
-        pRet = PTR_CAST( SwTOXBaseSection, this );
+        pRet = dynamic_cast<const SwTOXBaseSection*>(this);
     return pRet;
 }
 
commit 0a49132cd064272442ca7500476e2346dc0aa4cd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:04:19 2014 +0100

    coverity#705918 Dereference before null check
    
    Change-Id: Ic36d335f06833e830c97ca34b7d96c5ff421f944

diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx
index 64692a8..d98bfd4 100644
--- a/sw/source/core/draw/dpage.cxx
+++ b/sw/source/core/draw/dpage.cxx
@@ -84,38 +84,35 @@ const SdrPageGridFrameList*  SwDPage::GetGridFrameList(
                         const SdrPageView* pPV, const Rectangle *pRect ) const
 {
     SwViewShell *pSh = ((SwDrawDocument*)GetModel())->GetDoc().GetCurrentViewShell();
-    if ( pSh )
+    while (pSh && pSh->Imp()->GetPageView() != pPV)
+        pSh = (SwViewShell*)pSh->GetNext();
+    if (pSh)
     {
-        while ( pSh->Imp()->GetPageView() != pPV )
-            pSh = (SwViewShell*)pSh->GetNext();
-        if ( pSh )
-        {
-            if ( pGridLst )
-                ((SwDPage*)this)->pGridLst->Clear();
-            else
-                ((SwDPage*)this)->pGridLst = new SdrPageGridFrameList;
+        if ( pGridLst )
+            ((SwDPage*)this)->pGridLst->Clear();
+        else
+            ((SwDPage*)this)->pGridLst = new SdrPageGridFrameList;
 
-            if ( pRect )
-            {
-                //The drawing demands all pages which overlap with the rest.
-                const SwRect aRect( *pRect );
-                const SwFrm *pPg = pSh->GetLayout()->Lower();
+        if ( pRect )
+        {
+            //The drawing demands all pages which overlap with the rest.
+            const SwRect aRect( *pRect );
+            const SwFrm *pPg = pSh->GetLayout()->Lower();
+            do
+            {   if ( pPg->Frm().IsOver( aRect ) )
+                    ::InsertGridFrame( ((SwDPage*)this)->pGridLst, pPg );
+                pPg = pPg->GetNext();
+            } while ( pPg );
+        }
+        else
+        {
+            //The drawing demands all visible pages
+            const SwFrm *pPg = pSh->Imp()->GetFirstVisPage();
+            if ( pPg )
                 do
-                {   if ( pPg->Frm().IsOver( aRect ) )
-                        ::InsertGridFrame( ((SwDPage*)this)->pGridLst, pPg );
+                {   ::InsertGridFrame( ((SwDPage*)this)->pGridLst, pPg );
                     pPg = pPg->GetNext();
-                } while ( pPg );
-            }
-            else
-            {
-                //The drawing demands all visible pages
-                const SwFrm *pPg = pSh->Imp()->GetFirstVisPage();
-                if ( pPg )
-                    do
-                    {   ::InsertGridFrame( ((SwDPage*)this)->pGridLst, pPg );
-                        pPg = pPg->GetNext();
-                    } while ( pPg && pPg->Frm().IsOver( pSh->VisArea() ) );
-            }
+                } while ( pPg && pPg->Frm().IsOver( pSh->VisArea() ) );
         }
     }
     return pGridLst;
commit ad1bb28b25d24772e06c1d45e8ea8853702a1c10
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:02:22 2014 +0100

    coverity#1213291 Dereference before null check
    
    Change-Id: I854a016523e290e2ea42aa86c0c46e8a31fc5018

diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 68606d8..8d16d93 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2087,7 +2087,7 @@ void DrawGraphic(
             {
                 GraphicAttr pGrfAttr = pGrf->GetAttr();
                 if ( (pGrfAttr.GetTransparency() != 0) &&
-                     ( pBrush && (pBrush->GetColor() == COL_TRANSPARENT) )
+                     (pBrush->GetColor() == COL_TRANSPARENT)
                    )
                 {
                     bTransparentGrfWithNoFillBackgrd = true;
commit bb9114f72332b0075d25e5ab625ea6c44cd12975
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 20:00:58 2014 +0100

    coverity#705926 Dereference before null check
    
    Change-Id: I5a475d357aed24a01cd4e1e45765f1d6e585ee45

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 786145a..110459d 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -479,7 +479,7 @@ static void lcl_PreprocessRowsInCells( SwTabFrm& rTab, SwRowFrm& rLastLine,
             SwTwips nCurrentHeight =
                     lcl_CalcMinRowHeight( pTmpLastLineRow,
                                           rTab.IsConsiderObjsForMinCellHeight() );
-            while ( pTmpLastLineRow && pTmpLastLineRow->GetNext() && nTmpCut > nCurrentHeight )
+            while ( pTmpLastLineRow->GetNext() && nTmpCut > nCurrentHeight )
             {
                 nTmpCut -= nCurrentHeight;
                 pTmpLastLineRow = (SwRowFrm*)pTmpLastLineRow->GetNext();
@@ -490,74 +490,71 @@ static void lcl_PreprocessRowsInCells( SwTabFrm& rTab, SwRowFrm& rLastLine,
             }
 
             // pTmpLastLineRow does not fit to the line or it is the last line
-            if ( pTmpLastLineRow )
+            // Check if we can move pTmpLastLineRow to the follow table,
+            // or if we have to split the line:
+            SwFrm* pCell = pTmpLastLineRow->Lower();
+            bool bTableLayoutToComplex = false;
+            long nMinHeight = 0;
+
+            // We have to take into account:
+            // 1. The fixed height of the row
+            // 2. The borders of the cells inside the row
+            // 3. The minimum height of the row
+            if ( pTmpLastLineRow->HasFixSize() )
+                nMinHeight = (pTmpLastLineRow->Frm().*fnRect->fnGetHeight)();
+            else
             {
-                // Check if we can move pTmpLastLineRow to the follow table,
-                // or if we have to split the line:
-                SwFrm* pCell = pTmpLastLineRow->Lower();
-                bool bTableLayoutToComplex = false;
-                long nMinHeight = 0;
-
-                // We have to take into account:
-                // 1. The fixed height of the row
-                // 2. The borders of the cells inside the row
-                // 3. The minimum height of the row
-                if ( pTmpLastLineRow->HasFixSize() )
-                    nMinHeight = (pTmpLastLineRow->Frm().*fnRect->fnGetHeight)();
-                else
+                while ( pCell )
                 {
-                    while ( pCell )
+                    if ( ((SwCellFrm*)pCell)->Lower() &&
+                         ((SwCellFrm*)pCell)->Lower()->IsRowFrm() )
                     {
-                        if ( ((SwCellFrm*)pCell)->Lower() &&
-                             ((SwCellFrm*)pCell)->Lower()->IsRowFrm() )
-                        {
-                            bTableLayoutToComplex = true;
-                            break;
-                        }
-
-                        SwBorderAttrAccess aAccess( SwFrm::GetCache(), pCell );
-                        const SwBorderAttrs &rAttrs = *aAccess.Get();
-                        nMinHeight = std::max( nMinHeight, lcl_CalcTopAndBottomMargin( *(SwLayoutFrm*)pCell, rAttrs ) );
-                        pCell = pCell->GetNext();
+                        bTableLayoutToComplex = true;
+                        break;
                     }
 
-                    const SwFmtFrmSize &rSz = pTmpLastLineRow->GetFmt()->GetFrmSize();
-                    if ( rSz.GetHeightSizeType() == ATT_MIN_SIZE )
-                        nMinHeight = std::max( nMinHeight, rSz.GetHeight() );
+                    SwBorderAttrAccess aAccess( SwFrm::GetCache(), pCell );
+                    const SwBorderAttrs &rAttrs = *aAccess.Get();
+                    nMinHeight = std::max( nMinHeight, lcl_CalcTopAndBottomMargin( *(SwLayoutFrm*)pCell, rAttrs ) );
+                    pCell = pCell->GetNext();
                 }
 
-                // 1. Case:
-                // The line completely fits into the master table.
-                // Nevertheless, we build a follow (otherwise painting problems
-                // with empty cell).
-
-                // 2. Case:
-                // The line has to be split, the minimum height still fits into
-                // the master table, and the table structure is not to complex.
-                if ( nTmpCut > nCurrentHeight ||
-                     ( pTmpLastLineRow->IsRowSplitAllowed() &&
-                      !bTableLayoutToComplex && nMinHeight < nTmpCut ) )
-                {
-                    // The line has to be split:
-                    SwRowFrm* pNewRow = new SwRowFrm( *pTmpLastLineRow->GetTabLine(), &rTab, false );
-                    pNewRow->SetFollowFlowRow( true );
-                    pNewRow->SetFollowRow( pTmpLastLineRow->GetFollowRow() );
-                    pTmpLastLineRow->SetFollowRow( pNewRow );
-                    pNewRow->InsertBehind( pCurrFollowFlowLineCell, 0 );
-                    pTmpLastLineRow = (SwRowFrm*)pTmpLastLineRow->GetNext();
-                }
+                const SwFmtFrmSize &rSz = pTmpLastLineRow->GetFmt()->GetFrmSize();
+                if ( rSz.GetHeightSizeType() == ATT_MIN_SIZE )
+                    nMinHeight = std::max( nMinHeight, rSz.GetHeight() );
+            }
 
-                // The following lines have to be moved:
-                while ( pTmpLastLineRow )
-                {
-                    SwRowFrm* pTmp = (SwRowFrm*)pTmpLastLineRow->GetNext();
-                    lcl_MoveFootnotes( rTab, *rTab.GetFollow(), *pTmpLastLineRow );
-                    pTmpLastLineRow->Remove();
-                    pTmpLastLineRow->InsertBefore( pCurrFollowFlowLineCell, 0 );
-                    pTmpLastLineRow->Shrink( ( pTmpLastLineRow->Frm().*fnRect->fnGetHeight)() );
-                    pCurrFollowFlowLineCell->Grow( ( pTmpLastLineRow->Frm().*fnRect->fnGetHeight)() );
-                    pTmpLastLineRow = pTmp;
-                }
+            // 1. Case:
+            // The line completely fits into the master table.
+            // Nevertheless, we build a follow (otherwise painting problems
+            // with empty cell).
+
+            // 2. Case:
+            // The line has to be split, the minimum height still fits into
+            // the master table, and the table structure is not to complex.
+            if ( nTmpCut > nCurrentHeight ||
+                 ( pTmpLastLineRow->IsRowSplitAllowed() &&
+                  !bTableLayoutToComplex && nMinHeight < nTmpCut ) )
+            {
+                // The line has to be split:
+                SwRowFrm* pNewRow = new SwRowFrm( *pTmpLastLineRow->GetTabLine(), &rTab, false );
+                pNewRow->SetFollowFlowRow( true );
+                pNewRow->SetFollowRow( pTmpLastLineRow->GetFollowRow() );
+                pTmpLastLineRow->SetFollowRow( pNewRow );
+                pNewRow->InsertBehind( pCurrFollowFlowLineCell, 0 );
+                pTmpLastLineRow = (SwRowFrm*)pTmpLastLineRow->GetNext();
+            }
+
+            // The following lines have to be moved:
+            while ( pTmpLastLineRow )
+            {
+                SwRowFrm* pTmp = (SwRowFrm*)pTmpLastLineRow->GetNext();
+                lcl_MoveFootnotes( rTab, *rTab.GetFollow(), *pTmpLastLineRow );
+                pTmpLastLineRow->Remove();
+                pTmpLastLineRow->InsertBefore( pCurrFollowFlowLineCell, 0 );
+                pTmpLastLineRow->Shrink( ( pTmpLastLineRow->Frm().*fnRect->fnGetHeight)() );
+                pCurrFollowFlowLineCell->Grow( ( pTmpLastLineRow->Frm().*fnRect->fnGetHeight)() );
+                pTmpLastLineRow = pTmp;
             }
         }
 
commit fdd91a2867e7d65caa6941517e5536edffbe4f8e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 19:57:35 2014 +0100

    coverity#705927 Dereference before null check
    
    Change-Id: I72e58bfac2ade64119ed2abebb910b6e1e9e8b6a

diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 8b26e60..786145a 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -979,7 +979,7 @@ bool SwTabFrm::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKee
         {
             // Check if there are (first) rows inside this row,
             // which are not allowed to be split.
-            SwCellFrm* pLowerCell = pRow ? (SwCellFrm*)pRow->Lower() : 0;
+            SwCellFrm* pLowerCell = (SwCellFrm*)pRow->Lower();
             while ( pLowerCell )
             {
                 if ( pLowerCell->Lower() && pLowerCell->Lower()->IsRowFrm() )
commit c9342381d2435f3db70e640ec61f2162ddb861bc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 19:56:02 2014 +0100

    coverity#705928 Dereference before null check
    
    Change-Id: If780c64d5b55d961614e825a338506220833f7dc

diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 70f8896..bbab6c3 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2641,7 +2641,7 @@ void SwLayoutFrm::ChgLowersProp( const Size& rOldSize )
                 if( bVert )
                 {
                     SwTwips nBot = Frm().Left() + Prt().Left();
-                    while ( pLowerFrm->GetPrev() && pLowerFrm->Frm().Left() < nBot )
+                    while ( pLowerFrm && pLowerFrm->GetPrev() && pLowerFrm->Frm().Left() < nBot )
                     {
                         pLowerFrm->_InvalidateAll();
                         pLowerFrm->InvalidatePage( pPage );
@@ -2651,7 +2651,7 @@ void SwLayoutFrm::ChgLowersProp( const Size& rOldSize )
                 else
                 {
                     SwTwips nBot = Frm().Top() + Prt().Bottom();
-                    while ( pLowerFrm->GetPrev() && pLowerFrm->Frm().Top() > nBot )
+                    while ( pLowerFrm && pLowerFrm->GetPrev() && pLowerFrm->Frm().Top() > nBot )
                     {
                         pLowerFrm->_InvalidateAll();
                         pLowerFrm->InvalidatePage( pPage );
commit 4e0d635f50040df960ce60ed954c76fa811f40bc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 19:53:18 2014 +0100

    coverity#736861 Dereference before null check
    
    Change-Id: I4930657852f0ee4c3d7a751b9c90a2a65d329c40

diff --git a/sw/source/core/uibase/app/docsh.cxx b/sw/source/core/uibase/app/docsh.cxx
index e3c0e48..23abaf7 100644
--- a/sw/source/core/uibase/app/docsh.cxx
+++ b/sw/source/core/uibase/app/docsh.cxx
@@ -818,7 +818,7 @@ void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup,
     pDev->SetFillColor();
     pDev->SetLineColor();
     pDev->SetBackground();
-    bool bWeb = 0 != PTR_CAST(SwWebDocShell, this);
+    const bool bWeb = this->ISA(SwWebDocShell);
     SwPrintData aOpts;
     SwViewShell::PrtOle2( pDoc, SW_MOD()->GetUsrPref(bWeb), aOpts, pDev, aRect );
     pDev->Pop();
commit 4d9d727a23c9e42599a90a1759c85b3e443de493
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 19:52:31 2014 +0100

    coverity#736864 Dereference before null check
    
    Change-Id: Ia26b4b391de088487e30a2767660ade6c147eeb4

diff --git a/sw/source/core/uibase/uiview/view.cxx b/sw/source/core/uibase/uiview/view.cxx
index 705514f..1d3ecd9 100644
--- a/sw/source/core/uibase/uiview/view.cxx
+++ b/sw/source/core/uibase/uiview/view.cxx
@@ -748,6 +748,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
     m_aTimer.SetTimeout( 120 );
 
     SwDocShell* pDocSh = PTR_CAST( SwDocShell, _pFrame->GetObjectShell() );
+    OSL_ENSURE( pDocSh, "view without DocShell." );
     bool bOldModifyFlag = pDocSh->IsEnableSetModified();
     if(bOldModifyFlag)
         pDocSh->EnableSetModified( false );
@@ -757,10 +758,9 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
     // manually.
     if( pDocSh->GetDoc()->get( IDocumentSettingAccess::EMBED_FONTS ))
         pDocSh->UpdateFontList();
-    OSL_ENSURE( pDocSh, "view without DocShell." );
-    SwWebDocShell* pWebDShell = PTR_CAST( SwWebDocShell, pDocSh );
+    bool bWebDShell = pDocSh->ISA(SwWebDocShell);
 
-    const SwMasterUsrPref *pUsrPref = SW_MOD()->GetUsrPref(0 != pWebDShell);
+    const SwMasterUsrPref *pUsrPref = SW_MOD()->GetUsrPref(bWebDShell);
     SwViewOption aUsrPref( *pUsrPref);
 
     //! get lingu options without loading lingu DLL
@@ -804,7 +804,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
     {
         SwDoc& rDoc = *((SwDocShell*)pDocSh)->GetDoc();
 
-        if( !bOldShellWasSrcView && pWebDShell && !m_bOldShellWasPagePreview )
+        if( !bOldShellWasSrcView && bWebDShell && !m_bOldShellWasPagePreview )
             aUsrPref.setBrowseMode( true );
         else
             aUsrPref.setBrowseMode( rDoc.get(IDocumentSettingAccess::BROWSE_MODE) );
commit 85834e2e18b3dbeb6d257e4bb83e4cc61e538f9e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 19:17:44 2014 +0100

    coverity#1213305 Dereference before null check
    
    Change-Id: Ib42b50aad0f82f9b6974969ab9a30a4d1efbf46e

diff --git a/sw/source/core/uibase/uiview/viewmdi.cxx b/sw/source/core/uibase/uiview/viewmdi.cxx
index ce60583..b18ef33 100644
--- a/sw/source/core/uibase/uiview/viewmdi.cxx
+++ b/sw/source/core/uibase/uiview/viewmdi.cxx
@@ -80,7 +80,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
 
     long nFac = nFactor;
 
-    bool bWeb = 0 != PTR_CAST(SwWebView, this);
+    const bool bWeb = this->ISA(SwWebView);
     SwMasterUsrPref *pUsrPref = (SwMasterUsrPref*)SW_MOD()->GetUsrPref(bWeb);
 
     const SwPageDesc &rDesc = m_pWrtShell->GetPageDesc( m_pWrtShell->GetCurPageDesc() );
commit 5ca465c9a6c5dec04b77b013581a3629c17ced99
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 19:17:06 2014 +0100

    coverity#1213306 Dereference before null check
    
    Change-Id: I0ea0731b96ba9483986240ab69a5fd4e728bfae1

diff --git a/sw/source/core/uibase/uiview/viewmdi.cxx b/sw/source/core/uibase/uiview/viewmdi.cxx
index c681a8f..ce60583 100644
--- a/sw/source/core/uibase/uiview/viewmdi.cxx
+++ b/sw/source/core/uibase/uiview/viewmdi.cxx
@@ -215,7 +215,7 @@ void SwView::SetViewLayout( sal_uInt16 nColumns, bool bBookMode, bool bViewOnly
 
     if ( !GetViewFrame()->GetFrame().IsInPlace() && !bViewOnly )
     {
-        const bool bWeb = 0 != PTR_CAST(SwWebView, this);
+        const bool bWeb = this->ISA(SwWebView);
         SwMasterUsrPref *pUsrPref = (SwMasterUsrPref*)SW_MOD()->GetUsrPref(bWeb);
 
         // Update MasterUsrPrefs and after that update the ViewOptions of the current View.
commit f5177e438e7ba026c5372ba10f0aff5923797664
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 19:14:56 2014 +0100

    coverity#736870 Dereference before null check
    
    Change-Id: Ic1a410952023d47da5bb36a438eac1bc3c68319c

diff --git a/sw/source/core/uibase/uiview/viewprt.cxx b/sw/source/core/uibase/uiview/viewprt.cxx
index f29c7b8..aa2abd7 100644
--- a/sw/source/core/uibase/uiview/viewprt.cxx
+++ b/sw/source/core/uibase/uiview/viewprt.cxx
@@ -116,7 +116,7 @@ sal_uInt16 SwView::SetPrinter(SfxPrinter* pNew, sal_uInt16 nDiffFlags, bool  )
         if ( nDiffFlags & SFX_PRINTER_PRINTER )
             rSh.SetModified();
     }
-    bool bWeb = 0 != PTR_CAST(SwWebView, this);
+    bool bWeb = this->ISA(SwWebView);
     if ( nDiffFlags & SFX_PRINTER_OPTIONS )
         ::SetPrinter( rSh.getIDocumentDeviceAccess(), pNew, bWeb );
 
commit 7ad148c17ac55beff60b23ae973f4ebb7b599980
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 19:13:44 2014 +0100

    coverity#736853 Dereference before null check
    
    Change-Id: I13dcfdc1d424ef115dcb665d91648decdc7176d7

diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index ac0a415..229ae11 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -348,7 +348,7 @@ uno::Reference< drawing::XShape >  SwFmDrawPage::_CreateShape( SdrObject *pObj )
             uno::Reference< uno::XInterface > xCreate(xRet, uno::UNO_QUERY);
             xRet = 0;
             uno::Reference< beans::XPropertySet >  xPrSet;
-            if ( pObj->IsGroupObject() && (!pObj->Is3DObj() || ( PTR_CAST(E3dScene,pObj ) != NULL ) ) )
+            if ( pObj->IsGroupObject() && (!pObj->Is3DObj() || (pObj->ISA(E3dScene))) )
                 xPrSet = new SwXGroupShape( xCreate );
             else
                 xPrSet = new SwXShape( xCreate );
commit 5a1a10e8bf9d9125d981d71761f8f11d55e317d5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 19:12:05 2014 +0100

    coverity#736855 Dereference before null check
    
    Change-Id: I3074846fc5609f30fa1b545e07657c95347f640d

diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index 34fa98e..44eafd5 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -516,7 +516,7 @@ sal_Int32 RtfSdrExport::StartShape()
     lcl_AppendSP(m_rAttrOutput.RunText(), "wzName", msfilter::rtfutil::OutString(m_pSdrObject->GetTitle(), m_rExport.eCurrentEncoding));
 
     // now check if we have some text
-    const SdrTextObj* pTxtObj = PTR_CAST(SdrTextObj, m_pSdrObject);
+    const SdrTextObj* pTxtObj = dynamic_cast<const SdrTextObj*>(m_pSdrObject);
     if (pTxtObj)
     {
         const OutlinerParaObject* pParaObj = 0;
commit b11059614348d96ec99b90730164bd0b7af5c739
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 19:11:20 2014 +0100

    coverity#736856 Dereference before null check
    
    Change-Id: I4ae578356f47c1f079008acdb55e61e690a37be1

diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 3ac2e76..b4f28ab 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1190,7 +1190,7 @@ SdrObject* SwWW8ImplReader::ReadTxtBox( WW8_DPHEAD* pHd, const WW8_DO* pDo,
 
     long nStartCpFly,nEndCpFly;
     bool bContainsGraphics;
-    InsertTxbxText(PTR_CAST(SdrTextObj,pObj), &aSize, 0, 0, 0, 0, false,
+    InsertTxbxText(dynamic_cast<SdrTextObj*>(pObj), &aSize, 0, 0, 0, 0, false,
         bDummy,0,&nStartCpFly,&nEndCpFly,&bContainsGraphics);
 
     SetStdAttr( rSet, aTxtB.aLnt, aTxtB.aShd );
commit bb04d85521acd1bea92bf9fdf4e3d17053b3a99f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 19:10:01 2014 +0100

    coverity#736862 Dereference before null check
    
    Change-Id: I0264f7eeb003274d7a061caecc6fc6fb5c6b9fb7

diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx
index cc591f3..a6bed35 100644
--- a/sw/source/ui/fmtui/tmpdlg.cxx
+++ b/sw/source/ui/fmtui/tmpdlg.cxx
@@ -534,7 +534,7 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
              aList.push_back( rCharFmtLB.GetEntry(j) );
 
         aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
-        FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
+        FieldUnit eMetric = ::GetDfltMetric(pDocShell->ISA(SwWebDocShell));
         aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)));
         rPage.PageCreated(aSet);
     }
commit f04803ecd33210bebfc85d60690c26200424a077
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 19:09:13 2014 +0100

    coverity#736863 Dereference before null check
    
    Change-Id: If719ed8411ee65c6b81452434810a21ac1da7e58

diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx
index 74b5061..d81d767 100644
--- a/sw/source/ui/misc/num.cxx
+++ b/sw/source/ui/misc/num.cxx
@@ -972,14 +972,14 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage)
 
         aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ;
 
-        FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
+        FieldUnit eMetric = ::GetDfltMetric(pDocShell->ISA(SwWebDocShell));
         aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric) ) );
         rPage.PageCreated(aSet);
     }
     else if (nPageId == m_nPositionPageId)
     {
         SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell();
-        FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, pDocShell));
+        FieldUnit eMetric = ::GetDfltMetric(pDocShell->ISA(SwWebDocShell));
         SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
         aSet.Put ( SfxAllEnumItem(SID_METRIC_ITEM, static_cast< sal_uInt16 >(eMetric)) );
         rPage.PageCreated(aSet);
commit dc5c767882d91a1c42410b86d0e33eaf72ed9a81
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 18:41:39 2014 +0100

    coverity#736092 Improper use of negative value
    
    Change-Id: Idd8d0ea9c6a99cdef8e933b67201208006e92228

diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index d6b57d7..a9ccee7 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1496,7 +1496,7 @@ void ScChangeActionContent::GetDescription(
     if (aTmpStr.isEmpty())
         aTmpStr = ScGlobal::GetRscString( STR_CHANGED_BLANK );
 
-    nPos = aRsc.indexOfAsciiL("#3", 2, nPos);
+    nPos = nPos >= 0 ? aRsc.indexOfAsciiL("#3", 2, nPos) : -1;
     if (nPos >= 0)
     {
         aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
commit 3d7cc977313959d12a0469ee29310b536e377f7c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 18:41:08 2014 +0100

    coverity#736091 Improper use of negative value
    
    Change-Id: I9cf59f66e4d8c7b1036f6808b428f3845aa181a9

diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index b9cc58a..d6b57d7 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1208,7 +1208,7 @@ void ScChangeActionMove::GetDescription(
     }
 
     aTmpStr = ScChangeAction::GetRefString(GetBigRange(), pDoc, bFlag3D);
-    nPos = aRsc.indexOfAsciiL("#2", 2, nPos);
+    nPos = nPos >= 0 ? aRsc.indexOfAsciiL("#2", 2, nPos) : -1;
     if (nPos >= 0)
     {
         aRsc = aRsc.replaceAt(nPos, 2, aTmpStr);
commit ed75dbb1ca64a06840c5c3d1ecbfeb6362350fde
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 18:39:12 2014 +0100

    coverity#736100 Improper use of negative value
    
    Change-Id: Ia5cf36b64841f2d465c922da40008a540cc6caf7

diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index 191ffc2..c29d009 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -933,7 +933,9 @@ void SmCursor::InsertFraction() {
     //Find Parent and offset in parent
     SmStructureNode *pLineParent = pLine->GetParent();
     int nParentIndex = pLineParent->IndexOfSubNode(pLine);
-    OSL_ENSURE(nParentIndex != -1, "pLine must be a subnode of pLineParent!");
+    assert(nParentIndex != -1); //pLine must be a subnode of pLineParent!
+    if (nParentIndex == -1)
+        return;
 
     //We begin modifying the tree here
     BeginEdit();
commit 70ba0a8d4e8ba959c5eef4f025b85306a7153fd0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 18:38:31 2014 +0100

    coverity#736101 Improper use of negative value
    
    Change-Id: I6fec141e19de921128365da7cbd17e0a0bc0b9a9

diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index 7748db9..191ffc2 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -263,7 +263,9 @@ void SmCursor::Delete(){
     SmStructureNode* pLineParent = pLine->GetParent();
     //Find line offset in parent
     int nLineOffset = pLineParent->IndexOfSubNode(pLine);
-    OSL_ENSURE(nLineOffset != -1, "pLine must be a child of its parent!");
+    assert(nLineOffset != -1); //pLine must be a child of its parent!
+    if (nLineOffset == -1)
+        return;
 
     //Position after delete
     SmCaretPos PosAfterDelete;
commit 08fad277a07bb3cd7873ccd4f4f64ec6dae21e9f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 18:37:34 2014 +0100

    coverity#736102 Improper use of negative value
    
    Change-Id: I3f915ff949fa00357599e8cfc59c01c6eb04e9fd

diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index f3eff79..7748db9 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -809,7 +809,10 @@ bool SmCursor::InsertRow() {
     //Find parent and offset in parent
     SmStructureNode *pLineParent = pLine->GetParent();
     int nParentIndex = pLineParent->IndexOfSubNode(pLine);
-    OSL_ENSURE( nParentIndex != -1, "pLine must be a subnode of pLineParent!");
+
+    assert(nParentIndex != -1); //pLine must be a subnode of pLineParent
+    if (nParentIndex == -1)
+        return false;
 
     //Discover the context of this command
     SmTableNode  *pTable  = NULL;
commit 9ca2e0abe7ed6c60682cadec836789dace169eb4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 18:35:55 2014 +0100

    coverity#982701 Improper use of negative value
    
    Change-Id: I3c932e8386d994450f05a876b6ad76ba141bd4e9

diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 5d5f9e3..575c6ea 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -5439,6 +5439,10 @@ sal_Int32 SvNumberformat::GetQuoteEnd( const OUString& rStr, sal_Int32 nPos,
                                        sal_Unicode cQuote, sal_Unicode cEscIn,
                                        sal_Unicode cEscOut )
 {
+    if ( nPos < 0 )
+    {
+        return -1;
+    }
     sal_Int32 nLen = rStr.getLength();
     if ( nPos >= nLen )
     {
commit ee636db4dd742e14c052a0974d3bf593f3181309
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 17:51:19 2014 +0100

    coverity#1169835 Improper use of negative value
    
    Change-Id: I1857f5c712f9407c8a4b69f30044e8bb444afad2

diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 6c6fc7b..11d36cc 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -489,7 +489,7 @@ sal_Int32 FormulaDlg_Impl::GetFunctionPos(sal_Int32 nPos)
                 const sal_Int32 n1 = nTokPos < 0 ? -1 : aFormString.indexOf(sep, nTokPos);
                 const sal_Int32 n2 = nTokPos < 0 ? -1 : aFormString.indexOf(')',nTokPos);
                 sal_Int32 nXXX = nTokPos;
-                if( n1 < n2 )
+                if( n1 < n2 && n1 != -1 )
                 {
                     nTokPos=n1;
                 }
@@ -501,8 +501,8 @@ sal_Int32 FormulaDlg_Impl::GetFunctionPos(sal_Int32 nPos)
                 {
                     aArgs[0] = *pNextToken;
                     const OUString a2String = xParser->printFormula(aArgs, aRefPos);
-                    const sal_Int32 n3 = aFormString.indexOf(a2String,nXXX);
-                    if ( n3 < nTokPos )
+                    const sal_Int32 n3 = nXXX < 0 ? -1 : aFormString.indexOf(a2String, nXXX);
+                    if (n3 < nTokPos && n3 != -1)
                         nTokPos = n3;
                 }
             }
commit f3e519d4242d66d61d54417645005fff5e3747aa
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 17:46:41 2014 +0100

    coverity#982735 Negative loop bound
    
    xmlSecBase64Decode returns int
    
    Change-Id: I5bfb273141e62f1355033c669c49af5c645da900

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 91b59e3..498fe14 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -665,19 +665,13 @@ Reference< XCertificate > SecurityEnvironment_NssImpl :: createCertificateFromRa
 
 Reference< XCertificate > SecurityEnvironment_NssImpl :: createCertificateFromAscii( const OUString& asciiCertificate ) throw( SecurityException , RuntimeException, std::exception )
 {
-    xmlChar* chCert ;
-    xmlSecSize certSize ;
-
     OString oscert = OUStringToOString( asciiCertificate , RTL_TEXTENCODING_ASCII_US ) ;
-
-    chCert = xmlStrndup( ( const xmlChar* )oscert.getStr(), ( int )oscert.getLength() ) ;
-
-    certSize = xmlSecBase64Decode( chCert, ( xmlSecByte* )chCert, xmlStrlen( chCert ) ) ;
-
-    if(certSize > 0)
+    xmlChar* chCert = xmlStrndup( ( const xmlChar* )oscert.getStr(), ( int )oscert.getLength() ) ;
+    int certSize = xmlSecBase64Decode( chCert, ( xmlSecByte* )chCert, xmlStrlen( chCert ) ) ;
+    if (certSize > 0)
     {
-        Sequence< sal_Int8 > rawCert( certSize ) ;
-        for( unsigned int i = 0 ; i < certSize ; i ++ )
+        Sequence< sal_Int8 > rawCert(certSize) ;
+        for (int i = 0 ; i < certSize; ++i)
             rawCert[i] = *( chCert + i ) ;
 
         xmlFree( chCert ) ;
commit a59a897fa542e40baf4991625c3f3cd66e20d088
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun May 11 17:42:24 2014 +0100

    coverity#705435 Improper use of negative value
    
    Change-Id: I590f7ae2b367242b5672d79b1c9c3d6661830564

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 6812923..5f86a02 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2447,7 +2447,16 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
 
             // new left margin = old left + label space
             const SwNumRule* pRule = rNode.GetNumRule();
-            const SwNumFmt& rNumFmt = pRule->Get( static_cast< sal_uInt16 >(rNode.GetActualListLevel()) );
+            int nLevel = rNode.GetActualListLevel();
+
+            if (nLevel < 0)
+                nLevel = 0;
+
+            if (nLevel >= MAXLEVEL)
+                nLevel = MAXLEVEL - 1;
+
+            const SwNumFmt& rNumFmt = pRule->Get( static_cast< sal_uInt16 >(nLevel) );
+
             // #i86652#
             if ( rNumFmt.GetPositionAndSpaceMode() ==
                                     SvxNumberFormat::LABEL_WIDTH_AND_POSITION )


More information about the Libreoffice-commits mailing list