[Libreoffice-commits] core.git: 4 commits - qadevOOo/runner sw/source

Caolán McNamara caolanm at redhat.com
Wed Nov 11 16:31:56 PST 2015


 qadevOOo/runner/util/AccessibilityTools.java |    9 ---------
 sw/source/core/layout/laycache.cxx           |   12 +++++-------
 2 files changed, 5 insertions(+), 16 deletions(-)

New commits:
commit 4b918705f67d0837b56e56d7abac23e6eb21feb4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Nov 11 20:39:48 2015 +0000

    coverity#1326178 Dereference after null check
    
    and
    
    coverity#1326179 Dereference after null check
    
    Change-Id: I65099a52d8b275655c2de29848f364de0be06161

diff --git a/qadevOOo/runner/util/AccessibilityTools.java b/qadevOOo/runner/util/AccessibilityTools.java
index 5b75b6d..4426af4 100644
--- a/qadevOOo/runner/util/AccessibilityTools.java
+++ b/qadevOOo/runner/util/AccessibilityTools.java
@@ -53,16 +53,7 @@ public class AccessibilityTools {
         XWindow xWindow = null;
 
         try {
-            if (xModel == null) {
-                System.out.println("invalid model (==null)");
-            }
-
             XController xController = xModel.getCurrentController();
-
-            if (xController == null) {
-                System.out.println("can't get controller from model");
-            }
-
             XFrame xFrame = xController.getFrame();
 
             if (xFrame == null) {
commit 2cdd40668865fe8e7f2d79480fa61b4eae13f3ab
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Nov 11 20:36:38 2015 +0000

    coverity#1338595 Dereference before null check
    
    Change-Id: I8f23fb4fe51f64a82e58dcc150aeca964ac6af38

diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index 7124158..06b0f3f 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -223,7 +223,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc )
                                 assert(pTab && "Table follow without master");
                             }
                         }
-                        do
+                        while (1)
                         {
                             sal_uLong nNdIdx =
                                     pTab->GetTable()->GetTableNode()->GetIndex();
@@ -268,7 +268,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc )
                             }
                             else
                                 break;
-                        } while( pTab );
+                        }
                     }
                 }
             }
commit eb9a7ffbefba46db4bc4e054c82151d5265bdaa5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Nov 11 20:35:04 2015 +0000

    OSL_ENSURE followed by unconditional dereference -> assert
    
    Change-Id: Ife08acfd0defbed7f09a3b8dce089f61b0d7e11c

diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index 43cabb8..7124158 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -220,7 +220,7 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc )
                                     pSub = pSub->GetNext();
                                 }
                                 pTab = pTab->GetFollow();
-                                OSL_ENSURE( pTab, "Table follow without master" );
+                                assert(pTab && "Table follow without master");
                             }
                         }
                         do
commit cbfcdc4d120c160457b6353461387258daa35453
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Nov 11 20:34:00 2015 +0000

    dynamic cast followed by static cast
    
    Change-Id: I22a2123265da9d6808d9fd1bcb44666810a9311e

diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index 9cdba42..43cabb8 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -278,9 +278,8 @@ void SwLayoutCache::Write( SvStream &rStream, const SwDoc& rDoc )
                 for ( size_t i = 0; i < rObjs.size(); ++i )
                 {
                     SwAnchoredObject* pAnchoredObj = rObjs[i];
-                    if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) !=  nullptr )
+                    if (SwFlyFrm *pFly = dynamic_cast<SwFlyFrm*>(pAnchoredObj))
                     {
-                        SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
                         if( pFly->Frm().Left() != FAR_AWAY &&
                             !pFly->GetAnchorFrm()->FindFooterOrHeader() )
                         {
@@ -943,9 +942,8 @@ void SwLayHelper::_CheckFlyCache( SwPageFrm* pPage )
         for ( size_t i = 0; i < rObjs.size(); ++i )
         {
             SwAnchoredObject* pAnchoredObj = rObjs[i];
-            if ( dynamic_cast< const SwFlyFrm *>( pAnchoredObj ) !=  nullptr )  // a text frame?
+            if (SwFlyFrm *pFly = dynamic_cast<SwFlyFrm*>(pAnchoredObj))  // a text frame?
             {
-                SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
                 if( pFly->GetAnchorFrm() &&
                     !pFly->GetAnchorFrm()->FindFooterOrHeader() )
                 {


More information about the Libreoffice-commits mailing list