summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2024-05-01 20:48:52 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-05-02 08:17:47 +0200
commitdf8dd90f143e650cff12e775f46a32eb3cf8806c (patch)
treeb837be8731727af2350cfc821f6301459a50626d /comphelper
parenta3d758d528d3408fcccd7d3673439b5d68347e30 (diff)
elide some OUString creation in GetContentPart
Change-Id: I2a9a8e7713cb4efbc7bf3401cbbe31640098cb1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166980 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/xmlsechelper.cxx6
1 files changed, 2 insertions, 4 deletions
diff --git a/comphelper/source/misc/xmlsechelper.cxx b/comphelper/source/misc/xmlsechelper.cxx
index e1bb828ba631..2a0a4d2e3198 100644
--- a/comphelper/source/misc/xmlsechelper.cxx
+++ b/comphelper/source/misc/xmlsechelper.cxx
@@ -260,18 +260,16 @@ std::vector< std::pair< OUString, OUString> > parseDN(std::u16string_view rRawSt
OUString GetContentPart( const OUString& _rRawString, const css::security::CertificateKind &rKind )
{
- char const * aIDs[] = { "CN", "OU", "O", "E", nullptr };
+ static constexpr OUString aIDs[] { u"CN"_ustr, u"OU"_ustr, u"O"_ustr, u"E"_ustr };
// tdf#131733 Don't process OpenPGP certs, only X509
if (rKind == css::security::CertificateKind_OPENPGP )
return _rRawString;
OUString retVal;
- int i = 0;
std::vector< std::pair< OUString, OUString > > vecAttrValueOfDN = parseDN(_rRawString);
- while ( aIDs[i] )
+ for ( const auto & sPartId : aIDs )
{
- OUString sPartId = OUString::createFromAscii( aIDs[i++] );
auto idn = std::find_if(vecAttrValueOfDN.cbegin(), vecAttrValueOfDN.cend(),
[&sPartId](const std::pair< OUString, OUString >& dn) { return dn.first == sPartId; });
if (idn != vecAttrValueOfDN.cend())