[Libreoffice-commits] core.git: sfx2/source svtools/source sw/source vcl/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Tue Sep 12 04:48:38 UTC 2017


 sfx2/source/view/viewfrm.cxx       |    5 ++---
 svtools/source/contnr/treelist.cxx |    2 +-
 sw/source/filter/ww8/ww8par5.cxx   |    5 ++---
 vcl/source/gdi/print3.cxx          |    7 +------
 4 files changed, 6 insertions(+), 13 deletions(-)

New commits:
commit 7e2a6709d9511f983f9981258c38ccc125bcd3fe
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Mon Sep 11 17:08:33 2017 +0200

    cppcheck: identicalConditionAfterEarlyExit
    
    Change-Id: I59d91390ee303eadc10315405cce44cfd7c37d56
    Reviewed-on: https://gerrit.libreoffice.org/42179
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 75d833880caa..a8e83f9c95be 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -794,8 +794,7 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet )
             {
                 const SfxViewShell *pVSh;
                 const SfxShell *pFSh;
-                if ( !pSh ||
-                     !pSh->HasName() ||
+                if ( !pSh->HasName() ||
                      !( pSh->Get_Impl()->nLoadedFlags &  SfxLoadedFlags::MAINDOCUMENT ) ||
                      ( pSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED &&
                        ( !(pVSh = pSh->GetViewShell())  ||
@@ -815,7 +814,7 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet )
 
             case SID_RELOAD:
             {
-                if ( !pSh || !pSh->CanReload_Impl() || pSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
+                if ( !pSh->CanReload_Impl() || pSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED )
                     rSet.DisableItem(nWhich);
                 else
                 {
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index ce0a07cef863..8d6c72b570c4 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -433,7 +433,7 @@ sal_uLong SvTreeList::GetChildCount( const SvTreeListEntry* pParent ) const
     if ( !pParent )
         return GetEntryCount();
 
-    if (!pParent || pParent->m_Children.empty())
+    if (pParent->m_Children.empty())
         return 0;
 
     sal_uLong nCount = 0;
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index e306bbef3290..36d700d715c1 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -922,7 +922,7 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes)
     }
 
     // no routine available
-    if (bNested || !bHasHandler || bCodeNest)
+    if (!bHasHandler || bCodeNest)
     {
         if( m_nFieldTagBad[nI] & nMask )      // Flag: Tag it when bad
             return Read_F_Tag( &aF );       // Result not as text
@@ -2723,12 +2723,11 @@ void SwWW8ImplReader::Read_SubF_Ruby( WW8ReadFieldParams& rReadParam)
         //Create a new char style if necessary
         if (!pCharFormat)
         {
-            SwCharFormat *pFormat=nullptr;
             OUString aNm;
             //Take this as the base name
             SwStyleNameMapper::FillUIName(RES_POOLCHR_RUBYTEXT,aNm);
             aNm+=OUString::number(m_aRubyCharFormats.size()+1);
-            pFormat = m_rDoc.MakeCharFormat(aNm, m_rDoc.GetDfltCharFormat());
+            SwCharFormat *pFormat = m_rDoc.MakeCharFormat(aNm, m_rDoc.GetDfltCharFormat());
             SvxFontHeightItem aHeightItem(nFontSize*10, 100, RES_CHRATR_FONTSIZE);
             SvxFontItem aFontItem(FAMILY_DONTKNOW,sFontName,
                 OUString(), PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT);
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index e70c4d02dd82..a825d0b23438 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -1266,16 +1266,11 @@ DrawModeFlags PrinterController::removeTransparencies( GDIMetaFile const & i_rIn
 void PrinterController::printFilteredPage( int i_nPage )
 {
     if( mpImplData->meJobState != css::view::PrintableState_JOB_STARTED )
-        return;
+        return; // rhbz#657394: check that we are still printing...
 
     GDIMetaFile aPageFile;
     PrinterController::PageSize aPageSize = getFilteredPageFile( i_nPage, aPageFile );
 
-    if (mpImplData->meJobState != css::view::PrintableState_JOB_STARTED)
-    {   // rhbz#657394: check that we are still printing...
-        return;
-    }
-
     if( mpImplData->mpProgress )
     {
         // do nothing if printing is canceled


More information about the Libreoffice-commits mailing list