summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-07-07 13:05:57 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-07-07 15:21:33 +0200
commitadf419792743a4c79b2054e42618dff75bb552ce (patch)
tree18869048ab4255831c5846709ebd522e0bd64ca3 /xmlsecurity
parent23f80b26098bcf9a8ae870e8ded878cca6e0c541 (diff)
elide some string copies
Change-Id: I3e0d9f7e5a446689e007b9d01fb1c6bf9bc068e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136880 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx7
-rw-r--r--xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx4
-rw-r--r--xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx5
3 files changed, 9 insertions, 7 deletions
diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index 5e0ca9094b19..88bf6169bf11 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -37,6 +37,7 @@
#include <osl/nlsupport.h>
#include <osl/process.h>
#include <o3tl/char16_t2wchar_t.hxx>
+#include <o3tl/string_view.hxx>
#include <memory>
#include <string_view>
@@ -77,9 +78,9 @@ findTypeInDN(const OUString& rRawString, std::u16string_view sTypeName)
{
if (! bInValue)
{
- OUString sType = rRawString.copy(nTypeNameStart, i - nTypeNameStart);
- sType = sType.trim();
- if (sType.equalsIgnoreAsciiCase(sTypeName))
+ std::u16string_view sType = rRawString.subView(nTypeNameStart, i - nTypeNameStart);
+ sType = o3tl::trim(sType);
+ if (o3tl::equalsIgnoreAsciiCase(sType, sTypeName))
{
bFound = true;
break;
diff --git a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
index e37a5473ceb8..1395cb2e8acb 100644
--- a/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx
@@ -152,9 +152,9 @@ css::uno::Sequence< css::security::CertAltNameEntry > SAL_CALL SanExtensionImpl:
OString SanExtensionImpl::removeOIDFromString( const OString &oidString)
{
OString objID;
- OString oid("OID.");
+ constexpr std::string_view oid("OID.");
if (oidString.match(oid))
- objID = oidString.copy(oid.getLength());
+ objID = oidString.copy(oid.size());
else
objID = oidString;
return objID;
diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
index 7e28cbc615bd..e1b62e13c0f5 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
@@ -36,6 +36,7 @@
#include <certificateextension_xmlsecimpl.hxx>
#include "sanextension_nssimpl.hxx"
+#include <o3tl/string_view.hxx>
#include <tools/time.hxx>
#include <svl/sigstruct.hxx>
@@ -185,9 +186,9 @@ css::uno::Sequence< css::uno::Reference< css::security::XCertificateExtension >
// remove "OID." prefix if existing
OString objID;
- OString oid("OID.");
+ constexpr std::string_view oid("OID.");
if (oidString.match(oid))
- objID = oidString.copy(oid.getLength());
+ objID = oidString.copy(oid.size());
else
objID = oidString;