Kaydet (Commit) 7fa1e75e authored tarafından Matteo Casalin's avatar Matteo Casalin

Take advantage of known index to avoid an OUString copy

Change-Id: I3cf7a10f5d27ddc626adea07697aa65e01f6f978
Reviewed-on: https://gerrit.libreoffice.org/66942
Tested-by: Jenkins
Reviewed-by: 's avatarMatteo Casalin <matteo.casalin@yahoo.com>
üst c1145093
...@@ -232,17 +232,11 @@ SAL_IMPLEMENT_MAIN() ...@@ -232,17 +232,11 @@ SAL_IMPLEMENT_MAIN()
} }
if ( readOption( &sOption, "p", &nPos, arg) ) { if ( readOption( &sOption, "p", &nPos, arg) ) {
OString sTmp(OUStringToOString(sOption, RTL_TEXTENCODING_UTF8)); OString sTmp(OUStringToOString(sOption, RTL_TEXTENCODING_UTF8));
sal_Int32 nIndex= sTmp.indexOf(':'); sal_Int32 nIndex{ sTmp.indexOf(':')+1 };
OString sPrt = sTmp.copy(0, nIndex+1); const OString sPrt = sTmp.copy(0, nIndex);
OString sCmds = sTmp.copy(nIndex+1);
nIndex = 0;
std::vector< OString > vCmds; std::vector< OString > vCmds;
do { while (nIndex>=0)
OString sCmd = sCmds.getToken( 0, ',', nIndex ); vCmds.push_back(sTmp.getToken( 0, ',', nIndex ));
vCmds.push_back(sCmd);
} while ( nIndex >= 0 );
options.protocolCmdMap.emplace(sPrt, vCmds); options.protocolCmdMap.emplace(sPrt, vCmds);
continue; continue;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment