summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/component
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-05-09 15:17:26 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-05-09 18:21:59 +0200
commitfac093e5e63bd53bae3de552fedba927bd5c4561 (patch)
tree7b921dc813a6d6e0df55ef6d15edabb76e52bd40 /xmlsecurity/source/component
parent2479ab8b788ca000f2e979d0858de8d05de8e858 (diff)
Simplify Sequence iterations in xmlscript, xmlsecurity
Use range-based loops or replace with comphelper or STL functions Change-Id: I3d63811caf80c87a9d560087e1f0d933ebcc0d55 Reviewed-on: https://gerrit.libreoffice.org/72040 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlsecurity/source/component')
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.cxx19
1 files changed, 5 insertions, 14 deletions
diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 5e2f2d5ee056..834f6dc0a462 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -619,24 +619,15 @@ void DocumentDigitalSignatures::showCertificate(
sal_Bool DocumentDigitalSignatures::isAuthorTrusted(
const Reference< css::security::XCertificate >& Author )
{
- bool bFound = false;
-
OUString sSerialNum = xmlsecurity::bigIntegerToNumericString( Author->getSerialNumber() );
Sequence< SvtSecurityOptions::Certificate > aTrustedAuthors = SvtSecurityOptions().GetTrustedAuthors();
- const SvtSecurityOptions::Certificate* pAuthors = aTrustedAuthors.getConstArray();
- const SvtSecurityOptions::Certificate* pAuthorsEnd = pAuthors + aTrustedAuthors.getLength();
- for ( ; pAuthors != pAuthorsEnd; ++pAuthors )
- {
- SvtSecurityOptions::Certificate aAuthor = *pAuthors;
- if ( ( aAuthor[0] == Author->getIssuerName() ) && ( aAuthor[1] == sSerialNum ) )
- {
- bFound = true;
- break;
- }
- }
- return bFound;
+ return std::any_of(aTrustedAuthors.begin(), aTrustedAuthors.end(),
+ [&Author, &sSerialNum](const SvtSecurityOptions::Certificate& rAuthor) {
+ return ( rAuthor[0] == Author->getIssuerName() )
+ && ( rAuthor[1] == sSerialNum );
+ });
}
uno::Sequence<Reference<css::security::XCertificate>>