Search for char instead of 1 char long string, when possible.

follow-up of a767448225

Change-Id: I25f40c601454c092078307d931333af1bc1447ac
This commit is contained in:
Thomas Arnhold
2013-06-29 09:45:49 +02:00
parent 34dc6baf2c
commit e67c21ee06
12 changed files with 17 additions and 17 deletions

View File

@@ -964,7 +964,7 @@ PluginInputStream::PluginInputStream( XPlugin_Impl* pPlugin,
// set correct extension, some plugins need that
OUString aName( m_aNPStream.url, strlen( m_aNPStream.url ), m_pPlugin->getTextEncoding() );
OUString aExtension;
sal_Int32 nSepInd = aName.lastIndexOf(".");
sal_Int32 nSepInd = aName.lastIndexOf('.');
if( nSepInd != -1 )
{
aExtension = aName.copy( nSepInd + 1, aName.getLength() - nSepInd - 1 );

View File

@@ -1063,7 +1063,7 @@ sal_Bool ODatabaseForm::InsertFilePart( INetMIMEMessage& rParent, const OUString
delete pStream;
pStream = 0;
}
sal_Int32 nSepInd = aFileName.lastIndexOf(".");
sal_Int32 nSepInd = aFileName.lastIndexOf('.');
OUString aExtension = aFileName.copy( nSepInd + 1, aFileName.getLength() - nSepInd - 1 );
INetContentType eContentType = INetContentTypes::GetContentType4Extension( aExtension );
if (eContentType != CONTENT_TYPE_UNKNOWN)

View File

@@ -92,7 +92,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
HelpParser aParser( sXhpFile );
const OString sOutput(
aArgs.m_sOutputFile +
sXhpFile.copy( sXhpFile.lastIndexOf("/") ));
sXhpFile.copy( sXhpFile.lastIndexOf('/') ));
if( !aParser.Merge( aArgs.m_sMergeSrc, sOutput,
aArgs.m_sLanguage, pMergeDataFile ))
{

View File

@@ -248,7 +248,7 @@ sal_Bool LngParser::Merge(
OString sNewText;
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sLang, sal_True );
if( sLang == "qtz" )
sNewText = sNewText.copy(sNewText.indexOf("|") + 2);
sNewText = sNewText.copy(sNewText.indexOf('|') + 2);
if ( !sNewText.isEmpty()) {
OString *pLine = (*pLines)[ nPos ];
@@ -286,7 +286,7 @@ sal_Bool LngParser::Merge(
OString sNewText;
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur, sal_True );
if( sCur == "qtz" )
sNewText = sNewText.copy(sNewText.indexOf("|") + 2);
sNewText = sNewText.copy(sNewText.indexOf('|') + 2);
if ( !sNewText.isEmpty() && sCur != "x-comment")
{
OString sLine;

View File

@@ -181,7 +181,7 @@ sal_Bool MergeEntrys::GetText( OString &rReturn,
OString MergeEntrys::GetQTZText(const ResData& rResData, const OString& rOrigText)
{
const OString sFilename = rResData.sFilename.copy(rResData.sFilename.lastIndexOf("/")+1);
const OString sFilename = rResData.sFilename.copy(rResData.sFilename.lastIndexOf('/')+1);
const OString sKey =
PoEntry::genKeyId(sFilename + rResData.sGId + rResData.sId + rResData.sResTyp + rOrigText);
return sKey + "||" + rOrigText;
@@ -310,7 +310,7 @@ MergeDataFile::MergeDataFile(
const sal_Int32 nStart =
sPoFileName.indexOf(sTransSource)+sTransSource.getLength();
const sal_Int32 nCount =
sPoFileName.indexOf("/",nStart) - nStart;
sPoFileName.indexOf('/',nStart) - nStart;
sLang = sPoFileName.copy(nStart,nCount);
}
aLanguageSet.insert( sLang );

View File

@@ -245,7 +245,7 @@ PoEntry::PoEntry(
throw WRONGHELPTEXT;
m_pGenPo = new GenPoEntry();
m_pGenPo->setReference(rSourceFile.copy(rSourceFile.lastIndexOf("/")+1));
m_pGenPo->setReference(rSourceFile.copy(rSourceFile.lastIndexOf('/')+1));
OString sMsgCtxt =
rGroupId + "\n" +

View File

@@ -191,7 +191,7 @@ void PropParser::Merge( const OString &rMergeSrc, const OString &rDestinationFil
if( !sLine.startsWith(" *") && !sLine.startsWith("/*") &&
nEqualSign != -1 )
{
const OString sID( sLine.copy( 0, sLine.indexOf("=") ).trim() );
const OString sID( sLine.copy( 0, sLine.indexOf('=') ).trim() );
ResData aResData( sID, m_sSource );
aResData.sResTyp = "property";
OString sNewText;

View File

@@ -68,13 +68,13 @@ namespace
helper::xmlStrToOString( pID );
xmlFree( pID );
const sal_Int32 nFirstSlash = sID.indexOf("/");
const sal_Int32 nFirstSlash = sID.indexOf('/');
// Update id attribute of topic
{
OString sNewID =
sID.copy( 0, nFirstSlash + 1 ) +
rXhpRoot.copy( rXhpRoot.lastIndexOf("/") + 1 ) +
sID.copy( sID.indexOf( "/", nFirstSlash + 1 ) );
rXhpRoot.copy( rXhpRoot.lastIndexOf('/') + 1 ) +
sID.copy( sID.indexOf( '/', nFirstSlash + 1 ) );
xmlSetProp(
pReturn, (const xmlChar*)("id"),
reinterpret_cast<const xmlChar*>(sNewID.getStr()));
@@ -82,7 +82,7 @@ namespace
const OString sXhpPath =
rXhpRoot +
sID.copy(sID.indexOf("/", nFirstSlash + 1));
sID.copy(sID.indexOf('/', nFirstSlash + 1));
xmlDocPtr pXhpFile = xmlParseFile( sXhpPath.getStr() );
// if xhpfile is missing than put this topic into comment
if ( !pXhpFile )

View File

@@ -491,7 +491,7 @@ OUString ChartExport::parseFormula( const OUString& rRange )
OSL_TRACE("ChartExport::parseFormula, parser is invalid");
//FIXME: currently just using simple converter, e.g $Sheet1.$A$1:$C$1 -> Sheet1!$A$1:$C$1
OUString aRange( rRange );
if( aRange.indexOf("$") == 0 )
if( aRange.indexOf('$') == 0 )
aRange = aRange.copy(1);
aRange = aRange.replaceAll(".$", "!$" );
aResult = aRange;

View File

@@ -127,7 +127,7 @@ sal_Bool Append(const OString &rOutputSrs, const OString &rTmpFile)
/* replaces extension of a file name */
OString OutputFile(const OString &rInput, const char * pExt)
{
sal_Int32 nSepInd = rInput.lastIndexOf(".");
sal_Int32 nSepInd = rInput.lastIndexOf('.');
if( nSepInd != -1 )
{

View File

@@ -439,7 +439,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
{
OUString module = SfxHelp::GetCurrentModuleIdentifier();
OUString sURL("http://hub.libreoffice.org/send-feedback/?LOversion=" + utl::ConfigManager::getAboutBoxProductVersion() +
"&LOlocale=" + utl::ConfigManager::getLocale() + "&LOmodule=" + module.copy(module.lastIndexOf(".") + 1 ) );
"&LOlocale=" + utl::ConfigManager::getLocale() + "&LOmodule=" + module.copy(module.lastIndexOf('.') + 1 ) );
try
{
uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute(

View File

@@ -1547,7 +1547,7 @@ SerfSession::isDomainMatch( OUString certHostName )
if (hostName.equalsIgnoreAsciiCase( certHostName ) )
return sal_True;
if ( 0 == certHostName.indexOf( OUString::createFromAscii( "*" ) ) &&
if ( 0 == certHostName.indexOf( '*' ) &&
hostName.getLength() >= certHostName.getLength() )
{
OUString cmpStr = certHostName.copy( 1 );