summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-04-12 16:39:03 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-04-18 07:37:31 +0000
commit789055bc2acb4c71483fd60ea258d158bd5aec10 (patch)
tree7849de841a71f667a30b2a971ad0c3d406110396 /toolkit
parent150ac9cf05ed9da6a2af5bc3f820280fd853e519 (diff)
clang-tidy performance-unnecessary-copy-initialization
probably not much performance benefit, but it sure is good at identifying leftover intermediate variables from previous refactorings. Change-Id: I3ce16fe496ac2733c1cb0a35f74c0fc9193cc657 Reviewed-on: https://gerrit.libreoffice.org/24026 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/awt/stylesettings.cxx10
-rw-r--r--toolkit/source/awt/vclxfont.cxx3
-rw-r--r--toolkit/source/awt/vclxwindows.cxx3
-rw-r--r--toolkit/source/controls/controlmodelcontainerbase.cxx2
-rw-r--r--toolkit/source/controls/eventcontainer.cxx4
-rw-r--r--toolkit/source/controls/unocontrolbase.cxx2
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx4
-rw-r--r--toolkit/source/controls/unocontrols.cxx6
-rw-r--r--toolkit/source/helper/listenermultiplexer.cxx3
9 files changed, 17 insertions, 20 deletions
diff --git a/toolkit/source/awt/stylesettings.cxx b/toolkit/source/awt/stylesettings.cxx
index 69f486f728c8..0aad2ed2e0b1 100644
--- a/toolkit/source/awt/stylesettings.cxx
+++ b/toolkit/source/awt/stylesettings.cxx
@@ -136,7 +136,7 @@ namespace toolkit
{
const vcl::Window* pWindow = i_rData.pOwningWindow->GetWindow();
const AllSettings aAllSettings = pWindow->GetSettings();
- const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
return (aStyleSettings.*i_pGetter)().GetColor();
}
@@ -154,7 +154,7 @@ namespace toolkit
{
const vcl::Window* pWindow = i_rData.pOwningWindow->GetWindow();
const AllSettings aAllSettings = pWindow->GetSettings();
- const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
return VCLUnoHelper::CreateFontDescriptor( (aStyleSettings.*i_pGetter)() );
}
@@ -387,7 +387,7 @@ namespace toolkit
StyleMethodGuard aGuard( *m_pData );
const vcl::Window* pWindow = m_pData->pOwningWindow->GetWindow();
const AllSettings aAllSettings = pWindow->GetSettings();
- const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
return aStyleSettings.GetFaceGradientColor().GetColor();
}
@@ -691,7 +691,7 @@ namespace toolkit
StyleMethodGuard aGuard( *m_pData );
const vcl::Window* pWindow = m_pData->pOwningWindow->GetWindow();
const AllSettings aAllSettings = pWindow->GetSettings();
- const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
return aStyleSettings.GetSeparatorColor().GetColor();
}
@@ -757,7 +757,7 @@ namespace toolkit
StyleMethodGuard aGuard( *m_pData );
const vcl::Window* pWindow = m_pData->pOwningWindow->GetWindow();
const AllSettings aAllSettings = pWindow->GetSettings();
- const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ const StyleSettings& aStyleSettings = aAllSettings.GetStyleSettings();
return aStyleSettings.GetHighContrastMode();
}
diff --git a/toolkit/source/awt/vclxfont.cxx b/toolkit/source/awt/vclxfont.cxx
index bea6aed231ac..6504346055b6 100644
--- a/toolkit/source/awt/vclxfont.cxx
+++ b/toolkit/source/awt/vclxfont.cxx
@@ -205,8 +205,7 @@ sal_Bool VCLXFont::hasGlyphs( const OUString& aText )
OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice );
if ( pOutDev )
{
- OUString aStr( aText );
- if ( pOutDev->HasGlyphs( maFont, aStr ) == -1 )
+ if ( pOutDev->HasGlyphs( maFont, aText ) == -1 )
{
return sal_True;
}
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 53ccd5184750..bf946a1c8748 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -1725,8 +1725,7 @@ void VCLXListBox::selectItem( const OUString& rItemText, sal_Bool bSelect ) thro
VclPtr< ListBox > pBox = GetAs< ListBox >();
if ( pBox )
{
- OUString aItemText( rItemText );
- selectItemPos( pBox->GetEntryPos( aItemText ), bSelect );
+ selectItemPos( pBox->GetEntryPos( rItemText ), bSelect );
}
}
diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx
index 5358cc26e8d2..8be65bfa7a7c 100644
--- a/toolkit/source/controls/controlmodelcontainerbase.cxx
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -566,7 +566,7 @@ void ControlModelContainerBase::insertByName( const OUString& aName, const Any&
Reference< beans::XPropertySetInfo > xPropInfo = xProps.get()->getPropertySetInfo();
- OUString sImageSourceProperty = GetPropertyName( BASEPROPERTY_IMAGEURL );
+ const OUString& sImageSourceProperty = GetPropertyName( BASEPROPERTY_IMAGEURL );
if ( xPropInfo.get()->hasPropertyByName( sImageSourceProperty ) && ImplHasProperty(BASEPROPERTY_DIALOGSOURCEURL) )
{
Any aUrl = xProps.get()->getPropertyValue( sImageSourceProperty );
diff --git a/toolkit/source/controls/eventcontainer.cxx b/toolkit/source/controls/eventcontainer.cxx
index 8b495da657a3..418e3370431f 100644
--- a/toolkit/source/controls/eventcontainer.cxx
+++ b/toolkit/source/controls/eventcontainer.cxx
@@ -87,7 +87,7 @@ sal_Bool NameContainer_Impl::hasByName( const OUString& aName )
void NameContainer_Impl::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();
@@ -114,7 +114,7 @@ void NameContainer_Impl::replaceByName( const OUString& aName, const Any& aEleme
void NameContainer_Impl::insertByName( const OUString& aName, const Any& aElement )
throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException, std::exception)
{
- Type aAnyType = aElement.getValueType();
+ const Type& aAnyType = aElement.getValueType();
if( mType != aAnyType )
throw IllegalArgumentException();
diff --git a/toolkit/source/controls/unocontrolbase.cxx b/toolkit/source/controls/unocontrolbase.cxx
index 81732d148cdc..0993d75a7d28 100644
--- a/toolkit/source/controls/unocontrolbase.cxx
+++ b/toolkit/source/controls/unocontrolbase.cxx
@@ -34,7 +34,7 @@ using namespace com::sun::star;
bool UnoControlBase::ImplHasProperty( sal_uInt16 nPropId )
{
- OUString aPropName( GetPropertyName( nPropId ) );
+ const OUString& aPropName( GetPropertyName( nPropId ) );
return ImplHasProperty( aPropName );
}
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index fd711d1cd3c3..57bd9dbe8a20 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -683,7 +683,7 @@ void UnoControlModel::write( const css::uno::Reference< css::io::XObjectOutputSt
OUString sTypeName( rType.getTypeName() );
sMessage += OString( sTypeName.getStr(), sTypeName.getLength(), RTL_TEXTENCODING_ASCII_US );
sMessage += "'.\n(Currently handling property '";
- OUString sPropertyName( GetPropertyName( *it ) );
+ const OUString& sPropertyName( GetPropertyName( *it ) );
sMessage += OString( sPropertyName.getStr(), sPropertyName.getLength(), osl_getThreadTextEncoding() );
sMessage += "'.)";
OSL_FAIL( sMessage.getStr() );
@@ -895,7 +895,7 @@ void UnoControlModel::read( const css::uno::Reference< css::io::XObjectInputStre
OUString sTypeName( pType->getTypeName() );
sMessage += OString( sTypeName.getStr(), sTypeName.getLength(), RTL_TEXTENCODING_ASCII_US );
sMessage += "'.\n(Currently handling property '";
- OUString sPropertyName( GetPropertyName( nPropId ) );
+ const OUString& sPropertyName( GetPropertyName( nPropId ) );
sMessage += OString( sPropertyName.getStr(), sPropertyName.getLength(), osl_getThreadTextEncoding() );
sMessage += "'.)";
OSL_FAIL( sMessage.getStr() );
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
index 7fa42777cb70..6597313c7ba0 100644
--- a/toolkit/source/controls/unocontrols.cxx
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -2753,7 +2753,7 @@ void UnoListBoxControl::updateFromModel()
// notify the change of the SelectedItems property, again. While our base class, in updateFromModel,
// already did this, our peer(s) can only legitimately set the selection after they have the string
// item list, which we just notified with the itemListChanged call.
- const OUString sSelectedItemsPropName( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ) );
+ const OUString& sSelectedItemsPropName( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ) );
ImplSetPeerProperty( sSelectedItemsPropName, ImplGetPropertyValue( sSelectedItemsPropName ) );
}
@@ -3773,7 +3773,7 @@ void UnoDateFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::Runt
// also change the text property (#i25106#)
if ( xPeer.is() )
{
- OUString sTextPropertyName = GetPropertyName( BASEPROPERTY_TEXT );
+ const OUString& sTextPropertyName = GetPropertyName( BASEPROPERTY_TEXT );
ImplSetPropertyValue( sTextPropertyName, xPeer->getProperty( sTextPropertyName ), false );
}
@@ -4055,7 +4055,7 @@ void UnoTimeFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::Runt
{
// also change the text property (#i25106#)
uno::Reference< awt::XVclWindowPeer > xPeer( getPeer(), uno::UNO_QUERY );
- OUString sTextPropertyName = GetPropertyName( BASEPROPERTY_TEXT );
+ const OUString& sTextPropertyName = GetPropertyName( BASEPROPERTY_TEXT );
ImplSetPropertyValue( sTextPropertyName, xPeer->getProperty( sTextPropertyName ), false );
// re-calc the Time property
diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx
index b744864c258c..2cd81736eb72 100644
--- a/toolkit/source/helper/listenermultiplexer.cxx
+++ b/toolkit/source/helper/listenermultiplexer.cxx
@@ -164,7 +164,6 @@ IMPL_TABLISTENERMULTIPLEXER_LISTENERMETHOD_BODY_1PARAM( TabListenerMultiplexer,
void TabListenerMultiplexer::changed( sal_Int32 evt, const css::uno::Sequence< css::beans::NamedValue >& evt2 ) throw(css::uno::RuntimeException, std::exception)
{
sal_Int32 aMulti( evt );
- css::uno::Sequence< css::beans::NamedValue > aMulti2( evt2 );
::comphelper::OInterfaceIteratorHelper2 aIt( *this );
while( aIt.hasMoreElements() )
{
@@ -172,7 +171,7 @@ void TabListenerMultiplexer::changed( sal_Int32 evt, const css::uno::Sequence< c
static_cast< css::awt::XTabListener* >( aIt.next() ) );
try
{
- xListener->changed( aMulti, aMulti2 );
+ xListener->changed( aMulti, evt2 );
}
catch(const css::lang::DisposedException& e)
{