summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-08-14 11:14:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-08-16 09:04:51 +0200
commit7d7a7862a7dccb6764f80258f28685a0da3cbbcb (patch)
treeb7281950f84b12c4868542f103a23c1460d22863 /xmlsecurity
parentabeab40aeb2bf16c1438b5e5f0cd70b3e11f6b7a (diff)
new loplugin:sequenceloop
look for places we should be using std::as_const on for-range loops over uno::Sequence, to avoid triggering a copy Change-Id: I7efb641bf09d37c87946f03428ee4eec90298c8a Reviewed-on: https://gerrit.libreoffice.org/77441 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/qa/unit/signing/signing.cxx2
-rw-r--r--xmlsecurity/source/dialogs/certificatechooser.cxx2
-rw-r--r--xmlsecurity/source/dialogs/macrosecurity.cxx2
-rw-r--r--xmlsecurity/source/helper/documentsignaturehelper.cxx4
-rw-r--r--xmlsecurity/source/helper/documentsignaturemanager.cxx4
-rw-r--r--xmlsecurity/source/helper/ooxmlsecexporter.cxx2
-rw-r--r--xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx3
7 files changed, 10 insertions, 9 deletions
diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx
index da2019c26eba..deb8cf2f2032 100644
--- a/xmlsecurity/qa/unit/signing/signing.cxx
+++ b/xmlsecurity/qa/unit/signing/signing.cxx
@@ -190,7 +190,7 @@ SigningTest::getCertificate(DocumentSignatureManager& rSignatureManager,
{
uno::Reference<xml::crypto::XSecurityEnvironment> xSecurityEnvironment
= rSignatureManager.getSecurityEnvironment();
- uno::Sequence<uno::Reference<security::XCertificate>> aCertificates
+ const uno::Sequence<uno::Reference<security::XCertificate>> aCertificates
= xSecurityEnvironment->getPersonalCertificates();
for (const auto& xCertificate : aCertificates)
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx
index ec499bc159b0..32c688f2a257 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -198,7 +198,7 @@ void CertificateChooser::ImplInitialize()
// fill list of certificates; the first entry will be selected
- for ( const auto& xCert : xCerts )
+ for ( const auto& xCert : std::as_const(xCerts) )
{
std::shared_ptr<UserData> userData = std::make_shared<UserData>();
userData->xCertificate = xCert;
diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx
index 04f8f0f9dd86..4e0dcc76e2fb 100644
--- a/xmlsecurity/source/dialogs/macrosecurity.cxx
+++ b/xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -357,7 +357,7 @@ MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP(weld::Container* pP
FillCertLB();
- css::uno::Sequence< OUString > aSecureURLs = m_pDlg->m_aSecOptions.GetSecureURLs();
+ const css::uno::Sequence< OUString > aSecureURLs = m_pDlg->m_aSecOptions.GetSecureURLs();
mbURLsReadonly = m_pDlg->m_aSecOptions.IsReadOnly( SvtSecurityOptions::EOption::SecureUrls );
m_xTrustFileROFI->set_visible(mbURLsReadonly);
m_xTrustFileLocLB->set_sensitive(!mbURLsReadonly);
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index ee5fb4989ec1..c097b14a2180 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -86,7 +86,7 @@ static void ImplFillElementList(
const OUString& rRootStorageName, const bool bRecursive,
const DocumentSignatureAlgorithm mode)
{
- Sequence< OUString > aElements = rxStore->getElementNames();
+ const Sequence< OUString > aElements = rxStore->getElementNames();
for ( const auto& rName : aElements )
{
@@ -213,7 +213,7 @@ DocumentSignatureHelper::CreateElementList(
xSubStore.clear();
// Object folders...
- Sequence< OUString > aElementNames = rxStore->getElementNames();
+ const Sequence< OUString > aElementNames = rxStore->getElementNames();
for ( const auto& rName : aElementNames )
{
if ( ( rName.match( "Object " ) ) && rxStore->isStorageElement( rName ) )
diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx
index 557557f6bae8..19cdc2fb4d1d 100644
--- a/xmlsecurity/source/helper/documentsignaturemanager.cxx
+++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx
@@ -177,7 +177,7 @@ bool DocumentSignatureManager::isXML(const OUString& rURI)
if (readManifest())
{
- for (const uno::Sequence<beans::PropertyValue>& entry : m_manifest)
+ for (const uno::Sequence<beans::PropertyValue>& entry : std::as_const(m_manifest))
{
OUString sPath;
OUString sMediaType;
@@ -393,7 +393,7 @@ bool DocumentSignatureManager::add(
eAlgorithmID);
}
- uno::Sequence<uno::Reference<security::XCertificate>> aCertPath
+ const uno::Sequence<uno::Reference<security::XCertificate>> aCertPath
= xSecurityContext->getSecurityEnvironment()->buildCertificatePath(xCert);
OUStringBuffer aStrBuffer;
diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
index 062c76d5c47b..cf87d6e1ad17 100644
--- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
@@ -242,7 +242,7 @@ void OOXMLSecExporter::Impl::writeRelationshipTransform(const OUString& rURI)
m_xDocumentHandler->startElement("Transform", uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
}
- uno::Sequence< uno::Sequence<beans::StringPair> > aRelationsInfo = comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(xRelStream, rURI, m_xComponentContext);
+ const uno::Sequence< uno::Sequence<beans::StringPair> > aRelationsInfo = comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(xRelStream, rURI, m_xComponentContext);
for (const uno::Sequence<beans::StringPair>& rPairs : aRelationsInfo)
{
OUString aId;
diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
index 19818823980b..f3a76c76e099 100644
--- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
@@ -288,7 +288,8 @@ OUString SAL_CALL XMLSignature_NssImpl::getImplementationName()
/* XServiceInfo */
sal_Bool SAL_CALL XMLSignature_NssImpl::supportsService(const OUString& rServiceName)
{
- for (OUString const & rCurrentServiceName : getSupportedServiceNames())
+ const css::uno::Sequence<OUString> aServiceNames = getSupportedServiceNames();
+ for (OUString const & rCurrentServiceName : aServiceNames)
{
if (rCurrentServiceName == rServiceName)
return true;