summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-12-12 10:21:45 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-12-12 10:21:45 +0100
commit898c4147000edc83598523cfe25d81ecdcfe82c6 (patch)
tree42a63c0e1ca5d9eb97f5218ee56fd5bd1747d4fb
parent66b4128f89680442911c2491a72c74b6856332c5 (diff)
basic: Use appropriate OUString functions on string constants
Change-Id: Ied7e5eba39672363065083493bd5e60449fda371
-rw-r--r--basic/source/basmgr/basmgr.cxx11
-rw-r--r--basic/source/classes/eventatt.cxx8
-rw-r--r--basic/source/classes/sb.cxx28
-rw-r--r--basic/source/runtime/runtime.cxx4
-rw-r--r--basic/source/sbx/sbxform.cxx28
-rw-r--r--basic/source/sbx/sbxvalue.cxx2
6 files changed, 35 insertions, 46 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 8029d1851a28..8c1eafb9e435 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 d7f97ab7795c..a60c5c56d0ee 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 c24828ae691e..4f16e2ad9063 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 81220f40cda5..ec6b1f5e4b6c 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 d38410566e7b..2e275ac606b2 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 87bf0c0bbde1..9b44890d54db 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 )