[Libreoffice-commits] .: desktop/source ucb/source

Caolán McNamara caolan at kemper.freedesktop.org
Sat Jan 15 13:24:22 PST 2011


 desktop/source/app/desktopcontext.cxx |    2 +-
 ucb/source/core/provprox.cxx          |    2 +-
 ucb/source/ucp/file/bc.cxx            |   28 ++++++++++++++--------------
 ucb/source/ucp/file/shell.cxx         |    6 +++---
 4 files changed, 19 insertions(+), 19 deletions(-)

New commits:
commit b8dc42c46239452cd199c697e50c283a77e21f0f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 15 21:13:41 2011 +0000

    microopts equalsAsciiL faster than compareToAscii(const sal_Char*)

diff --git a/desktop/source/app/desktopcontext.cxx b/desktop/source/app/desktopcontext.cxx
index 73038d3..df33617 100644
--- a/desktop/source/app/desktopcontext.cxx
+++ b/desktop/source/app/desktopcontext.cxx
@@ -49,7 +49,7 @@ Any SAL_CALL DesktopContext::getValueByName( const OUString& Name) throw (Runtim
 {
     Any retVal;
 
-    if ( 0 == Name.compareToAscii( JAVA_INTERACTION_HANDLER_NAME ))
+    if (Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(JAVA_INTERACTION_HANDLER_NAME)))
     {
         retVal = makeAny( Reference< XInteractionHandler >( new svt::JavaInteractionHandler()) );
     }
diff --git a/ucb/source/core/provprox.cxx b/ucb/source/core/provprox.cxx
index f9109a4..d821676 100644
--- a/ucb/source/core/provprox.cxx
+++ b/ucb/source/core/provprox.cxx
@@ -348,7 +348,7 @@ UcbContentProviderProxy::getContentProvider()
             m_xProvider
                 = Reference< XContentProvider >(
                       m_xSMgr->createInstance( m_aService ), UNO_QUERY );
-            if(m_aArguments.compareToAscii("NoConfig") == 0)
+            if(m_aArguments.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("NoConfig")))
             {
                 Reference<XInitialization> xInit(m_xProvider,UNO_QUERY);
                 if(xInit.is()) {
diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx
index a2c78df..7d63e91 100644
--- a/ucb/source/ucp/file/bc.cxx
+++ b/ucb/source/ucp/file/bc.cxx
@@ -276,7 +276,7 @@ sal_Bool SAL_CALL
 BaseContent::supportsService( const rtl::OUString& ServiceName )
     throw( RuntimeException)
 {
-    if( ServiceName.compareToAscii( "com.sun.star.ucb.FileContent" ) == 0 )
+    if (ServiceName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.ucb.FileContent")))
         return true;
     else
         return false;
@@ -349,15 +349,15 @@ BaseContent::execute( const Command& aCommand,
 
     Any aAny;
 
-    if( ! aCommand.Name.compareToAscii( "getPropertySetInfo" ) )  // No exceptions
+    if (aCommand.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("getPropertySetInfo")))  // No exceptions
     {
         aAny <<= getPropertySetInfo( CommandId );
     }
-    else if( ! aCommand.Name.compareToAscii( "getCommandInfo" ) )  // no exceptions
+    else if (aCommand.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("getCommandInfo")))  // no exceptions
     {
         aAny <<= getCommandInfo();
     }
-    else if( ! aCommand.Name.compareToAscii( "setPropertyValues" ) )
+    else if (aCommand.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("setPropertyValues")))
     {
         Sequence< beans::PropertyValue > sPropertyValues;
 
@@ -367,7 +367,7 @@ BaseContent::execute( const Command& aCommand,
         else
             aAny <<= setPropertyValues( CommandId,sPropertyValues );  // calls endTask by itself
     }
-    else if( ! aCommand.Name.compareToAscii( "getPropertyValues" ) )
+    else if (aCommand.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("getPropertyValues")))
     {
         Sequence< beans::Property > ListOfRequestedProperties;
 
@@ -378,7 +378,7 @@ BaseContent::execute( const Command& aCommand,
             aAny <<= getPropertyValues( CommandId,
                                         ListOfRequestedProperties );
     }
-    else if( ! aCommand.Name.compareToAscii( "open" ) )
+    else if (aCommand.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("open")))
     {
         OpenCommandArgument2 aOpenArgument;
         if( ! ( aCommand.Argument >>= aOpenArgument ) )
@@ -391,7 +391,7 @@ BaseContent::execute( const Command& aCommand,
                 aAny <<= result;
         }
     }
-    else if( ! aCommand.Name.compareToAscii( "delete" ) )
+    else if (aCommand.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("delete")))
     {
         if( ! aCommand.Argument.has< sal_Bool >() )
             m_pMyShell->installError( CommandId,
@@ -399,7 +399,7 @@ BaseContent::execute( const Command& aCommand,
         else
             deleteContent( CommandId );
     }
-    else if( ! aCommand.Name.compareToAscii( "transfer" ) )
+    else if (aCommand.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("transfer")))
     {
         TransferInfo aTransferInfo;
         if( ! ( aCommand.Argument >>= aTransferInfo ) )
@@ -408,7 +408,7 @@ BaseContent::execute( const Command& aCommand,
         else
             transfer( CommandId, aTransferInfo );
     }
-    else if( ! aCommand.Name.compareToAscii( "insert" ) )
+    else if (aCommand.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("insert")))
     {
         InsertCommandArgument aInsertArgument;
         if( ! ( aCommand.Argument >>= aInsertArgument ) )
@@ -417,7 +417,7 @@ BaseContent::execute( const Command& aCommand,
         else
             insert( CommandId,aInsertArgument );
     }
-    else if( ! aCommand.Name.compareToAscii( "getCasePreservingURL" ) )
+    else if (aCommand.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("getCasePreservingURL")))
     {
         Sequence< beans::Property > seq(1);
         seq[0] = beans::Property(
@@ -430,7 +430,7 @@ BaseContent::execute( const Command& aCommand,
         if(!xRow->wasNull())
             aAny <<= CasePreservingURL;
     }
-    else if( ! aCommand.Name.compareToAscii( "createNewContent" ) )
+    else if (aCommand.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("createNewContent")))
     {
         ucb::ContentInfo aArg;
         if ( !( aCommand.Argument >>= aArg ) )
@@ -836,16 +836,16 @@ BaseContent::getPropertyValues(
             const beans::Property& rProp = pProps[ n ];
             Any& rValue = pValues[ n ];
 
-            if( rProp.Name.compareToAscii( "ContentType" ) == 0 )
+            if (rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("ContentType")))
             {
                 rValue <<= m_bFolder ? m_pMyShell->FolderContentType
                     : m_pMyShell->FileContentType;
             }
-            else if( rProp.Name.compareToAscii( "IsFolder" ) == 0 )
+            else if (rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("IsFolder")))
             {
                 rValue <<= m_bFolder;
             }
-            else if( rProp.Name.compareToAscii( "IsDocument" ) == 0 )
+            else if (rProp.Name.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("IsDocument")))
             {
                 rValue <<= sal_Bool( !m_bFolder );
             }
diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx
index 63cef17..415419d 100644
--- a/ucb/source/ucp/file/shell.cxx
+++ b/ucb/source/ucp/file/shell.cxx
@@ -1977,9 +1977,9 @@ void SAL_CALL shell::insertDefaultProperties( const rtl::OUString& aUnqPath )
 
 sal_Bool SAL_CALL shell::getUnqFromUrl( const rtl::OUString& Url,rtl::OUString& Unq )
 {
-    if( 0 == Url.compareToAscii( "file:///" ) ||
-        0 == Url.compareToAscii( "file://localhost/" ) ||
-        0 == Url.compareToAscii( "file://127.0.0.1/" ) )
+    if (Url.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("file:///")) ||
+        Url.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("file://localhost/")) ||
+        Url.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("file://127.0.0.1/")))
     {
         Unq = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file:///"));
         return false;


More information about the Libreoffice-commits mailing list