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 /desktop | |
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 'desktop')
-rw-r--r-- | desktop/source/app/updater.cxx | 2 | ||||
-rw-r--r-- | desktop/source/deployment/misc/dp_misc.cxx | 2 | ||||
-rw-r--r-- | desktop/source/deployment/misc/dp_ucb.cxx | 12 |
3 files changed, 8 insertions, 8 deletions
diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx index adcc130751e7..ca62f4a8ae39 100644 --- a/desktop/source/app/updater.cxx +++ b/desktop/source/app/updater.cxx @@ -571,7 +571,7 @@ std::string download_content(const OString& rURL, bool bFile, OUString& rHash) { OUString aTempFileURL = aTempFile.GetURL(); OString aTempFileURLOString = OUStringToOString(aTempFileURL, RTL_TEXTENCODING_UTF8); - response_body.append(aTempFileURLOString.getStr(), aTempFileURLOString.getLength()); + response_body.append(aTempFileURLOString); aTempFile.EnableKillingFile(false); diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index 9ab6d8f09743..b231dac760ec 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -266,7 +266,7 @@ OUString makeURL( OUString const & baseURL, OUString const & relPath_ ) { OUStringBuffer buf; if (baseURL.getLength() > 1 && baseURL[ baseURL.getLength() - 1 ] == '/') - buf.append( baseURL.copy( 0, baseURL.getLength() - 1 ) ); + buf.appendCopy( baseURL, 0, baseURL.getLength() - 1 ); else buf.append( baseURL ); OUString relPath(relPath_); diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx index be62722ffc43..10e696a0a745 100644 --- a/desktop/source/deployment/misc/dp_ucb.cxx +++ b/desktop/source/deployment/misc/dp_ucb.cxx @@ -215,18 +215,18 @@ bool readLine( OUString * res, OUString const & startingWith, { pos = file.indexOf( LF, pos ); if (pos < 0) { // EOF - buf.append( file.copy( start ) ); + buf.appendCopy( file, start ); } else { if (pos > 0 && file[ pos - 1 ] == CR) { // consume extra CR - buf.append( file.copy( start, pos - start - 1 ) ); + buf.appendCopy( file, start, pos - start - 1 ); ++pos; } else - buf.append( file.copy( start, pos - start ) ); + buf.appendCopy( file, start, pos - start ); ++pos; // consume LF // check next line: if (pos < file.getLength() && @@ -270,16 +270,16 @@ bool readProperties( std::vector< std::pair< OUString, OUString> > & out_result, bool bEOF = false; pos = file.indexOf( LF, pos ); if (pos < 0) { // EOF - buf.append( file.copy( start ) ); + buf.appendCopy( file, start ); bEOF = true; } else { if (pos > 0 && file[ pos - 1 ] == CR) // consume extra CR - buf.append( file.copy( start, pos - start - 1 ) ); + buf.appendCopy( file, start, pos - start - 1 ); else - buf.append( file.copy( start, pos - start ) ); + buf.appendCopy( file, start, pos - start ); pos++; } OUString aLine = buf.makeStringAndClear(); |