From 2a1fb4401da16f6a18c0bd05fe4b460a3048f9b5 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 22 Dec 2017 14:23:16 +0200 Subject: loplugin:passstuffbyref improved returns improve the detection of stuff we can return by const &, instead of by copying Change-Id: I479ae89d0413125a8295cc3cddbc0017ed61ed69 Reviewed-on: https://gerrit.libreoffice.org/46915 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../source/accessibility/accessiblerelationsethelper.cxx | 4 ++-- unotools/source/config/eventcfg.cxx | 4 ++-- unotools/source/config/moduleoptions.cxx | 12 ++++++------ unotools/source/ucbhelper/ucblockbytes.hxx | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'unotools') diff --git a/unotools/source/accessibility/accessiblerelationsethelper.cxx b/unotools/source/accessibility/accessiblerelationsethelper.cxx index 07456acf43ac..b93192af973e 100644 --- a/unotools/source/accessibility/accessiblerelationsethelper.cxx +++ b/unotools/source/accessibility/accessiblerelationsethelper.cxx @@ -39,7 +39,7 @@ public: sal_Int32 getRelationCount() const; /// @throws lang::IndexOutOfBoundsException /// @throws uno::RuntimeException - AccessibleRelation getRelation( sal_Int32 nIndex ) const; + AccessibleRelation const & getRelation( sal_Int32 nIndex ) const; /// @throws uno::RuntimeException bool containsRelation( sal_Int16 aRelationType ) const; /// @throws uno::RuntimeException @@ -65,7 +65,7 @@ sal_Int32 AccessibleRelationSetHelperImpl::getRelationCount() const return maRelations.size(); } -AccessibleRelation AccessibleRelationSetHelperImpl::getRelation( sal_Int32 nIndex ) const +AccessibleRelation const & AccessibleRelationSetHelperImpl::getRelation( sal_Int32 nIndex ) const { if ((nIndex < 0) || (static_cast(nIndex) >= maRelations.size())) throw lang::IndexOutOfBoundsException(); diff --git a/unotools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx index 98cfd1a76dae..8451b3a93501 100644 --- a/unotools/source/config/eventcfg.cxx +++ b/unotools/source/config/eventcfg.cxx @@ -111,7 +111,7 @@ public: /// @throws css::uno::RuntimeException bool hasByName( const OUString& aName ); /// @throws css::uno::RuntimeException - static css::uno::Type getElementType( ); + static css::uno::Type const & getElementType( ); /// @throws css::uno::RuntimeException bool hasElements() const; OUString const & GetEventName( GlobalEventId nID ) const; @@ -300,7 +300,7 @@ bool GlobalEventConfig_Impl::hasByName( const OUString& aName ) return pos != m_supportedEvents.end(); } -Type GlobalEventConfig_Impl::getElementType( ) +Type const & GlobalEventConfig_Impl::getElementType( ) { //DF definitely not sure about this?? return cppu::UnoType>::get(); diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx index a9ff6b5eaecc..1e3bcaf5b32d 100644 --- a/unotools/source/config/moduleoptions.cxx +++ b/unotools/source/config/moduleoptions.cxx @@ -256,10 +256,10 @@ class SvtModuleOptions_Impl : public ::utl::ConfigItem bool IsModuleInstalled ( SvtModuleOptions::EModule eModule ) const; css::uno::Sequence < OUString > GetAllServiceNames(); - OUString GetFactoryName ( SvtModuleOptions::EFactory eFactory ) const; - OUString GetFactoryStandardTemplate( SvtModuleOptions::EFactory eFactory ) const; + OUString const & GetFactoryName ( SvtModuleOptions::EFactory eFactory ) const; + OUString const & GetFactoryStandardTemplate( SvtModuleOptions::EFactory eFactory ) const; static OUString GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory eFactory ); - OUString GetFactoryDefaultFilter ( SvtModuleOptions::EFactory eFactory ) const; + OUString const & GetFactoryDefaultFilter ( SvtModuleOptions::EFactory eFactory ) const; bool IsDefaultFilterReadonly( SvtModuleOptions::EFactory eFactory ) const; sal_Int32 GetFactoryIcon ( SvtModuleOptions::EFactory eFactory ) const; static bool ClassifyFactoryByName ( const OUString& sName , @@ -439,7 +439,7 @@ css::uno::Sequence < OUString > SvtModuleOptions_Impl::GetAllServiceNames() return comphelper::containerToSequence(aVec); } -OUString SvtModuleOptions_Impl::GetFactoryName( SvtModuleOptions::EFactory eFactory ) const +OUString const & SvtModuleOptions_Impl::GetFactoryName( SvtModuleOptions::EFactory eFactory ) const { return m_lFactories[eFactory].getFactory(); } @@ -482,7 +482,7 @@ OUString SvtModuleOptions::GetFactoryShortName(SvtModuleOptions::EFactory eFacto return sShortName; } -OUString SvtModuleOptions_Impl::GetFactoryStandardTemplate( SvtModuleOptions::EFactory eFactory ) const +OUString const & SvtModuleOptions_Impl::GetFactoryStandardTemplate( SvtModuleOptions::EFactory eFactory ) const { return m_lFactories[eFactory].getTemplateFile(); } @@ -524,7 +524,7 @@ OUString SvtModuleOptions_Impl::GetFactoryEmptyDocumentURL( SvtModuleOptions::EF return sURL; } -OUString SvtModuleOptions_Impl::GetFactoryDefaultFilter( SvtModuleOptions::EFactory eFactory ) const +OUString const & SvtModuleOptions_Impl::GetFactoryDefaultFilter( SvtModuleOptions::EFactory eFactory ) const { return m_lFactories[eFactory].getDefaultFilter(); } diff --git a/unotools/source/ucbhelper/ucblockbytes.hxx b/unotools/source/ucbhelper/ucblockbytes.hxx index 71ebf42ed088..164c551d8dbf 100644 --- a/unotools/source/ucbhelper/ucblockbytes.hxx +++ b/unotools/source/ucbhelper/ucblockbytes.hxx @@ -111,7 +111,7 @@ public: void SetError( ErrCode nError ) { m_nError = nError; } - ErrCode GetError() const + ErrCode const & GetError() const { return m_nError; } // calling this method delegates the responsibility to call closeinput to the caller! -- cgit