diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-05-09 15:17:26 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-05-09 18:21:59 +0200 |
commit | fac093e5e63bd53bae3de552fedba927bd5c4561 (patch) | |
tree | 7b921dc813a6d6e0df55ef6d15edabb76e52bd40 /xmlsecurity/source/xmlsec | |
parent | add a way to specify SfxRequest preferred dialog parent (diff) | |
download | core-fac093e5e63bd53bae3de552fedba927bd5c4561.tar.gz core-fac093e5e63bd53bae3de552fedba927bd5c4561.zip |
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/xmlsec')
-rw-r--r-- | xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx | 13 | ||||
-rw-r--r-- | xmlsecurity/source/xmlsec/saxhelper.cxx | 7 |
2 files changed, 8 insertions, 12 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index d67bf2e517e4..a5015bc87c55 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -142,12 +142,7 @@ OUString SAL_CALL SecurityEnvironment_NssImpl::getImplementationName() { /* XServiceInfo */ sal_Bool SAL_CALL SecurityEnvironment_NssImpl::supportsService( const OUString& serviceName) { Sequence< OUString > seqServiceNames = getSupportedServiceNames() ; - const OUString* pArray = seqServiceNames.getConstArray() ; - for( sal_Int32 i = 0 ; i < seqServiceNames.getLength() ; i ++ ) { - if( *( pArray + i ) == serviceName ) - return true ; - } - return false ; + return comphelper::findValue(seqServiceNames, serviceName) != -1; } /* XServiceInfo */ @@ -545,9 +540,9 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, { //prepare the intermediate certificates - for (sal_Int32 i = 0; i < intermediateCerts.getLength(); i++) + for (const auto& rIntermediateCert : intermediateCerts) { - Sequence<sal_Int8> der = intermediateCerts[i]->getEncoded(); + Sequence<sal_Int8> der = rIntermediateCert->getEncoded(); SECItem item; item.type = siBuffer; item.data = reinterpret_cast<unsigned char*>(der.getArray()); @@ -559,7 +554,7 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, PR_TRUE /* copyDER */); if (!certTmp) { - SAL_INFO("xmlsecurity.xmlsec", "Failed to add a temporary certificate: " << intermediateCerts[i]->getIssuerName()); + SAL_INFO("xmlsecurity.xmlsec", "Failed to add a temporary certificate: " << rIntermediateCert->getIssuerName()); } else diff --git a/xmlsecurity/source/xmlsec/saxhelper.cxx b/xmlsecurity/source/xmlsec/saxhelper.cxx index bf3c39127c44..d9e71226a7b8 100644 --- a/xmlsecurity/source/xmlsec/saxhelper.cxx +++ b/xmlsecurity/source/xmlsec/saxhelper.cxx @@ -76,10 +76,11 @@ static const xmlChar** attrlist_to_nxmlstr( const cssu::Sequence< cssxcsax::XMLA return nullptr ; } - for( int i = 0 , j = 0 ; j < nLength ; ++j ) + int i = 0; + for( const auto& rAttr : aAttributes ) { - attname = ous_to_xmlstr( aAttributes[j].sName ) ; - attvalue = ous_to_xmlstr( aAttributes[j].sValue ) ; + attname = ous_to_xmlstr( rAttr.sName ) ; + attvalue = ous_to_xmlstr( rAttr.sValue ) ; if( attname != nullptr && attvalue != nullptr ) { |