summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx19
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_export.cxx5
-rw-r--r--xmlscript/source/xmlflat_imexp/xmlbas_export.cxx39
-rw-r--r--xmlscript/source/xmllib_imexp/xmllib_export.cxx19
-rw-r--r--xmlsecurity/source/component/documentdigitalsignatures.cxx19
-rw-r--r--xmlsecurity/source/dialogs/certificatechooser.cxx16
-rw-r--r--xmlsecurity/source/dialogs/macrosecurity.cxx5
-rw-r--r--xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx8
-rw-r--r--xmlsecurity/source/helper/documentsignaturehelper.cxx30
-rw-r--r--xmlsecurity/source/helper/documentsignaturemanager.cxx7
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx13
-rw-r--r--xmlsecurity/source/xmlsec/saxhelper.cxx7
12 files changed, 72 insertions, 115 deletions
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
index 186dc6923f61..cf0a13e39235 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -318,11 +318,10 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
{
ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument );
- OUString const * pItemValues = itemValues.getConstArray();
- for ( sal_Int32 nPos = 0; nPos < itemValues.getLength(); ++nPos )
+ for ( const auto& rItemValue : itemValues )
{
ElementDescriptor * item = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument );
- item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", pItemValues[ nPos ] );
+ item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", rItemValue );
popup->addSubElement( item );
}
@@ -366,12 +365,10 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
{
ElementDescriptor * popup = new ElementDescriptor( _xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menupopup", _xDocument );
- OUString const * pItemValues = itemValues.getConstArray();
- sal_Int32 nPos;
- for ( nPos = 0; nPos < itemValues.getLength(); ++nPos )
+ for ( const auto& rItemValue : itemValues )
{
ElementDescriptor * item = new ElementDescriptor(_xProps, _xPropState, XMLNS_DIALOGS_PREFIX ":menuitem", _xDocument );
- item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", pItemValues[ nPos ] );
+ item->addAttribute( XMLNS_DIALOGS_PREFIX ":value", rItemValue );
popup->addSubElement( item );
}
@@ -379,7 +376,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
if (readProp( "SelectedItems" ) >>= selected)
{
sal_Int16 const * pSelected = selected.getConstArray();
- for ( nPos = selected.getLength(); nPos--; )
+ for ( sal_Int32 nPos = selected.getLength(); nPos--; )
{
ElementDescriptor * item = static_cast< ElementDescriptor * >(
popup->getSubElement( pSelected[ nPos ] ).get() );
@@ -1090,14 +1087,12 @@ void ElementDescriptor::readBullitinBoard( StyleBag * all_styles )
if ( !xDialogModel.is() )
return; // #TODO throw???
Sequence< OUString > aElements( xDialogModel->getElementNames() );
- OUString const * pElements = aElements.getConstArray();
ElementDescriptor * pRadioGroup = nullptr;
- sal_Int32 nPos;
- for ( nPos = 0; nPos < aElements.getLength(); ++nPos )
+ for ( const auto& rElement : aElements )
{
- Any aControlModel( xDialogModel->getByName( pElements[ nPos ] ) );
+ Any aControlModel( xDialogModel->getByName( rElement ) );
Reference< beans::XPropertySet > xProps;
OSL_VERIFY( aControlModel >>= xProps );
if (! xProps.is())
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index 9341952eef35..eca2feb26fa0 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -1152,11 +1152,10 @@ void ElementDescriptor::readEvents()
if (xEvents.is())
{
Sequence< OUString > aNames( xEvents->getElementNames() );
- OUString const * pNames = aNames.getConstArray();
- for ( sal_Int32 nPos = 0; nPos < aNames.getLength(); ++nPos )
+ for ( const auto& rName : aNames )
{
script::ScriptEventDescriptor descr;
- if (xEvents->getByName( pNames[ nPos ] ) >>= descr)
+ if (xEvents->getByName( rName ) >>= descr)
{
SAL_WARN_IF( descr.ListenerType.isEmpty() ||
descr.EventMethod.isEmpty() ||
diff --git a/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx b/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx
index 872f47a7e2df..74db5079a8cc 100644
--- a/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx
+++ b/xmlscript/source/xmlflat_imexp/xmlbas_export.cxx
@@ -153,17 +153,13 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /
if ( xLibContainer.is() )
{
Sequence< OUString > aLibNames = xLibContainer->getElementNames();
- sal_Int32 nLibCount = aLibNames.getLength();
- const OUString* pLibNames = aLibNames.getConstArray();
- for ( sal_Int32 i = 0 ; i < nLibCount ; ++i )
+ for ( const OUString& rLibName : aLibNames )
{
- OUString aLibName( pLibNames[i] );
-
- if ( xLibContainer->hasByName( aLibName ) )
+ if ( xLibContainer->hasByName( rLibName ) )
{
OUString aTrueStr( "true" );
- if ( xLibContainer->isLibraryLink( aLibName ) )
+ if ( xLibContainer->isLibraryLink( rLibName ) )
{
// ooo/script:library-linked element
OUString aLibElementName( aPrefix );
@@ -173,9 +169,9 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /
xLibAttribs = static_cast< xml::sax::XAttributeList* >( pLibElement );
// ooo/script:name attribute
- pLibElement->addAttribute( aPrefix + ":name", aLibName );
+ pLibElement->addAttribute( aPrefix + ":name", rLibName );
- OUString aLinkURL( xLibContainer->getLibraryLinkURL( aLibName ) );
+ OUString aLinkURL( xLibContainer->getLibraryLinkURL( rLibName ) );
if ( !aLinkURL.isEmpty() )
{
// xlink:href attribute
@@ -185,7 +181,7 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /
pLibElement->addAttribute( XMLNS_XLINK_PREFIX ":type", "simple" );
}
- if ( xLibContainer->isLibraryReadOnly( aLibName ) )
+ if ( xLibContainer->isLibraryReadOnly( rLibName ) )
{
// ooo/script:readonly attribute
pLibElement->addAttribute( aPrefix + ":readonly", aTrueStr );
@@ -209,9 +205,9 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /
xLibAttribs = static_cast< xml::sax::XAttributeList* >( pLibElement );
// ooo/script:name attribute
- pLibElement->addAttribute( aPrefix + ":name", aLibName );
+ pLibElement->addAttribute( aPrefix + ":name", rLibName );
- if ( xLibContainer->isLibraryReadOnly( aLibName ) )
+ if ( xLibContainer->isLibraryReadOnly( rLibName ) )
{
// ooo/script:readonly attribute
pLibElement->addAttribute( aPrefix + ":readonly", aTrueStr );
@@ -219,28 +215,25 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /
// TODO: password protected libraries
Reference< script::XLibraryContainerPassword > xPasswd( xLibContainer, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) )
+ if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( rLibName ) )
continue;
// <ooo/script:library-embedded...
m_xHandler->ignorableWhitespace( OUString() );
m_xHandler->startElement( aLibElementName, xLibAttribs );
- if ( !xLibContainer->isLibraryLoaded( aLibName ) )
- xLibContainer->loadLibrary( aLibName );
+ if ( !xLibContainer->isLibraryLoaded( rLibName ) )
+ xLibContainer->loadLibrary( rLibName );
Reference< container::XNameContainer > xLib;
- xLibContainer->getByName( aLibName ) >>= xLib;
+ xLibContainer->getByName( rLibName ) >>= xLib;
if ( xLib.is() )
{
Sequence< OUString > aModNames = xLib->getElementNames();
- sal_Int32 nModCount = aModNames.getLength();
- const OUString* pModNames = aModNames.getConstArray();
- for ( sal_Int32 j = 0 ; j < nModCount ; ++j )
+ for ( const OUString& rModName : aModNames )
{
- OUString aModName( pModNames[j] );
- if ( xLib->hasByName( aModName ) )
+ if ( xLib->hasByName( rModName ) )
{
// ooo/script:module element
OUString aModElementName( aPrefix );
@@ -250,7 +243,7 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /
xModAttribs = static_cast< xml::sax::XAttributeList* >( pModElement );
// ooo/script:name attribute
- pModElement->addAttribute( aPrefix + ":name", aModName );
+ pModElement->addAttribute( aPrefix + ":name", rModName );
// <ooo/script:module...
m_xHandler->ignorableWhitespace( OUString() );
@@ -270,7 +263,7 @@ sal_Bool XMLBasicExporterBase::filter( const Sequence< beans::PropertyValue >& /
// module data
// TODO: write encrypted data for password protected libraries
OUString aSource;
- xLib->getByName( aModName ) >>= aSource;
+ xLib->getByName( rModName ) >>= aSource;
m_xHandler->characters( aSource );
// TODO: <ooo/script:byte-code>
diff --git a/xmlscript/source/xmllib_imexp/xmllib_export.cxx b/xmlscript/source/xmllib_imexp/xmllib_export.cxx
index 270377fbc759..5353c1c245ec 100644
--- a/xmlscript/source/xmllib_imexp/xmllib_export.cxx
+++ b/xmlscript/source/xmllib_imexp/xmllib_export.cxx
@@ -118,21 +118,16 @@ exportLibrary(
if( rLib.bPreload )
pLibElement->addAttribute( XMLNS_LIBRARY_PREFIX ":preload", sTrueStr );
- sal_Int32 nElementCount = rLib.aElementNames.getLength();
- if( nElementCount )
+ for( const auto& rElementName : rLib.aElementNames )
{
- const OUString* pElementNames = rLib.aElementNames.getConstArray();
- for( sal_Int32 i = 0 ; i < nElementCount ; i++ )
- {
- XMLElement* pElement = new XMLElement( XMLNS_LIBRARY_PREFIX ":element" );
- Reference< xml::sax::XAttributeList > xElementAttribs;
- xElementAttribs = static_cast< xml::sax::XAttributeList* >( pElement );
+ XMLElement* pElement = new XMLElement( XMLNS_LIBRARY_PREFIX ":element" );
+ Reference< xml::sax::XAttributeList > xElementAttribs;
+ xElementAttribs = static_cast< xml::sax::XAttributeList* >( pElement );
- pElement->addAttribute( XMLNS_LIBRARY_PREFIX ":name",
- pElementNames[i] );
+ pElement->addAttribute( XMLNS_LIBRARY_PREFIX ":name",
+ rElementName );
- pLibElement->addSubElement( pElement );
- }
+ pLibElement->addSubElement( pElement );
}
pLibElement->dump( xOut.get() );
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>>
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx
index bb6905acedb8..68bd9efbb497 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -198,23 +198,23 @@ void CertificateChooser::ImplInitialize()
// fill list of certificates; the first entry will be selected
- for ( sal_Int32 nC = 0; nC < nCertificates; ++nC )
+ for ( const auto& xCert : xCerts )
{
std::shared_ptr<UserData> userData = std::make_shared<UserData>();
- userData->xCertificate = xCerts[ nC ];
+ userData->xCertificate = xCert;
userData->xSecurityContext = secContext;
userData->xSecurityEnvironment = secEnvironment;
mvUserData.push_back(userData);
- OUString sIssuer = xmlsec::GetContentPart( xCerts[ nC ]->getIssuerName() );
+ OUString sIssuer = xmlsec::GetContentPart( xCert->getIssuerName() );
m_xCertLB->append();
int nRow = m_xCertLB->n_children() - 1;
- m_xCertLB->set_text(nRow, xmlsec::GetContentPart(xCerts[nC]->getSubjectName()), 0);
+ m_xCertLB->set_text(nRow, xmlsec::GetContentPart(xCert->getSubjectName()), 0);
m_xCertLB->set_text(nRow, sIssuer, 1);
- m_xCertLB->set_text(nRow, xmlsec::GetCertificateKind(xCerts[nC]->getCertificateKind()), 2);
- m_xCertLB->set_text(nRow, utl::GetDateString(xCerts[nC]->getNotValidAfter()), 3);
- m_xCertLB->set_text(nRow, UsageInClearText(xCerts[nC]->getCertificateUsage()), 4);
+ m_xCertLB->set_text(nRow, xmlsec::GetCertificateKind(xCert->getCertificateKind()), 2);
+ m_xCertLB->set_text(nRow, utl::GetDateString(xCert->getNotValidAfter()), 3);
+ m_xCertLB->set_text(nRow, UsageInClearText(xCert->getCertificateUsage()), 4);
OUString sId(OUString::number(reinterpret_cast<sal_Int64>(userData.get())));
m_xCertLB->set_id(nRow, sId);
@@ -226,7 +226,7 @@ void CertificateChooser::ImplInitialize()
m_xCertLB->select(nRow);
else if ( meAction == UserAction::Encrypt &&
aUserOpts.GetEncryptToSelf() )
- mxEncryptToSelf = xCerts[nC];
+ mxEncryptToSelf = xCert;
}
#endif
}
diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx
index 59e62442909f..206781851b78 100644
--- a/xmlsecurity/source/dialogs/macrosecurity.cxx
+++ b/xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -363,10 +363,9 @@ MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP(weld::Container* pP
m_xTrustFileLocLB->set_sensitive(!mbURLsReadonly);
m_xAddLocPB->set_sensitive(!mbURLsReadonly);
- sal_Int32 nEntryCnt = aSecureURLs.getLength();
- for (sal_Int32 i = 0; i < nEntryCnt; ++i)
+ for (const auto& rSecureURL : aSecureURLs)
{
- OUString aSystemFileURL( aSecureURLs[ i ] );
+ OUString aSystemFileURL( rSecureURL );
osl::FileBase::getSystemPathFromFileURL( aSystemFileURL, aSystemFileURL );
m_xTrustFileLocLB->append_text(aSystemFileURL);
}
diff --git a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
index c83c7751e794..869f1bf26371 100644
--- a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
+++ b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>
#include <rtl/ustring.hxx>
#include <framework/xmlsignaturetemplateimpl.hxx>
+#include <comphelper/sequence.hxx>
using namespace ::com::sun::star::uno ;
using ::com::sun::star::lang::XMultiServiceFactory ;
@@ -97,12 +98,7 @@ OUString SAL_CALL XMLSignatureTemplateImpl::getImplementationName() {
/* XServiceInfo */
sal_Bool SAL_CALL XMLSignatureTemplateImpl::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 */
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index f1929f927758..66a058c1d3dd 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -87,42 +87,40 @@ static void ImplFillElementList(
{
Reference < css::container::XNameAccess > xElements( rxStore, UNO_QUERY );
Sequence< OUString > aElements = xElements->getElementNames();
- sal_Int32 nElements = aElements.getLength();
- const OUString* pNames = aElements.getConstArray();
- for ( sal_Int32 n = 0; n < nElements; n++ )
+ for ( const auto& rName : aElements )
{
- if (pNames[n] == "[Content_Types].xml")
+ if (rName == "[Content_Types].xml")
// OOXML
continue;
// If the user enabled validating according to OOo 3.0
// then mimetype and all content of META-INF must be excluded.
if (mode != DocumentSignatureAlgorithm::OOo3_2
- && (pNames[n] == "META-INF" || pNames[n] == "mimetype"))
+ && (rName == "META-INF" || rName == "mimetype"))
{
continue;
}
else
{
OUString sEncName = ::rtl::Uri::encode(
- pNames[n], rtl_UriCharClassRelSegment,
+ rName, rtl_UriCharClassRelSegment,
rtl_UriEncodeStrict, RTL_TEXTENCODING_UTF8);
- if (sEncName.isEmpty() && !pNames[n].isEmpty())
+ if (sEncName.isEmpty() && !rName.isEmpty())
throw css::uno::RuntimeException("Failed to encode element name of XStorage", nullptr);
- if ( rxStore->isStreamElement( pNames[n] ) )
+ if ( rxStore->isStreamElement( rName ) )
{
//Exclude documentsignatures.xml!
- if (pNames[n] ==
+ if (rName ==
DocumentSignatureHelper::GetDocumentContentSignatureDefaultStreamName())
continue;
OUString aFullName( rRootStorageName + sEncName );
rList.push_back(aFullName);
}
- else if ( bRecursive && rxStore->isStorageElement( pNames[n] ) )
+ else if ( bRecursive && rxStore->isStorageElement( rName ) )
{
- Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( pNames[n], css::embed::ElementModes::READ );
+ Reference < css::embed::XStorage > xSubStore = rxStore->openStorageElement( rName, css::embed::ElementModes::READ );
OUString aFullRootName( rRootStorageName + sEncName + "/" );
ImplFillElementList(rList, xSubStore, aFullRootName, bRecursive, mode);
}
@@ -217,14 +215,12 @@ DocumentSignatureHelper::CreateElementList(
// Object folders...
Reference < css::container::XNameAccess > xElements( rxStore, UNO_QUERY );
Sequence< OUString > aElementNames = xElements->getElementNames();
- sal_Int32 nElements = aElementNames.getLength();
- const OUString* pNames = aElementNames.getConstArray();
- for ( sal_Int32 n = 0; n < nElements; n++ )
+ for ( const auto& rName : aElementNames )
{
- if ( ( pNames[n].match( "Object " ) ) && rxStore->isStorageElement( pNames[n] ) )
+ if ( ( rName.match( "Object " ) ) && rxStore->isStorageElement( rName ) )
{
- Reference < css::embed::XStorage > xTmpSubStore = rxStore->openStorageElement( pNames[n], css::embed::ElementModes::READ );
- ImplFillElementList(aElements, xTmpSubStore, pNames[n]+aSep, true, mode);
+ Reference < css::embed::XStorage > xTmpSubStore = rxStore->openStorageElement( rName, css::embed::ElementModes::READ );
+ ImplFillElementList(aElements, xTmpSubStore, rName+aSep, true, mode);
}
}
}
diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx
index 9cd197e786ae..305a98fb884d 100644
--- a/xmlsecurity/source/helper/documentsignaturemanager.cxx
+++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx
@@ -181,15 +181,12 @@ bool DocumentSignatureManager::isXML(const OUString& rURI)
if (readManifest())
{
- for (int i = 0; i < m_manifest.getLength(); i++)
+ for (const uno::Sequence<beans::PropertyValue>& entry : m_manifest)
{
- const uno::Sequence<beans::PropertyValue>& entry = m_manifest[i];
OUString sPath, sMediaType;
bool bEncrypted = false;
- for (int j = 0; j < entry.getLength(); j++)
+ for (const beans::PropertyValue& prop : entry)
{
- const beans::PropertyValue& prop = entry[j];
-
if (prop.Name == sPropFullPath)
prop.Value >>= sPath;
else if (prop.Name == sPropMediaType)
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 )
{