clang-tidy performance-unnecessary-value-param in basic

Change-Id: I997213ca28efc2df04d454ffaf3c81c9cbad09ac
This commit is contained in:
Noel Grandin 2016-04-11 10:20:19 +02:00
parent bfff081e74
commit f678b82f0e
10 changed files with 34 additions and 42 deletions

View File

@ -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!" );

View File

@ -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();

View File

@ -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 );

View File

@ -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);

View File

@ -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

View File

@ -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();

View File

@ -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() );

View File

@ -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,

View File

@ -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() )

View File

@ -295,7 +295,7 @@ public:
const OUString& GetDeclareClassName();
void SetDeclareClassName( const OUString& );
void SetComListener( css::uno::Reference< css::uno::XInterface > xComListener,
void SetComListener( const css::uno::Reference< css::uno::XInterface >& xComListener,
StarBASIC* pParentBasic );
void ClearComListener();