From 99f89d40f7ca7e26f683a75f62a2cb7fe30459ad Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 11 Oct 2022 10:36:26 +0200 Subject: [PATCH] revert pessimization revert part of commit 113d9bba057b2fd634fcfcebb83a4d92cf41d69f Author: Noel Grandin Date: Fri Sep 30 09:06:51 2022 +0200 use more string_view in stoc This is another case of a potential pessimization, for no gain: The passed in schemeSpecificPart will always be an OUString, and path may be a view of its full content (if there is neither authority nor query part). Change-Id: Ibc60fb1f5f351668ef924e25ee3aeb1d80f6f710 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141205 Tested-by: Jenkins Reviewed-by: Noel Grandin --- stoc/source/uriproc/UriReferenceFactory.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx index aa6da45197de..ed739cdc32cf 100644 --- a/stoc/source/uriproc/UriReferenceFactory.cxx +++ b/stoc/source/uriproc/UriReferenceFactory.cxx @@ -167,10 +167,10 @@ private: }; css::uno::Reference< css::uri::XUriReference > parseGeneric( - OUString const & scheme, std::u16string_view schemeSpecificPart) + OUString const & scheme, OUString const & schemeSpecificPart) { - size_t len = schemeSpecificPart.size(); - size_t i = 0; + sal_Int32 len = schemeSpecificPart.getLength(); + sal_Int32 i = 0; bool hasAuthority = false; OUString authority; if (len - i >= 2 && schemeSpecificPart[i] == '/' @@ -183,22 +183,22 @@ css::uno::Reference< css::uri::XUriReference > parseGeneric( ++i; } hasAuthority = true; - authority = schemeSpecificPart.substr(n, i - n); + authority = schemeSpecificPart.copy(n, i - n); } sal_Int32 n = i; - i = schemeSpecificPart.find('?', i); - if (i == std::u16string_view::npos) { + i = schemeSpecificPart.indexOf('?', i); + if (i == -1) { i = len; } - std::u16string_view path = schemeSpecificPart.substr(n, i - n); + OUString path = schemeSpecificPart.copy(n, i - n); bool hasQuery = false; OUString query; if (i != len) { hasQuery = true; - query = schemeSpecificPart.substr(i + 1); + query = schemeSpecificPart.copy(i + 1); } return new UriReference( - scheme, hasAuthority, authority, OUString(path), hasQuery, query); + scheme, hasAuthority, authority, path, hasQuery, query); } struct Segment {