[Libreoffice-commits] core.git: 5 commits - avmedia/source basic/source comphelper/source cppuhelper/source cpputools/source

Stephan Bergmann sbergman at redhat.com
Fri Dec 12 01:23:41 PST 2014


 avmedia/source/macavf/macavfuno.mm                                |    4 -
 avmedia/source/vlc/wrapper/SymbolLoader.hxx                       |    4 -
 basic/source/basmgr/basmgr.cxx                                    |   11 +--
 basic/source/classes/eventatt.cxx                                 |    8 +-
 basic/source/classes/sb.cxx                                       |   28 +++++-----
 basic/source/runtime/runtime.cxx                                  |    4 -
 basic/source/sbx/sbxform.cxx                                      |   28 +++-------
 basic/source/sbx/sbxvalue.cxx                                     |    2 
 comphelper/source/misc/documentinfo.cxx                           |    2 
 comphelper/source/officeinstdir/officeinstallationdirectories.cxx |    3 -
 cppuhelper/source/factory.cxx                                     |    4 -
 cpputools/source/unoexe/unoexe.cxx                                |    8 --
 12 files changed, 45 insertions(+), 61 deletions(-)

New commits:
commit dbe8aaa9b93950d148d2417b6d8627e696c0db53
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 12 10:22:56 2014 +0100

    cpputools: Use appropriate OUString functions on string constants
    
    Change-Id: Iea0f7b4ee3ef867a061c159d90efb5d210ae92a4

diff --git a/cpputools/source/unoexe/unoexe.cxx b/cpputools/source/unoexe/unoexe.cxx
index e5944ae..94c0e11 100644
--- a/cpputools/source/unoexe/unoexe.cxx
+++ b/cpputools/source/unoexe/unoexe.cxx
@@ -195,16 +195,12 @@ static Reference< XInterface > loadComponent(
 
         OUString aExt( rLocation.copy( nDot +1 ) );
 
-        if (aExt.equalsAscii( "dll" ) ||
-            aExt.equalsAscii( "exe" ) ||
-            aExt.equalsAscii( "dylib" ) ||
-            aExt.equalsAscii( "so" ) )
+        if (aExt == "dll" || aExt == "exe" || aExt == "dylib" || aExt == "so")
         {
             createInstance(
                 xLoader, xContext, OUString("com.sun.star.loader.SharedLibrary") );
         }
-        else if (aExt.equalsAscii( "jar" ) ||
-                 aExt.equalsAscii( "class" ) )
+        else if (aExt == "jar" || aExt == "class")
         {
             createInstance(
                 xLoader, xContext, OUString("com.sun.star.loader.Java") );
commit 1be14f1a0085e7895cc1201504d5e57715494dfb
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 12 10:22:33 2014 +0100

    cppuhelper: Use appropriate OUString functions on string constants
    
    Change-Id: I7957898ed3172e79888bdb793e304359b10d75d7

diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx
index 29100b6..e288dad 100644
--- a/cppuhelper/source/factory.cxx
+++ b/cppuhelper/source/factory.cxx
@@ -790,9 +790,9 @@ Reference< XInterface > ORegistryFactoryHelper::createModuleFactory()
             if( nPos != -1 )
             {
                 aActivatorName = aLocation.copy( 0, nPos );
-                if( aActivatorName.equalsAscii( "java" ) )
+                if( aActivatorName == "java" )
                     aActivatorName = "com.sun.star.loader.Java";
-                else if( aActivatorName.equalsAscii( "module" ) )
+                else if( aActivatorName == "module" )
                     aActivatorName = "com.sun.star.loader.SharedLibrary";
                 aLocation = aLocation.copy( nPos + 3 );
             }
commit 85bcf0616009853ef57dd019b53fc811b3311be9
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 12 10:22:13 2014 +0100

    comphelper: Use appropriate OUString functions on string constants
    
    Change-Id: Ia09f122d4d968318fc0208b64b9bf7a0bc131f8a

diff --git a/comphelper/source/misc/documentinfo.cxx b/comphelper/source/misc/documentinfo.cxx
index 4ddf1f2..6e72b73 100644
--- a/comphelper/source/misc/documentinfo.cxx
+++ b/comphelper/source/misc/documentinfo.cxx
@@ -95,7 +95,7 @@ namespace comphelper {
             // work around a problem with embedded objects, which sometimes return
             // private:object as URL
             sDocURL = _rxDocument->getURL();
-            if ( sDocURL.matchAsciiL( "private:", 8 ) )
+            if ( sDocURL.startsWithIgnoreAsciiCase( "private:" ) )
                 sDocURL.clear();
 
             // 2. if the document is not saved, yet, check the frame title
diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
index cb79e94..044eeaa 100644
--- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
+++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
@@ -46,8 +46,7 @@ using namespace comphelper;
 
 static bool makeCanonicalFileURL( OUString & rURL )
 {
-    OSL_ENSURE( rURL.matchAsciiL( "file:", sizeof( "file:" ) - 1 , 0 ) ,
-                "File URL expected!" );
+    OSL_ENSURE(rURL.startsWithIgnoreAsciiCase("file:"), "File URL expected!");
 
     OUString aNormalizedURL;
     if ( osl::FileBase::getAbsoluteFileURL( OUString(),
commit 898c4147000edc83598523cfe25d81ecdcfe82c6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 12 10:21:45 2014 +0100

    basic: Use appropriate OUString functions on string constants
    
    Change-Id: Ied7e5eba39672363065083493bd5e60449fda371

diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 8029d18..8c1eafb 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -97,7 +97,6 @@ static const char szOldManagerStream[] = "BasicManager";
 static const char szManagerStream[] = "BasicManager2";
 static const char szImbedded[] = "LIBIMBEDDED";
 static const char szCryptingKey[] = "CryptedBasic";
-static const char szScriptLanguage[] = "StarBasic";
 
 TYPEINIT1( BasicManager, SfxBroadcaster );
 
@@ -396,7 +395,7 @@ public:
 
     bool&             IsReference()           { return bReference; }
 
-    bool              IsExtern() const        { return ! aStorageName.equalsAscii(szImbedded); }
+    bool              IsExtern() const        { return aStorageName != szImbedded; }
 
     void              SetStorageName( const OUString& rName )   { aStorageName = rName; }
     const OUString&   GetStorageName() const                  { return aStorageName; }
@@ -874,7 +873,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const OUString& rBase
 
         // Correct absolute pathname if relative is existing.
         // Always try relative first if there are two stands on disk
-        if ( !pInfo->GetRelStorageName().isEmpty() && ( ! pInfo->GetRelStorageName().equalsAscii(szImbedded) ) )
+        if ( !pInfo->GetRelStorageName().isEmpty() && pInfo->GetRelStorageName() != szImbedded )
         {
             INetURLObject aObj( aRealStorageName, INET_PROT_FILE );
             aObj.removeSegment();
@@ -966,7 +965,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
             DBG_ASSERT(!bWasAbsolute, "RelStorageName was absolute!" );
 
             SotStorageRef xStorageRef;
-            if ( ( aLibAbsStorage == aCurStorage ) || ( aLibRelStorageName.equalsAscii(szImbedded) ) )
+            if ( aLibAbsStorage == aCurStorage || aLibRelStorageName == szImbedded )
             {
                 xStorageRef = &rStorage;
             }
@@ -1046,7 +1045,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora
     DBG_ASSERT( pLibInfo, "LibInfo!?" );
 
     OUString aStorageName( pLibInfo->GetStorageName() );
-    if ( aStorageName.isEmpty() || ( aStorageName.equalsAscii(szImbedded) ) )
+    if ( aStorageName.isEmpty() || aStorageName == szImbedded )
     {
         aStorageName = GetStorageName();
     }
@@ -1967,7 +1966,7 @@ uno::Any ModuleContainer_Impl::getByName( const OUString& aName )
     if( !pMod )
         throw container::NoSuchElementException();
     uno::Reference< script::XStarBasicModuleInfo > xMod = (XStarBasicModuleInfo*)new ModuleInfo_Impl
-        ( aName, OUString::createFromAscii( szScriptLanguage ), pMod->GetSource32() );
+        ( aName, "StarBasic", pMod->GetSource32() );
     uno::Any aRetAny;
     aRetAny <<= xMod;
     return aRetAny;
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index d7f97ab..a60c5c5 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -183,7 +183,7 @@ void BasicScriptListener_Impl::disposing(const EventObject& ) throw ( RuntimeExc
 
 void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any* pRet )
 {
-    if( aScriptEvent.ScriptType.equalsAscii( "StarBasic" ) )
+    if( aScriptEvent.ScriptType == "StarBasic" )
     {
         // Full qualified name?
         OUString aMacro( aScriptEvent.ScriptCode );
@@ -219,7 +219,7 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
         else if( pParent )
         {
             OUString aName = p->GetName();
-            if( aName.equalsAscii("Standard") )
+            if( aName == "Standard" )
             {
                 // Own basic is doc standard lib
                 xDocStandardBasic = static_cast<StarBASIC*>(p);
@@ -233,11 +233,11 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
 
         bool bSearchLib = true;
         StarBASICRef xLibSearchBasic;
-        if( aLocation.equalsAscii("application") )
+        if( aLocation == "application" )
         {
             xLibSearchBasic = xAppStandardBasic;
         }
-        else if( aLocation.equalsAscii("document") )
+        else if( aLocation == "document" )
         {
             xLibSearchBasic = xDocStandardBasic;
         }
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index c24828a..4f16e2a 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -2053,10 +2053,10 @@ BasicCollection::BasicCollection( const OUString& rClass )
 {
     if( !nCountHash )
     {
-        nCountHash  = MakeHashCode( OUString::createFromAscii( pCountStr ) );
-        nAddHash    = MakeHashCode( OUString::createFromAscii( pAddStr ) );
-        nItemHash   = MakeHashCode( OUString::createFromAscii( pItemStr ) );
-        nRemoveHash = MakeHashCode( OUString::createFromAscii( pRemoveStr ) );
+        nCountHash  = MakeHashCode( pCountStr );
+        nAddHash    = MakeHashCode( pAddStr );
+        nItemHash   = MakeHashCode( pItemStr );
+        nRemoveHash = MakeHashCode( pRemoveStr );
     }
     Initialize();
 
@@ -2078,14 +2078,14 @@ void BasicCollection::Initialize()
     SetFlag( SBX_FIXED );
     ResetFlag( SBX_WRITE );
     SbxVariable* p;
-    p = Make( OUString::createFromAscii( pCountStr ), SbxCLASS_PROPERTY, SbxINTEGER );
+    p = Make( pCountStr, SbxCLASS_PROPERTY, SbxINTEGER );
     p->ResetFlag( SBX_WRITE );
     p->SetFlag( SBX_DONTSTORE );
-    p = Make( OUString::createFromAscii( pAddStr ), SbxCLASS_METHOD, SbxEMPTY );
+    p = Make( pAddStr, SbxCLASS_METHOD, SbxEMPTY );
     p->SetFlag( SBX_DONTSTORE );
-    p = Make( OUString::createFromAscii( pItemStr ), SbxCLASS_METHOD, SbxVARIANT );
+    p = Make( pItemStr, SbxCLASS_METHOD, SbxVARIANT );
     p->SetFlag( SBX_DONTSTORE );
-    p = Make( OUString::createFromAscii( pRemoveStr ), SbxCLASS_METHOD, SbxEMPTY );
+    p = Make( pRemoveStr, SbxCLASS_METHOD, SbxEMPTY );
     p->SetFlag( SBX_DONTSTORE );
     if ( !xAddInfo.Is() )
     {
@@ -2124,22 +2124,22 @@ void BasicCollection::SFX_NOTIFY( SfxBroadcaster& rCst, const TypeId& rId1,
         if( bRead || bWrite )
         {
             if( pVar->GetHashCode() == nCountHash
-                  && aVarName.equalsIgnoreAsciiCaseAscii( pCountStr ) )
+                  && aVarName.equalsIgnoreAsciiCase( pCountStr ) )
             {
                 pVar->PutLong( xItemArray->Count32() );
             }
             else if( pVar->GetHashCode() == nAddHash
-                  && aVarName.equalsIgnoreAsciiCaseAscii( pAddStr ) )
+                  && aVarName.equalsIgnoreAsciiCase( pAddStr ) )
             {
                 CollAdd( pArg );
             }
             else if( pVar->GetHashCode() == nItemHash
-                  && aVarName.equalsIgnoreAsciiCaseAscii( pItemStr ) )
+                  && aVarName.equalsIgnoreAsciiCase( pItemStr ) )
             {
                 CollItem( pArg );
             }
             else if( pVar->GetHashCode() == nRemoveHash
-                  && aVarName.equalsIgnoreAsciiCaseAscii( pRemoveStr ) )
+                  && aVarName.equalsIgnoreAsciiCase( pRemoveStr ) )
             {
                 CollRemove( pArg );
             }
@@ -2152,12 +2152,12 @@ void BasicCollection::SFX_NOTIFY( SfxBroadcaster& rCst, const TypeId& rId1,
         else if ( bRequestInfo )
         {
             if( pVar->GetHashCode() == nAddHash
-                  && aVarName.equalsIgnoreAsciiCaseAscii( pAddStr ) )
+                  && aVarName.equalsIgnoreAsciiCase( pAddStr ) )
             {
                 pVar->SetInfo( xAddInfo );
             }
             else if( pVar->GetHashCode() == nItemHash
-                  && aVarName.equalsIgnoreAsciiCaseAscii( pItemStr ) )
+                  && aVarName.equalsIgnoreAsciiCase( pItemStr ) )
             {
                 pVar->SetInfo( xItemInfo );
             }
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 81220f4..ec6b1f5 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1002,7 +1002,7 @@ SbxVariableRef SbiRuntime::PopVar()
 #endif
     SbxVariableRef xVar = refExprStk->Get( --nExprLvl );
 #ifdef DBG_UTIL
-    if ( xVar->GetName().equalsAscii( "Cells" ) )
+    if ( xVar->GetName() == "Cells" )
         SAL_INFO("basic", "PopVar: Name equals 'Cells'" );
 #endif
     // methods hold themselves in parameter 0
@@ -1990,7 +1990,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
                                 pNewObj->SetParent( rItem.m_pObjParent );
                                 refVar->PutObject( pNewObj );
                             }
-                            else if( rItem.m_aObjClass.equalsIgnoreAsciiCaseAscii( pCollectionStr ) )
+                            else if( rItem.m_aObjClass.equalsIgnoreAsciiCase( pCollectionStr ) )
                             {
                                 BasicCollection* pNewCollection = new BasicCollection( OUString(pCollectionStr) );
                                 pNewCollection->SetName( rItem.m_aObjName );
diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index d384105..2e275ac 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -74,8 +74,6 @@ COMMENT: Visual-Basic treats the following (invalid) format-strings
 #define BASICFORMAT_TRUEFALSE       "True/False"
 #define BASICFORMAT_ONOFF           "On/Off"
 
-#define EMPTYFORMATSTRING           ""
-
 // Comment: Visual-Basic has a maximum of 12 positions after the
 //          decimal point for floating-point-numbers.
 // all format-strings are compatible to Visual-Basic:
@@ -388,9 +386,7 @@ OUString SbxBasicFormater::GetPosFormatString( const OUString& sFormatStrg, bool
         return sFormatStrg.copy( 0,nPos );
     }
 
-    OUString aRetStr;
-    aRetStr = OUString::createFromAscii( EMPTYFORMATSTRING );
-    return aRetStr;
+    return OUString();
 }
 
 // see also GetPosFormatString()
@@ -415,9 +411,7 @@ OUString SbxBasicFormater::GetNegFormatString( const OUString& sFormatStrg, bool
             return sTempStrg.copy( 0,nPos );
         }
     }
-    OUString aRetStr;
-    aRetStr = OUString::createFromAscii( EMPTYFORMATSTRING );
-    return aRetStr;
+    return OUString();
 }
 
 // see also GetPosFormatString()
@@ -448,9 +442,7 @@ OUString SbxBasicFormater::Get0FormatString( const OUString& sFormatStrg, bool &
         }
     }
 
-    OUString aRetStr;
-    aRetStr = OUString::createFromAscii( EMPTYFORMATSTRING );
-    return aRetStr;
+    return OUString();
 }
 
 // see also GetPosFormatString()
@@ -477,9 +469,7 @@ OUString SbxBasicFormater::GetNullFormatString( const OUString& sFormatStrg, boo
         }
     }
 
-    OUString aRetStr;
-    aRetStr = OUString::createFromAscii( EMPTYFORMATSTRING );
-    return aRetStr;
+    return OUString();
 }
 
 // returns value <> 0 in case of an error
@@ -974,7 +964,7 @@ OUString SbxBasicFormater::BasicFormat( double dNumber, const OUString& _sFormat
     // analyse format-string concerning predefined formats:
     if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_GENERALNUMBER ) )
     {
-        sFormatStrg = OUString::createFromAscii( GENERALNUMBER_FORMAT );
+        sFormatStrg = GENERALNUMBER_FORMAT;
     }
     if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_CURRENCY ) )
     {
@@ -982,19 +972,19 @@ OUString SbxBasicFormater::BasicFormat( double dNumber, const OUString& _sFormat
     }
     if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_FIXED ) )
     {
-        sFormatStrg = OUString::createFromAscii( FIXED_FORMAT );
+        sFormatStrg = FIXED_FORMAT;
     }
     if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_STANDARD ) )
     {
-        sFormatStrg = OUString::createFromAscii( STANDARD_FORMAT );
+        sFormatStrg = STANDARD_FORMAT;
     }
     if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_PERCENT ) )
     {
-        sFormatStrg = OUString::createFromAscii( PERCENT_FORMAT );
+        sFormatStrg = PERCENT_FORMAT;
     }
     if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_SCIENTIFIC ) )
     {
-        sFormatStrg = OUString::createFromAscii( SCIENTIFIC_FORMAT );
+        sFormatStrg = SCIENTIFIC_FORMAT;
     }
     if( sFormatStrg.equalsIgnoreAsciiCase( BASICFORMAT_YESNO ) )
     {
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 87bf0c0..9b44890 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -806,7 +806,7 @@ bool SbxValue::SetType( SbxDataType t )
                         sal_uInt16 nSlotId = pThisVar
                                     ? ( (sal_Int16) ( pThisVar->GetUserData() & 0xFFFF ) )
                                     : 0;
-                        DBG_ASSERT( nSlotId != 5345 || pThisVar->GetName().equalsAscii("Parent"),
+                        DBG_ASSERT( nSlotId != 5345 || pThisVar->GetName() == "Parent",
                                     "SID_PARENTOBJECT is not named 'Parent'" );
                         bool bParentProp = 5345 == nSlotId;
                         if ( !bParentProp )
commit 66b4128f89680442911c2491a72c74b6856332c5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 12 10:20:55 2014 +0100

    avmedia: Use appropriate OUString functions on string constants
    
    Change-Id: I1abbe02b6a449d61d6bed5a7659f81ec4cf985fe

diff --git a/avmedia/source/macavf/macavfuno.mm b/avmedia/source/macavf/macavfuno.mm
index 0b95913..d313324 100644
--- a/avmedia/source/macavf/macavfuno.mm
+++ b/avmedia/source/macavf/macavfuno.mm
@@ -34,11 +34,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL avmediaMacAVF_component_getFactor
 
     if( rtl_str_compare( pImplName, AVMEDIA_MACAVF_MANAGER_IMPLEMENTATIONNAME ) == 0 )
     {
-        const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( AVMEDIA_MACAVF_MANAGER_SERVICENAME ) );
+        const ::rtl::OUString aServiceName( AVMEDIA_MACAVF_MANAGER_SERVICENAME );
 
         xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory(
                         reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ),
-                        ::rtl::OUString::createFromAscii( AVMEDIA_MACAVF_MANAGER_IMPLEMENTATIONNAME ),
+                        AVMEDIA_MACAVF_MANAGER_IMPLEMENTATIONNAME,
                         create_MediaPlayer, uno::Sequence< ::rtl::OUString >( &aServiceName, 1 ) ) );
     }
 
diff --git a/avmedia/source/vlc/wrapper/SymbolLoader.hxx b/avmedia/source/vlc/wrapper/SymbolLoader.hxx
index 2426dea..e506f26 100644
--- a/avmedia/source/vlc/wrapper/SymbolLoader.hxx
+++ b/avmedia/source/vlc/wrapper/SymbolLoader.hxx
@@ -93,9 +93,9 @@ namespace
     bool InitApiMap( const ApiMap ( &pMap )[N]  )
     {
 #if defined( LINUX ) || defined( MACOSX )
-        const OUString& fullPath = OUString::createFromAscii(LibName);
+        OUString const fullPath(LibName);
 #elif defined( WNT )
-        const OUString& fullPath = GetVLCPath() + OUString::createFromAscii(LibName);
+        OUString const fullPath(GetVLCPath() + LibName);
 #endif
         SAL_INFO("avmedia", fullPath);
 


More information about the Libreoffice-commits mailing list