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 /unotools/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 'unotools/source')
-rw-r--r-- | unotools/source/config/configpaths.cxx | 4 | ||||
-rw-r--r-- | unotools/source/i18n/textsearch.cxx | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/unotools/source/config/configpaths.cxx b/unotools/source/config/configpaths.cxx index abbf8f465f09..cd2e9c7f06a7 100644 --- a/unotools/source/config/configpaths.cxx +++ b/unotools/source/config/configpaths.cxx @@ -49,7 +49,7 @@ void lcl_resolveCharEntities(OUString & aLocalString) OSL_ENSURE(ch,"Configuration path contains '&' that is not part of a valid character escape"); if (ch) { - aResult.append(aLocalString.copy(nStart,nEscapePos-nStart)).append(ch); + aResult.appendCopy(aLocalString, nStart,nEscapePos-nStart).append(ch); sal_Int32 nEscapeEnd=aLocalString.indexOf(';',nEscapePos); nStart = nEscapeEnd+1; @@ -62,7 +62,7 @@ void lcl_resolveCharEntities(OUString & aLocalString) } while ( nEscapePos > 0); - aResult.append(aLocalString.copy(nStart)); + aResult.appendCopy(aLocalString, nStart); aLocalString = aResult.makeStringAndClear(); } diff --git a/unotools/source/i18n/textsearch.cxx b/unotools/source/i18n/textsearch.cxx index baddd527d2b3..5bb4dfd81a4a 100644 --- a/unotools/source/i18n/textsearch.cxx +++ b/unotools/source/i18n/textsearch.cxx @@ -306,7 +306,7 @@ void TextSearch::ReplaceBackReferences( OUString& rReplaceStr, const OUString &r { sal_Int32 nStart = rResult.startOffset[0]; sal_Int32 nLength = rResult.endOffset[0] - rResult.startOffset[0]; - sBuff.append(rStr.getStr() + nStart, nLength); + sBuff.appendCopy(rStr, nStart, nLength); } else if((i < rReplaceStr.getLength() - 1) && rReplaceStr[i] == '$') { @@ -339,7 +339,7 @@ void TextSearch::ReplaceBackReferences( OUString& rReplaceStr, const OUString &r nSttReg = rResult.endOffset[j]; } // Copy reference from found string - sBuff.append(rStr.getStr() + nSttReg, nRegLen); + sBuff.appendCopy(rStr, nSttReg, nRegLen); } i += 1; } |