diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-12-15 12:45:36 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-12-17 09:35:24 +0000 |
commit | bba34cfa6df4f8b7ca181d517dca675c0dc23b81 (patch) | |
tree | 0ca8b45d2c8909c11092aaba0a950019805cb1c2 /connectivity/source/drivers/file | |
parent | 7b028f4aaefe626edfa5283363e21146ceca4acf (diff) |
use return value optimization
Change-Id: I08e6b49c9250d3542777f207e93f1d7b6d1a92a7
Diffstat (limited to 'connectivity/source/drivers/file')
-rw-r--r-- | connectivity/source/drivers/file/quotedstring.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/connectivity/source/drivers/file/quotedstring.cxx b/connectivity/source/drivers/file/quotedstring.cxx index ffb468a729d0..b8d9c6bc03f2 100644 --- a/connectivity/source/drivers/file/quotedstring.cxx +++ b/connectivity/source/drivers/file/quotedstring.cxx @@ -85,10 +85,10 @@ namespace connectivity } //------------------------------------------------------------------ - void QuotedTokenizedString::GetTokenSpecial( String& _rStr,xub_StrLen& nStartPos, sal_Unicode cTok, sal_Unicode cStrDel ) const + String QuotedTokenizedString::GetTokenSpecial(xub_StrLen& nStartPos, sal_Unicode cTok, sal_Unicode cStrDel) const { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "file", "Ocke.Janssen@sun.com", "QuotedTokenizedString::GetTokenCount" ); - _rStr.Erase(); + String aStr; const xub_StrLen nLen = m_sString.Len(); if ( nLen ) { @@ -98,9 +98,9 @@ namespace connectivity if (bInString ) ++nStartPos; // skip this character! if ( nStartPos >= nLen ) - return; + return aStr; - sal_Unicode* pData = _rStr.AllocBuffer( nLen - nStartPos + 1 ); + sal_Unicode* pData = aStr.AllocBuffer( nLen - nStartPos + 1 ); const sal_Unicode* pStart = pData; // Search until end of string for the first not matching character for( xub_StrLen i = nStartPos; i < nLen; ++i ) @@ -147,8 +147,9 @@ namespace connectivity } } // for( xub_StrLen i = nStartPos; i < nLen; ++i ) *pData = 0; - _rStr.ReleaseBufferAccess(xub_StrLen(pData - pStart)); + aStr.ReleaseBufferAccess(xub_StrLen(pData - pStart)); } + return aStr; } } |