comphelper/source/misc/xmlsechelper.cxx |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit df8dd90f143e650cff12e775f46a32eb3cf8806c
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Wed May 1 20:48:52 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu May 2 08:17:47 2024 +0200

    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.gran...@collabora.co.uk>

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())

Reply via email to