[Libreoffice-commits] core.git: drawinglayer/source oox/source scripting/source sd/source slideshow/source sot/source svgio/source svl/source test/source ucb/source unotools/source uui/source writerperfect/source xmlhelp/source xmloff/source xmlsecurity/source

Noel Grandin noel.grandin at collabora.co.uk
Fri Apr 28 09:24:12 UTC 2017


 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx              |    7 -
 oox/source/export/chartexport.cxx                                    |    4 
 scripting/source/provider/MasterScriptProvider.cxx                   |   47 ++--------
 scripting/source/vbaevents/eventhelper.cxx                           |   19 ----
 sd/source/core/drawdoc2.cxx                                          |    5 -
 sd/source/filter/html/htmlex.cxx                                     |    5 -
 sd/source/ui/dlg/LayerTabBar.cxx                                     |    2 
 sd/source/ui/dlg/tpoption.cxx                                        |    5 -
 sd/source/ui/func/fusel.cxx                                          |   11 --
 sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx |    5 -
 sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx                |    5 -
 slideshow/source/engine/animationnodes/nodetools.cxx                 |    8 -
 sot/source/base/exchange.cxx                                         |    6 -
 sot/source/sdstor/stg.cxx                                            |    6 -
 svgio/source/svgreader/svgtextpathnode.cxx                           |    7 -
 svl/source/numbers/zforlist.cxx                                      |    6 -
 svl/source/numbers/zformat.cxx                                       |   11 --
 test/source/diff/diff.cxx                                            |    5 -
 ucb/source/cacher/cachedcontentresultset.cxx                         |    7 -
 ucb/source/ucp/ftp/ftpdirp.cxx                                       |    5 -
 ucb/source/ucp/ftp/ftpresultsetbase.cxx                              |    8 -
 ucb/source/ucp/tdoc/tdoc_docmgr.cxx                                  |    5 -
 ucb/source/ucp/webdav-neon/ContentProperties.cxx                     |    5 -
 ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx                     |    5 -
 ucb/source/ucp/webdav-neon/NeonSession.cxx                           |    5 -
 ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx                  |   31 +-----
 ucb/source/ucp/webdav-neon/webdavcontent.cxx                         |   19 +---
 unotools/source/config/eventcfg.cxx                                  |    5 -
 uui/source/iahndl.cxx                                                |    5 -
 writerperfect/source/common/DirectoryStream.cxx                      |    5 -
 writerperfect/source/writer/WordPerfectImportFilter.cxx              |    4 
 xmlhelp/source/cxxhelp/provider/resultsetbase.cxx                    |    7 -
 xmloff/source/chart/SchXMLExport.cxx                                 |    4 
 xmloff/source/draw/xexptran.cxx                                      |    7 -
 xmloff/source/style/chrlohdl.cxx                                     |    5 -
 xmloff/source/text/txtparae.cxx                                      |    8 -
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx               |    8 -
 xmlsecurity/source/helper/documentsignaturehelper.cxx                |    4 
 38 files changed, 74 insertions(+), 242 deletions(-)

New commits:
commit 9348b322a5c230dfcc2231661b73e480b130fcd9
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Apr 12 11:21:58 2017 +0200

    clang-tidy readability-simplify-boolean-expr
    
    Change-Id: Iea7ab64683f0b29794d50d774cc482b54a00e70a
    Reviewed-on: https://gerrit.libreoffice.org/36450
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index a11326e1e76b..4b5e45c7ef04 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -204,12 +204,7 @@ namespace drawinglayer
             aLocalPolygon.transform(maCurrentTransformation);
 
             // try drawing; if it did not work, use standard fallback
-            if(mpOutputDevice->DrawPolyLineDirect( aLocalPolygon, 0.0, fTransparency))
-            {
-                return true;
-            }
-
-            return false;
+            return mpOutputDevice->DrawPolyLineDirect( aLocalPolygon, 0.0, fTransparency);
         }
 
         bool VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect(const drawinglayer::primitive2d::PolygonStrokePrimitive2D& rSource, double fTransparency)
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 329a5e8aadef..4936e65b18cf 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -120,9 +120,7 @@ namespace {
 bool isPrimaryAxes(sal_Int32 nIndex)
 {
     assert(nIndex == 0 || nIndex == 1);
-    if (nIndex == 1)
-        return false;
-    return true;
+    return nIndex != 1;
 }
 
 }
diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx
index 56faea32c6d2..0b4baeddd981 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -55,16 +55,11 @@ using namespace ::sf_misc;
 namespace func_provider
 {
 
-bool endsWith( const OUString& target,
-    const OUString& item )
+bool endsWith( const OUString& target, const OUString& item )
 {
-    sal_Int32 index = 0;
-    if (  ( index = target.indexOf( item ) ) != -1  &&
-       ( index == ( target.getLength() - item.getLength() ) ) )
-    {
-        return true;
-    }
-    return false;
+    sal_Int32 index = target.indexOf( item );
+    return index != -1  &&
+           index == ( target.getLength() - item.getLength() );
 }
 
 /* should be available in some central location. */
@@ -607,30 +602,17 @@ MasterScriptProvider::removeByName( const OUString& Name )
 
 
 void SAL_CALL
-MasterScriptProvider::replaceByName( const OUString& aName, const Any& aElement )
+MasterScriptProvider::replaceByName( const OUString& /*aName*/, const Any& /*aElement*/ )
 {
-    (void)aName;
-    (void)aElement;
-
     // TODO needs implementing
-    if ( true )
-    {
-        throw RuntimeException( "replaceByName not implemented!!!!" );
-    }
+     throw RuntimeException( "replaceByName not implemented!!!!" );
 }
 
 Any SAL_CALL
-MasterScriptProvider::getByName( const OUString& aName )
+MasterScriptProvider::getByName( const OUString& /*aName*/ )
 {
-    (void)aName;
-
     // TODO needs to be implemented
-    Any result;
-    if ( true )
-    {
-        throw RuntimeException( "getByName not implemented!!!!" );
-    }
-    return result;
+    throw RuntimeException( "getByName not implemented!!!!" );
 }
 
 sal_Bool SAL_CALL
@@ -701,12 +683,7 @@ Sequence< OUString > SAL_CALL
 MasterScriptProvider::getElementNames(  )
 {
     // TODO needs implementing
-    Sequence< OUString >  names;
-    if ( true )
-    {
-        throw RuntimeException( "getElementNames not implemented!!!!" );
-    }
-    return names;
+    throw RuntimeException( "getElementNames not implemented!!!!" );
 }
 
 Type SAL_CALL
@@ -720,11 +697,7 @@ MasterScriptProvider::getElementType(  )
 sal_Bool SAL_CALL MasterScriptProvider::hasElements(  )
 {
     // TODO needs implementing
-    if ( true )
-    {
-        throw RuntimeException( "hasElements not implemented!!!!" );
-    }
-    return false;
+    throw RuntimeException( "hasElements not implemented!!!!" );
 }
 
 
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index 96b4ee53ba7a..ea1128344ec4 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -87,18 +87,12 @@ static const sal_Int32 DELIMLEN = strlen(DELIM);
 
 bool isKeyEventOk( awt::KeyEvent& evt, const Sequence< Any >& params )
 {
-    if ( !( params.getLength() > 0 ) ||
-        !( params[ 0 ] >>= evt ) )
-        return false;
-    return true;
+    return ( params.getLength() > 0 ) && ( params[ 0 ] >>= evt );
 }
 
 bool isMouseEventOk( awt::MouseEvent& evt, const Sequence< Any >& params )
 {
-    if ( !( params.getLength() > 0 ) ||
-        !( params[ 0 ] >>= evt ) )
-        return false;
-    return true;
+    return ( params.getLength() > 0 ) && ( params[ 0 ] >>= evt );
 }
 
 Sequence< Any > ooMouseEvtToVBADblClick( const Sequence< Any >& params )
@@ -793,14 +787,7 @@ bool DenyMouseDrag(const ScriptEvent& evt, void const * )
 {
     awt::MouseEvent aEvent;
     evt.Arguments[ 0 ] >>= aEvent;
-    if (aEvent.Buttons == 0 )
-    {
-        return true;
-    }
-    else
-    {
-        return false;
-    }
+    return aEvent.Buttons == 0;
 }
 
 
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 88aa8dfccb59..87b25fc22bbe 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -216,10 +216,7 @@ bool SdDrawDocument::IsPageNameUnique( const OUString& rPgName ) const
         nPage++;
     }
 
-    if (nCount == 1)
-        return true;
-    else
-        return false;
+    return nCount == 1;
 }
 
 SdPage* SdDrawDocument::GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index 934f8027fba5..ebbb9c1fc1dc 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -2945,10 +2945,7 @@ bool HtmlExport::CreateASPScripts()
             return false;
     }
 
-    if (!CopyScript(maExportPath, "edit.asp", maIndex))
-        return false;
-
-    return true;
+    return CopyScript(maExportPath, "edit.asp", maIndex);
 }
 
 static const char *PERL_Scripts[] = { "webcast.pl", "common.pl", "editpic.pl", "poll.pl", "savepic.pl", "show.pl" };
diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx
index eeeb24cd42d4..7b19236c7857 100644
--- a/sd/source/ui/dlg/LayerTabBar.cxx
+++ b/sd/source/ui/dlg/LayerTabBar.cxx
@@ -287,7 +287,7 @@ void LayerTabBar::EndRenaming()
 
 void LayerTabBar::ActivatePage()
 {
-    if ( /*IsInSwitching*/ true && pDrViewSh!=nullptr)
+    if (pDrViewSh!=nullptr)
     {
 
         SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index 3d406cca077d..cb7eafc02332 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -601,10 +601,7 @@ bool SdTpOptionsMisc::SetScale( const OUString& aScale, sal_Int32& rX, sal_Int32
         return false;
 
     rY = (long) aTmp.toInt32();
-    if( rY == 0 )
-        return false;
-
-    return true;
+    return rY != 0;
 }
 
 void SdTpOptionsMisc::UpdateCompatibilityControls()
diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx
index 725ea9f4e54e..846b2e208cc5 100644
--- a/sd/source/ui/func/fusel.cxx
+++ b/sd/source/ui/func/fusel.cxx
@@ -1400,17 +1400,10 @@ bool FuSelection::AnimateObj(SdrObject* pObj, const Point& rPos)
 
                         // Check the return value from the script
                         bool bTmp = false;
-                        if ( eErr == ERRCODE_NONE &&
+                        bAnimated = eErr == ERRCODE_NONE &&
                              aRet.getValueType() == cppu::UnoType<bool>::get() &&
                              ( aRet >>= bTmp ) &&
-                             bTmp )
-                        {
-                            bAnimated = true;
-                        }
-                        else
-                        {
-                            bAnimated = false;
-                        }
+                             bTmp;
                     }
                     else
                     {
diff --git a/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx b/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx
index 6e940bf7e899..f162147acdd5 100644
--- a/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx
@@ -220,10 +220,7 @@ bool InsertionIndicatorHandler::IsInsertionTrivial (
     // to check that the insertion position is not directly in front or
     // directly behind the selection and thus moving the selection there
     // would not change the model.
-    if (nInsertionIndex<nFirstIndex || nInsertionIndex>(nLastIndex+1))
-        return false;
-
-    return true;
+    return nInsertionIndex >= nFirstIndex && nInsertionIndex < nLastIndex;
 }
 
 bool InsertionIndicatorHandler::IsInsertionTrivial (const sal_Int8 nDndAction)
diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
index 10ea1f09e71d..e551acf34ded 100644
--- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
+++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
@@ -66,10 +66,7 @@ void ViewCacheContext::NotifyPreviewCreation (
 bool ViewCacheContext::IsIdle()
 {
     tools::IdleState nIdleState (tools::IdleDetection::GetIdleState(mrSlideSorter.GetContentWindow()));
-    if (nIdleState == tools::IdleState::Idle)
-        return true;
-    else
-        return false;
+    return nIdleState == tools::IdleState::Idle;
 }
 
 bool ViewCacheContext::IsVisible (cache::CacheKey aKey)
diff --git a/slideshow/source/engine/animationnodes/nodetools.cxx b/slideshow/source/engine/animationnodes/nodetools.cxx
index e69acef0b905..dd8e30e5be6b 100644
--- a/slideshow/source/engine/animationnodes/nodetools.cxx
+++ b/slideshow/source/engine/animationnodes/nodetools.cxx
@@ -81,13 +81,7 @@ namespace slideshow
 
             animations::Timing eTiming;
 
-            if( !(rAny >>= eTiming) ||
-                eTiming != animations::Timing_INDEFINITE )
-            {
-                return false;
-            }
-
-            return true;
+            return (rAny >>= eTiming) && eTiming == animations::Timing_INDEFINITE;
         }
 
     }
diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 95b02b2b9f3a..943fbbe7c303 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -498,16 +498,14 @@ OUString SotExchange::GetFormatName( SotClipboardFormatId nFormat )
 
 bool SotExchange::IsInternal( const SvGlobalName& rName )
 {
-    if ( rName == SvGlobalName(SO3_SW_CLASSID_60) ||
+    return rName == SvGlobalName(SO3_SW_CLASSID_60) ||
          rName == SvGlobalName(SO3_SC_CLASSID_60) ||
          rName == SvGlobalName(SO3_SIMPRESS_CLASSID_60) ||
          rName == SvGlobalName(SO3_SDRAW_CLASSID_60) ||
          rName == SvGlobalName(SO3_SCH_CLASSID_60) ||
          rName == SvGlobalName(SO3_SM_CLASSID_60) ||
          rName == SvGlobalName(SO3_SWWEB_CLASSID_60) ||
-         rName == SvGlobalName(SO3_SWGLOB_CLASSID_60) )
-        return true;
-    return false;
+         rName == SvGlobalName(SO3_SWGLOB_CLASSID_60);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 7f4c0fb50157..d5e0bf691877 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -116,13 +116,11 @@ OLEStorageBase::~OLEStorageBase()
 
 bool OLEStorageBase::Validate_Impl( bool bWrite ) const
 {
-    if( pIo
+    return pIo
         && pIo->m_pTOC
         && pEntry
         && !pEntry->m_bInvalid
-        &&  ( !bWrite || !pEntry->m_bDirect || ( nStreamMode & StreamMode::WRITE ) ) )
-            return true;
-    return false;
+        &&  ( !bWrite || !pEntry->m_bDirect || ( nStreamMode & StreamMode::WRITE ) );
 }
 
 bool OLEStorageBase::ValidateMode_Impl( StreamMode m, StgDirEntry* p )
diff --git a/svgio/source/svgreader/svgtextpathnode.cxx b/svgio/source/svgreader/svgtextpathnode.cxx
index 0608a71b8ee4..bb4c2ce85a3d 100644
--- a/svgio/source/svgreader/svgtextpathnode.cxx
+++ b/svgio/source/svgreader/svgtextpathnode.cxx
@@ -367,12 +367,7 @@ namespace svgio
 
             const double fBasegfxPathLength(basegfx::tools::getLength(aPolygon));
 
-            if(basegfx::fTools::equalZero(fBasegfxPathLength))
-            {
-                return false;
-            }
-
-            return true;
+            return !basegfx::fTools::equalZero(fBasegfxPathLength);
         }
 
         void SvgTextPathNode::decomposePathNode(
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index decaa845640a..27d5a3a50592 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -2991,11 +2991,7 @@ bool SvNumberFormatter::IsUserDefined(const OUString& sStr,
         return true;
     }
     SvNumberformat* pEntry = GetFormatEntry( nKey );
-    if ( pEntry && ((pEntry->GetType() & css::util::NumberFormat::DEFINED) != 0) )
-    {
-        return true;
-    }
-    return false;
+    return pEntry && ((pEntry->GetType() & css::util::NumberFormat::DEFINED) != 0);
 }
 
 sal_uInt32 SvNumberFormatter::GetEntryKey(const OUString& sStr,
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index cf2a245755f1..961f2d1701e5 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -4557,15 +4557,8 @@ void SvNumberformat::GetFormatSpecialInfo(bool& bThousand,
     // "negative in red" is only useful for the whole format
 
     const Color* pColor = NumFor[1].GetColor();
-    if (fLimit1 == 0.0 && fLimit2 == 0.0 && pColor
-        && (*pColor == rScan.GetRedColor()))
-    {
-        IsRed = true;
-    }
-    else
-    {
-        IsRed = false;
-    }
+    IsRed = fLimit1 == 0.0 && fLimit2 == 0.0 && pColor
+        && (*pColor == rScan.GetRedColor());
 }
 
 void SvNumberformat::GetNumForInfo( sal_uInt16 nNumFor, short& rScannedType,
diff --git a/test/source/diff/diff.cxx b/test/source/diff/diff.cxx
index 9b62c68f69c2..5b8d371a8b7c 100644
--- a/test/source/diff/diff.cxx
+++ b/test/source/diff/diff.cxx
@@ -65,10 +65,7 @@ struct tolerance
             cmp = xmlStrcmp(attribName, rTol.attribName);
         }
 
-        if(cmp>=0)
-            return false;
-        else
-            return true;
+        return cmp < 0;
     }
 };
 
diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx
index 353de0253519..dbe645cf2e04 100644
--- a/ucb/source/cacher/cachedcontentresultset.cxx
+++ b/ucb/source/cacher/cachedcontentresultset.cxx
@@ -179,12 +179,9 @@ bool SAL_CALL CachedContentResultSet::CCRS_Cache
     if( !m_pResult )
         return false;
 
-    if( ( m_pResult->FetchError & FetchError::ENDOFDATA )
+    return ( m_pResult->FetchError & FetchError::ENDOFDATA )
         && m_pResult->Orientation
-        && m_pResult->Rows.getLength() )
-        return true;
-
-    return false;
+        && m_pResult->Rows.getLength();
 }
 
 bool SAL_CALL CachedContentResultSet::CCRS_Cache
diff --git a/ucb/source/ucp/ftp/ftpdirp.cxx b/ucb/source/ucp/ftp/ftpdirp.cxx
index 032f96927f2b..915f1921443b 100644
--- a/ucb/source/ucp/ftp/ftpdirp.cxx
+++ b/ucb/source/ucp/ftp/ftpdirp.cxx
@@ -835,10 +835,7 @@ bool FTPDirectoryParser::parseVMS (
         rEntry.m_aDate.SetNanoSec(0);
 
         // Skip <rest> part:
-        if (*p && (*p != '\t' && *p != ' '))
-            return false;
-
-        return true;
+        return !*p || *p == '\t' || *p == ' ';
     }
 }
 
diff --git a/ucb/source/ucp/ftp/ftpresultsetbase.cxx b/ucb/source/ucp/ftp/ftpresultsetbase.cxx
index afb599be75eb..b95b18ad5df3 100644
--- a/ucb/source/ucp/ftp/ftpresultsetbase.cxx
+++ b/ucb/source/ucp/ftp/ftpresultsetbase.cxx
@@ -143,12 +143,8 @@ ResultSetBase::dispose()
 sal_Bool SAL_CALL
 ResultSetBase::next()
 {
-    bool test;
-    if( ++m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size()) )
-        test = true;
-    else
-        test = false;
-    return test;
+    ++m_nRow;
+    return m_nRow < sal::static_int_cast<sal_Int32>(m_aItems.size());
 }
 
 
diff --git a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
index d03b789821ca..1fd8247a9b14 100644
--- a/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_docmgr.cxx
@@ -583,10 +583,7 @@ bool OfficeDocumentsManager::isHelpDocument(
         return false;
 
     OUString sURL( xModel->getURL() );
-    if ( sURL.match( "vnd.sun.star.help://" ) )
-        return true;
-
-    return false;
+    return sURL.match( "vnd.sun.star.help://" );
 }
 
 
diff --git a/ucb/source/ucp/webdav-neon/ContentProperties.cxx b/ucb/source/ucp/webdav-neon/ContentProperties.cxx
index e90021b0ee8e..ef82213e7937 100644
--- a/ucb/source/ucp/webdav-neon/ContentProperties.cxx
+++ b/ucb/source/ucp/webdav-neon/ContentProperties.cxx
@@ -171,10 +171,7 @@ ContentProperties::ContentProperties( const ContentProperties & rOther )
 
 bool ContentProperties::contains( const OUString & rName ) const
 {
-    if ( get( rName ) )
-        return true;
-    else
-        return false;
+    return get( rName ) != nullptr;
 }
 
 
diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
index c29c9b56e2d4..a17377734f12 100644
--- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
@@ -1193,10 +1193,7 @@ bool DAVResourceAccess::handleException( const DAVException & e, int errorCount
             case SC_SERVICE_UNAVAILABLE: // retry, the service may become available
             case SC_INSUFFICIENT_STORAGE: // space may be freed, retry
             {
-                if ( errorCount < 3 )
-                    return true;
-                else
-                    return false;
+                return errorCount < 3;
             }
             break;
             // all the other HTTP server response status codes are NOT retry
diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx
index 8f6a625ccfee..6e808ebe07d2 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx
@@ -150,10 +150,7 @@ static bool noKeepAlive( const uno::Sequence< beans::NamedValue >& rFlags )
     const beans::NamedValue* pValue(
         std::find_if(pAry,pAry+nLen,
             [] (beans::NamedValue const& rNV) { return rNV.Name == "KeepAlive"; } ));
-    if ( pValue != pAry+nLen && !pValue->Value.get<bool>() )
-        return true;
-
-    return false;
+    return pValue != pAry+nLen && !pValue->Value.get<bool>();
 }
 
 struct NeonRequestContext
diff --git a/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx b/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx
index a1a2c7a1c2cb..d2ce9673d375 100644
--- a/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx
+++ b/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx
@@ -307,28 +307,15 @@ static OUString decodeValue( const OUString & rValue )
 // static
 bool UCBDeadPropertyValue::supportsType( const uno::Type & rType )
 {
-    if ( ( rType != cppu::UnoType<OUString>::get() )
-         &&
-         ( rType != cppu::UnoType<sal_Int32>::get() )
-         &&
-         ( rType != cppu::UnoType<sal_Int16>::get() )
-         &&
-         ( rType != cppu::UnoType<bool>::get() )
-         &&
-         ( rType != cppu::UnoType<cppu::UnoCharType>::get() )
-         &&
-         ( rType != cppu::UnoType<sal_Int8>::get() )
-         &&
-         ( rType != cppu::UnoType<sal_Int64>::get() )
-         &&
-         ( rType != cppu::UnoType<float>::get() )
-         &&
-         ( rType != cppu::UnoType<double>::get() ) )
-    {
-        return false;
-    }
-
-    return true;
+    return rType == cppu::UnoType<OUString>::get()
+         || rType == cppu::UnoType<sal_Int32>::get()
+         || rType == cppu::UnoType<sal_Int16>::get()
+         || rType == cppu::UnoType<bool>::get()
+         || rType == cppu::UnoType<cppu::UnoCharType>::get()
+         || rType == cppu::UnoType<sal_Int8>::get()
+         || rType == cppu::UnoType<sal_Int64>::get()
+         || rType == cppu::UnoType<float>::get()
+         || rType == cppu::UnoType<double>::get();
 }
 
 
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index 1f4845d543d2..5e401027ace8 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -3774,16 +3774,13 @@ uno::Any Content::MapDAVException( const DAVException & e, bool bWrite )
 // static
 bool Content::shouldAccessNetworkAfterException( const DAVException & e )
 {
-    if ( ( e.getStatus() == SC_NOT_FOUND ) ||
-         ( e.getStatus() == SC_GONE ) ||
-         ( e.getError() == DAVException::DAV_HTTP_TIMEOUT ) ||
-         ( e.getError() == DAVException::DAV_HTTP_LOOKUP ) ||
-         ( e.getError() == DAVException::DAV_HTTP_CONNECT ) ||
-         ( e.getError() == DAVException::DAV_HTTP_AUTH ) ||
-         ( e.getError() == DAVException::DAV_HTTP_AUTHPROXY ) )
-        return false;
-
-    return true;
+    return !(( e.getStatus() == SC_NOT_FOUND ) ||
+             ( e.getStatus() == SC_GONE ) ||
+             ( e.getError() == DAVException::DAV_HTTP_TIMEOUT ) ||
+             ( e.getError() == DAVException::DAV_HTTP_LOOKUP ) ||
+             ( e.getError() == DAVException::DAV_HTTP_CONNECT ) ||
+             ( e.getError() == DAVException::DAV_HTTP_AUTH ) ||
+             ( e.getError() == DAVException::DAV_HTTP_AUTHPROXY ));
 }
 
 
@@ -4275,7 +4272,7 @@ void Content::getResourceOptions(
                  )
             )
         {
-            *networkAccessAllowed = *networkAccessAllowed && false;
+            *networkAccessAllowed = false;
         }
     }
     rDAVOptions = aDAVOptions;
diff --git a/unotools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx
index 2e47efdd2905..5d0dda0c1266 100644
--- a/unotools/source/config/eventcfg.cxx
+++ b/unotools/source/config/eventcfg.cxx
@@ -297,10 +297,7 @@ bool SAL_CALL GlobalEventConfig_Impl::hasByName( const OUString& aName )
     // never accessed before - is it supported in general?
     SupportedEventsVector::iterator pos = ::std::find(
         m_supportedEvents.begin(), m_supportedEvents.end(), aName );
-    if ( pos != m_supportedEvents.end() )
-        return true;
-
-    return false;
+    return pos != m_supportedEvents.end();
 }
 
 Type SAL_CALL GlobalEventConfig_Impl::getElementType(  )
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index b42e5625ba70..30ea6ef76a21 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -265,10 +265,7 @@ UUIInteractionHelper::isInformationalErrorMessageRequest(
 
     uno::Reference< task::XInteractionAbort > xAbort(
         rContinuations[0], uno::UNO_QUERY);
-    if (xAbort.is())
-        return true;
-
-    return false;
+    return xAbort.is();
 }
 
 bool
diff --git a/writerperfect/source/common/DirectoryStream.cxx b/writerperfect/source/common/DirectoryStream.cxx
index a23f2571adbd..cc186cfaab0b 100644
--- a/writerperfect/source/common/DirectoryStream.cxx
+++ b/writerperfect/source/common/DirectoryStream.cxx
@@ -169,10 +169,7 @@ const css::uno::Reference<css::ucb::XContent> DirectoryStream::getContent() cons
 
 bool DirectoryStream::isStructured()
 {
-    if (!m_pImpl)
-        return false;
-
-    return true;
+    return m_pImpl != nullptr;
 }
 
 unsigned DirectoryStream::subStreamCount()
diff --git a/writerperfect/source/writer/WordPerfectImportFilter.cxx b/writerperfect/source/writer/WordPerfectImportFilter.cxx
index cba9a9b96f22..68c2a5cc8dd1 100644
--- a/writerperfect/source/writer/WordPerfectImportFilter.cxx
+++ b/writerperfect/source/writer/WordPerfectImportFilter.cxx
@@ -145,9 +145,7 @@ bool SAL_CALL WordPerfectImportFilter::importImpl(const Sequence< css::beans::Pr
     collector.addDocumentHandler(&aHandler, ODF_FLAT_XML);
     collector.registerEmbeddedObjectHandler("image/x-wpg", &handleEmbeddedWPGObject);
     collector.registerEmbeddedImageHandler("image/x-wpg", &handleEmbeddedWPGImage);
-    if (libwpd::WPD_OK == libwpd::WPDocument::parse(&input, &collector, aUtf8Passwd.isEmpty() ? nullptr : aUtf8Passwd.getStr()))
-        return true;
-    return false;
+    return libwpd::WPD_OK == libwpd::WPDocument::parse(&input, &collector, aUtf8Passwd.isEmpty() ? nullptr : aUtf8Passwd.getStr());
 }
 
 sal_Bool SAL_CALL WordPerfectImportFilter::filter(const Sequence< css::beans::PropertyValue > &aDescriptor)
diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
index 6bc38014777d..53cb1b5233da 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
@@ -142,13 +142,8 @@ ResultSetBase::dispose()
 sal_Bool SAL_CALL
 ResultSetBase::next()
 {
-    bool test;
     m_nRow++;
-    if( sal::static_int_cast<sal_uInt32>( m_nRow ) < m_aItems.size() )
-        test = true;
-    else
-        test = false;
-    return test;
+    return sal::static_int_cast<sal_uInt32>( m_nRow ) < m_aItems.size();
 }
 
 
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 56d32ee8e1a9..35f4a3ffd0be 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -678,9 +678,7 @@ bool lcl_SequenceHasUnhiddenData( const uno::Reference< chart2::data::XDataSeque
             return true;
         }
     }
-    if( xDataSequence->getData().getLength() )
-        return true;
-    return false;
+    return xDataSequence->getData().getLength();
 }
 
 typedef vector< OUString > tStringVector;
diff --git a/xmloff/source/draw/xexptran.cxx b/xmloff/source/draw/xexptran.cxx
index 23b489ddf8e2..250a5b0064e6 100644
--- a/xmloff/source/draw/xexptran.cxx
+++ b/xmloff/source/draw/xexptran.cxx
@@ -73,12 +73,9 @@ bool Imp_IsOnUnitChar(const OUString& rStr, const sal_Int32 nPos)
 {
     sal_Unicode aChar(rStr[nPos]);
 
-    if(('a' <= aChar && 'z' >= aChar)
+    return ('a' <= aChar && 'z' >= aChar)
         || ('A' <= aChar && 'Z' >= aChar)
-        || '%' == aChar
-    )
-        return true;
-    return false;
+        || '%' == aChar;
 }
 
 double Imp_GetDoubleChar(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen,
diff --git a/xmloff/source/style/chrlohdl.cxx b/xmloff/source/style/chrlohdl.cxx
index ceef4c0a6b48..d10f8a8990c8 100644
--- a/xmloff/source/style/chrlohdl.cxx
+++ b/xmloff/source/style/chrlohdl.cxx
@@ -241,10 +241,7 @@ bool XMLCharScriptHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue
     // For non-ISO language it does not make sense to write *:script if
     // *:language is not written either, does it? It's all in
     // *:rfc-language-tag
-    if (aLanguage.isEmpty() || rStrExpValue.isEmpty())
-        return false;
-
-    return true;
+    return !aLanguage.isEmpty() && !rStrExpValue.isEmpty();
 }
 
 XMLCharCountryHdl::~XMLCharCountryHdl()
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index f2db593d0f74..eff5a4e74587 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -167,11 +167,9 @@ namespace
         if(!xShape.is())
             return false;
         Reference<XServiceInfo> xServiceInfo(xTxtContent, UNO_QUERY);
-        if(xServiceInfo->supportsService("com.sun.star.text.TextFrame") ||
-            xServiceInfo->supportsService("com.sun.star.text.TextGraphicObject") ||
-            xServiceInfo->supportsService("com.sun.star.text.TextEmbeddedObject") )
-            return false;
-        return true;
+        return !xServiceInfo->supportsService("com.sun.star.text.TextFrame") &&
+               !xServiceInfo->supportsService("com.sun.star.text.TextGraphicObject") &&
+               !xServiceInfo->supportsService("com.sun.star.text.TextEmbeddedObject");
     };
 
     class BoundFrames
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index a485a43ab178..cedcb3ebc1d5 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -304,16 +304,12 @@ bool DigitalSignaturesDialog::canAddRemove()
 
 bool DigitalSignaturesDialog::canAdd()
 {
-    if (canAddRemove())
-        return true;
-    return false;
+    return canAddRemove();
 }
 
 bool DigitalSignaturesDialog::canRemove()
 {
-    if (canAddRemove())
-        return true;
-    return false;
+    return canAddRemove();
 }
 
 short DigitalSignaturesDialog::Execute()
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index 61e11ceb0448..96f78aaa6c80 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -139,9 +139,7 @@ bool DocumentSignatureHelper::isODFPre_1_2(const OUString & sVersion)
     //The property version exists only if the document is at least version 1.2
     //That is, if the document has version 1.1 and sVersion is empty.
     //The constant is defined in comphelper/documentconstants.hxx
-    if (compareVersions(sVersion, ODFVER_012_TEXT) == -1)
-        return true;
-    return false;
+    return compareVersions(sVersion, ODFVER_012_TEXT) == -1;
 }
 
 bool DocumentSignatureHelper::isOOo3_2_Signature(const SignatureInformation & sigInfo)


More information about the Libreoffice-commits mailing list