diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-18 08:27:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-18 09:46:28 +0200 |
commit | 5fb66ae5595b7435e8954df31473fad15a74b8c2 (patch) | |
tree | 3b3f0ce3eafa10557a7e78b10851c97ee16c7ebf | |
parent | 181a1b36ac728e3a43e054496ceb53fd3315abdb (diff) |
clang-tidy readability-simplify-boolean-expr
Change-Id: I78fa01a6c803dec782488490b730af3a11814d64
Reviewed-on: https://gerrit.libreoffice.org/61902
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
49 files changed, 89 insertions, 315 deletions
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index b694d02648aa..d9f246fc2bd2 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -990,7 +990,7 @@ namespace bool lcl_isFormatObjectCommand( const OUString& aCommand ) { - if( aCommand == "MainTitle" + return aCommand == "MainTitle" || aCommand == "SubTitle" || aCommand == "XTitle" || aCommand == "YTitle" @@ -1036,12 +1036,7 @@ bool lcl_isFormatObjectCommand( const OUString& aCommand ) || aCommand == "FormatStockLoss" || aCommand == "FormatStockGain" || aCommand == "FormatMajorGrid" - || aCommand == "FormatMinorGrid" - ) - return true; - - // else - return false; + || aCommand == "FormatMinorGrid"; } } // anonymous namespace diff --git a/codemaker/source/codemaker/global.cxx b/codemaker/source/codemaker/global.cxx index 8eb506e10e51..e9a9b8f415c1 100644 --- a/codemaker/source/codemaker/global.cxx +++ b/codemaker/source/codemaker/global.cxx @@ -214,10 +214,7 @@ bool makeValidTypeFile(const OString& targetFileName, const OString& tmpFileName bool removeTypeFile(const OString& fileName) { - if ( !unlink(fileName.getStr()) ) - return true; - - return false; + return unlink(fileName.getStr()) == 0; } OUString convertToFileUrl(const OString& fileName) @@ -269,10 +266,7 @@ FileStream::~FileStream() bool FileStream::isValid() const { - if ( m_file ) - return true; - - return false; + return m_file != nullptr; } void FileStream::createTempFile(const OString& sPath) diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.cxx b/connectivity/source/drivers/firebird/StatementCommonBase.cxx index df9b775232e0..03439c937c12 100644 --- a/connectivity/source/drivers/firebird/StatementCommonBase.cxx +++ b/connectivity/source/drivers/firebird/StatementCommonBase.cxx @@ -386,10 +386,7 @@ short OStatementCommonBase::getSqlInfoItem(char aInfoItem) bool OStatementCommonBase::isDDLStatement() { - if (getSqlInfoItem(isc_info_sql_stmt_type) == isc_info_sql_stmt_ddl) - return true; - else - return false; + return getSqlInfoItem(isc_info_sql_stmt_type) == isc_info_sql_stmt_ddl; } sal_Int32 OStatementCommonBase::getStatementChangeCount() diff --git a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx index 56d82555cedc..e3996f067c7f 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx @@ -199,12 +199,7 @@ namespace connectivity { sal_Int32 index=static_cast<sal_Int32>(product); ProductStruct &rProduct = m_ProductProfileList[index]; - if (rProduct.mProfileList.empty() || rProduct.mProfileList.find(profileName) == rProduct.mProfileList.end()) - { - return false; - } - else - return true; + return rProduct.mProfileList.find(profileName) != rProduct.mProfileList.end(); } } } diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx index ad58f39d85e7..b1824d338efb 100644 --- a/connectivity/source/manager/mdrivermanager.cxx +++ b/connectivity/source/manager/mdrivermanager.cxx @@ -169,11 +169,7 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) bool operator()( const Reference<XDriver>& _rDriver ) const { // ask the driver - if ( _rDriver.is() && _rDriver->acceptsURL( m_rURL ) ) - return true; - - // does not accept ... - return false; + return _rDriver.is() && _rDriver->acceptsURL( m_rURL ); } }; diff --git a/dbaccess/source/filter/hsqldb/createparser.cxx b/dbaccess/source/filter/hsqldb/createparser.cxx index d8a3fdb583f3..0588b641a04f 100644 --- a/dbaccess/source/filter/hsqldb/createparser.cxx +++ b/dbaccess/source/filter/hsqldb/createparser.cxx @@ -127,23 +127,9 @@ OUString lcl_getDefaultValue(const OUString& sColumnDef) return OUString{}; } -bool lcl_isNullable(const OUString& sColumnDef) -{ - if (sColumnDef.indexOf("NOT NULL") >= 0) - { - return false; - } - return true; -} +bool lcl_isNullable(const OUString& sColumnDef) { return sColumnDef.indexOf("NOT NULL") < 0; } -bool lcl_isPrimaryKey(const OUString& sColumnDef) -{ - if (sColumnDef.indexOf("PRIMARY KEY") >= 0) - { - return true; - } - return false; -} +bool lcl_isPrimaryKey(const OUString& sColumnDef) { return sColumnDef.indexOf("PRIMARY KEY") >= 0; } sal_Int32 lcl_getDataTypeFromHsql(const OUString& sTypeName) { diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 6a23444900b1..6dfa7cc28825 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1136,13 +1136,9 @@ void CallbackFlushHandler::queue(const int type, const char* data) std::stringstream aOldStream(elem.second); boost::property_tree::read_json(aOldStream, aOldTree); const unsigned nOldDialogId = aOldTree.get<unsigned>("id", 0); - if (aOldTree.get<std::string>("action", "") == "invalidate" && + return aOldTree.get<std::string>("action", "") == "invalidate" && nLOKWindowId == nOldDialogId && - aOldTree.get<std::string>("rectangle", "").empty()) - { - return true; - } - return false; + aOldTree.get<std::string>("rectangle", "").empty(); }); // we found a invalidate-all window callback diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx index 422c7033702c..5081fbf9f236 100644 --- a/drawinglayer/source/tools/wmfemfhelper.cxx +++ b/drawinglayer/source/tools/wmfemfhelper.cxx @@ -1050,13 +1050,8 @@ namespace wmfemfhelper return false; } - if((LANGUAGE_JAPANESE == rFont.GetLanguage()) || (LANGUAGE_JAPANESE == rFont.GetCJKContextLanguage())) - { - // the underline is right for Japanese only - return true; - } - - return false; + // the underline is right for Japanese only + return (LANGUAGE_JAPANESE == rFont.GetLanguage()) || (LANGUAGE_JAPANESE == rFont.GetCJKContextLanguage()); } static void createFontAttributeTransformAndAlignment( diff --git a/extensions/source/dbpilots/gridwizard.cxx b/extensions/source/dbpilots/gridwizard.cxx index 01d6912b5b29..617d2504f8d4 100644 --- a/extensions/source/dbpilots/gridwizard.cxx +++ b/extensions/source/dbpilots/gridwizard.cxx @@ -77,10 +77,7 @@ namespace dbp return false; Reference< XGridColumnFactory > xColumnFactory(getContext().xObjectModel, UNO_QUERY); - if (!xColumnFactory.is()) - return false; - - return true; + return xColumnFactory.is(); } diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 2ae98b20f8dd..b7e023b17311 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -401,10 +401,7 @@ namespace pcr m_bSuspendingPropertyHandlers = true; bool bHandlerVeto = !suspendPropertyHandlers_nothrow( true ); m_bSuspendingPropertyHandlers = false; - if ( bHandlerVeto ) - return false; - - return true; + return !bHandlerVeto; } diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx index ae2b5a0f9c2d..fb99949ca40d 100644 --- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx +++ b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx @@ -535,10 +535,7 @@ namespace pcr std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, // TODO/eForms: proper parent VclMessageType::Question, VclButtonsType::YesNo, sConfirmation)); - if (xQueryBox->run() != RET_YES) - return false; - - return true; + return xQueryBox->run() == RET_YES; } bool XSDValidationPropertyHandler::implDoRemoveCurrentDataType() diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index 0c6b50bec05c..167d6ba97b20 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -977,9 +977,7 @@ OUString Sane::GetOptionUnitName( int n ) bool Sane::ActivateButtonOption( int n ) { SANE_Status nStatus = ControlOption( n, SANE_ACTION_SET_VALUE, nullptr ); - if( nStatus != SANE_STATUS_GOOD ) - return false; - return true; + return nStatus == SANE_STATUS_GOOD; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 53f66cea476b..c94a015b635c 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -2479,19 +2479,14 @@ bool EscherPropertyContainer::IsDefaultObject( break; } - if(rSdrObjCustomShape.IsDefaultGeometry( SdrObjCustomShape::DefaultType::Equations ) + return rSdrObjCustomShape.IsDefaultGeometry( SdrObjCustomShape::DefaultType::Equations ) && rSdrObjCustomShape.IsDefaultGeometry( SdrObjCustomShape::DefaultType::Viewbox ) && rSdrObjCustomShape.IsDefaultGeometry( SdrObjCustomShape::DefaultType::Path ) && rSdrObjCustomShape.IsDefaultGeometry( SdrObjCustomShape::DefaultType::Gluepoints ) && rSdrObjCustomShape.IsDefaultGeometry( SdrObjCustomShape::DefaultType::Segments ) && rSdrObjCustomShape.IsDefaultGeometry( SdrObjCustomShape::DefaultType::StretchX ) && rSdrObjCustomShape.IsDefaultGeometry( SdrObjCustomShape::DefaultType::StretchY ) - && rSdrObjCustomShape.IsDefaultGeometry( SdrObjCustomShape::DefaultType::TextFrames ) ) - { - return true; - } - - return false; + && rSdrObjCustomShape.IsDefaultGeometry( SdrObjCustomShape::DefaultType::TextFrames ); } void EscherPropertyContainer::LookForPolarHandles( const MSO_SPT eShapeType, sal_Int32& nAdjustmentsWhichNeedsToBeConverted ) diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx index 514260d359b2..04d57289ede5 100644 --- a/fpicker/source/office/iodlg.cxx +++ b/fpicker/source/office/iodlg.cxx @@ -1823,27 +1823,13 @@ bool SvtFileDialog::PrepareExecute() Reference< XResultSet > xResultSet = aCnt.createCursor( aProps, ::ucbhelper::INCLUDE_FOLDERS_ONLY ); - if ( xResultSet.is() ) + if ( xResultSet.is() && !xResultSet->next() ) { - bool bEmpty = true; - if ( !xResultSet->next() ) - { - // folder is empty - bEmpty = true; - } - else - { - bEmpty = false; - } - - if ( bEmpty ) - { - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), - VclMessageType::Warning, VclButtonsType::Ok, - FpsResId(STR_SVT_NOREMOVABLEDEVICE))); - xBox->run(); - return false; - } + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, + FpsResId(STR_SVT_NOREMOVABLEDEVICE))); + xBox->run(); + return false; } } catch ( ContentCreationException const & ) diff --git a/hwpfilter/source/hiodev.cxx b/hwpfilter/source/hiodev.cxx index 7fd808906c69..6416bb080cbe 100644 --- a/hwpfilter/source/hiodev.cxx +++ b/hwpfilter/source/hiodev.cxx @@ -270,10 +270,7 @@ void HMemIODev::flush() bool HMemIODev::state() const { - if (pos <= length) - return false; - else - return true; + return pos > length; } bool HMemIODev::setCompressed(bool ) diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx index 223b4bb7a984..258ea9370ef5 100644 --- a/hwpfilter/source/hwpfile.cxx +++ b/hwpfilter/source/hwpfile.cxx @@ -119,9 +119,7 @@ int HWPFile::SetState(int errcode) bool HWPFile::Read1b(unsigned char &out) { - if (!hiodev || !hiodev->read1b(out)) - return false; - return true; + return hiodev && hiodev->read1b(out); } bool HWPFile::Read1b(char &out) diff --git a/i18nlangtag/source/isolang/mslangid.cxx b/i18nlangtag/source/isolang/mslangid.cxx index dc15bf30662e..3ed50cdd80e2 100644 --- a/i18nlangtag/source/isolang/mslangid.cxx +++ b/i18nlangtag/source/isolang/mslangid.cxx @@ -475,14 +475,12 @@ bool MsLangId::isNonLatinWestern( LanguageType nLang ) // static bool MsLangId::isLegacy( LanguageType nLang ) { - if (nLang.anyOf( + return nLang.anyOf( LANGUAGE_SERBIAN_CYRILLIC_SAM, - LANGUAGE_SERBIAN_LATIN_SAM)) + LANGUAGE_SERBIAN_LATIN_SAM); /* TODO: activate once dictionary was renamed from pap-AN to * pap-CW, or the pap-CW one supports also pap-AN, see fdo#44112 */ //case LANGUAGE_PAPIAMENTU: - return true; - return false; } diff --git a/idlc/source/fehelper.cxx b/idlc/source/fehelper.cxx index 02f0e8b4799c..a147d3d26e1a 100644 --- a/idlc/source/fehelper.cxx +++ b/idlc/source/fehelper.cxx @@ -37,10 +37,7 @@ bool FeDeclarator::checkType(AstDeclaration const * type) const if( count != -1 ) tmp = m_name.copy( count+1 ); - if (tmp == type->getLocalName()) - return false; - else - return true; + return tmp != type->getLocalName(); } AstType const * FeDeclarator::compose(AstDeclaration const * pDecl) diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx index 5a16c9fadc49..9f287c836d7f 100644 --- a/idlc/source/idlccompile.cxx +++ b/idlc/source/idlccompile.cxx @@ -53,9 +53,7 @@ static sal_Char tmpFilePattern[512]; bool isFileUrl(const OString& fileName) { - if (fileName.startsWith("file://") ) - return true; - return false; + return fileName.startsWith("file://"); } OString convertToAbsoluteSystemPath(const OString& fileName) diff --git a/oox/source/crypto/AgileEngine.cxx b/oox/source/crypto/AgileEngine.cxx index f4feeda99764..65482ee4624c 100644 --- a/oox/source/crypto/AgileEngine.cxx +++ b/oox/source/crypto/AgileEngine.cxx @@ -665,9 +665,7 @@ bool AgileEngine::setupEncryption(OUString const & rPassword) else setupEncryptionParameters({ 100000, 16, 256, 64, 16, OUString("AES"), OUString("ChainingModeCBC"), OUString("SHA512") }); - if (!setupEncryptionKey(rPassword)) - return false; - return true; + return setupEncryptionKey(rPassword); } void AgileEngine::setupEncryptionParameters(AgileEncryptionParameters const & rAgileEncryptionParameters) diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx index b276197eb93a..bee764560e83 100644 --- a/opencl/source/openclwrapper.cxx +++ b/opencl/source/openclwrapper.cxx @@ -760,10 +760,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/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx index 3deb5504fa24..312165a0739e 100644 --- a/sc/source/core/data/tabprotection.cxx +++ b/sc/source/core/data/tabprotection.cxx @@ -401,10 +401,7 @@ bool ScTableProtectionImpl::verifyPassword(const OUString& aPassText) const // Not yet generated or tracked with meHash1 or meHash2, but can be read // from OOXML. - if (maPasswordHash.verifyPassword( aPassText)) - return true; - - return false; + return maPasswordHash.verifyPassword( aPassText); } bool ScTableProtectionImpl::isOptionEnabled(SCSIZE nOptId) const diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 0e86fe322e78..b17cb016dfe0 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -5811,9 +5811,7 @@ bool ScCompiler::SkipImplicitIntersectionOptimization(const FormulaToken* token) return true; } formula::ParamClass returnType = ScParameterClassification::GetParameterType( token, SAL_MAX_UINT16 ); - if( returnType == formula::Reference ) - return true; - return false; + return returnType == formula::Reference; } void ScCompiler::HandleIIOpCode(FormulaToken* token, FormulaToken*** pppToken, sal_uInt8 nNumParams) diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx index 27993a47425f..ec1dce320cec 100644 --- a/sc/source/filter/oox/stylesbuffer.cxx +++ b/sc/source/filter/oox/stylesbuffer.cxx @@ -2846,20 +2846,14 @@ const FontModel& StylesBuffer::getDefaultFontModel() const bool StylesBuffer::equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 ) { - if( nBorderId1 == nBorderId2 ) - return true; - // in OOXML, borders are assumed to be unique - return false; + return nBorderId1 == nBorderId2; } bool StylesBuffer::equalFills( sal_Int32 nFillId1, sal_Int32 nFillId2 ) { - if( nFillId1 == nFillId2 ) - return true; - // in OOXML, fills are assumed to be unique - return false; + return nFillId1 == nFillId2; } OUString StylesBuffer::getDefaultStyleName() const diff --git a/sd/source/filter/eppt/pptx-animations.cxx b/sd/source/filter/eppt/pptx-animations.cxx index 86fd90362af7..d4e34d18a03f 100644 --- a/sd/source/filter/eppt/pptx-animations.cxx +++ b/sd/source/filter/eppt/pptx-animations.cxx @@ -419,10 +419,7 @@ bool isValidTarget(const Any& rTarget) ParagraphTarget aParagraphTarget; - if ((rTarget >>= aParagraphTarget) && aParagraphTarget.Shape.is()) - return true; - - return false; + return (rTarget >>= aParagraphTarget) && aParagraphTarget.Shape.is(); } /// extract ooxml node type from a XAnimationNode. diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 632a2f985268..1c16308dbd4e 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -555,11 +555,8 @@ bool lcl_isFilterNativelySupported(const SfxFilter& rFilter) return true; const OUString& aName = rFilter.GetFilterName(); - if (aName.startsWith("MS Excel")) - // We can handle all Excel variants natively. - return true; - - return false; + // We can handle all Excel variants natively. + return aName.startsWith("MS Excel"); } } diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index a14885f40752..6fd9832b2b4d 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -163,10 +163,8 @@ void SfxFrame::DoClose_Impl() bool SfxFrame::DocIsModified_Impl() { - if ( pImpl->pCurrentViewFrame && pImpl->pCurrentViewFrame->GetObjectShell() && - pImpl->pCurrentViewFrame->GetObjectShell()->IsModified() ) - return true; - return false; + return pImpl->pCurrentViewFrame && pImpl->pCurrentViewFrame->GetObjectShell() && + pImpl->pCurrentViewFrame->GetObjectShell()->IsModified(); } bool SfxFrame::PrepareClose_Impl( bool bUI ) diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx index b0f1491fafac..089f473f69ac 100644 --- a/slideshow/source/engine/tools.cxx +++ b/slideshow/source/engine/tools.cxx @@ -361,10 +361,7 @@ namespace slideshow const ::basegfx::B2DVector& /*rSlideBounds*/ ) { // try to extract string - if( !(rSourceAny >>= o_rValue) ) - return false; // nothing left to try - - return true; + return rSourceAny >>= o_rValue; } /// extract bool value from Any diff --git a/soltools/mkdepend/collectdircontent.cxx b/soltools/mkdepend/collectdircontent.cxx index 3aa4981055fb..bcfa08325bdb 100644 --- a/soltools/mkdepend/collectdircontent.cxx +++ b/soltools/mkdepend/collectdircontent.cxx @@ -72,11 +72,7 @@ bool IncludesCollection::exists(string filePath) { } DirContent dirContent = (*mapIter).second; DirContent::iterator dirIter = dirContent.find(fileName); - if (dirIter == dirContent.end()) { - return false; - } else { - return true; - }; + return dirIter != dirContent.end(); } extern "C" { diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index 2bf1fbf55229..c46499cfab83 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -1228,10 +1228,7 @@ void SAL_CALL JavaVirtualMachine::elementReplaced( const jchar* jcharName= pJNIEnv->GetStringChars( jsClass, nullptr); OUString sName(reinterpret_cast<sal_Unicode const *>(jcharName)); bool bIsSandbox; - if ( sName == "com.sun.star.lib.sandbox.SandboxSecurity" ) - bIsSandbox= true; - else - bIsSandbox= false; + bIsSandbox = sName == "com.sun.star.lib.sandbox.SandboxSecurity"; pJNIEnv->ReleaseStringChars( jsClass, jcharName); if (bIsSandbox) diff --git a/svl/source/misc/inethist.cxx b/svl/source/misc/inethist.cxx index c4d5daeea374..7c05b6ef423e 100644 --- a/svl/source/misc/inethist.cxx +++ b/svl/source/misc/inethist.cxx @@ -276,16 +276,8 @@ bool INetURLHistory_Impl::queryUrl (const OUString &rUrl) const { sal_uInt32 h = crc32 (rUrl); sal_uInt16 k = find (h); - if ((k < capacity()) && (m_pHash[k] == h)) - { - // Cache hit. - return true; - } - else - { - // Cache miss. - return false; - } + // true if cache hit + return (k < capacity()) && (m_pHash[k] == h); } /* diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 077baa7ab2e5..a817d8d191c1 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -4212,14 +4212,7 @@ bool SvNumberformat::ImpGetNumberOutput(double fNumber, bool bSign; if (fNumber < 0.0) { - if (nIx == 0) // Not in the ones at the back - { - bSign = true; // Formats - } - else - { - bSign = false; - } + bSign = (nIx == 0); // Not in the ones at the back; fNumber = -fNumber; } else diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index b8c6ac4be8a9..a870053d54fd 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -725,10 +725,7 @@ bool SvxNumberFormatShell::IsEssentialFormat_Impl(SvNumFormatType eType, sal_uIn break; } - if (nKey == pFormatter->GetStandardFormat(eType, eCurLanguage)) - return true; - - return false; + return nKey == pFormatter->GetStandardFormat(eType, eCurLanguage); } short SvxNumberFormatShell::FillEListWithCurrency_Impl(std::vector<OUString>& rList, short nSelPos) diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index 942512100f26..7067627f47cb 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -411,10 +411,7 @@ namespace sdr const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(); // draft when no graphic - if(GraphicType::NONE == rGraphicObject.GetType() || GraphicType::Default == rGraphicObject.GetType()) - return true; - - return false; + return GraphicType::NONE == rGraphicObject.GetType() || GraphicType::Default == rGraphicObject.GetType(); } } // end of namespace contact diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index d2993c240157..b98ee9e053ba 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -159,13 +159,8 @@ namespace return false; } - if((LANGUAGE_JAPANESE == rFont.GetLanguage()) || (LANGUAGE_JAPANESE == rFont.GetCJKContextLanguage())) - { - // the underline is right for Japanese only - return true; - } - - return false; + // the underline is right for Japanese only + return (LANGUAGE_JAPANESE == rFont.GetLanguage()) || (LANGUAGE_JAPANESE == rFont.GetCJKContextLanguage()); } void impTextBreakupHandler::impCreateTextPortionPrimitive(const DrawPortionInfo& rInfo) diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 6741375ee4ad..4fb9dbc606c0 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -306,12 +306,9 @@ void SwFormatField::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) bool SwFormatField::GetInfo( SfxPoolItem& rInfo ) const { const SwTextNode* pTextNd; - if( RES_AUTOFMT_DOCNODE != rInfo.Which() || + return RES_AUTOFMT_DOCNODE != rInfo.Which() || !mpTextField || nullptr == ( pTextNd = mpTextField->GetpTextNode() ) || - &pTextNd->GetNodes() != static_cast<SwAutoFormatGetDocNode&>(rInfo).pNodes ) - return true; - - return false; + &pTextNd->GetNodes() != static_cast<SwAutoFormatGetDocNode&>(rInfo).pNodes; } bool SwFormatField::IsFieldInDoc() const diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx index a833dbe064f3..ea924809a705 100644 --- a/sw/source/core/txtnode/txtatr2.cxx +++ b/sw/source/core/txtnode/txtatr2.cxx @@ -71,13 +71,8 @@ void SwTextCharFormat::ModifyNotification( const SfxPoolItem* pOld, const SfxPoo bool SwTextCharFormat::GetInfo( SfxPoolItem const & rInfo ) const { - if ( RES_AUTOFMT_DOCNODE != rInfo.Which() || !m_pTextNode || - &m_pTextNode->GetNodes() != static_cast<SwAutoFormatGetDocNode const &>(rInfo).pNodes ) - { - return true; - } - - return false; + return RES_AUTOFMT_DOCNODE != rInfo.Which() || !m_pTextNode || + &m_pTextNode->GetNodes() != static_cast<SwAutoFormatGetDocNode const &>(rInfo).pNodes; } SwTextAttrNesting::SwTextAttrNesting( SfxPoolItem & i_rAttr, @@ -184,13 +179,8 @@ void SwTextINetFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew bool SwTextINetFormat::GetInfo( SfxPoolItem& rInfo ) const { - if ( RES_AUTOFMT_DOCNODE != rInfo.Which() || !m_pTextNode || - &m_pTextNode->GetNodes() != static_cast<SwAutoFormatGetDocNode&>(rInfo).pNodes ) - { - return true; - } - - return false; + return RES_AUTOFMT_DOCNODE != rInfo.Which() || !m_pTextNode || + &m_pTextNode->GetNodes() != static_cast<SwAutoFormatGetDocNode&>(rInfo).pNodes; } bool SwTextINetFormat::IsProtect( ) const @@ -232,13 +222,8 @@ void SwTextRuby::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) bool SwTextRuby::GetInfo( SfxPoolItem& rInfo ) const { - if( RES_AUTOFMT_DOCNODE != rInfo.Which() || !m_pTextNode || - &m_pTextNode->GetNodes() != static_cast<SwAutoFormatGetDocNode&>(rInfo).pNodes ) - { - return true; - } - - return false; + return RES_AUTOFMT_DOCNODE != rInfo.Which() || !m_pTextNode || + &m_pTextNode->GetNodes() != static_cast<SwAutoFormatGetDocNode&>(rInfo).pNodes; } SwCharFormat* SwTextRuby::GetCharFormat() diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 3d539978f096..8dc33bfd8b71 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5149,10 +5149,7 @@ bool DocxAttributeOutput::ExportAsActiveXControl(const SdrObject* pObject) const return false; oox::ole::OleFormCtrlExportHelper exportHelper(comphelper::getProcessComponentContext(), xModel, xControlModel); - if(!exportHelper.isValid()) - return false; - - return true; + return exportHelper.isValid(); } void DocxAttributeOutput::PostponeOLE( SwOLENode& rNode, const Size& rSize, const SwFlyFrameFormat* pFlyFrameFormat ) diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx index ecdd172fd585..cf205d099044 100644 --- a/test/source/screenshot_test.cxx +++ b/test/source/screenshot_test.cxx @@ -187,10 +187,7 @@ void ScreenshotTest::dumpDialogToPath(const OString& rUIXMLDescription) VclPtr<vcl::Window> aOwnedToplevel; bool bLegacy; - if (rUIXMLDescription == "cui/ui/textanimtabpage.ui" || rUIXMLDescription == "cui/ui/areatabpage.ui") - bLegacy = false; - else - bLegacy = true; + bLegacy = rUIXMLDescription != "cui/ui/textanimtabpage.ui" && rUIXMLDescription != "cui/ui/areatabpage.ui"; std::unique_ptr<VclBuilder> xBuilder(new VclBuilder(pDialog, VclBuilderContainer::getUIRootDir(), OStringToOUString(rUIXMLDescription, RTL_TEXTENCODING_UTF8), OString(), css::uno::Reference<css::frame::XFrame>(), bLegacy)); vcl::Window *pRoot = xBuilder->get_widget_root(); Dialog *pRealDialog = dynamic_cast<Dialog*>(pRoot); diff --git a/tools/source/datetime/datetime.cxx b/tools/source/datetime/datetime.cxx index 6f41e0523c56..00790ff78dd4 100644 --- a/tools/source/datetime/datetime.cxx +++ b/tools/source/datetime/datetime.cxx @@ -52,46 +52,31 @@ DateTime& DateTime::operator =( const css::util::DateTime& rUDateTime ) bool DateTime::IsBetween( const DateTime& rFrom, const DateTime& rTo ) const { - if ( (*this >= rFrom) && (*this <= rTo) ) - return true; - else - return false; + return (*this >= rFrom) && (*this <= rTo); } bool DateTime::operator >( const DateTime& rDateTime ) const { - if ( (Date::operator>( rDateTime )) || - (Date::operator==( rDateTime ) && tools::Time::operator>( rDateTime )) ) - return true; - else - return false; + return (Date::operator>( rDateTime )) || + (Date::operator==( rDateTime ) && tools::Time::operator>( rDateTime )); } bool DateTime::operator <( const DateTime& rDateTime ) const { - if ( (Date::operator<( rDateTime )) || - (Date::operator==( rDateTime ) && tools::Time::operator<( rDateTime )) ) - return true; - else - return false; + return (Date::operator<( rDateTime )) || + (Date::operator==( rDateTime ) && tools::Time::operator<( rDateTime )); } bool DateTime::operator >=( const DateTime& rDateTime ) const { - if ( (Date::operator>( rDateTime )) || - (Date::operator==( rDateTime ) && tools::Time::operator>=( rDateTime )) ) - return true; - else - return false; + return (Date::operator>( rDateTime )) || + (Date::operator==( rDateTime ) && tools::Time::operator>=( rDateTime )); } bool DateTime::operator <=( const DateTime& rDateTime ) const { - if ( (Date::operator<( rDateTime )) || - (Date::operator==( rDateTime ) && tools::Time::operator<=( rDateTime )) ) - return true; - else - return false; + return (Date::operator<( rDateTime )) || + (Date::operator==( rDateTime ) && tools::Time::operator<=( rDateTime )); } sal_Int64 DateTime::GetSecFromDateTime( const Date& rDate ) const diff --git a/tools/source/fsys/wldcrd.cxx b/tools/source/fsys/wldcrd.cxx index c0750b7098b1..2ea29eedddeb 100644 --- a/tools/source/fsys/wldcrd.cxx +++ b/tools/source/fsys/wldcrd.cxx @@ -104,10 +104,7 @@ bool WildCard::Matches( const OUString& rString ) const } } - if ( ImpMatch( aTmpWild.getStr(), aString.getStr() ) ) - return true; - else - return false; + return ImpMatch( aTmpWild.getStr(), aString.getStr() ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index ea855f98e9f0..61a16a5400e7 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -192,10 +192,7 @@ bool tools::Rectangle::IsInside( const Point& rPoint ) const bool tools::Rectangle::IsInside( const tools::Rectangle& rRect ) const { - if ( IsInside( rRect.TopLeft() ) && IsInside( rRect.BottomRight() ) ) - return true; - else - return false; + return IsInside( rRect.TopLeft() ) && IsInside( rRect.BottomRight() ); } bool tools::Rectangle::IsOver( const tools::Rectangle& rRect ) const diff --git a/ucb/source/ucp/cmis/cmis_datasupplier.cxx b/ucb/source/ucp/cmis/cmis_datasupplier.cxx index 42c5c10157d2..83baa3ba37aa 100644 --- a/ucb/source/ucp/cmis/cmis_datasupplier.cxx +++ b/ucb/source/ucp/cmis/cmis_datasupplier.cxx @@ -83,10 +83,7 @@ namespace cmis return true; getData(); - if ( maResults.size() > nIndex ) - return true; - - return false; + return maResults.size() > nIndex; } sal_uInt32 DataSupplier::totalCount() diff --git a/ucb/source/ucp/ext/ucpext_datasupplier.cxx b/ucb/source/ucp/ext/ucpext_datasupplier.cxx index cc8ac22b9f04..9d6f962119c0 100644 --- a/ucb/source/ucp/ext/ucpext_datasupplier.cxx +++ b/ucb/source/ucp/ext/ucpext_datasupplier.cxx @@ -253,11 +253,8 @@ namespace ucb { namespace ucp { namespace ext { ::osl::ClearableGuard< ::osl::Mutex > aGuard( m_pImpl->m_aMutex ); - if ( m_pImpl->m_aResults.size() > i_nIndex ) - // result already present. - return true; - - return false; + // true if result already present. + return m_pImpl->m_aResults.size() > i_nIndex; } diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index b701185d6c3a..b15446522b35 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -357,13 +357,9 @@ bool TextEngine::DoesKeyChangeText( const KeyEvent& rKeyEvent ) bool TextEngine::IsSimpleCharInput( const KeyEvent& rKeyEvent ) { - if( rKeyEvent.GetCharCode() >= 32 && rKeyEvent.GetCharCode() != 127 && + return rKeyEvent.GetCharCode() >= 32 && rKeyEvent.GetCharCode() != 127 && KEY_MOD1 != (rKeyEvent.GetKeyCode().GetModifier() & ~KEY_SHIFT) && // (ssa) #i45714#: - KEY_MOD2 != (rKeyEvent.GetKeyCode().GetModifier() & ~KEY_SHIFT) ) // check for Ctrl and Alt separately - { - return true; - } - return false; + KEY_MOD2 != (rKeyEvent.GetKeyCode().GetModifier() & ~KEY_SHIFT); // check for Ctrl and Alt separately } void TextEngine::ImpInitDoc() diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 150a85877809..d3496adc4f1e 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -5243,9 +5243,7 @@ bool PDFWriterImpl::emitCatalog() aLine.append( ">>\n" "endobj\n\n" ); - CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) ); - - return true; + return writeBuffer( aLine.getStr(), aLine.getLength() ); } #if HAVE_FEATURE_NSS @@ -5317,10 +5315,7 @@ bool PDFWriterImpl::emitSignature() aLine.append(" >>\nendobj\n\n" ); - if (!writeBuffer( aLine.getStr(), aLine.getLength() )) - return false; - - return true; + return writeBuffer( aLine.getStr(), aLine.getLength() ); } bool PDFWriterImpl::finalizeSignature() @@ -5393,8 +5388,7 @@ bool PDFWriterImpl::finalizeSignature() CHECK_RETURN( (osl::File::E_None == m_aFile.setPos(osl_Pos_Absolut, m_nSignatureContentOffset)) ); m_aFile.write(aCMSHexBuffer.getStr(), aCMSHexBuffer.getLength(), nWritten); - CHECK_RETURN( (osl::File::E_None == m_aFile.setPos(osl_Pos_Absolut, nOffset)) ); - return true; + return osl::File::E_None == m_aFile.setPos(osl_Pos_Absolut, nOffset); } #endif //HAVE_FEATURE_NSS @@ -5923,9 +5917,7 @@ bool PDFWriterImpl::emitTrailer() aLine.append( static_cast<sal_Int64>(nXRefOffset) ); aLine.append( "\n" "%%EOF\n" ); - CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) ); - - return true; + return writeBuffer( aLine.getStr(), aLine.getLength() ); } struct AnnotationSortEntry @@ -8861,9 +8853,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject ) aLine.append( " 0 R\n" ">>\n" "endobj\n\n" ); - CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) ); - - return true; + return writeBuffer( aLine.getStr(), aLine.getLength() ); } void PDFWriterImpl::writeJPG( JPGEmit& rObject ) diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx index 2034a54beb8a..de65574e1ac9 100644 --- a/vcl/source/outdev/textline.cxx +++ b/vcl/source/outdev/textline.cxx @@ -41,13 +41,9 @@ bool OutputDevice::ImplIsUnderlineAbove( const vcl::Font& rFont ) if ( !rFont.IsVertical() ) return false; - if( (LANGUAGE_JAPANESE == rFont.GetLanguage()) || - (LANGUAGE_JAPANESE == rFont.GetCJKContextLanguage()) ) - { - // the underline is right for Japanese only - return true; - } - return false; + // the underline is right for Japanese only + return (LANGUAGE_JAPANESE == rFont.GetLanguage()) || + (LANGUAGE_JAPANESE == rFont.GetCJKContextLanguage()); } void OutputDevice::ImplInitTextLineSize() diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx index 5dc4f6c435b3..87c84b5c44ef 100644 --- a/vcl/unx/generic/app/i18n_ic.cxx +++ b/vcl/unx/generic/app/i18n_ic.cxx @@ -468,12 +468,8 @@ SalI18N_InputContext::GetWeightingOfIMStyle( XIMStyle nStyle ) bool SalI18N_InputContext::IsSupportedIMStyle( XIMStyle nStyle ) const { - if ( (nStyle & mnSupportedPreeditStyle) - && (nStyle & g_nSupportedStatusStyle) ) - { - return true; - } - return false; + return (nStyle & mnSupportedPreeditStyle) + && (nStyle & g_nSupportedStatusStyle); } bool diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index 7ed81b9e6f2a..60768588f3ee 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -1164,12 +1164,7 @@ bool XMLTextImportHelper::IsDuplicateFrame(const OUString& sName, sal_Int32 nX, } // In some case, position is not defined for frames, so check whether the two frames follow each other (are anchored to the same position) - if (m_xImpl->msLastImportedFrameName != sName) - { - return false; - } - - return true; + return m_xImpl->msLastImportedFrameName == sName; } return false; } |