diff options
author | Noel Grandin <noel@peralex.com> | 2016-04-11 10:20:19 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-04-11 11:38:57 +0200 |
commit | f678b82f0e4dea47dfc8938f01442b6eb1ce23ad (patch) | |
tree | ac8e998a3857c4d8a51cfb90e7644de2f40e3829 /basic | |
parent | bfff081e74ad06a7e353669eec345c6440db57cb (diff) |
clang-tidy performance-unnecessary-value-param in basic
Change-Id: I997213ca28efc2df04d454ffaf3c81c9cbad09ac
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/basmgr/basicmanagerrepository.cxx | 4 | ||||
-rw-r--r-- | basic/source/basmgr/basmgr.cxx | 24 | ||||
-rw-r--r-- | basic/source/classes/sbunoobj.cxx | 23 | ||||
-rw-r--r-- | basic/source/inc/sbunoobj.hxx | 8 | ||||
-rw-r--r-- | basic/source/runtime/runtime.cxx | 3 | ||||
-rw-r--r-- | basic/source/sbx/sbxvar.cxx | 2 | ||||
-rw-r--r-- | basic/source/uno/dlgcont.cxx | 2 | ||||
-rw-r--r-- | basic/source/uno/namecont.cxx | 6 | ||||
-rw-r--r-- | basic/source/uno/scriptcont.cxx | 2 |
9 files changed, 33 insertions, 41 deletions
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 559ed3ab5e44..7737ec8e6874 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -183,7 +183,7 @@ namespace basic /** removes the Model/BasicManager pair given by iterator from our store */ - void impl_removeFromRepository( BasicManagerStore::iterator _pos ); + void impl_removeFromRepository( const BasicManagerStore::iterator& _pos ); private: StarBASIC* impl_getDefaultAppBasicLibrary(); @@ -520,7 +520,7 @@ namespace basic } - void ImplRepository::impl_removeFromRepository( BasicManagerStore::iterator _pos ) + void ImplRepository::impl_removeFromRepository( const BasicManagerStore::iterator& _pos ) { OSL_PRECOND( _pos != m_aStore.end(), "ImplRepository::impl_removeFromRepository: invalid position!" ); diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 4ac855666ff2..dd8602fe58b7 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -149,8 +149,8 @@ public: , maLibName( aLibName ) {} static void insertLibraryImpl( const uno::Reference< script::XLibraryContainer >& xScriptCont, BasicManager* pMgr, - uno::Any aLibAny, const OUString& aLibName ); - static void addLibraryModulesImpl( BasicManager* pMgr, uno::Reference< container::XNameAccess > xLibNameAccess, + const uno::Any& aLibAny, const OUString& aLibName ); + static void addLibraryModulesImpl( BasicManager* pMgr, const uno::Reference< container::XNameAccess >& xLibNameAccess, const OUString& aLibName ); @@ -172,7 +172,7 @@ public: void BasMgrContainerListenerImpl::insertLibraryImpl( const uno::Reference< script::XLibraryContainer >& xScriptCont, - BasicManager* pMgr, uno::Any aLibAny, const OUString& aLibName ) + BasicManager* pMgr, const uno::Any& aLibAny, const OUString& aLibName ) { Reference< container::XNameAccess > xLibNameAccess; aLibAny >>= xLibNameAccess; @@ -203,7 +203,7 @@ void BasMgrContainerListenerImpl::insertLibraryImpl( const uno::Reference< scrip void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager* pMgr, - uno::Reference< container::XNameAccess > xLibNameAccess, const OUString& aLibName ) + const uno::Reference< container::XNameAccess >& xLibNameAccess, const OUString& aLibName ) { uno::Sequence< OUString > aModuleNames = xLibNameAccess->getElementNames(); sal_Int32 nModuleCount = aModuleNames.getLength(); @@ -840,8 +840,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage ) if ( !aLibs.isEmpty() ) { - OUString aCurStorageName( aStorName ); - INetURLObject aCurStorage( aCurStorageName, INetProtocol::File ); + INetURLObject aCurStorage( aStorName, INetProtocol::File ); sal_Int32 nLibs = comphelper::string::getTokenCount(aLibs, LIB_SEP); for ( sal_Int32 nLib = 0; nLib < nLibs; nLib++ ) { @@ -1544,17 +1543,16 @@ namespace SbMethod* lcl_queryMacro( BasicManager* i_manager, OUString const& i_fullyQualifiedName ) { sal_Int32 nLast = 0; - const OUString sParse = i_fullyQualifiedName; - OUString sLibName = sParse.getToken( (sal_Int32)0, (sal_Unicode)'.', nLast ); - OUString sModule = sParse.getToken( (sal_Int32)0, (sal_Unicode)'.', nLast ); + OUString sLibName = i_fullyQualifiedName.getToken( (sal_Int32)0, (sal_Unicode)'.', nLast ); + OUString sModule = i_fullyQualifiedName.getToken( (sal_Int32)0, (sal_Unicode)'.', nLast ); OUString sMacro; if(nLast >= 0) { - sMacro = sParse.copy(nLast); + sMacro = i_fullyQualifiedName.copy(nLast); } else { - sMacro = sParse; + sMacro = i_fullyQualifiedName; } utl::TransliterationWrapper& rTransliteration = SbGlobal::GetTransliteration(); @@ -1846,7 +1844,7 @@ void ModuleContainer_Impl::insertByName( const OUString& aName, const uno::Any& throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException, std::exception) { uno::Type aModuleType = cppu::UnoType<script::XStarBasicModuleInfo>::get(); - uno::Type aAnyType = aElement.getValueType(); + const uno::Type& aAnyType = aElement.getValueType(); if( aModuleType != aAnyType ) { throw lang::IllegalArgumentException(); @@ -2022,7 +2020,7 @@ void DialogContainer_Impl::insertByName( const OUString& aName, const uno::Any& { (void)aName; uno::Type aModuleType = cppu::UnoType<script::XStarBasicDialogInfo>::get(); - uno::Type aAnyType = aElement.getValueType(); + const uno::Type& aAnyType = aElement.getValueType(); if( aModuleType != aAnyType ) { throw lang::IllegalArgumentException(); diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 610622cf4984..a39697d1d933 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -523,7 +523,7 @@ SbxDataType unoToSbxType( const Reference< XIdlClass >& xIdlClass ) static void implSequenceToMultiDimArray( SbxDimArray*& pArray, Sequence< sal_Int32 >& indices, Sequence< sal_Int32 >& sizes, const Any& aValue, sal_Int32& dimension, bool bIsZeroIndex, Type* pType = nullptr ) { - Type aType = aValue.getValueType(); + const Type& aType = aValue.getValueType(); TypeClass eTypeClass = aType.getTypeClass(); sal_Int32 dimCopy = dimension; @@ -605,7 +605,7 @@ static void implSequenceToMultiDimArray( SbxDimArray*& pArray, Sequence< sal_Int void unoToSbxValue( SbxVariable* pVar, const Any& aValue ) { - Type aType = aValue.getValueType(); + const Type& aType = aValue.getValueType(); TypeClass eTypeClass = aType.getTypeClass(); switch( eTypeClass ) { @@ -2671,11 +2671,10 @@ SbxVariable* SbUnoObject::Find( const OUString& rName, SbxClassType t ) try { Reference< XNameAccess > xNameAccess( mxUnoAccess->queryAdapter( cppu::UnoType<XPropertySet>::get()), UNO_QUERY ); - OUString aUName2( rName ); - if( xNameAccess.is() && xNameAccess->hasByName( aUName2 ) ) + if( xNameAccess.is() && xNameAccess->hasByName( rName ) ) { - Any aAny = xNameAccess->getByName( aUName2 ); + Any aAny = xNameAccess->getByName( rName ); // ATTENTION: Because of XNameAccess, the variable generated here // may not be included as a fixed property in the object and therefore @@ -3328,12 +3327,11 @@ VBAConstantHelper::isVBAConstantType( const OUString& rName ) { init(); bool bConstant = false; - OUString sKey( rName ); VBAConstantsVector::const_iterator it = aConstCache.begin(); for( ; it != aConstCache.end(); ++it ) { - if( sKey.equalsIgnoreAsciiCase( *it ) ) + if( rName.equalsIgnoreAsciiCase( *it ) ) { bConstant = true; break; @@ -3348,9 +3346,7 @@ VBAConstantHelper::getVBAConstant( const OUString& rName ) SbxVariable* pConst = nullptr; init(); - OUString sKey( rName ); - - VBAConstantsHash::const_iterator it = aConstHash.find( sKey.toAsciiLowerCase() ); + VBAConstantsHash::const_iterator it = aConstHash.find( rName.toAsciiLowerCase() ); if ( it != aConstHash.end() ) { @@ -3399,8 +3395,7 @@ SbxVariable* SbUnoClass::Find( const OUString& rName, SbxClassType ) if( m_xClass.is() ) { // Is it a field(?) - OUString aUStr( rName ); - Reference< XIdlField > xField = m_xClass->getField( aUStr ); + Reference< XIdlField > xField = m_xClass->getField( rName ); Reference< XIdlClass > xClass; if( xField.is() ) { @@ -4499,7 +4494,7 @@ void SAL_CALL ModuleInvocationProxy::removeEventListener( const Reference< XEven Reference< XInterface > createComListener( const Any& aControlAny, const OUString& aVBAType, - const OUString& aPrefix, SbxObjectRef xScopeObj ) + const OUString& aPrefix, const SbxObjectRef& xScopeObj ) { Reference< XInterface > xRet; @@ -4572,7 +4567,7 @@ static StarBasicDisposeItem* lcl_getOrCreateItemForBasic( StarBASIC* pBasic ) } void registerComponentToBeDisposedForBasic - ( Reference< XComponent > xComponent, StarBASIC* pBasic ) + ( const Reference< XComponent >& xComponent, StarBASIC* pBasic ) { StarBasicDisposeItem* pItem = lcl_getOrCreateItemForBasic( pBasic ); pItem->m_vComImplementsObjects.push_back( xComponent ); diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx index 457fd07ca0c4..cbc3c6f57499 100644 --- a/basic/source/inc/sbunoobj.hxx +++ b/basic/source/inc/sbunoobj.hxx @@ -38,7 +38,7 @@ #include <vector> #include <map> -void registerComponentToBeDisposedForBasic( css::uno::Reference< css::lang::XComponent > xComponent, StarBASIC* pBasic ); +void registerComponentToBeDisposedForBasic( const css::uno::Reference< css::lang::XComponent >& xComponent, StarBASIC* pBasic ); class StructRefInfo { @@ -389,9 +389,9 @@ public: SbxVariable* getDefaultProp( SbxVariable* pRef ); css::uno::Reference< css::uno::XInterface > createComListener( const css::uno::Any& aControlAny, - const OUString& aVBAType, - const OUString& aPrefix, - SbxObjectRef xScopeObj ); + const OUString& aVBAType, + const OUString& aPrefix, + const SbxObjectRef& xScopeObj ); bool checkUnoObjectType(SbUnoObject& refVal, const OUString& aClass); diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index dade0d5a5610..c643df737884 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -1899,10 +1899,9 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b { Any aControlAny = pUnoObj->getUnoAny(); OUString aDeclareClassName = refVar->GetDeclareClassName(); - OUString aVBAType = aDeclareClassName; OUString aPrefix = refVar->GetName(); SbxObjectRef xScopeObj = refVar->GetParent(); - xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj ); + xComListener = createComListener( aControlAny, aDeclareClassName, aPrefix, xScopeObj ); refVal->SetDeclareClassName( aDeclareClassName ); refVal->SetComListener( xComListener, &rBasic ); // Hold reference diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 20361375a669..bc5c8f2668f9 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -450,7 +450,7 @@ void SbxVariable::SetDeclareClassName( const OUString& rDeclareClassName ) pImpl->m_aDeclareClassName = rDeclareClassName; } -void SbxVariable::SetComListener( css::uno::Reference< css::uno::XInterface > xComListener, +void SbxVariable::SetComListener( const css::uno::Reference< css::uno::XInterface >& xComListener, StarBASIC* pParentBasic ) { SbxVariableImpl* pImpl = getImpl(); diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx index ba60807989fe..b5b20fff5578 100644 --- a/basic/source/uno/dlgcont.cxx +++ b/basic/source/uno/dlgcont.cxx @@ -112,7 +112,7 @@ bool SAL_CALL SfxDialogLibraryContainer::isLibraryElementValid(const Any& rEleme } bool writeOasis2OOoLibraryElement( - Reference< XInputStream > xInput, Reference< XOutputStream > xOutput ) + const Reference< XInputStream >& xInput, const Reference< XOutputStream >& xOutput ) { Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 5945253be971..45d35f0af727 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -144,7 +144,7 @@ sal_Bool NameContainer::hasByName( const OUString& aName ) void NameContainer::replaceByName( const OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException, std::exception) { - Type aAnyType = aElement.getValueType(); + const Type& aAnyType = aElement.getValueType(); if( mType != aAnyType ) { throw IllegalArgumentException(); @@ -200,7 +200,7 @@ void NameContainer::insertCheck(const OUString& aName, const Any& aElement) void NameContainer::insertNoCheck(const OUString& aName, const Any& aElement) throw(IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception) { - Type aAnyType = aElement.getValueType(); + const Type& aAnyType = aElement.getValueType(); if( mType != aAnyType ) { throw IllegalArgumentException(); @@ -584,7 +584,7 @@ static void checkAndCopyFileImpl( const INetURLObject& rSourceFolderInetObj, const INetURLObject& rTargetFolderInetObj, const OUString& rCheckFileName, const OUString& rCheckExtension, - Reference< XSimpleFileAccess3 > xSFI ) + const Reference< XSimpleFileAccess3 >& xSFI ) { INetURLObject aTargetFolderInetObj( rTargetFolderInetObj ); aTargetFolderInetObj.insertName( rCheckFileName, true, INetURLObject::LAST_SEGMENT, diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index 87a106ead62d..64fdfe0fa0d2 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -546,7 +546,7 @@ void SAL_CALL SfxScriptLibraryContainer::changeLibraryPassword( const OUString& } -void setStreamKey( uno::Reference< io::XStream > xStream, const OUString& aPass ) +void setStreamKey( const uno::Reference< io::XStream >& xStream, const OUString& aPass ) { uno::Reference< embed::XEncryptionProtectedSource > xEncrStream( xStream, uno::UNO_QUERY ); if ( xEncrStream.is() ) |