From 5c2c2d8dc4449c9d4ac9d645f634772ba93373af Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 9 Nov 2016 15:14:57 +0200 Subject: loplugin:expandablemethods in comphelper..cppuhelper Change-Id: I9d5487af4729bd3ee4f6450092e4b77f74a12e6d Reviewed-on: https://gerrit.libreoffice.org/30717 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- connectivity/source/commontools/DriversConfig.cxx | 3 ++- .../source/commontools/formattedcolumnvalue.cxx | 8 +------- connectivity/source/commontools/sqlerror.cxx | 9 +-------- connectivity/source/cpool/ZPoolCollection.cxx | 11 +++-------- connectivity/source/cpool/ZPoolCollection.hxx | 1 - connectivity/source/drivers/file/FStatement.cxx | 7 +------ .../source/drivers/jdbc/ContextClassLoader.cxx | 2 +- .../drivers/mozab/bootstrap/MMozillaBootstrap.cxx | 23 ++++------------------ .../drivers/mozab/bootstrap/MMozillaBootstrap.hxx | 3 --- connectivity/source/drivers/odbc/OConnection.cxx | 7 +------ .../drivers/odbc/ODatabaseMetaDataResultSet.cxx | 4 ++-- connectivity/source/inc/file/FStatement.hxx | 2 -- .../source/inc/java/ContextClassLoader.hxx | 4 +--- connectivity/source/inc/odbc/OConnection.hxx | 2 -- .../source/inc/odbc/ODatabaseMetaDataResultSet.hxx | 2 -- connectivity/source/parse/sqliterator.cxx | 4 +++- 16 files changed, 20 insertions(+), 72 deletions(-) (limited to 'connectivity') diff --git a/connectivity/source/commontools/DriversConfig.cxx b/connectivity/source/commontools/DriversConfig.cxx index c40ed479177b..2da9b4dc4953 100644 --- a/connectivity/source/commontools/DriversConfig.cxx +++ b/connectivity/source/commontools/DriversConfig.cxx @@ -91,7 +91,7 @@ DriversConfigImpl::DriversConfigImpl() { } -void DriversConfigImpl::Load(const uno::Reference< uno::XComponentContext >& _rxORB) const +const TInstalledDrivers& DriversConfigImpl::getInstalledDrivers(const uno::Reference< uno::XComponentContext >& _rxORB) const { if ( m_aDrivers.empty() ) { @@ -119,6 +119,7 @@ void DriversConfigImpl::Load(const uno::Reference< uno::XComponentContext >& _rx } } // if ( m_aInstalled.isValid() ) } + return m_aDrivers; } DriversConfig::DriversConfig(const uno::Reference< uno::XComponentContext >& _rxORB) diff --git a/connectivity/source/commontools/formattedcolumnvalue.cxx b/connectivity/source/commontools/formattedcolumnvalue.cxx index 8a75af3c3cde..bd582dbc82e4 100644 --- a/connectivity/source/commontools/formattedcolumnvalue.cxx +++ b/connectivity/source/commontools/formattedcolumnvalue.cxx @@ -220,15 +220,9 @@ namespace dbtools } - void FormattedColumnValue::clear() - { - lcl_clear_nothrow( *m_pData ); - } - - FormattedColumnValue::~FormattedColumnValue() { - clear(); + lcl_clear_nothrow( *m_pData ); } sal_Int16 FormattedColumnValue::getKeyType() const diff --git a/connectivity/source/commontools/sqlerror.cxx b/connectivity/source/commontools/sqlerror.cxx index 1febff0a796a..f074257e2e80 100644 --- a/connectivity/source/commontools/sqlerror.cxx +++ b/connectivity/source/commontools/sqlerror.cxx @@ -57,7 +57,6 @@ namespace connectivity // versions of the public SQLError methods which are just delegated to this impl-class static const OUString& getMessagePrefix(); OUString getErrorMessage( const ErrorCondition _eCondition, const ParamValue& _rParamValue1, const ParamValue& _rParamValue2, const ParamValue& _rParamValue3 ); - OUString getSQLState( const ErrorCondition _eCondition ); static ErrorCode getErrorCode( const ErrorCondition _eCondition ); void raiseException( const ErrorCondition _eCondition, const Reference< XInterface >& _rxContext, const ParamValue& _rParamValue1, const ParamValue& _rParamValue2, const ParamValue& _rParamValue3 ); void raiseException( const ErrorCondition _eCondition, const ParamValue& _rParamValue1, const ParamValue& _rParamValue2, const ParamValue& _rParamValue3 ); @@ -148,12 +147,6 @@ namespace connectivity } - OUString SQLError_Impl::getSQLState( const ErrorCondition _eCondition ) - { - return impl_getSQLState( _eCondition ); - } - - ErrorCode SQLError_Impl::getErrorCode( const ErrorCondition _eCondition ) { return 0 - ::sal::static_int_cast< ErrorCode, ErrorCondition >( _eCondition ); @@ -217,7 +210,7 @@ namespace connectivity return SQLException( getErrorMessage( _eCondition, _rParamValue1, _rParamValue2, _rParamValue3 ), _rxContext, - getSQLState( _eCondition ), + impl_getSQLState( _eCondition ), getErrorCode( _eCondition ), Any() ); diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx index ad462ea596b6..f502b5fdb2eb 100644 --- a/connectivity/source/cpool/ZPoolCollection.cxx +++ b/connectivity/source/cpool/ZPoolCollection.cxx @@ -252,7 +252,9 @@ bool OPoolCollection::isPoolingEnabled() Reference const & OPoolCollection::getConfigPoolRoot() { if(!m_xConfigNode.is()) - m_xConfigNode = createWithServiceFactory(getConnectionPoolNodeName()); + m_xConfigNode = createWithProvider( + css::configuration::theDefaultProvider::get(m_xContext), + getConnectionPoolNodeName()); return m_xConfigNode; } @@ -312,13 +314,6 @@ OConnectionPool* OPoolCollection::getConnectionPool(const OUString& _sImplName, return pRet; } -Reference< XInterface > OPoolCollection::createWithServiceFactory(const OUString& _rPath) const -{ - return createWithProvider( - css::configuration::theDefaultProvider::get(m_xContext), - _rPath); -} - Reference< XInterface > OPoolCollection::createWithProvider(const Reference< XMultiServiceFactory >& _rxConfProvider, const OUString& _rPath) { diff --git a/connectivity/source/cpool/ZPoolCollection.hxx b/connectivity/source/cpool/ZPoolCollection.hxx index ea5e2d307f38..316fb7a227c0 100644 --- a/connectivity/source/cpool/ZPoolCollection.hxx +++ b/connectivity/source/cpool/ZPoolCollection.hxx @@ -85,7 +85,6 @@ namespace connectivity const css::uno::Reference< css::uno::XComponentContext >& _rxContext); // some configuration helper methods - css::uno::Reference< css::uno::XInterface > createWithServiceFactory(const OUString& _rPath) const; css::uno::Reference< css::uno::XInterface > const & getConfigPoolRoot(); static css::uno::Reference< css::uno::XInterface > createWithProvider( const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxConfProvider, const OUString& _rPath); diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx index 2db04098760f..36cf31411a0b 100644 --- a/connectivity/source/drivers/file/FStatement.cxx +++ b/connectivity/source/drivers/file/FStatement.cxx @@ -308,11 +308,6 @@ Any SAL_CALL OStatement::queryInterface( const Type & rType ) throw(RuntimeExcep return aRet.hasValue() ? aRet : OStatement_BASE2::queryInterface( rType); } -OSQLAnalyzer* OStatement_Base::createAnalyzer() -{ - return new OSQLAnalyzer(m_pConnection.get()); -} - void OStatement_Base::anylizeSQL() { OSL_ENSURE(m_pSQLAnalyzer,"OResultSet::anylizeSQL: Analyzer isn't set!"); @@ -436,7 +431,7 @@ void OStatement_Base::construct(const OUString& sql) throw(SQLException, Runtim // create the column mapping createColumnMapping(); - m_pSQLAnalyzer = createAnalyzer(); + m_pSQLAnalyzer = new OSQLAnalyzer(m_pConnection.get()); Reference xIndexSup(xTunnel,UNO_QUERY); if(xIndexSup.is()) diff --git a/connectivity/source/drivers/jdbc/ContextClassLoader.cxx b/connectivity/source/drivers/jdbc/ContextClassLoader.cxx index c45b5aeb87e4..6c2d37122e5a 100644 --- a/connectivity/source/drivers/jdbc/ContextClassLoader.cxx +++ b/connectivity/source/drivers/jdbc/ContextClassLoader.cxx @@ -92,7 +92,7 @@ namespace connectivity { namespace jdbc } - void ContextClassLoaderScope::pop() + ContextClassLoaderScope::~ContextClassLoaderScope() { if ( isActive() ) { diff --git a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx index 82cc40e56b9c..a1f073dd7dbb 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx +++ b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx @@ -70,25 +70,9 @@ void MozillaBootstrap::disposing() OMozillaBootstrap_BASE::disposing(); } -// static ServiceInfo - -OUString MozillaBootstrap::getImplementationName_Static( ) throw(RuntimeException) -{ - return OUString(MOZAB_MozillaBootstrap_IMPL_NAME); -} - -Sequence< OUString > MozillaBootstrap::getSupportedServiceNames_Static( ) throw (RuntimeException) -{ - // which service is supported - // for more information @see com.sun.star.mozilla.MozillaBootstrap - Sequence aSNS { "com.sun.star.mozilla.MozillaBootstrap" }; - return aSNS; -} - - OUString SAL_CALL MozillaBootstrap::getImplementationName( ) throw(RuntimeException, std::exception) { - return getImplementationName_Static(); + return OUString(MOZAB_MozillaBootstrap_IMPL_NAME); } sal_Bool SAL_CALL MozillaBootstrap::supportsService( const OUString& _rServiceName ) throw(RuntimeException, std::exception) @@ -96,10 +80,11 @@ sal_Bool SAL_CALL MozillaBootstrap::supportsService( const OUString& _rServiceNa return cppu::supportsService(this, _rServiceName); } - Sequence< OUString > SAL_CALL MozillaBootstrap::getSupportedServiceNames( ) throw(RuntimeException, std::exception) { - return getSupportedServiceNames_Static(); + // which service is supported + // for more information @see com.sun.star.mozilla.MozillaBootstrap + return { "com.sun.star.mozilla.MozillaBootstrap" }; } diff --git a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx index 9b1b9cb4dc89..2a61d88d760b 100644 --- a/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx +++ b/connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.hxx @@ -49,9 +49,6 @@ namespace connectivity // OComponentHelper virtual void SAL_CALL disposing() override; - // XInterface - static OUString getImplementationName_Static( ) throw(css::uno::RuntimeException); - static css::uno::Sequence< OUString > getSupportedServiceNames_Static( ) throw (css::uno::RuntimeException); // XServiceInfo virtual OUString SAL_CALL getImplementationName( ) throw(css::uno::RuntimeException, std::exception) override; diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx index 4eca0ab340ea..66f31461ba29 100644 --- a/connectivity/source/drivers/odbc/OConnection.cxx +++ b/connectivity/source/drivers/odbc/OConnection.cxx @@ -505,11 +505,6 @@ void OConnection::disposing() dispose_ChildImpl(); } -OConnection* OConnection::cloneConnection() -{ - return new OConnection(m_pDriverHandleCopy,m_pDriver); -} - SQLHANDLE OConnection::createStatementHandle() { OConnection* pConnectionTemp = this; @@ -519,7 +514,7 @@ SQLHANDLE OConnection::createStatementHandle() sal_Int32 nMaxStatements = getMetaData()->getMaxStatements(); if(nMaxStatements && nMaxStatements <= m_nStatementCount) { - OConnection* pConnection = cloneConnection(); + OConnection* pConnection = new OConnection(m_pDriverHandleCopy,m_pDriver); pConnection->acquire(); pConnection->Construct(m_sURL,getConnectionInfo()); pConnectionTemp = pConnection; diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx index 1d29d68a963e..1b8549888057 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaDataResultSet.cxx @@ -778,10 +778,10 @@ void ODatabaseMetaDataResultSet::getFastPropertyValue( Any& rValue, sal_Int32 nH rValue <<= getCursorName(); break; case PROPERTY_ID_RESULTSETCONCURRENCY: - rValue <<= getResultSetConcurrency(); + rValue <<= sal_Int32(css::sdbc::ResultSetConcurrency::READ_ONLY); break; case PROPERTY_ID_RESULTSETTYPE: - rValue <<= getResultSetType(); + rValue <<= sal_Int32(css::sdbc::ResultSetType::FORWARD_ONLY); break; case PROPERTY_ID_FETCHDIRECTION: rValue <<= getFetchDirection(); diff --git a/connectivity/source/inc/file/FStatement.hxx b/connectivity/source/inc/file/FStatement.hxx index ffdc75150dfd..50059b8eb80c 100644 --- a/connectivity/source/inc/file/FStatement.hxx +++ b/connectivity/source/inc/file/FStatement.hxx @@ -106,8 +106,6 @@ namespace connectivity connectivity::OSQLParseNode* pAscendingDescending); virtual void initializeResultSet(OResultSet* _pResult); - // create the analyzer - OSQLAnalyzer* createAnalyzer(); void closeResultSet() throw (css::sdbc::SQLException, css::uno::RuntimeException, std::exception); diff --git a/connectivity/source/inc/java/ContextClassLoader.hxx b/connectivity/source/inc/java/ContextClassLoader.hxx index 01c4ed55c330..174c3e9377ea 100644 --- a/connectivity/source/inc/java/ContextClassLoader.hxx +++ b/connectivity/source/inc/java/ContextClassLoader.hxx @@ -55,7 +55,7 @@ namespace connectivity { namespace jdbc const css::uno::Reference< css::uno::XInterface >& _rxErrorContext ); - ~ContextClassLoaderScope() { pop(); } + ~ContextClassLoaderScope(); bool isActive() const { @@ -67,8 +67,6 @@ namespace connectivity { namespace jdbc ContextClassLoaderScope(ContextClassLoaderScope &) = delete; void operator =(ContextClassLoaderScope &) = delete; - void pop(); - JNIEnv& m_environment; LocalRef< jobject > m_currentThread; LocalRef< jobject > m_oldContextClassLoader; diff --git a/connectivity/source/inc/odbc/OConnection.hxx b/connectivity/source/inc/odbc/OConnection.hxx index 2dc2df43468b..a3c0067e4a07 100644 --- a/connectivity/source/inc/odbc/OConnection.hxx +++ b/connectivity/source/inc/odbc/OConnection.hxx @@ -76,8 +76,6 @@ namespace connectivity SQLRETURN OpenConnection(const OUString& aConnectStr,sal_Int32 nTimeOut, bool bSilent); - OConnection* cloneConnection(); // creates a new connection - public: oslGenericFunction getOdbcFunction(ODBC3SQLFunctionId _nIndex) const; SQLRETURN Construct( const OUString& url,const css::uno::Sequence< css::beans::PropertyValue >& info) throw(css::sdbc::SQLException, std::exception); diff --git a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx index 1ca0f69eba99..5ab546e4d888 100644 --- a/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx +++ b/connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx @@ -83,8 +83,6 @@ namespace connectivity // set the columncount of the driver void checkColumnCount(); - static sal_Int32 getResultSetConcurrency() { return css::sdbc::ResultSetConcurrency::READ_ONLY; } - static sal_Int32 getResultSetType() { return css::sdbc::ResultSetType::FORWARD_ONLY; } static sal_Int32 getFetchDirection() { return css::sdbc::FetchDirection::FORWARD; } static sal_Int32 getFetchSize() throw(css::sdbc::SQLException, css::uno::RuntimeException); static OUString getCursorName() throw(css::sdbc::SQLException, css::uno::RuntimeException); diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 0f0e0d3cc1de..1534d793c362 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -1546,7 +1546,9 @@ void OSQLParseTreeIterator::traverseAll() void OSQLParseTreeIterator::impl_traverse( TraversalParts _nIncludeMask ) { - impl_resetErrors(); + // resets our errors + m_aErrors = css::sdbc::SQLException(); + m_pImpl->m_nIncludeMask = _nIncludeMask; if ( !traverseTableNames( *m_pImpl->m_pTables ) ) -- cgit