From 789055bc2acb4c71483fd60ea258d158bd5aec10 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 12 Apr 2016 16:39:03 +0200 Subject: 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 Tested-by: Noel Grandin --- xmlhelp/source/cxxhelp/provider/databases.cxx | 7 +++--- xmlhelp/source/treeview/tvread.cxx | 36 ++++++++++++--------------- 2 files changed, 19 insertions(+), 24 deletions(-) (limited to 'xmlhelp') diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx index 8c7fae0a0eba..53e5cb3a3c50 100644 --- a/xmlhelp/source/cxxhelp/provider/databases.cxx +++ b/xmlhelp/source/cxxhelp/provider/databases.cxx @@ -1819,17 +1819,16 @@ OUString IndexFolderIterator::implGetIndexFolderFromPackage( bool& o_rbTemporary ::osl::FileBase::RC eErr = ::osl::File::createTempFile( nullptr, nullptr, &aTempFileURL ); if( eErr == ::osl::FileBase::E_None ) { - OUString aTempDirURL = aTempFileURL; try { - m_xSFA->kill( aTempDirURL ); + m_xSFA->kill( aTempFileURL ); } catch (const Exception &) { } - m_xSFA->createFolder( aTempDirURL ); + m_xSFA->createFolder( aTempFileURL ); - aZipDir = aTempDirURL; + aZipDir = aTempFileURL; o_rbTemporary = true; } } diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index 3dffd29d251d..53b56c71d358 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -312,13 +312,12 @@ TVRead::getByHierarchicalName( const OUString& aName ) RuntimeException, std::exception ) { sal_Int32 idx; - OUString name( aName ); - if( ( idx = name.indexOf( '/' ) ) != -1 && - name.copy( 0,idx ) == "Children" ) - return Children->getByHierarchicalName( name.copy( 1 + idx ) ); + if( ( idx = aName.indexOf( '/' ) ) != -1 && + aName.copy( 0,idx ) == "Children" ) + return Children->getByHierarchicalName( aName.copy( 1 + idx ) ); - return getByName( name ); + return getByName( aName ); } sal_Bool SAL_CALL @@ -326,13 +325,12 @@ TVRead::hasByHierarchicalName( const OUString& aName ) throw( RuntimeException, std::exception ) { sal_Int32 idx; - OUString name( aName ); - if( ( idx = name.indexOf( '/' ) ) != -1 && - name.copy( 0,idx ) == "Children" ) - return Children->hasByHierarchicalName( name.copy( 1 + idx ) ); + if( ( idx = aName.indexOf( '/' ) ) != -1 && + aName.copy( 0,idx ) == "Children" ) + return Children->hasByHierarchicalName( aName.copy( 1 + idx ) ); - return hasByName( name ); + return hasByName( aName ); } /**************************************************************************/ @@ -573,20 +571,19 @@ TVChildTarget::getByHierarchicalName( const OUString& aName ) RuntimeException, std::exception ) { sal_Int32 idx; - OUString name( aName ); - if( ( idx = name.indexOf( '/' ) ) != -1 ) + if( ( idx = aName.indexOf( '/' ) ) != -1 ) { - OUString num( name.getStr()+2,idx-4 ); + OUString num( aName.getStr()+2,idx-4 ); sal_Int32 pref = num.toInt32() - 1; if( pref < 0 || Elements.size() <= sal_uInt32( pref ) ) throw NoSuchElementException(); - return Elements[pref]->getByHierarchicalName( name.copy( 1 + idx ) ); + return Elements[pref]->getByHierarchicalName( aName.copy( 1 + idx ) ); } else - return getByName( name ); + return getByName( aName ); } sal_Bool SAL_CALL @@ -594,19 +591,18 @@ TVChildTarget::hasByHierarchicalName( const OUString& aName ) throw( RuntimeException, std::exception ) { sal_Int32 idx; - OUString name( aName ); - if( ( idx = name.indexOf( '/' ) ) != -1 ) + if( ( idx = aName.indexOf( '/' ) ) != -1 ) { - OUString num( name.getStr()+2,idx-4 ); + OUString num( aName.getStr()+2,idx-4 ); sal_Int32 pref = num.toInt32() - 1; if( pref < 0 || Elements.size() <= sal_uInt32( pref ) ) return false; - return Elements[pref]->hasByHierarchicalName( name.copy( 1 + idx ) ); + return Elements[pref]->hasByHierarchicalName( aName.copy( 1 + idx ) ); } else - return hasByName( name ); + return hasByName( aName ); } ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext ) -- cgit