tdf#147201 Use std::size() instead of SAL_N_ELEMENTS() macro
Change-Id: I38fa927d9964b7212b84d42d5b1bc5f60386139c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141484
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index e51b84c..a9e58a3 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -104,10 +104,10 @@ static void traceTrustStatus(DWORD err)
{
if (err == 0)
SAL_INFO("xmlsecurity.xmlsec", " " << arErrStrings[0].name);
for (std::size_t i = 1; i < SAL_N_ELEMENTS(arErrStrings); i++)
for (auto const & arErrStringIter : arErrStrings)
{
if (arErrStrings[i].error & err)
SAL_INFO("xmlsecurity.xmlsec", " " << arErrStrings[i].name);
if (arErrStringIter.error & err)
SAL_INFO("xmlsecurity.xmlsec", " " << arErrStringIter.name);
}
}
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
index e26f72c..71bff4d 100644
--- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -224,13 +224,13 @@ const OUString & ONSSInitializer::getMozillaCurrentProfile(const css::uno::Refer
if (xMozillaBootstrap.is())
{
for (std::size_t i=0; i<SAL_N_ELEMENTS(productTypes); ++i)
for (auto const productTypeIter : productTypes)
{
OUString profile = xMozillaBootstrap->getDefaultProfile(productTypes[i]);
OUString profile = xMozillaBootstrap->getDefaultProfile(productTypeIter);
if (!profile.isEmpty())
{
OUString sProfilePath = xMozillaBootstrap->getProfilePath(productTypes[i], profile);
OUString sProfilePath = xMozillaBootstrap->getProfilePath(productTypeIter, profile);
if (m_sNSSPath.isEmpty())
{
SAL_INFO("xmlsecurity.xmlsec", "Using Mozilla profile " << sProfilePath);
@@ -264,12 +264,12 @@ css::uno::Sequence<css::xml::crypto::NSSProfile> SAL_CALL ONSSInitializer::getNS
if (xMozillaBootstrap.is())
{
for (std::size_t i=0; i<SAL_N_ELEMENTS(productTypes); ++i)
for (auto const productTypeIter : productTypes)
{
uno::Sequence<OUString> aProductProfileList;
xMozillaBootstrap->getProfileList(productTypes[i], aProductProfileList);
xMozillaBootstrap->getProfileList(productTypeIter, aProductProfileList);
for (const auto& sProfile : std::as_const(aProductProfileList))
aProfileList.push_back({sProfile, xMozillaBootstrap->getProfilePath(productTypes[i], sProfile), productTypes[i]});
aProfileList.push_back({sProfile, xMozillaBootstrap->getProfilePath(productTypeIter, sProfile), productTypeIter});
}
}
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 990ea86..8872dd9 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -641,7 +641,7 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert,
arUsages[3] = UsageDescription( certificateUsageEmailSigner, "certificateUsageEmailSigner" );
arUsages[4] = UsageDescription( certificateUsageEmailRecipient, "certificateUsageEmailRecipient" );
int numUsages = SAL_N_ELEMENTS(arUsages);
int numUsages = std::size(arUsages);
for (int i = 0; i < numUsages; i++)
{
SAL_INFO("xmlsecurity.xmlsec", "Testing usage " << i+1 <<