[Libreoffice-commits] core.git: editeng/source sd/source

Noel Grandin noelgrandin at gmail.com
Sun Oct 18 23:49:14 PDT 2015


 editeng/source/items/flditem.cxx  |   10 ++++------
 editeng/source/items/frmitems.cxx |   14 +++++---------
 sd/source/ui/app/sdmod1.cxx       |    4 +---
 3 files changed, 10 insertions(+), 18 deletions(-)

New commits:
commit 2d64fcf4c8d3316ad9ae2232601678553dcad6a3
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sat Oct 17 20:00:57 2015 +0200

    cppcheck:nullPointerRedundantCheck
    
    Change-Id: I00a58a90f96e9eaf681239146213706e278ea5e1
    Reviewed-on: https://gerrit.libreoffice.org/19421
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index c2a7e5d..b308abe 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -358,14 +358,12 @@ bool SvxFieldItem::operator==( const SfxPoolItem& rItem ) const
     DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal which or type" );
 
     const SvxFieldData* pOtherFld = static_cast<const SvxFieldItem&>(rItem).GetField();
-    if ( !pField && !pOtherFld )
+    if( pField == pOtherFld )
         return true;
-
-    if ( ( !pField && pOtherFld ) || ( pField && !pOtherFld ) )
+    if( pOtherFld == nullptr )
         return false;
-
-    return ( ( pField->Type() == pOtherFld->Type() )
-                && ( *pField == *pOtherFld ) );
+    return ( pField->Type() == pOtherFld->Type() )
+            && ( *pField == *pOtherFld );
 }
 
 
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 25c2fcc..1b8912d 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -1664,15 +1664,11 @@ SvxBoxItem& SvxBoxItem::operator=( const SvxBoxItem& rBox )
 
 inline bool CmpBrdLn( const SvxBorderLine* pBrd1, const SvxBorderLine* pBrd2 )
 {
-    bool bRet;
-    if( 0 != pBrd1 ?  0 == pBrd2 : 0 != pBrd2 )
-        bRet = false;
-    else
-        if( !pBrd1 )
-            bRet = true;
-        else
-            bRet = (*pBrd1 == *pBrd2);
-    return bRet;
+    if( pBrd1 == pBrd2 )
+        return true;
+    if( pBrd1 == nullptr )
+        return false;
+    return *pBrd1 == *pBrd2;
 }
 
 
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index cdadcc5..7dc21b2 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -526,8 +526,6 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
         if ( pFrmItem )
             xTargetFrame = pFrmItem->GetFrame();
 
-        SfxViewFrame* pViewFrame = NULL;
-
         SdOptions* pOpt = GetSdOptions(DOCUMENT_TYPE_IMPRESS);
         bool bStartWithTemplate = pOpt->IsStartWithTemplate();
 
@@ -636,7 +634,7 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
                     SfxObjectShell* pShell = xShell;
                     if( pShell )
                     {
-                        pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pShell, xTargetFrame );
+                        SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pShell, xTargetFrame );
                         DBG_ASSERT( pViewFrame, "no ViewFrame!!" );
                         pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
 


More information about the Libreoffice-commits mailing list