[Libreoffice-commits] .: 2 commits - connectivity/source cppuhelper/source desktop/source extensions/source fpicker/source l10ntools/source oox/source sc/source shell/source svtools/source ucb/source uui/source vbahelper/source

Eike Rathke erack at kemper.freedesktop.org
Fri Jul 13 07:36:13 PDT 2012


 connectivity/source/parse/sqlnode.cxx           |    4 ++--
 cppuhelper/source/shlib.cxx                     |   21 ++++-----------------
 desktop/source/app/dispatchwatcher.cxx          |    6 +++---
 extensions/source/plugin/base/nfuncs.cxx        |    2 +-
 fpicker/source/office/ServerDetailsControls.cxx |    4 ++--
 l10ntools/source/export.cxx                     |    4 ++--
 l10ntools/source/merge.cxx                      |    4 ++--
 oox/source/drawingml/chart/axisconverter.cxx    |    2 +-
 oox/source/drawingml/chart/seriesconverter.cxx  |    2 +-
 sc/source/filter/xml/xmlcondformat.cxx          |    6 +++---
 sc/source/ui/vba/vbafilesearch.cxx              |    2 +-
 shell/source/backends/gconfbe/gconfaccess.cxx   |    2 +-
 shell/source/tools/lngconvex/lngconvex.cxx      |    2 +-
 svtools/source/contnr/contentenumeration.cxx    |    2 +-
 ucb/source/ucp/webdav/NeonSession.cxx           |    2 +-
 uui/source/iahndl-ssl.cxx                       |    2 +-
 vbahelper/source/vbahelper/vbalineformat.cxx    |    2 +-
 17 files changed, 28 insertions(+), 41 deletions(-)

New commits:
commit a7674482254ee996b1c4fee60f3064778be369aa
Author: Christophe JAILLET <christophe.jaillet at wanadoo.fr>
Date:   Thu Jul 12 22:10:17 2012 +0200

    Search for char instead of 1 char long string, when possible.
    
    It is faster and even avoid memory allocation somtimes.
    
    Change-Id: Ic12ff70e95953de44ef5798131150669d07a5445

diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index a2c273d..e2afd6a 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -1078,10 +1078,10 @@ OSQLParseNode* OSQLParser::buildNode_STR_NUM(OSQLParseNode*& _pLiteral)
             if((aResult.TokenType & KParseType::IDENTNAME) && aResult.EndPos == _rValue.getLength())
             {
                 aValue = ::rtl::OUString::valueOf(aResult.Value);
-                sal_Int32 nPos = aValue.lastIndexOf(::rtl::OUString("."));
+                sal_Int32 nPos = aValue.lastIndexOf('.');
                 if((nPos+_nScale) < aValue.getLength())
                     aValue = aValue.replaceAt(nPos+_nScale,aValue.getLength()-nPos-_nScale,::rtl::OUString());
-                aValue = aValue.replaceAt(aValue.lastIndexOf(::rtl::OUString(".")),1,s_xLocaleData->getLocaleItem(m_pData->aLocale).decimalSeparator);
+                aValue = aValue.replaceAt(aValue.lastIndexOf('.'),1,s_xLocaleData->getLocaleItem(m_pData->aLocale).decimalSeparator);
                 return aValue;
             }
         }
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
index fe295b1..1ed73d5 100644
--- a/desktop/source/app/dispatchwatcher.cxx
+++ b/desktop/source/app/dispatchwatcher.cxx
@@ -434,8 +434,8 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
                         Reference< XStorable > xStorable( xDoc, UNO_QUERY );
                         if ( xStorable.is() ) {
                             rtl::OUString aParam = aDispatchRequest.aPrinterName;
-                            sal_Int32 nPathIndex =  aParam.lastIndexOfAsciiL( ";", 1 );
-                            sal_Int32 nFilterIndex = aParam.indexOfAsciiL( ":", 1 );
+                            sal_Int32 nPathIndex =  aParam.lastIndexOf( ';' );
+                            sal_Int32 nFilterIndex = aParam.indexOf( ':' );
                             if( nPathIndex < nFilterIndex )
                                 nFilterIndex = -1;
                             rtl::OUString aFilterOut=aParam.copy( nPathIndex+1 );
@@ -493,7 +493,7 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch
                         }
                     } else if ( aDispatchRequest.aRequestType == REQUEST_BATCHPRINT ) {
                         rtl::OUString aParam = aDispatchRequest.aPrinterName;
-                        sal_Int32 nPathIndex =  aParam.lastIndexOfAsciiL( ";", 1 );
+                        sal_Int32 nPathIndex =  aParam.lastIndexOf( ';' );
 
                         rtl::OUString aFilterOut;
                         rtl::OUString aPrinterName;
diff --git a/extensions/source/plugin/base/nfuncs.cxx b/extensions/source/plugin/base/nfuncs.cxx
index b06665b..b37a1c9 100644
--- a/extensions/source/plugin/base/nfuncs.cxx
+++ b/extensions/source/plugin/base/nfuncs.cxx
@@ -142,7 +142,7 @@ NPNetscapeFuncs aNPNFuncs =
 static ::rtl::OString normalizeURL( XPlugin_Impl* plugin, const ::rtl::OString& url )
 {
     ::rtl::OString aLoadURL;
-    if( url.indexOf( ":" ) == -1 )
+    if( url.indexOf( ':' ) == -1 )
     {
         aLoadURL = ::rtl::OUStringToOString( plugin->getCreationURL(), plugin->getTextEncoding() );
         int nPos;
diff --git a/fpicker/source/office/ServerDetailsControls.cxx b/fpicker/source/office/ServerDetailsControls.cxx
index 69dfa4f..93e02f8 100644
--- a/fpicker/source/office/ServerDetailsControls.cxx
+++ b/fpicker/source/office/ServerDetailsControls.cxx
@@ -155,7 +155,7 @@ INetURLObject HostDetailsContainer::getUrl( )
         if ( nPort != m_nDefaultPort )
             sUrl += ":" + rtl::OUString::valueOf( nPort );
         if ( !sPath.isEmpty( ) )
-            if ( sPath.indexOf( "/" ) != 0 )
+            if ( sPath.indexOf( '/' ) != 0 )
                 sUrl += "/";
             sUrl += sPath;
     }
@@ -254,7 +254,7 @@ INetURLObject SmbDetailsContainer::getUrl( )
         if ( !sShare.isEmpty( ) )
             sUrl += sShare;
         if ( !sPath.isEmpty( ) )
-            if ( sPath.indexOf( "/" ) != 0 )
+            if ( sPath.indexOf( '/' ) != 0 )
                 sUrl += "/";
             sUrl += sPath;
     }
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index 3980836..065d7b7 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -1285,7 +1285,7 @@ rtl::OString Export::GetText(const rtl::OString &rSource, int nToken)
         case TEXTLINE:
         case LONGTEXTLINE:
         {
-            rtl::OString sTmp(rSource.copy(rSource.indexOf("=")));
+            rtl::OString sTmp(rSource.copy(rSource.indexOf('=')));
             CleanValue( sTmp );
             sTmp = sTmp.replaceAll("\n", rtl::OString()).
                 replaceAll("\r", rtl::OString()).
@@ -1547,7 +1547,7 @@ sal_Bool Export::PrepareTextToMerge(rtl::OString &rText, sal_uInt16 nTyp,
         case STRING_TYP_QUICKHELPTEXT :
         case STRING_TYP_TITLE :
         {
-            nStart = rText.indexOf( "=" );
+            nStart = rText.indexOf( '=' );
             if ( nStart == -1 ) {
                 rText = sOrigText;
                 return sal_False;
diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx
index 9fe2656..b77e86b 100644
--- a/l10ntools/source/merge.cxx
+++ b/l10ntools/source/merge.cxx
@@ -41,8 +41,8 @@ namespace
     {
         return rFilename.copy(
             std::max(
-                rFilename.lastIndexOf( "\\" ),
-                rFilename.lastIndexOf( "/" ))+1);
+                rFilename.lastIndexOf( '\\' ),
+                rFilename.lastIndexOf( '/' ))+1);
     };
 }
 
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx
index d07d28c..2a0ea14 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -316,7 +316,7 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
 
         if( (aScaleData.AxisType == cssc2::AxisType::REALNUMBER) || (aScaleData.AxisType == cssc2::AxisType::PERCENT) )
         {
-            if( mrModel.maNumberFormat.maFormatCode.indexOfAsciiL("%",1) >= 0)
+            if( mrModel.maNumberFormat.maFormatCode.indexOf('%') >= 0)
                 mrModel.maNumberFormat.mbSourceLinked = false;
             getFormatter().convertNumberFormat( aAxisProp, mrModel.maNumberFormat );
         }
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index 0522376..6ad0d74 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -126,7 +126,7 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt
     bool bShowPercent = !rDataLabel.mbDeleted && rDataLabel.mobShowPercent.get( false ) && (rTypeInfo.meTypeCategory == TYPECATEGORY_PIE);
     if( bShowValue &&
         !bShowPercent && rTypeInfo.meTypeCategory == TYPECATEGORY_PIE &&
-        rDataLabel.maNumberFormat.maFormatCode.indexOfAsciiL("%", 1) >= 0 )
+        rDataLabel.maNumberFormat.maFormatCode.indexOf('%') >= 0 )
     {
         bShowValue = false;
         bShowPercent = true;
diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx
index ed9bc49..7878b82 100644
--- a/sc/source/filter/xml/xmlcondformat.cxx
+++ b/sc/source/filter/xml/xmlcondformat.cxx
@@ -343,17 +343,17 @@ void GetConditionData(const rtl::OUString& rValue, ScConditionMode& eMode, rtl::
         rExpr1 = rValue.copy(2);
         eMode = SC_COND_NOTEQUAL;
     }
-    else if(rValue.indexOf("<") == 0)
+    else if(rValue.indexOf('<') == 0)
     {
         rExpr1 = rValue.copy(1);
         eMode = SC_COND_LESS;
     }
-    else if(rValue.indexOf("=") == 0)
+    else if(rValue.indexOf('=') == 0)
     {
         rExpr1 = rValue.copy(1);
         eMode = SC_COND_EQUAL;
     }
-    else if(rValue.indexOf(">") == 0)
+    else if(rValue.indexOf('>') == 0)
     {
         rExpr1 = rValue.copy(1);
         eMode = SC_COND_GREATER;
diff --git a/sc/source/ui/vba/vbafilesearch.cxx b/sc/source/ui/vba/vbafilesearch.cxx
index ddb5c04..c0c6f97 100644
--- a/sc/source/ui/vba/vbafilesearch.cxx
+++ b/sc/source/ui/vba/vbafilesearch.cxx
@@ -180,7 +180,7 @@ sal_Int32 SAL_CALL ScVbaFileSearch::Execute( )  throw (css::uno::RuntimeExceptio
     if ( IsWildCard( aTempFileName ) )
     {
         bool bEndWithAsterisk = aTempFileName.endsWithAsciiL("*", 1);
-        bool bStartWithAsterisk = (aTempFileName.indexOf(::rtl::OUString("*")) == 0);
+        bool bStartWithAsterisk = (aTempFileName.indexOf('*') == 0);
         if ( !bEndWithAsterisk && !bStartWithAsterisk )
         {
             aTempFileName = ::rtl::OUString("*") + aTempFileName + ::rtl::OUString("*");
diff --git a/shell/source/backends/gconfbe/gconfaccess.cxx b/shell/source/backends/gconfbe/gconfaccess.cxx
index 8743bcd..5a49e96 100644
--- a/shell/source/backends/gconfbe/gconfaccess.cxx
+++ b/shell/source/backends/gconfbe/gconfaccess.cxx
@@ -433,7 +433,7 @@ sal_Bool SAL_CALL isDependencySatisfied( GConfClient* pClient, const Configurati
                 g_get_real_name(), osl_getThreadTextEncoding() ) );
             if( aCompleteName != "Unknown" )
             {
-                if( aCompleteName.trim().indexOf(rtl::OUString(" "), 0) != -1 )
+                if( aCompleteName.trim().indexOf( ' ' ) != -1 )
                     return sal_True;
             }
         }
diff --git a/shell/source/tools/lngconvex/lngconvex.cxx b/shell/source/tools/lngconvex/lngconvex.cxx
index 5b2ecb2..dce42ab 100644
--- a/shell/source/tools/lngconvex/lngconvex.cxx
+++ b/shell/source/tools/lngconvex/lngconvex.cxx
@@ -200,7 +200,7 @@ public:
 private:
     void init()
     {
-        sal_Int32 idx = lang_.indexOf("-");
+        sal_Int32 idx = lang_.indexOf('-');
 
         if (idx > -1)
         {
diff --git a/svtools/source/contnr/contentenumeration.cxx b/svtools/source/contnr/contentenumeration.cxx
index c79636c..8fe19c9 100644
--- a/svtools/source/contnr/contentenumeration.cxx
+++ b/svtools/source/contnr/contentenumeration.cxx
@@ -370,7 +370,7 @@ namespace svt
 
     sal_Bool FileViewContentEnumerator::URLOnBlackList ( const ::rtl::OUString& sRealURL )
     {
-        ::rtl::OUString entryName = sRealURL.copy( sRealURL.lastIndexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ))) +1 );
+        ::rtl::OUString entryName = sRealURL.copy( sRealURL.lastIndexOf( '/' ) + 1 );
 
         for (int i = 0; i < m_rBlackList.getLength() ; i++)
         {
diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx
index 18271b4..45ee240 100644
--- a/ucb/source/ucp/webdav/NeonSession.cxx
+++ b/ucb/source/ucp/webdav/NeonSession.cxx
@@ -2167,7 +2167,7 @@ NeonSession::isDomainMatch( rtl::OUString certHostName )
     if (hostName.equalsIgnoreAsciiCase( certHostName ) )
         return sal_True;
 
-    if ( 0 == certHostName.indexOf( rtl::OUString("*") ) &&
+    if ( 0 == certHostName.indexOf( '*' ) &&
          hostName.getLength() >= certHostName.getLength()  )
     {
         rtl::OUString cmpStr = certHostName.copy( 1 );
diff --git a/uui/source/iahndl-ssl.cxx b/uui/source/iahndl-ssl.cxx
index 0639d68..462e2d5 100644
--- a/uui/source/iahndl-ssl.cxx
+++ b/uui/source/iahndl-ssl.cxx
@@ -97,7 +97,7 @@ isDomainMatch(
        if (hostName.equalsIgnoreAsciiCase( element ))
            return true;
 
-       if ( 0 == element.indexOf( rtl::OUString( "*" ) ) &&
+       if ( 0 == element.indexOf( '*' ) &&
                  hostName.getLength() >= element.getLength()  )
        {
            rtl::OUString cmpStr = element.copy( 1 );
diff --git a/vbahelper/source/vbahelper/vbalineformat.cxx b/vbahelper/source/vbahelper/vbalineformat.cxx
index b5f5709..68e2039 100644
--- a/vbahelper/source/vbahelper/vbalineformat.cxx
+++ b/vbahelper/source/vbahelper/vbalineformat.cxx
@@ -104,7 +104,7 @@ ScVbaLineFormat::getBeginArrowheadStyle() throw (uno::RuntimeException)
     m_xPropertySet->getPropertyValue( rtl::OUString("LineStartName") ) >>= sLineName;
     if( ( sLineName.getLength() > 7 ) && ( sLineName.indexOf( rtl::OUString("msArray") ) ) != -1 )
     {
-        sal_Int32 nIndex = sLineName.indexOf( rtl::OUString(" ") );
+        sal_Int32 nIndex = sLineName.indexOf( ' ' );
         rtl::OUString sName = sLineName.copy( 0, nIndex );
         //sal_Int32 nSize = sLineName.copy( nIndex + 1 ).toInt32();
         nLineType = convertLineStartEndNameToArrowheadStyle( sName );
commit 0cba5e5d25bf2f30c8500e1e673a7ef9e8e8d352
Author: Christophe JAILLET <christophe.jaillet at wanadoo.fr>
Date:   Thu Jul 12 23:30:30 2012 +0200

    This look like the same as rLibName.endsWithIgnoreAsciiCase so kill it. Add missing { }
    
    Untested as I don't have a working build environment yet.
    
    Change-Id: I1988da8c07729eb99d3f53f71b8f950df29a7361

diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx
index 7d87142..f783f87 100644
--- a/cppuhelper/source/shlib.cxx
+++ b/cppuhelper/source/shlib.cxx
@@ -210,19 +210,6 @@ static bool checkAccessPath( OUString * pComp ) throw ()
 }
 
 //------------------------------------------------------------------------------
-static inline sal_Int32 endsWith(
-    const OUString & rText, const OUString & rEnd ) SAL_THROW(())
-{
-    if (rText.getLength() >= rEnd.getLength() &&
-        rEnd.equalsIgnoreAsciiCase(
-            rText.copy( rText.getLength() - rEnd.getLength() ) ))
-    {
-        return rText.getLength() - rEnd.getLength();
-    }
-    return -1;
-}
-
-//------------------------------------------------------------------------------
 static OUString makeComponentPath(
     const OUString & rLibName, const OUString & rPath )
 {
@@ -247,13 +234,13 @@ static OUString makeComponentPath(
         if (rPath[ rPath.getLength() -1 ] != '/')
             buf.append( (sal_Unicode) '/' );
     }
-    sal_Int32 nEnd = endsWith( rLibName, OUSTR(SAL_DLLEXTENSION) );
-    if (nEnd < 0) // !endsWith
+    if (! rLibName.endsWithIgnoreAsciiCase( OUSTR(SAL_DLLEXTENSION) ))
     {
 #if defined SAL_DLLPREFIX
-        nEnd = endsWith( rLibName, OUSTR(".uno") );
-        if (nEnd < 0) // !endsWith
+        if (! rLibName.endsWithIgnoreAsciiCase( OUSTR(".uno") ))
+        {
             buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(SAL_DLLPREFIX) );
+        }
 #endif
         buf.append( rLibName );
         buf.appendAscii( RTL_CONSTASCII_STRINGPARAM(SAL_DLLEXTENSION) );


More information about the Libreoffice-commits mailing list