diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-10-11 10:36:26 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-10-11 15:49:19 +0200 |
commit | 99f89d40f7ca7e26f683a75f62a2cb7fe30459ad (patch) | |
tree | 4d41330f4a77c23119e292769070e8d94a413624 /stoc/source | |
parent | 4b4160cb1aab3ab1ff8eec6b2736bf459afed408 (diff) |
revert pessimization
revert part of
commit 113d9bba057b2fd634fcfcebb83a4d92cf41d69f
Author: Noel Grandin <noel.grandin@collabora.co.uk>
Date: Fri Sep 30 09:06:51 2022 +0200
use more string_view in stoc
<sberg> 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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc/source')
-rw-r--r-- | stoc/source/uriproc/UriReferenceFactory.cxx | 18 |
1 files 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 { |