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 /connectivity | |
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 'connectivity')
-rw-r--r-- | connectivity/source/commontools/dbtools2.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Clob.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/PreparedStatement.cxx | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index cd09553e06df..5e1296adbbc6 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -132,7 +132,7 @@ OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const } else { - aSql.append(sTypeName.copy(0,++nParenPos)); + aSql.appendCopy(sTypeName, 0, ++nParenPos); } if ( nPrecision > 0 && nDataType != DataType::TIMESTAMP ) @@ -149,7 +149,7 @@ OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const else { nParenPos = sTypeName.indexOf(')',nParenPos); - aSql.append(sTypeName.copy(nParenPos)); + aSql.appendCopy(sTypeName, nParenPos); } } else diff --git a/connectivity/source/drivers/firebird/Clob.cxx b/connectivity/source/drivers/firebird/Clob.cxx index d14e35723569..2d150da912f1 100644 --- a/connectivity/source/drivers/firebird/Clob.cxx +++ b/connectivity/source/drivers/firebird/Clob.cxx @@ -99,7 +99,7 @@ OUString SAL_CALL Clob::getSubString(sal_Int64 nPosition, if( nCharsToCopy > nLength ) nCharsToCopy = nLength; // append relevant part of first segment - sSegmentBuffer.append( sSegment.copy(0, nCharsToCopy ) ); + sSegmentBuffer.appendCopy( sSegment, 0, nCharsToCopy ); nActLen += sSegmentBuffer.getLength(); } } @@ -115,7 +115,7 @@ OUString SAL_CALL Clob::getSubString(sal_Int64 nPosition, RTL_TEXTENCODING_UTF8 ); sal_Int32 nStrLen = sSegment.getLength(); if( nActLen + nStrLen > nLength ) - sSegmentBuffer.append(sSegment.copy(0, nLength - nActLen) ); + sSegmentBuffer.appendCopy(sSegment, 0, nLength - nActLen); else sSegmentBuffer.append(sSegment); nActLen += nStrLen; diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx index e55266780242..acb99c8abb99 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.cxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx @@ -333,9 +333,9 @@ sal_Int64 toNumericWithoutDecimalPlace(const OUString& sSource) OUStringBuffer sBuffer(15); if(nDotIndex > 0) { - sBuffer.append(sNumber.copy(0, nDotIndex)); + sBuffer.appendCopy(sNumber, 0, nDotIndex); } - sBuffer.append(sNumber.copy(nDotIndex + 1)); + sBuffer.appendCopy(sNumber, nDotIndex + 1); return sBuffer.makeStringAndClear().toInt64(); } } |