diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2018-08-29 00:47:33 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-29 11:40:29 +0200 |
commit | 085269d25a705b656436feac47149296b4b4b35d (patch) | |
tree | 3195c0526652ebd9e125507aa17cd15b2acfb368 /xmlsecurity/source/helper | |
parent | b0e74b65a86eb965c3e93da2fb77972cc5445f3c (diff) |
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.grandin@collabora.co.uk>
Diffstat (limited to 'xmlsecurity/source/helper')
-rw-r--r-- | xmlsecurity/source/helper/ooxmlsecexporter.cxx | 4 | ||||
-rw-r--r-- | xmlsecurity/source/helper/xmlsignaturehelper.cxx | 18 |
2 files changed, 7 insertions, 15 deletions
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); |