diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-07 10:34:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-14 08:35:00 +0200 |
commit | cd66852f6dd08631a25d15a1527a647e69ab8ce3 (patch) | |
tree | 0ac1fab1d063046376e31e21d6656ee05eebb627 /stoc/source | |
parent | 095e1ca4372d90da7fc56051f1271ddd975a9e3a (diff) |
create appendCopy method in OUStringBuffer
so we can avoid temporary copies when appending a substring of an
OUString to the buffer. I would have preferred to call the method just
"append" but that results in ambiguous method errors when the callsite
is something like
sal_Int32 n;
OUStringBuffer s;
s.append(n, 10);
I'm not sure why
Change-Id: I6b5b6641fcb5b26ce2269f89ef06e03c0b6aa76f
Reviewed-on: https://gerrit.libreoffice.org/58666
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc/source')
-rw-r--r-- | stoc/source/uriproc/ExternalUriReferenceTranslator.cxx | 4 | ||||
-rw-r--r-- | stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx b/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx index 333a28aad663..f1f102311c7e 100644 --- a/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx +++ b/stoc/source/uriproc/ExternalUriReferenceTranslator.cxx @@ -91,7 +91,7 @@ OUString Translator::translateToInternal( } sal_Int32 i = RTL_CONSTASCII_LENGTH("file:"); OUStringBuffer buf; - buf.append(externalUriReference.getStr(), i); + buf.appendCopy(externalUriReference, 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 +139,7 @@ OUString Translator::translateToExternal( } sal_Int32 i = RTL_CONSTASCII_LENGTH("file://"); OUStringBuffer buf; - buf.append(internalUriReference.getStr(), i); + buf.appendCopy(internalUriReference, 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 5280e54164be..af7b25c57264 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx @@ -284,7 +284,7 @@ void SAL_CALL UrlReference::setName(OUString const & name) OUStringBuffer newPath; newPath.append(encodeNameOrParamFragment(name)); - newPath.append(m_base.m_path.copy(i)); + newPath.appendCopy(m_base.m_path, i); m_base.m_path = newPath.makeStringAndClear(); } @@ -315,7 +315,7 @@ void UrlReference::setParameter(OUString const & key, OUString const & value) } OUStringBuffer newPath; - newPath.append(m_base.m_path.copy(0, i)); + newPath.appendCopy(m_base.m_path, 0, i); if (!bExistent) { newPath.append( m_base.m_path.indexOf('?') < 0 ? '?' : '&' ); newPath.append(encodeNameOrParamFragment(key)); @@ -325,7 +325,7 @@ void UrlReference::setParameter(OUString const & key, OUString const & value) if (bExistent) { /*oldValue = */ parsePart(m_base.m_path, false, &i); // skip key - newPath.append(m_base.m_path.copy(i)); + newPath.appendCopy(m_base.m_path, i); } m_base.m_path = newPath.makeStringAndClear(); |