diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-01-11 11:21:46 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-01-11 13:55:14 +0100 |
commit | 70519a43e0d89a6b5d89859a6851f8c757c6b0c7 (patch) | |
tree | bc1f4a6b6510e3bff75e9dc54eb71e2fa6cfc3c8 /stoc/source/uriproc | |
parent | a0210c5c5e8fd47b55567a8b18788d57d2b7decb (diff) |
Replace OUStringBuffer::appendCopy with append(std::u16string_view)
...which is more general
Change-Id: I94f28f8eda887120cf5f143b4549e0339b60e6a7
Reviewed-on: https://gerrit.libreoffice.org/66155
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'stoc/source/uriproc')
-rw-r--r-- | stoc/source/uriproc/ExternalUriReferenceTranslator.cxx | 8 | ||||
-rw-r--r-- | stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx | 7 |
2 files changed, 10 insertions, 5 deletions
diff --git a/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx b/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx index f1f102311c7e..c945c1a92c78 100644 --- a/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx +++ b/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/uno/Exception.hpp> #include <com/sun/star/uno/Reference.hxx> @@ -91,7 +95,7 @@ OUString Translator::translateToInternal( } sal_Int32 i = RTL_CONSTASCII_LENGTH("file:"); OUStringBuffer buf; - buf.appendCopy(externalUriReference, 0, i); + buf.append(std::u16string_view(externalUriReference).substr(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)) @@ -139,7 +143,7 @@ OUString Translator::translateToExternal( } sal_Int32 i = RTL_CONSTASCII_LENGTH("file://"); OUStringBuffer buf; - buf.appendCopy(internalUriReference, 0, i); + buf.append(std::u16string_view(internalUriReference).substr(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 af7b25c57264..7fdc07b922e7 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx @@ -40,6 +40,7 @@ #include <sal/types.h> #include <exception> +#include <string_view> namespace { @@ -284,7 +285,7 @@ void SAL_CALL UrlReference::setName(OUString const & name) OUStringBuffer newPath; newPath.append(encodeNameOrParamFragment(name)); - newPath.appendCopy(m_base.m_path, i); + newPath.append(std::u16string_view(m_base.m_path).substr(i)); m_base.m_path = newPath.makeStringAndClear(); } @@ -315,7 +316,7 @@ void UrlReference::setParameter(OUString const & key, OUString const & value) } OUStringBuffer newPath; - newPath.appendCopy(m_base.m_path, 0, i); + newPath.append(std::u16string_view(m_base.m_path).substr(0, i)); if (!bExistent) { newPath.append( m_base.m_path.indexOf('?') < 0 ? '?' : '&' ); newPath.append(encodeNameOrParamFragment(key)); @@ -325,7 +326,7 @@ void UrlReference::setParameter(OUString const & key, OUString const & value) if (bExistent) { /*oldValue = */ parsePart(m_base.m_path, false, &i); // skip key - newPath.appendCopy(m_base.m_path, i); + newPath.append(std::u16string_view(m_base.m_path).substr(i)); } m_base.m_path = newPath.makeStringAndClear(); |