chart2/source/controller/dialogs/DataBrowserModel.cxx | 10 +++---- chart2/source/model/template/DataInterpreter.cxx | 4 +-- comphelper/source/property/propertycontainerhelper.cxx | 3 -- configmgr/source/setnode.cxx | 5 +-- connectivity/source/parse/sqlnode.cxx | 15 ++++------- cui/source/dialogs/pastedlg.cxx | 13 ++++------ dbaccess/source/ui/app/subcomponentmanager.cxx | 4 +-- dbaccess/source/ui/browser/formadapter.cxx | 4 +-- dbaccess/source/ui/browser/genericcontroller.cxx | 4 +-- dbaccess/source/ui/misc/RowSetDrop.cxx | 4 +-- dbaccess/source/ui/misc/WCopyTable.cxx | 4 +-- desktop/source/lib/init.cxx | 4 +-- desktop/source/lib/lokclipboard.cxx | 4 +-- editeng/source/editeng/editobj.cxx | 6 +--- extensions/source/propctrlr/cellbindinghelper.cxx | 6 ---- extensions/source/propctrlr/propcontroller.cxx | 4 +-- forms/source/component/ListBox.cxx | 4 +-- formula/source/ui/dlg/formula.cxx | 5 +-- jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 5 --- jvmfwk/source/framework.cxx | 5 +-- sal/cppunittester/cppunittester.cxx | 2 - sal/osl/all/debugbase.cxx | 4 +-- sc/source/core/tool/dbdata.cxx | 6 ++-- sc/source/ui/dbgui/filtdlg.cxx | 6 +--- sd/source/ui/sidebar/MasterPageContainerQueue.cxx | 5 +-- sd/source/ui/view/ViewShellManager.cxx | 8 +----- sfx2/source/dialog/filtergrouping.cxx | 5 --- sfx2/source/doc/Metadatable.cxx | 2 - sfx2/source/view/classificationhelper.cxx | 4 +-- shell/source/unix/sysshell/recently_used_file_handler.cxx | 4 --- shell/source/win32/zipfile/zipfile.cxx | 4 --- svtools/source/misc/transfer.cxx | 8 +++--- svtools/source/misc/transfer2.cxx | 4 +-- svx/source/dialog/ClassificationCommon.cxx | 5 +-- svx/source/dialog/charmap.cxx | 9 ++----- svx/source/items/customshapeitem.cxx | 4 +-- sw/qa/extras/layout/layout.cxx | 7 ++--- sw/source/core/undo/rolbck.cxx | 4 +-- sw/source/core/unocore/unostyle.cxx | 5 +-- toolkit/source/controls/geometrycontrolmodel.cxx | 8 ------ unoidl/source/unoidl-check.cxx | 10 +++---- vcl/unx/generic/printer/ppdparser.cxx | 4 +-- vcl/unx/gtk3/gtk3gtkinst.cxx | 2 - writerfilter/source/dmapper/DomainMapper_Impl.cxx | 14 +++------- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 5 +-- xmlsecurity/qa/unit/signing/signing.cxx | 2 - xmlsecurity/source/helper/ooxmlsecexporter.cxx | 4 +-- xmlsecurity/source/helper/xmlsignaturehelper.cxx | 18 +++----------- 48 files changed, 107 insertions(+), 169 deletions(-)
New commits: commit 085269d25a705b656436feac47149296b4b4b35d Author: Arkadiy Illarionov <qar...@gmail.com> AuthorDate: Wed Aug 29 00:47:33 2018 +0300 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Aug 29 11:40:29 2018 +0200 Replace find_if with proper quantifier algorithms Change-Id: Icc820a47ac891c358883f9c01224f676c58fdd11 Reviewed-on: https://gerrit.libreoffice.org/59744 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx index 7a2a041d41f8..10af6e5cbf4c 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.cxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx @@ -485,11 +485,9 @@ void DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColu Sequence<Reference<chart2::data::XLabeledDataSequence> > aSequencesOfDeleted = xSourceOfDeleted->getDataSequences(); for (sal_Int32 i = 0; i < aSequencesOfDeleted.getLength(); ++i) { - std::vector<Reference<chart2::data::XLabeledDataSequence> >::const_iterator aHitIt( - std::find_if( aAllDataSeqs.begin(), aAllDataSeqs.end(), - lcl_RepresentationsOfLSeqMatch( aSequencesOfDeleted[i] ))); // if not used by the remaining series this sequence can be deleted - if( aHitIt == aAllDataSeqs.end() ) + if( std::none_of( aAllDataSeqs.begin(), aAllDataSeqs.end(), + lcl_RepresentationsOfLSeqMatch( aSequencesOfDeleted[i] )) ) aSequenceIndexesToDelete.push_back( lcl_getValuesRepresentationIndex( aSequencesOfDeleted[i] ) ); } @@ -873,8 +871,8 @@ void DataBrowserModel::updateFromModel() else if( aRole == "values-x" ) nSequenceNumberFormatKey = nXAxisNumberFormat; - if( std::find_if( aSharedSequences.begin(), aSharedSequences.end(), - lcl_RepresentationsOfLSeqMatch( aLSeqs[nSeqIdx] )) == aSharedSequences.end()) + if( std::none_of( aSharedSequences.begin(), aSharedSequences.end(), + lcl_RepresentationsOfLSeqMatch( aLSeqs[nSeqIdx] )) ) { // no shared sequence m_aColumns.emplace_back( diff --git a/chart2/source/model/template/DataInterpreter.cxx b/chart2/source/model/template/DataInterpreter.cxx index dde227a99d98..849c4e3404bf 100644 --- a/chart2/source/model/template/DataInterpreter.cxx +++ b/chart2/source/model/template/DataInterpreter.cxx @@ -286,8 +286,8 @@ Reference< data::XDataSource > SAL_CALL DataInterpreter::mergeInterpretedData( Reference< data::XLabeledDataSequence > xAdd( aSeq[nSeqIdx] ); // only add if sequence is not yet in the result - if( find_if( aResultVec.begin(), aResultVec.end(), - lcl_LabeledSequenceEquals( xAdd )) == aResultVec.end()) + if( none_of( aResultVec.begin(), aResultVec.end(), + lcl_LabeledSequenceEquals( xAdd )) ) { aResultVec.push_back( xAdd ); } diff --git a/comphelper/source/property/propertycontainerhelper.cxx b/comphelper/source/property/propertycontainerhelper.cxx index 702a7a8e01dd..d2e5ad30afd2 100644 --- a/comphelper/source/property/propertycontainerhelper.cxx +++ b/comphelper/source/property/propertycontainerhelper.cxx @@ -154,12 +154,11 @@ bool OPropertyContainerHelper::isRegisteredProperty( const OUString& _rName ) co // i.e. registered and revoked even though the XPropertySet has already been // accessed, a vector is not really the best data structure anymore ... - ConstPropertiesIterator pos = std::find_if( + return std::any_of( m_aProperties.begin(), m_aProperties.end(), PropertyDescriptionNameMatch( _rName ) ); - return pos != m_aProperties.end(); } diff --git a/configmgr/source/setnode.cxx b/configmgr/source/setnode.cxx index 2e63a239ea94..eac56f70f476 100644 --- a/configmgr/source/setnode.cxx +++ b/configmgr/source/setnode.cxx @@ -63,11 +63,10 @@ int SetNode::getMandatory() const { bool SetNode::isValidTemplate(OUString const & templateName) const { return Data::equalTemplateNames(templateName, defaultTemplateName_) || - (std::find_if( + std::any_of( additionalTemplateNames_.begin(), additionalTemplateNames_.end(), - [&templateName](OUString const & longName) { return Data::equalTemplateNames(templateName, longName); } ) != - additionalTemplateNames_.end()); + [&templateName](OUString const & longName) { return Data::equalTemplateNames(templateName, longName); } ); } SetNode::SetNode(SetNode const & other, bool keepTemplateName): diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index ada5d32d4275..2b2a687f6e47 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -1690,9 +1690,8 @@ void OSQLParseNode::append(OSQLParseNode* pNewNode) { OSL_ENSURE(pNewNode != nullptr, "OSQLParseNode: invalid NewSubTree"); OSL_ENSURE(pNewNode->getParent() == nullptr, "OSQLParseNode: Node is not an orphan"); - OSL_ENSURE(std::find_if(m_aChildren.begin(), m_aChildren.end(), - [&] (std::unique_ptr<OSQLParseNode> const & r) { return r.get() == pNewNode; }) - == m_aChildren.end(), + OSL_ENSURE(std::none_of(m_aChildren.begin(), m_aChildren.end(), + [&] (std::unique_ptr<OSQLParseNode> const & r) { return r.get() == pNewNode; }), "OSQLParseNode::append() Node already element of parent"); // Create connection to getParent @@ -2394,13 +2393,11 @@ OSQLParseNode* OSQLParseNode::replace(OSQLParseNode* pOldSubNode, OSQLParseNode* { OSL_ENSURE(pOldSubNode != nullptr && pNewSubNode != nullptr, "OSQLParseNode: invalid nodes"); OSL_ENSURE(pNewSubNode->getParent() == nullptr, "OSQLParseNode: node already has getParent"); - OSL_ENSURE(std::find_if(m_aChildren.begin(), m_aChildren.end(), - [&] (std::unique_ptr<OSQLParseNode> const & r) { return r.get() == pOldSubNode; }) - != m_aChildren.end(), + OSL_ENSURE(std::any_of(m_aChildren.begin(), m_aChildren.end(), + [&] (std::unique_ptr<OSQLParseNode> const & r) { return r.get() == pOldSubNode; }), "OSQLParseNode::Replace() Node not element of parent"); - OSL_ENSURE(std::find_if(m_aChildren.begin(), m_aChildren.end(), - [&] (std::unique_ptr<OSQLParseNode> const & r) { return r.get() == pNewSubNode; }) - == m_aChildren.end(), + OSL_ENSURE(std::none_of(m_aChildren.begin(), m_aChildren.end(), + [&] (std::unique_ptr<OSQLParseNode> const & r) { return r.get() == pNewSubNode; }), "OSQLParseNode::Replace() Node already element of parent"); pOldSubNode->setParent( nullptr ); diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx index 27297eaf903e..d48235c5a3ac 100644 --- a/cui/source/dialogs/pastedlg.cxx +++ b/cui/source/dialogs/pastedlg.cxx @@ -143,14 +143,13 @@ SotClipboardFormatId SvPasteObjectDialog::GetFormat( const TransferableDataHelpe aName = SvPasteObjectHelper::GetSotFormatUIName( nFormat ); // Show RICHTEXT only in case RTF is not present. - if (nFormat == SotClipboardFormatId::RICHTEXT) + if (nFormat == SotClipboardFormatId::RICHTEXT && + std::any_of(pFormats->begin(), pFormats->end(), + [](const DataFlavorEx& rFlavor) { + return rFlavor.mnSotId == SotClipboardFormatId::RTF; + })) { - auto it = std::find_if(pFormats->begin(), pFormats->end(), - [](const DataFlavorEx& rFlavor) { - return rFlavor.mnSotId == SotClipboardFormatId::RTF; - }); - if (it != pFormats->end()) - continue; + continue; } if (ObjectLB().find_text(aName) == -1) diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx index c6d1bb33085c..c235320ddc1f 100644 --- a/dbaccess/source/ui/app/subcomponentmanager.cxx +++ b/dbaccess/source/ui/app/subcomponentmanager.cxx @@ -455,12 +455,12 @@ namespace dbaui if ( !_rName.isEmpty() ) { // check there does not already exist such a component - SubComponents::const_iterator existentPos = std::find_if( + auto subComponentNotExists = std::none_of( m_pData->m_aComponents.begin(), m_pData->m_aComponents.end(), SubComponentMatch( _rName, _nComponentType, _eOpenMode ) ); - OSL_ENSURE( existentPos == m_pData->m_aComponents.end(), "already existent!" ); + OSL_ENSURE( subComponentNotExists, "already existent!" ); } #endif SubComponentDescriptor aElement( _rName, _nComponentType, _eOpenMode, _rxComponent ); diff --git a/dbaccess/source/ui/browser/formadapter.cxx b/dbaccess/source/ui/browser/formadapter.cxx index e2c796e7b65d..cc6b13e6e2f8 100644 --- a/dbaccess/source/ui/browser/formadapter.cxx +++ b/dbaccess/source/ui/browser/formadapter.cxx @@ -1419,9 +1419,9 @@ void SbaXFormAdapter::implInsert(const Any& aElement, sal_Int32 nIndex, const OU sal_Int32 SbaXFormAdapter::implGetPos(const OUString& rName) { - std::vector< OUString>::const_iterator aIter = std::find_if( m_aChildNames.begin(), + std::vector< OUString>::const_iterator aIter = std::find( m_aChildNames.begin(), m_aChildNames.end(), - [&rName](OUString const & s) { return s == rName; }); + rName); if(aIter != m_aChildNames.end()) return aIter - m_aChildNames.begin(); diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index 588f38e81c5a..8baf8a5693ba 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -524,12 +524,12 @@ void OGenericUnoController::ImplInvalidateFeature( sal_Int32 _nId, const Referen #if OSL_DEBUG_LEVEL > 0 if ( _nId != -1 ) { - SupportedFeatures::const_iterator aFeaturePos = std::find_if( + auto isSupportedFeature = std::any_of( m_aSupportedFeatures.begin(), m_aSupportedFeatures.end(), CompareFeatureById( _nId ) ); - OSL_ENSURE( aFeaturePos != m_aSupportedFeatures.end(), "OGenericUnoController::ImplInvalidateFeature: invalidating an unsupported feature is suspicious, at least!" ); + OSL_ENSURE( isSupportedFeature, "OGenericUnoController::ImplInvalidateFeature: invalidating an unsupported feature is suspicious, at least!" ); } #endif diff --git a/dbaccess/source/ui/misc/RowSetDrop.cxx b/dbaccess/source/ui/misc/RowSetDrop.cxx index b4e605f2754e..2fff06db9a9e 100644 --- a/dbaccess/source/ui/misc/RowSetDrop.cxx +++ b/dbaccess/source/ui/misc/RowSetDrop.cxx @@ -100,8 +100,8 @@ bool ORowSetImportExport::Write() bool ORowSetImportExport::Read() { // check if there is any column to copy - if(std::find_if(m_aColumnMapping.begin(),m_aColumnMapping.end(), - [](sal_Int32 n) { return n > 0; }) == m_aColumnMapping.end()) + if(std::none_of(m_aColumnMapping.begin(),m_aColumnMapping.end(), + [](sal_Int32 n) { return n > 0; })) return false; bool bContinue = true; if(m_aSelection.getLength()) diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 7c86eced09f2..7d49411122a5 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -866,9 +866,9 @@ IMPL_LINK_NOARG(OCopyTableWizard, ImplOKHdl, Button*, void) { if ( supportsPrimaryKey() ) { - ODatabaseExport::TColumns::const_iterator aFind = std::find_if(m_vDestColumns.begin(),m_vDestColumns.end(), + bool noPrimaryKey = std::none_of(m_vDestColumns.begin(),m_vDestColumns.end(), [] (const ODatabaseExport::TColumns::value_type& tCol) { return tCol.second->IsPrimaryKey(); }); - if ( aFind == m_vDestColumns.end() && m_xInteractionHandler.is() ) + if ( noPrimaryKey && m_xInteractionHandler.is() ) { OUString sMsg(DBA_RES(STR_TABLEDESIGN_NO_PRIM_KEY)); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index ddbdeaa4e5ba..416b42f3ce04 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1100,7 +1100,7 @@ void CallbackFlushHandler::queue(const int type, const char* data) { // if we have to invalidate all of the window, ignore // any part invalidation message - const auto& pos = std::find_if(m_queue.rbegin(), m_queue.rend(), + auto invAllExist = std::any_of(m_queue.rbegin(), m_queue.rend(), [&nLOKWindowId] (const queue_type::value_type& elem) { if (elem.first != LOK_CALLBACK_WINDOW) @@ -1120,7 +1120,7 @@ void CallbackFlushHandler::queue(const int type, const char* data) }); // we found a invalidate-all window callback - if (pos != m_queue.rend()) + if (invAllExist) { SAL_INFO("lok.dialog", "Skipping queue [" << type << "]: [" << payload << "] since whole window needs to be invalidated."); return; diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx index 592bd29af608..091bd47d35db 100644 --- a/desktop/source/lib/lokclipboard.cxx +++ b/desktop/source/lib/lokclipboard.cxx @@ -74,10 +74,10 @@ uno::Sequence<datatransfer::DataFlavor> SAL_CALL LOKTransferable::getTransferDat sal_Bool SAL_CALL LOKTransferable::isDataFlavorSupported(const datatransfer::DataFlavor& rFlavor) { const std::vector<datatransfer::DataFlavor> aFlavors = getTransferDataFlavorsAsVector(); - return std::find_if(aFlavors.begin(), aFlavors.end(), [&rFlavor](const datatransfer::DataFlavor& i) + return std::any_of(aFlavors.begin(), aFlavors.end(), [&rFlavor](const datatransfer::DataFlavor& i) { return i.MimeType == rFlavor.MimeType && i.DataType == rFlavor.DataType; - }) != aFlavors.end(); + }); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index 57eea220c5a8..0c97c465c441 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -953,11 +953,9 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs ) { editeng::Section& rSecAttr = *itCurAttr; // serious bug: will cause duplicate attributes to be exported - auto iter(std::find_if( - rSecAttr.maAttributes.begin(), rSecAttr.maAttributes.end(), + if (std::none_of(rSecAttr.maAttributes.begin(), rSecAttr.maAttributes.end(), [&pItem](SfxPoolItem const*const pIt) - { return pIt->Which() == pItem->Which(); })); - if (rSecAttr.maAttributes.end() == iter) + { return pIt->Which() == pItem->Which(); })) { rSecAttr.maAttributes.push_back(pItem); } diff --git a/extensions/source/propctrlr/cellbindinghelper.cxx b/extensions/source/propctrlr/cellbindinghelper.cxx index 85b0353ca738..7942a4200563 100644 --- a/extensions/source/propctrlr/cellbindinghelper.cxx +++ b/extensions/source/propctrlr/cellbindinghelper.cxx @@ -381,15 +381,11 @@ namespace pcr if ( xDocumentFactory.is() ) aAvailableServices = xDocumentFactory->getAvailableServiceNames( ); - const OUString* pFound = std::find_if( + bYesItIs = std::any_of( aAvailableServices.begin(), aAvailableServices.end(), StringCompare( _rService ) ); - if ( pFound != aAvailableServices.end() ) - { - bYesItIs = true; - } } return bYesItIs; diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 8492d115e0d6..4cfbfe1e12ca 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -966,12 +966,12 @@ namespace pcr aProperties.reserve( aProperties.size() + aThisHandlersProperties.size() ); for (const auto & aThisHandlersPropertie : aThisHandlersProperties) { - std::vector< Property >::const_iterator previous = std::find_if( + auto noPrevious = std::none_of( aProperties.begin(), aProperties.end(), FindPropertyByName( aThisHandlersPropertie.Name ) ); - if ( previous == aProperties.end() ) + if ( noPrevious ) { aProperties.push_back( aThisHandlersPropertie ); continue; diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index 3a55e313dcf1..6f36ab12bf17 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -467,11 +467,11 @@ namespace frm _rPropertyNames.begin(), _rPropertyNames.end(), [](OUString const & s) { return s == PROPERTY_SELECT_SEQ; } ); - const OUString* pStringItemListPos = ::std::find_if( + auto aStringItemListExists = std::any_of( _rPropertyNames.begin(), _rPropertyNames.end(), [](OUString const & s) { return s == PROPERTY_STRINGITEMLIST; } ); - if ( ( pSelectedItemsPos != _rPropertyNames.end() ) && ( pStringItemListPos != _rPropertyNames.end() ) ) + if ( ( pSelectedItemsPos != _rPropertyNames.end() ) && aStringItemListExists ) { // both properties are present // -> remember the value for the select sequence diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx index 136fd8087e66..c1ec8ade2fd0 100644 --- a/formula/source/ui/dlg/formula.cxx +++ b/formula/source/ui/dlg/formula.cxx @@ -498,10 +498,9 @@ sal_Int32 FormulaDlg_Impl::GetFunctionPos(sal_Int32 nPos) bFlag = false; nFuncPos = nPrevFuncPos; } - bool bIsFunction = ::std::find_if( m_aFunctionOpCodes.getConstArray(), + bool bIsFunction = std::any_of( m_aFunctionOpCodes.getConstArray(), m_pFunctionOpCodesEnd, - [&eOp](const sheet::FormulaOpCodeMapEntry& aEntry) { return aEntry.Token.OpCode == eOp; }) - != m_pFunctionOpCodesEnd; + [&eOp](const sheet::FormulaOpCodeMapEntry& aEntry) { return aEntry.Token.OpCode == eOp; }); if ( bIsFunction && m_aSpecialOpCodes[sheet::FormulaMapGroupSpecialOffset::SPACES].Token.OpCode != eOp ) { diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index 08cb1fff7e5b..77823293ef83 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -128,10 +128,7 @@ bool addJREInfo( rtl::Reference<VendorBase> const & info, std::vector<rtl::Reference<VendorBase>> & infos) { - auto i( - std::find_if( - infos.begin(), infos.end(), InfoFindSame(info->getHome()))); - if (i == infos.end()) { + if (std::none_of(infos.begin(), infos.end(), InfoFindSame(info->getHome()))) { infos.push_back(info); return true; } else { diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx index b2532c48914d..a748d77cff37 100644 --- a/jvmfwk/source/framework.cxx +++ b/jvmfwk/source/framework.cxx @@ -118,13 +118,12 @@ javaFrameworkError jfw_findAllJREs(std::vector<std::unique_ptr<JavaInfo>> *pparI // for the vendors for which there is a javaSelection/plugins/ // library entry in the javavendors.xml; jfw_getJavaInfoByPath // can return a JavaInfo of any vendor: - if ((std::find_if( + if ((std::none_of( vecInfo.begin(), vecInfo.end(), [&aInfo](std::unique_ptr<JavaInfo> const & info) { return areEqualJavaInfo( info.get(), aInfo.get()); - }) - == vecInfo.end()) + })) && (std::find( vecVendors.begin(), vecVendors.end(), aInfo->sVendor) diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index f6be50375057..b4c15ea434a5 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -206,7 +206,7 @@ bool addRecursiveTests(const std::vector<std::string>& test_names, CppUnit::Test { CppUnit::Test* pNewTest = pTest->getChildTestAt(i); ret |= addRecursiveTests(test_names, pNewTest, rRunner); - if (std::find_if(test_names.begin(), test_names.end(), test_name_compare(pNewTest->getName())) != test_names.end()) + if (std::any_of(test_names.begin(), test_names.end(), test_name_compare(pNewTest->getName()))) { rRunner.addTest(pNewTest); ret = true; diff --git a/sal/osl/all/debugbase.cxx b/sal/osl/all/debugbase.cxx index ea46777dc640..91486be50ecf 100644 --- a/sal/osl/all/debugbase.cxx +++ b/sal/osl/all/debugbase.cxx @@ -89,8 +89,8 @@ bool SAL_CALL osl_detail_ObjectRegistry_storeAddresses( char const* pName ) if ( rFirst == "all" ) return true; auto const iEnd( rVec.cend() ); - return std::find_if( rVec.begin(), iEnd, - [pName] (OString const& it) { return isSubStr(pName, it); }) != iEnd; + return std::any_of( rVec.begin(), iEnd, + [pName] (OString const& it) { return isSubStr(pName, it); }); } bool SAL_CALL osl_detail_ObjectRegistry_checkObjectCount( diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index 2099a8e51563..dbd0a8509d84 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -763,8 +763,8 @@ void SetTableColumnName( ::std::vector<OUString>& rVec, size_t nIndex, const OUS aStr = rName; ++nCount; } - auto it( ::std::find_if( rVec.begin(), rVec.end(), TableColumnNameSearch( aStr))); - if (it == rVec.end()) + + if (std::none_of( rVec.begin(), rVec.end(), TableColumnNameSearch( aStr))) { rVec[nIndex] = aStr; break; // do while @@ -1263,7 +1263,7 @@ bool ScDBCollection::AnonDBs::empty() const bool ScDBCollection::AnonDBs::has( const ScDBData* p ) const { - return find_if(m_DBs.begin(), m_DBs.end(), FindByPointer(p)) != m_DBs.end(); + return any_of(m_DBs.begin(), m_DBs.end(), FindByPointer(p)); } bool ScDBCollection::AnonDBs::operator== (const AnonDBs& r) const diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index f8089345e891..943b5847d711 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -515,9 +515,7 @@ void ScFilterDlg::UpdateValueList( size_t nList ) { // See if the header value is already in the list. std::vector<ScTypedStrData>::iterator itBeg = pList->maFilterEntries.begin(), itEnd = pList->maFilterEntries.end(); - std::vector<ScTypedStrData>::iterator it = std::find_if( - itBeg, itEnd, FindTypedStrData(aHdrColl.front(), bCaseSens)); - if (it == itEnd) + if (std::none_of(itBeg, itEnd, FindTypedStrData(aHdrColl.front(), bCaseSens))) { // Not in the list. Insert it. pList->maFilterEntries.push_back(aHdrColl.front()); @@ -529,7 +527,7 @@ void ScFilterDlg::UpdateValueList( size_t nList ) // Record its position. itBeg = pList->maFilterEntries.begin(); itEnd = pList->maFilterEntries.end(); - it = std::find_if(itBeg, itEnd, FindTypedStrData(aHdrColl.front(), bCaseSens)); + auto it = std::find_if(itBeg, itEnd, FindTypedStrData(aHdrColl.front(), bCaseSens)); pList->mnHeaderPos = std::distance(itBeg, it); } } diff --git a/sd/source/ui/sidebar/MasterPageContainerQueue.cxx b/sd/source/ui/sidebar/MasterPageContainerQueue.cxx index 8b9a167ad20f..5493c2be72fb 100644 --- a/sd/source/ui/sidebar/MasterPageContainerQueue.cxx +++ b/sd/source/ui/sidebar/MasterPageContainerQueue.cxx @@ -239,11 +239,10 @@ IMPL_LINK(MasterPageContainerQueue, DelayedPreviewCreation, Timer*, pTimer, void bool MasterPageContainerQueue::HasRequest (MasterPageContainer::Token aToken) const { - RequestQueue::iterator iRequest (::std::find_if( + return std::any_of( mpRequestQueue->begin(), mpRequestQueue->end(), - PreviewCreationRequest::CompareToken(aToken))); - return (iRequest != mpRequestQueue->end()); + PreviewCreationRequest::CompareToken(aToken)); } bool MasterPageContainerQueue::IsEmpty() const diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx index dc9292201715..fb8eaba84484 100644 --- a/sd/source/ui/view/ViewShellManager.cxx +++ b/sd/source/ui/view/ViewShellManager.cxx @@ -518,11 +518,7 @@ void ViewShellManager::Implementation::ActivateSubShell ( ::osl::MutexGuard aGuard (maMutex); // Check that the given view shell is active. - ActiveShellList::iterator iShell (::std::find_if ( - maActiveViewShells.begin(), - maActiveViewShells.end(), - IsShell(&rParentShell))); - if (iShell == maActiveViewShells.end()) + if (std::none_of (maActiveViewShells.begin(), maActiveViewShells.end(), IsShell(&rParentShell))) return; // Create the sub shell list if it does not yet exist. @@ -533,7 +529,7 @@ void ViewShellManager::Implementation::ActivateSubShell ( // Do not activate an object bar that is already active. Requesting // this is not exactly an error but may be an indication of one. SubShellSubList& rList (iList->second); - if (::std::find_if(rList.begin(),rList.end(), IsId(nId)) != rList.end()) + if (std::any_of(rList.begin(),rList.end(), IsId(nId))) return; // Add just the id of the sub shell. The actual shell is created diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx index ba4aea583691..a24281ba1454 100644 --- a/sfx2/source/dialog/filtergrouping.cxx +++ b/sfx2/source/dialog/filtergrouping.cxx @@ -671,10 +671,7 @@ namespace sfx2 // -> append the wildcard aExtendWildcard( *aBelongsToLocal ); - MapGroupEntry2GroupEntry::iterator aThisGroupFinalPos = - ::std::find_if( aLocalFinalPositions.begin(), aLocalFinalPositions.end(), FindGroupEntry( aBelongsToLocal->second ) ); - - if ( aLocalFinalPositions.end() == aThisGroupFinalPos ) + if ( std::none_of( aLocalFinalPositions.begin(), aLocalFinalPositions.end(), FindGroupEntry( aBelongsToLocal->second ) ) ) { // the position within aCollectedLocals has not been mapped to a final position // within the "real" group (aCollectedLocals is only temporary) // -> do this now (as we just encountered the first filter belonging to this local class diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index 55d73c46bbb9..7d7ac24f658a 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -575,7 +575,7 @@ XmlIdRegistryDocument::XmlIdRegistry_Impl::TryInsertMetadatable( // this is only called from TryRegister now, so check // if all elements in the list are deleted (in undo) or // placeholders, then "steal" the id from them - if ( pList->end() == ::std::find_if(pList->begin(), pList->end(), + if ( std::none_of(pList->begin(), pList->end(), [](Metadatable* item)->bool { return !(item->IsInUndo() || item->IsInClipboard()); } ) ) diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx index d2e6f02d88fb..b05d13aa78eb 100644 --- a/sfx2/source/view/classificationhelper.cxx +++ b/sfx2/source/view/classificationhelper.cxx @@ -416,10 +416,10 @@ void SfxClassificationHelper::Impl::parsePolicy() static bool lcl_containsProperty(const uno::Sequence<beans::Property>& rProperties, const OUString& rName) { - return std::find_if(rProperties.begin(), rProperties.end(), [&](const beans::Property& rProperty) + return std::any_of(rProperties.begin(), rProperties.end(), [&](const beans::Property& rProperty) { return rProperty.Name == rName; - }) != rProperties.end(); + }); } void SfxClassificationHelper::Impl::setStartValidity(SfxClassificationPolicyType eType) diff --git a/shell/source/unix/sysshell/recently_used_file_handler.cxx b/shell/source/unix/sysshell/recently_used_file_handler.cxx index 0742e8b8912d..067c968f4814 100644 --- a/shell/source/unix/sysshell/recently_used_file_handler.cxx +++ b/shell/source/unix/sysshell/recently_used_file_handler.cxx @@ -98,10 +98,8 @@ namespace /* private */ { bool has_group(const string_t& name) const { - auto iter_end = groups_.cend(); return (has_groups() && - iter_end != std::find_if( - groups_.cbegin(), iter_end, + std::any_of(groups_.cbegin(), groups_.cend(), [&name](const string_t& s) { return (0 == strcasecmp(s.c_str(), name.c_str())); }) // compare two string_t's case insensitive diff --git a/shell/source/win32/zipfile/zipfile.cxx b/shell/source/win32/zipfile/zipfile.cxx index 0cf7f204cf7e..f7f8ccd23806 100644 --- a/shell/source/win32/zipfile/zipfile.cxx +++ b/shell/source/win32/zipfile/zipfile.cxx @@ -535,10 +535,8 @@ bool ZipFile::HasContent(const std::string &ContentName) const //case in-sensitive as it is not defined that such //names must be handled case sensitive DirectoryPtr_t dir = GetDirectory(); - Directory_t::iterator iter = - std::find_if(dir->begin(), dir->end(), internal::stricmp(ContentName)); - return (iter != dir->end()); + return std::any_of(dir->begin(), dir->end(), internal::stricmp(ContentName)); } diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx index f3863e6dc6c4..5600107f8eb4 100644 --- a/svtools/source/misc/transfer.cxx +++ b/svtools/source/misc/transfer.cxx @@ -614,8 +614,8 @@ void TransferableHelper::RemoveFormat( const DataFlavor& rFlavor ) bool TransferableHelper::HasFormat( SotClipboardFormatId nFormat ) { - return (std::find_if(maFormats.begin(), maFormats.end(), - [&](const DataFlavorEx& data) { return data.mnSotId == nFormat; }) != maFormats.end()); + return std::any_of(maFormats.begin(), maFormats.end(), + [&](const DataFlavorEx& data) { return data.mnSotId == nFormat; }); } @@ -1303,8 +1303,8 @@ void TransferableDataHelper::InitFormats() bool TransferableDataHelper::HasFormat( SotClipboardFormatId nFormat ) const { ::osl::MutexGuard aGuard(mxImpl->maMutex); - return (std::find_if(maFormats.begin(), maFormats.end(), - [&](const DataFlavorEx& data) { return data.mnSotId == nFormat; }) != maFormats.end()); + return std::any_of(maFormats.begin(), maFormats.end(), + [&](const DataFlavorEx& data) { return data.mnSotId == nFormat; }); } bool TransferableDataHelper::HasFormat( const DataFlavor& rFlavor ) const diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx index fb4e1c694316..a550fba22130 100644 --- a/svtools/source/misc/transfer2.cxx +++ b/svtools/source/misc/transfer2.cxx @@ -296,8 +296,8 @@ sal_Int8 DropTargetHelper::ExecuteDrop( const ExecuteDropEvent& ) bool DropTargetHelper::IsDropFormatSupported( SotClipboardFormatId nFormat ) { - return (std::find_if(maFormats.begin(), maFormats.end(), - [&](const DataFlavorEx& data) { return data.mnSotId == nFormat; }) != maFormats.end()); + return std::any_of(maFormats.begin(), maFormats.end(), + [&](const DataFlavorEx& data) { return data.mnSotId == nFormat; }); } diff --git a/svx/source/dialog/ClassificationCommon.cxx b/svx/source/dialog/ClassificationCommon.cxx index cd5dc7324d02..082b5b6a9418 100644 --- a/svx/source/dialog/ClassificationCommon.cxx +++ b/svx/source/dialog/ClassificationCommon.cxx @@ -58,9 +58,8 @@ OUString getProperty(uno::Reference<beans::XPropertyContainer> const& rxProperty bool containsProperty(uno::Sequence<beans::Property> const& rProperties, OUString const& rName) { - return std::find_if(rProperties.begin(), rProperties.end(), - [&](const beans::Property& rProperty) { return rProperty.Name == rName; }) - != rProperties.end(); + return std::any_of(rProperties.begin(), rProperties.end(), + [&](const beans::Property& rProperty) { return rProperty.Name == rName; }); } void removeAllProperties(uno::Reference<beans::XPropertyContainer> const& rxPropertyContainer) diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index 20d5cc11bd4f..0e8f30204fcb 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -204,19 +204,16 @@ void SvxShowCharSet::getFavCharacterList() bool SvxShowCharSet::isFavChar(const OUString& sTitle, const OUString& rFont) { - auto itChar = std::find_if(maFavCharList.begin(), + auto isFavCharTitleExists = std::any_of(maFavCharList.begin(), maFavCharList.end(), [sTitle] (const OUString & a) { return a == sTitle; }); - auto itChar2 = std::find_if(maFavCharFontList.begin(), + auto isFavCharFontExists = std::any_of(maFavCharFontList.begin(), maFavCharFontList.end(), [rFont] (const OUString & a) { return a == rFont; }); // if Fav char to be added is already in list, return true - if( itChar != maFavCharList.end() && itChar2 != maFavCharFontList.end() ) - return true; - else - return false; + return isFavCharTitleExists && isFavCharFontExists; } void SvxShowCharSet::createContextMenu() diff --git a/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx index ffd6c514c64f..f19937113b82 100644 --- a/svx/source/items/customshapeitem.cxx +++ b/svx/source/items/customshapeitem.cxx @@ -141,7 +141,7 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const css::beans::PropertyVal } else { // it's a new property - assert(aPropSeq.end() == std::find_if(aPropSeq.begin(), aPropSeq.end(), + assert(std::none_of(aPropSeq.begin(), aPropSeq.end(), [&rPropVal](beans::PropertyValue const& rVal) { return rVal.Name == rPropVal.Name; } )); sal_uInt32 nIndex = aPropSeq.getLength(); @@ -167,7 +167,7 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const OUString& rSequenceName aValue.Name = rSequenceName; aValue.Value <<= aSeq; - assert(aPropSeq.end() == std::find_if(aPropSeq.begin(), aPropSeq.end(), + assert(std::none_of(aPropSeq.begin(), aPropSeq.end(), [&rSequenceName](beans::PropertyValue const& rV) { return rV.Name == rSequenceName; } )); sal_uInt32 nIndex = aPropSeq.getLength(); diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 364e78503b53..8d5a76201563 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -222,10 +222,9 @@ void SwLayoutWriter::testTdf118672() = linguistic2::LinguServiceManager::create(comphelper::getProcessComponentContext()); uno::Sequence<lang::Locale> aLocales = xLinguServiceManager->getAvailableLocales("com.sun.star.linguistic2.Hyphenator"); - auto it = std::find_if(aLocales.begin(), aLocales.end(), [](const lang::Locale& rLocale) { - return rLocale.Language == "en" && rLocale.Country == "US"; - }); - if (it == aLocales.end()) + if (std::none_of(aLocales.begin(), aLocales.end(), [](const lang::Locale& rLocale) { + return rLocale.Language == "en" && rLocale.Country == "US"; + })) return; OUString aLine1("He heard quiet steps behind him. That didn't bode well. Who could be fol*1 2 " diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index fcee6d3272b6..c7160cb463d4 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -1304,13 +1304,13 @@ bool SwRegHistory::InsertItems( const SfxItemSet& rSet, continue; // special case, may get set on text node itself // tdf#105077 even worse, node's set could cause // nothing at all to be inserted - assert(std::find_if( + assert(std::any_of( m_pHistory->m_SwpHstry.begin(), m_pHistory->m_SwpHstry.end(), [nExpected](std::unique_ptr<SwHistoryHint> const& pHint) -> bool { SwHistoryResetText const*const pReset( dynamic_cast<SwHistoryResetText const*>(pHint.get())); return pReset && (pReset->GetWhich() == nExpected); - }) != m_pHistory->m_SwpHstry.end()); + })); } } #endif diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index e85e44f0214e..a81f553cc00b 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -484,9 +484,8 @@ uno::Sequence< OUString > SwXStyleFamilies::getElementNames() sal_Bool SwXStyleFamilies::hasByName(const OUString& Name) { auto pEntries(lcl_GetStyleFamilyEntries()); - const auto pEntry = std::find_if(pEntries->begin(), pEntries->end(), + return std::any_of(pEntries->begin(), pEntries->end(), [&Name] (const StyleFamilyEntry& e) { return e.m_sName == Name; }); - return pEntry != pEntries->end(); } sal_Int32 SwXStyleFamilies::getCount() @@ -1113,7 +1112,7 @@ public: bool AllowsKey(const OUString& rName) { - return aPropertyEntries.end() != std::find_if(aPropertyEntries.begin(), aPropertyEntries.end(), + return std::any_of(aPropertyEntries.begin(), aPropertyEntries.end(), [rName] (const SfxItemPropertyNamedEntry& rEntry) {return rName == rEntry.sName;} ); } bool SetProperty(const OUString& rName, const uno::Any& rValue) diff --git a/toolkit/source/controls/geometrycontrolmodel.cxx b/toolkit/source/controls/geometrycontrolmodel.cxx index e1f0b7b4dd94..d8f9045668fc 100644 --- a/toolkit/source/controls/geometrycontrolmodel.cxx +++ b/toolkit/source/controls/geometrycontrolmodel.cxx @@ -602,13 +602,7 @@ // look if this id is one we recognized as duplicate IntArrayArray::value_type& rDuplicateIds = AmbiguousPropertyIds::get()[ m_nPropertyMapId ]; - IntArrayArray::value_type::const_iterator aPos = ::std::find_if( - rDuplicateIds.begin(), - rDuplicateIds.end(), - Int32Equal( _nHandle ) - ); - - if ( rDuplicateIds.end() != aPos ) + if ( std::any_of(rDuplicateIds.begin(), rDuplicateIds.end(), Int32Equal( _nHandle )) ) { // yes, it is such a property OUString sPropName; diff --git a/unoidl/source/unoidl-check.cxx b/unoidl/source/unoidl-check.cxx index f0343231913e..41ad76143cd1 100644 --- a/unoidl/source/unoidl-check.cxx +++ b/unoidl/source/unoidl-check.cxx @@ -728,11 +728,10 @@ void checkMap( std::exit(EXIT_FAILURE); } for (auto & i: ent2A->getDirectOptionalBaseServices()) { - if (std::find_if( + if (std::none_of( ent2B->getDirectOptionalBaseServices().begin(), ent2B->getDirectOptionalBaseServices().end(), - EqualsAnnotation(i.name)) - == ent2B->getDirectOptionalBaseServices().end()) + EqualsAnnotation(i.name))) { std::cerr << "accumulation-based service " << name @@ -789,12 +788,11 @@ void checkMap( std::exit(EXIT_FAILURE); } for (auto & i: ent2A->getDirectOptionalBaseInterfaces()) { - if (std::find_if( + if (std::none_of( (ent2B->getDirectOptionalBaseInterfaces() .begin()), ent2B->getDirectOptionalBaseInterfaces().end(), - EqualsAnnotation(i.name)) - == ent2B->getDirectOptionalBaseInterfaces().end()) + EqualsAnnotation(i.name))) { std::cerr << "accumulation-based service " << name diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index 3b96fa79606a..c453f3dc91fc 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -573,10 +573,10 @@ const PPDParser* PPDParser::getParser( const OUString& rFile ) { // this may actually be the SGENPRT parser, // so ensure uniqueness here (but don't remove last we delete us!) - if (std::find_if( + if (std::none_of( rPPDCache.aAllParsers.begin(), rPPDCache.aAllParsers.end(), - [pNewParser] (std::unique_ptr<PPDParser> const & x) { return x.get() == pNewParser; } ) == rPPDCache.aAllParsers.end()) + [pNewParser] (std::unique_ptr<PPDParser> const & x) { return x.get() == pNewParser; } )) { // insert new parser to vector rPPDCache.aAllParsers.emplace_back(pNewParser); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index f1a8d593d127..6cc7f982d900 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -186,7 +186,7 @@ sal_Bool SAL_CALL GtkTransferable::isDataFlavorSupported(const css::datatransfer const std::vector<css::datatransfer::DataFlavor> aAll = getTransferDataFlavorsAsVector(); - return std::find_if(aAll.begin(), aAll.end(), DataFlavorEq(rFlavor)) != aAll.end(); + return std::any_of(aAll.begin(), aAll.end(), DataFlavorEq(rFlavor)); } class GtkClipboardTransferable : public GtkTransferable diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 508e74e017ae..e881f279a83f 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1397,11 +1397,10 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con uno::Sequence<beans::PropertyValue> aPrevPropertiesSeq; m_xPreviousParagraph->getPropertyValue("ParaInteropGrabBag") >>= aPrevPropertiesSeq; auto aPrevProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aPrevPropertiesSeq); - auto itPrevParaAutoAfter = std::find_if(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue) + bool bPrevParaAutoAfter = std::any_of(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "ParaBottomMarginAfterAutoSpacing"; }); - bool bPrevParaAutoAfter = itPrevParaAutoAfter != aPrevProperties.end(); if (bPrevParaAutoAfter) { // Previous after spacing is set to auto, set previous after space to 0. @@ -1453,22 +1452,18 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con // set top margin of the previous auto paragraph in cells, keeping zero bottom margin only at the first one if (m_nTableDepth > 0 && m_nTableDepth == m_nTableCellDepth && m_xPreviousParagraph.is()) { - bool bParaChangedTopMargin = false; - auto itParaTopMargin = std::find_if(aProperties.begin(), aProperties.end(), [](const beans::PropertyValue& rValue) + bool bParaChangedTopMargin = std::any_of(aProperties.begin(), aProperties.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "ParaTopMargin"; }); - if (itParaTopMargin != aProperties.end()) - bParaChangedTopMargin = true; uno::Sequence<beans::PropertyValue> aPrevPropertiesSeq; m_xPreviousParagraph->getPropertyValue("ParaInteropGrabBag") >>= aPrevPropertiesSeq; auto aPrevProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aPrevPropertiesSeq); - auto itPrevParaAutoBefore = std::find_if(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue) + bool bPrevParaAutoBefore = std::any_of(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "ParaTopMarginBeforeAutoSpacing"; }); - bool bPrevParaAutoBefore = itPrevParaAutoBefore != aPrevProperties.end(); if ((bPrevParaAutoBefore && !bParaChangedTopMargin) || (bParaChangedTopMargin && m_bParaAutoBefore)) { @@ -2517,11 +2512,10 @@ void DomainMapper_Impl::ClearPreviousParagraph() uno::Sequence<beans::PropertyValue> aPrevPropertiesSeq; m_xPreviousParagraph->getPropertyValue("ParaInteropGrabBag") >>= aPrevPropertiesSeq; auto aPrevProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aPrevPropertiesSeq); - auto itPrevParaAutoAfter = std::find_if(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue) + bool bPrevParaAutoAfter = std::any_of(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "ParaBottomMarginAfterAutoSpacing"; }); - bool bPrevParaAutoAfter = itPrevParaAutoAfter != aPrevProperties.end(); bool bPrevNumberingRules = false; uno::Reference<container::XNamed> xPreviousNumberingRules(m_xPreviousParagraph->getPropertyValue("NumberingRules"), uno::UNO_QUERY); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 29d5dedb7308..1c6c858bc12d 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2026,9 +2026,8 @@ void RTFDocumentImpl::resetAttributes() static bool lcl_containsProperty(const uno::Sequence<beans::Property>& rProperties, const OUString& rName) { - return std::find_if(rProperties.begin(), rProperties.end(), - [&](const beans::Property& rProperty) { return rProperty.Name == rName; }) - != rProperties.end(); + return std::any_of(rProperties.begin(), rProperties.end(), + [&](const beans::Property& rProperty) { return rProperty.Name == rName; }); } RTFError RTFDocumentImpl::popState() diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index 1e68d08b2d15..2a2c38945309 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -523,7 +523,7 @@ void SigningTest::testOOXMLRemoveAll() uno::Reference<io::XInputStream> xInputStream = xStream->getInputStream(); uno::Sequence< uno::Sequence<beans::StringPair> > aContentTypeInfo = comphelper::OFOPXMLHelper::ReadContentTypeSequence(xInputStream, mxComponentContext); uno::Sequence<beans::StringPair>& rOverrides = aContentTypeInfo[1]; - CPPUNIT_ASSERT_EQUAL(rOverrides.end(), std::find_if(rOverrides.begin(), rOverrides.end(), [](const beans::StringPair& rPair) + CPPUNIT_ASSERT(std::none_of(rOverrides.begin(), rOverrides.end(), [](const beans::StringPair& rPair) { return rPair.First.startsWith("/_xmlsignatures/sig"); })); diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx b/xmlsecurity/source/helper/ooxmlsecexporter.cxx index 774f6c034558..8e594cde62d6 100644 --- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx +++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx @@ -86,10 +86,10 @@ bool OOXMLSecExporter::Impl::isOOXMLBlacklist(const OUString& rStreamName) "/_xmlsignatures" }; // Just check the prefix, as we don't care about the content type part of the stream name. - return std::find_if(vBlacklist.begin(), vBlacklist.end(), [&](const OUStringLiteral& rLiteral) + return std::any_of(vBlacklist.begin(), vBlacklist.end(), [&](const OUStringLiteral& rLiteral) { return rStreamName.startsWith(rLiteral); - }) != vBlacklist.end(); + }); } bool OOXMLSecExporter::Impl::isOOXMLRelationBlacklist(const OUString& rRelationName) diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx index d21a8a101862..0e7a77640a68 100644 --- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx +++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx @@ -350,7 +350,7 @@ bool XMLSignatureHelper::ReadAndVerifySignatureStorage(const uno::Reference<embe { const uno::Sequence<beans::StringPair>& rRelation = aRelationsInfo[i]; auto aRelation = comphelper::sequenceToContainer< std::vector<beans::StringPair> >(rRelation); - if (std::find_if(aRelation.begin(), aRelation.end(), lcl_isSignatureType) != aRelation.end()) + if (std::any_of(aRelation.begin(), aRelation.end(), lcl_isSignatureType)) { std::vector<beans::StringPair>::iterator it = std::find_if(aRelation.begin(), aRelation.end(), [](const beans::StringPair& rPair) { return rPair.First == "Target"; }); if (it != aRelation.end()) @@ -442,7 +442,7 @@ void XMLSignatureHelper::EnsureSignaturesRelation(const css::uno::Reference<css: for (const uno::Sequence<beans::StringPair>& rRelation : aRelationsInfo) { auto aRelation = comphelper::sequenceToContainer< std::vector<beans::StringPair> >(rRelation); - if (std::find_if(aRelation.begin(), aRelation.end(), lcl_isSignatureOriginType) != aRelation.end()) + if (std::any_of(aRelation.begin(), aRelation.end(), lcl_isSignatureOriginType)) { bHaveRelation = true; break; @@ -465,7 +465,7 @@ void XMLSignatureHelper::EnsureSignaturesRelation(const css::uno::Reference<css: for (std::vector< uno::Sequence<beans::StringPair> >::iterator it = aRelationsInfo.begin(); it != aRelationsInfo.end();) { auto aRelation = comphelper::sequenceToContainer< std::vector<beans::StringPair> >(*it); - if (std::find_if(aRelation.begin(), aRelation.end(), lcl_isSignatureOriginType) != aRelation.end()) + if (std::any_of(aRelation.begin(), aRelation.end(), lcl_isSignatureOriginType)) it = aRelationsInfo.erase(it); else ++it; @@ -525,18 +525,10 @@ void XMLSignatureHelper::ExportSignatureContentTypes(const css::uno::Reference<c // Append rels and sigs to defaults, if it's not there already. uno::Sequence<beans::StringPair>& rDefaults = aContentTypeInfo[0]; auto aDefaults = comphelper::sequenceToContainer< std::vector<beans::StringPair> >(rDefaults); - auto it = std::find_if(rDefaults.begin(), rDefaults.end(), [](const beans::StringPair& rPair) - { - return rPair.First == "rels"; - }); - if (it == rDefaults.end()) + if (std::none_of(rDefaults.begin(), rDefaults.end(), [](const beans::StringPair& rPair) { return rPair.First == "rels"; })) aDefaults.emplace_back("rels", "application/vnd.openxmlformats-package.relationships+xml"); - it = std::find_if(rDefaults.begin(), rDefaults.end(), [](const beans::StringPair& rPair) - { - return rPair.First == "sigs"; - }); - if (it == rDefaults.end()) + if (std::none_of(rDefaults.begin(), rDefaults.end(), [](const beans::StringPair& rPair) { return rPair.First == "sigs"; })) aDefaults.emplace_back("sigs", "application/vnd.openxmlformats-package.digital-signature-origin"); rDefaults = comphelper::containerToSequence(aDefaults); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits