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>
This commit is contained in:
parent
2fb88cb41e
commit
fafb309d2e
@ -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 ) )
|
||||
|
Loading…
x
Reference in New Issue
Block a user