summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@pardus.org.tr>2016-06-20 13:56:03 +0300
committerNoel Grandin <noelgrandin@gmail.com>2016-06-21 06:43:57 +0000
commitfafb309d2ec6b7a7125409dabffd13613ad65a0d (patch)
treee6e6b4914ec908d90a9e4100dde53b0fc94fc1ef /basic
parent2fb88cb41e9d606280271c8dd78d2a776aa06ce2 (diff)
prefer OUStringBuffer to concatenating OUString in a loop
And improve OUString readability and efficiency. See: https://goo.gl/jsVAwy: Change-Id: I8d847b1ca3cde7cb8733d6f8a649612745cf6aae Reviewed-on: https://gerrit.libreoffice.org/26511 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/basmgr/basmgr.cxx25
1 files changed, 14 insertions, 11 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 9b8cf68a27a6..918d61d5e5be 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1626,29 +1626,32 @@ ErrCode BasicManager::ExecuteMacro( OUString const& i_fullyQualifiedName, OUStri
sArgs.remove( 0, 1 );
sArgs.remove( sArgs.getLength() - 1, 1 );
- sQuotedArgs = "(";
+ OUStringBuffer aBuff;
OUString sArgs2 = sArgs.makeStringAndClear();
sal_Int32 nCount = comphelper::string::getTokenCount(sArgs2, ',');
+
+ aBuff.append("(");
for (sal_Int32 n = 0; n < nCount; ++n)
{
- sQuotedArgs += "\"";
- sQuotedArgs += sArgs2.getToken(n, ',');
- sQuotedArgs += "\"";
+ aBuff.append( "\"" );
+ aBuff.append( sArgs2.getToken(n, ',') );
+ aBuff.append( "\"" );
+
if ( n < nCount - 1 )
{
- sQuotedArgs += ",";
+ aBuff.append( "," );
}
}
+ aBuff.append( ")" );
- sQuotedArgs += ")";
+ sQuotedArgs = aBuff.makeStringAndClear();
}
// add quoted arguments and do the call
- OUString sCall;
- sCall += "[";
- sCall += pMethod->GetName();
- sCall += sQuotedArgs;
- sCall += "]";
+ OUString sCall = "["
+ + pMethod->GetName()
+ + sQuotedArgs
+ + "]";
SbxVariable* pRet = pMethod->GetParent()->Execute( sCall );
if ( pRet && ( pRet != pMethod ) )