diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-01-28 12:38:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-28 17:32:18 +0100 |
commit | 943060836339f9640c612e9724f20e79db616e6e (patch) | |
tree | 3dc6e7748aef3ef0f2fca86979792162daa443fc /stoc | |
parent | d249bd5a3dfe13052ce9aa91bad94ec7d60604d4 (diff) |
simplify code, use more subView()
Change-Id: I569c7f34acbdf8451cd5c9acf1abd334637072d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110051
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/uriproc/ExternalUriReferenceTranslator.cxx | 4 | ||||
-rw-r--r-- | stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx | 8 |
2 files changed, 5 insertions, 7 deletions
diff --git a/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx b/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx index 9e21c5aef79f..1d93202f9c48 100644 --- a/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx +++ b/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx @@ -93,7 +93,7 @@ OUString Translator::translateToInternal( } sal_Int32 i = RTL_CONSTASCII_LENGTH("file:"); OUStringBuffer buf(128); - buf.append(std::u16string_view(externalUriReference).substr(0, i)); + buf.append(externalUriReference.subView(0, i)); // Some environments (e.g., Java) produce illegal file URLs without an // authority part; treat them as having an empty authority part: if (!externalUriReference.match("//", i)) @@ -141,7 +141,7 @@ OUString Translator::translateToExternal( } sal_Int32 i = RTL_CONSTASCII_LENGTH("file://"); OUStringBuffer buf(128); - buf.append(std::u16string_view(internalUriReference).substr(0, i)); + buf.append(internalUriReference.subView(0, i)); rtl_TextEncoding encoding = osl_getThreadTextEncoding(); for (bool path = true;;) { sal_Int32 j = i; diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx index 958e728d76cf..d5cfb2347863 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx @@ -282,9 +282,7 @@ void SAL_CALL UrlReference::setName(OUString const & name) sal_Int32 i = 0; parsePart(m_base.m_path, true, &i); - auto tmp = std::u16string_view(m_base.m_path).substr(i); - m_base.m_path = encodeNameOrParamFragment(name) + - std::u16string_view(tmp.data(), tmp.length()); + m_base.m_path = encodeNameOrParamFragment(name) + m_base.m_path.subView(i); } sal_Bool UrlReference::hasParameter(OUString const & key) @@ -314,7 +312,7 @@ void UrlReference::setParameter(OUString const & key, OUString const & value) } OUStringBuffer newPath(128); - newPath.append(std::u16string_view(m_base.m_path).substr(0, i)); + newPath.append(m_base.m_path.subView(0, i)); if (!bExistent) { newPath.append( m_base.m_path.indexOf('?') < 0 ? '?' : '&' ); newPath.append(encodeNameOrParamFragment(key)); @@ -324,7 +322,7 @@ void UrlReference::setParameter(OUString const & key, OUString const & value) if (bExistent) { /*oldValue = */ parsePart(m_base.m_path, false, &i); // skip key - newPath.append(std::u16string_view(m_base.m_path).substr(i)); + newPath.append(m_base.m_path.subView(i)); } m_base.m_path = newPath.makeStringAndClear(); |