diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2019-10-17 20:33:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-21 08:36:01 +0200 |
commit | 0f874472c672175135520101837ff0c9d4701d7f (patch) | |
tree | fa6a504bdfc7d5d838caed7cfb87793321797290 /stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx | |
parent | 9112c18524c9f5e67d6cbb282586a439e3020cdb (diff) |
size some stringbuffer to prevent re-alloc
found by the simple expidient of putting asserts in
the resize routine. Where an explicit const size is used,
I started with 32 and kept doubling until that site
did not need resizing anymore.
Change-Id: I998787edc940d0a3ba23b5ac37131ab9ecd300f4
Reviewed-on: https://gerrit.libreoffice.org/81138
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx')
-rw-r--r-- | stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx index 1191a711262f..b63fad9d529e 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx @@ -282,10 +282,9 @@ void SAL_CALL UrlReference::setName(OUString const & name) sal_Int32 i = 0; parsePart(m_base.m_path, true, &i); - OUStringBuffer newPath; - newPath.append(encodeNameOrParamFragment(name)); - newPath.append(std::u16string_view(m_base.m_path).substr(i)); - m_base.m_path = newPath.makeStringAndClear(); + auto tmp = std::u16string_view(m_base.m_path).substr(i); + m_base.m_path = encodeNameOrParamFragment(name) + + rtl::OUStringView(tmp.data(), tmp.length()); } sal_Bool UrlReference::hasParameter(OUString const & key) @@ -314,7 +313,7 @@ void UrlReference::setParameter(OUString const & key, OUString const & value) i = m_base.m_path.getLength(); } - OUStringBuffer newPath; + OUStringBuffer newPath(128); newPath.append(std::u16string_view(m_base.m_path).substr(0, i)); if (!bExistent) { newPath.append( m_base.m_path.indexOf('?') < 0 ? '?' : '&' ); |