[Libreoffice-commits] core.git: oox/source opencl/source sal/osl sal/qa

Noel Grandin noel.grandin at collabora.co.uk
Mon Apr 24 09:31:30 UTC 2017


 oox/source/export/vmlexport.cxx            |    5 +----
 opencl/source/openclconfig.cxx             |    8 ++------
 opencl/source/openclwrapper.cxx            |    4 +---
 sal/osl/unx/profile.cxx                    |   10 +---------
 sal/qa/OStringBuffer/rtl_OStringBuffer.cxx |   12 ++----------
 sal/qa/osl/file/osl_File.cxx               |    5 +----
 6 files changed, 8 insertions(+), 36 deletions(-)

New commits:
commit 63df0796f5ec500f3b6fb34510d4bc79c009e76d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Apr 24 09:24:05 2017 +0200

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

diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index aa814c460f51..ef400be64f7c 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -199,10 +199,7 @@ bool VMLExport::IsWaterMarkShape(const OUString& rStr)
 {
      if (rStr.isEmpty() )  return false;
 
-     if (rStr.match("PowerPlusWaterMarkObject") || rStr.match("WordPictureWatermark"))
-        return true;
-     else
-        return false;
+     return rStr.match("PowerPlusWaterMarkObject") || rStr.match("WordPictureWatermark");
 }
 
 static void impl_AddArrowHead( sax_fastparser::FastAttributeList *pAttrList, sal_Int32 nElement, sal_uInt32 nValue )
diff --git a/opencl/source/openclconfig.cxx b/opencl/source/openclconfig.cxx
index eaa0bba5e06c..b81ffed22937 100644
--- a/opencl/source/openclconfig.cxx
+++ b/opencl/source/openclconfig.cxx
@@ -38,8 +38,7 @@ bool OpenCLConfig::operator== (const OpenCLConfig& r) const
 {
     return (mbUseOpenCL == r.mbUseOpenCL &&
             maBlackList == r.maBlackList &&
-            maWhiteList == r.maWhiteList &&
-            true);
+            maWhiteList == r.maWhiteList);
 }
 
 bool OpenCLConfig::operator!= (const OpenCLConfig& r) const
@@ -122,10 +121,7 @@ bool match(const OUString& rPattern, const OUString& rInput)
     icu::UnicodeString sIcuInput(reinterpret_cast<const UChar*>(rInput.getStr()), rInput.getLength());
     RegexMatcher aMatcher(sIcuPattern, sIcuInput, 0, nIcuError);
 
-    if (U_SUCCESS(nIcuError) && aMatcher.matches(nIcuError) && U_SUCCESS(nIcuError))
-        return true;
-
-    return false;
+    return U_SUCCESS(nIcuError) && aMatcher.matches(nIcuError) && U_SUCCESS(nIcuError);
 }
 
 bool match(const OpenCLConfig::ImplMatcher& rListEntry, const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice)
diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx
index 796289362472..8660dd744816 100644
--- a/opencl/source/openclwrapper.cxx
+++ b/opencl/source/openclwrapper.cxx
@@ -791,9 +791,7 @@ void findDeviceInfoFromDeviceId(cl_device_id aDeviceId, size_t& rDeviceId, size_
 
 bool canUseOpenCL()
 {
-    if (getenv("SAL_DISABLE_OPENCL") || !officecfg::Office::Common::Misc::UseOpenCL::get())
-        return false;
-    return true;
+    return !getenv("SAL_DISABLE_OPENCL") || !officecfg::Office::Common::Misc::UseOpenCL::get();
 }
 
 bool switchOpenCLDevice(const OUString* pDevice, bool bAutoSelect, bool bForceEvaluation, OUString& rOutSelectedDeviceVersionIDString)
diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx
index a979c7b8e71b..c5e5dd77d819 100644
--- a/sal/osl/unx/profile.cxx
+++ b/sal/osl/unx/profile.cxx
@@ -890,15 +890,7 @@ static bool OslProfile_lockFile(const osl_TFile* pFile, osl_TLockMode eMode)
         sal_Char* pEnvValue;
         pEnvValue = getenv( "STAR_PROFILE_LOCKING_DISABLED" );
 
-        if ( pEnvValue == nullptr )
-        {
-            bLockingDisabled = false;
-
-        }
-        else
-        {
-            bLockingDisabled = true;
-        }
+        bLockingDisabled = pEnvValue != nullptr;
 
         bIsInitialized = true;
     }
diff --git a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
index bcdc5c5ab07c..caad268044da 100644
--- a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
+++ b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx
@@ -14661,11 +14661,7 @@ namespace rtl_OStringBuffer
 
                 OString sBufferString(_sStrBuf.getStr());
                 sal_Int32 nPos = sBufferString.indexOf(sFloatValue);
-                if ( nPos >= 0 && nPos == _nLen)
-                {
-                    return true;
-                }
-                return false;
+                return nPos >= 0 && nPos == _nLen;
             }
     };
 
@@ -15829,11 +15825,7 @@ namespace rtl_OStringBuffer
 
                 OString sBufferString(_sStrBuf.getStr());
                 sal_Int32 nPos = sBufferString.indexOf(sDoubleValue);
-                if ( nPos >= 0 && nPos == _nLen)
-                {
-                    return true;
-                }
-                return false;
+                return nPos >= 0 && nPos == _nLen;
             }
     };
 
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index 77ddcdede871..027c556d5cb8 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -351,10 +351,7 @@ inline bool checkDirectory( const ::rtl::OUString & str, oslCheckMode nCheckMode
             case oslCheckMode::ReadAccess:
                 //rc = pDir->getNextItem( rItem, 0 );
                 rc = aDir.getNextItem( rItem );
-                if ( ( rc == ::osl::FileBase::E_None ) || ( rc == ::osl::FileBase::E_NOENT ) )
-                    bCheckResult = true;
-                else
-                    bCheckResult = false;
+                bCheckResult = ( rc == ::osl::FileBase::E_None ) || ( rc == ::osl::FileBase::E_NOENT );
                 break;
             case oslCheckMode::WriteAccess:
                 ( ( aUString += str ) += aSlashURL ) += aTmpName2;


More information about the Libreoffice-commits mailing list