connectivity/source/drivers/evoab2/NColumns.cxx | 3 - connectivity/source/drivers/evoab2/NConnection.cxx | 15 +++------ connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx | 23 ++++++-------- connectivity/source/drivers/evoab2/NDriver.cxx | 6 +-- connectivity/source/drivers/evoab2/NPreparedStatement.cxx | 4 +- connectivity/source/drivers/evoab2/NPreparedStatement.hxx | 1 connectivity/source/drivers/evoab2/NStatement.cxx | 8 ++-- connectivity/source/drivers/evoab2/NTables.cxx | 3 - 8 files changed, 28 insertions(+), 35 deletions(-)
New commits: commit 41dd2d810f0535f85cbaaefbf7ce9f81d4da1609 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Thu Mar 4 16:32:23 2021 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Fri Mar 5 10:55:13 2021 +0100 loplugin:refcounting (--enable-evolution2) Change-Id: I83f16646e5bd7c3814d9d3dd3fa6408c40f96bd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111968 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/connectivity/source/drivers/evoab2/NColumns.cxx b/connectivity/source/drivers/evoab2/NColumns.cxx index 378e2af77634..5b2b64d5d58b 100644 --- a/connectivity/source/drivers/evoab2/NColumns.cxx +++ b/connectivity/source/drivers/evoab2/NColumns.cxx @@ -55,7 +55,7 @@ sdbcx::ObjectType OEvoabColumns::createObject(const OUString& _rName) { if (xRow->getString(4) == _rName) { - OColumn* pRet = new OColumn( + xRet = new OColumn( _rName, xRow->getString(6), xRow->getString(13), @@ -71,7 +71,6 @@ sdbcx::ObjectType OEvoabColumns::createObject(const OUString& _rName) sCatalogName, sSchemaName, sTableName); - xRet = pRet; break; } } diff --git a/connectivity/source/drivers/evoab2/NConnection.cxx b/connectivity/source/drivers/evoab2/NConnection.cxx index d586d6ba2df1..02e8d476dd6e 100644 --- a/connectivity/source/drivers/evoab2/NConnection.cxx +++ b/connectivity/source/drivers/evoab2/NConnection.cxx @@ -24,6 +24,7 @@ #include "NPreparedStatement.hxx" #include "NStatement.hxx" #include <connectivity/dbexception.hxx> +#include <rtl/ref.hxx> #include <rtl/ustring.hxx> #include <sal/log.hxx> @@ -117,8 +118,7 @@ css::uno::Reference< XTablesSupplier > OEvoabConnection::createCatalog() Reference< XTablesSupplier > xTab = m_xCatalog; if(!xTab.is()) { - OEvoabCatalog *pCat = new OEvoabCatalog(this); - xTab = pCat; + xTab = new OEvoabCatalog(this); m_xCatalog = xTab; } return xTab; @@ -129,10 +129,8 @@ Reference< XStatement > SAL_CALL OEvoabConnection::createStatement( ) ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - OStatement* pStmt = new OStatement(this); - - Reference< XStatement > xStmt = pStmt; - m_aStatements.push_back(WeakReferenceHelper(*pStmt)); + Reference< XStatement > xStmt = new OStatement(this); + m_aStatements.push_back(WeakReferenceHelper(xStmt)); return xStmt; } @@ -141,12 +139,11 @@ Reference< XPreparedStatement > SAL_CALL OEvoabConnection::prepareStatement( con ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OConnection_BASE::rBHelper.bDisposed); - OEvoabPreparedStatement* pStmt = new OEvoabPreparedStatement( this ); - Reference< XPreparedStatement > xStmt = pStmt; + rtl::Reference<OEvoabPreparedStatement> pStmt = new OEvoabPreparedStatement( this ); pStmt->construct( sql ); m_aStatements.push_back(WeakReferenceHelper(*pStmt)); - return xStmt; + return pStmt; } Reference< XPreparedStatement > SAL_CALL OEvoabConnection::prepareCall( const OUString& /*sql*/ ) diff --git a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx index 5e84a27e13fb..631e9b254bc8 100644 --- a/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx +++ b/connectivity/source/drivers/evoab2/NDatabaseMetaData.cxx @@ -23,6 +23,7 @@ #include <connectivity/dbexception.hxx> #include <connectivity/FValue.hxx> #include <com/sun/star/sdbc/ColumnSearch.hpp> +#include <rtl/ref.hxx> #include <cstddef> #include <string.h> @@ -984,8 +985,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTableTypes( ) { u"TABLE" // Currently we only support a 'TABLE' nothing more complex }; - ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes); - Reference< XResultSet > xRef = pResult; + rtl::Reference<::connectivity::ODatabaseMetaDataResultSet> pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes); // here we fill the rows which should be visible when ask for data from the resultset returned here ODatabaseMetaDataResultSet::ORows aRows; @@ -1000,7 +1000,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTableTypes( ) } // here we set the rows at the resultset pResult->setRows(aRows); - return xRef; + return pResult; } Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( ) @@ -1009,9 +1009,8 @@ Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( ) * Return the proper type information required by evo driver */ - ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo); + rtl::Reference<ODatabaseMetaDataResultSet> pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo); - Reference< XResultSet > xResultSet = pResultSet; static ODatabaseMetaDataResultSet::ORows aRows = []() { ODatabaseMetaDataResultSet::ORows tmp; @@ -1047,7 +1046,7 @@ Reference< XResultSet > OEvoabDatabaseMetaData::impl_getTypeInfo_throw( ) return tmp; }(); pResultSet->setRows(aRows); - return xResultSet; + return pResultSet; } Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getColumns( @@ -1056,10 +1055,9 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getColumns( { // this returns an empty resultset where the column-names are already set // in special the metadata of the resultset already returns the right columns - ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumns ); - Reference< XResultSet > xResultSet = pResultSet; + rtl::Reference<ODatabaseMetaDataResultSet> pResultSet = new ODatabaseMetaDataResultSet( ODatabaseMetaDataResultSet::eColumns ); pResultSet->setRows( getColumnRows( columnNamePattern ) ); - return xResultSet; + return pResultSet; } @@ -1078,8 +1076,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( { ::osl::MutexGuard aGuard( m_aMutex ); - ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes); - Reference< XResultSet > xRef = pResult; + rtl::Reference<ODatabaseMetaDataResultSet> pResult = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes); // check if any type is given // when no types are given then we have to return all tables e.g. TABLE @@ -1104,7 +1101,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( } } if(!bTableFound) - return xRef; + return pResult; ODatabaseMetaDataResultSet::ORows aRows; @@ -1207,7 +1204,7 @@ Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getTables( pResult->setRows(aRows); - return xRef; + return pResult; } Reference< XResultSet > SAL_CALL OEvoabDatabaseMetaData::getUDTs( const Any& /*catalog*/, const OUString& /*schemaPattern*/, const OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) diff --git a/connectivity/source/drivers/evoab2/NDriver.cxx b/connectivity/source/drivers/evoab2/NDriver.cxx index b8e3c4d4ff88..d1b7746f47c5 100644 --- a/connectivity/source/drivers/evoab2/NDriver.cxx +++ b/connectivity/source/drivers/evoab2/NDriver.cxx @@ -23,6 +23,7 @@ #include <connectivity/dbexception.hxx> #include <cppuhelper/supportsservice.hxx> #include <com/sun/star/ucb/XContentAccess.hpp> +#include <rtl/ref.hxx> #include <strings.hrc> #include <resource/sharedresources.hxx> @@ -103,12 +104,11 @@ Reference< XConnection > SAL_CALL OEvoabDriver::connect( const OUString& url, co if ( ! acceptsURL(url) ) return nullptr; - OEvoabConnection* pCon = new OEvoabConnection( *this ); + rtl::Reference<OEvoabConnection> pCon = new OEvoabConnection( *this ); pCon->construct(url,info); - Reference< XConnection > xCon = pCon; m_xConnections.push_back(WeakReferenceHelper(*pCon)); - return xCon; + return pCon; } sal_Bool SAL_CALL OEvoabDriver::acceptsURL( const OUString& url ) diff --git a/connectivity/source/drivers/evoab2/NPreparedStatement.cxx b/connectivity/source/drivers/evoab2/NPreparedStatement.cxx index 57981e95e82d..041db85b5838 100644 --- a/connectivity/source/drivers/evoab2/NPreparedStatement.cxx +++ b/connectivity/source/drivers/evoab2/NPreparedStatement.cxx @@ -21,6 +21,7 @@ #include "NPreparedStatement.hxx" #include <connectivity/dbexception.hxx> #include <connectivity/dbtools.hxx> +#include <rtl/ref.hxx> #include <tools/diagnose_ex.h> #include <strings.hrc> @@ -54,7 +55,8 @@ void OEvoabPreparedStatement::construct( const OUString& _sql ) ENSURE_OR_THROW( m_aQueryData.xSelectColumns.is(), "no SelectColumn" ); // create our meta data - OEvoabResultSetMetaData* pMeta = new OEvoabResultSetMetaData( m_aQueryData.sTable ); + rtl::Reference<OEvoabResultSetMetaData> pMeta + = new OEvoabResultSetMetaData( m_aQueryData.sTable ); m_xMetaData = pMeta; pMeta->setEvoabFields( m_aQueryData.xSelectColumns ); } diff --git a/connectivity/source/drivers/evoab2/NPreparedStatement.hxx b/connectivity/source/drivers/evoab2/NPreparedStatement.hxx index 62e79cb335f4..71f7cdf142b6 100644 --- a/connectivity/source/drivers/evoab2/NPreparedStatement.hxx +++ b/connectivity/source/drivers/evoab2/NPreparedStatement.hxx @@ -57,7 +57,6 @@ namespace connectivity::evoab void construct( const OUString& _sql ); - private: DECLARE_SERVICE_INFO(); //XInterface virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; diff --git a/connectivity/source/drivers/evoab2/NStatement.cxx b/connectivity/source/drivers/evoab2/NStatement.cxx index 80b02d82f0a5..6c56ad8d2002 100644 --- a/connectivity/source/drivers/evoab2/NStatement.cxx +++ b/connectivity/source/drivers/evoab2/NStatement.cxx @@ -22,6 +22,7 @@ #include <string_view> #include <osl/diagnose.h> +#include <rtl/ref.hxx> #include <rtl/ustring.hxx> #include <sal/log.hxx> #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> @@ -564,13 +565,12 @@ QueryData OCommonStatement::impl_getEBookQuery_throw( const OUString& _rSql ) Reference< XResultSet > OCommonStatement::impl_executeQuery_throw( const QueryData& _rQueryData ) { // create result set - OEvoabResultSet* pResult = new OEvoabResultSet( this, m_xConnection.get() ); - Reference< XResultSet > xRS = pResult; + rtl::Reference<OEvoabResultSet> pResult = new OEvoabResultSet( this, m_xConnection.get() ); pResult->construct( _rQueryData ); // done - m_xResultSet = xRS; - return xRS; + m_xResultSet = pResult; + return pResult; } diff --git a/connectivity/source/drivers/evoab2/NTables.cxx b/connectivity/source/drivers/evoab2/NTables.cxx index b7a844fac15d..69b54ba70759 100644 --- a/connectivity/source/drivers/evoab2/NTables.cxx +++ b/connectivity/source/drivers/evoab2/NTables.cxx @@ -48,7 +48,7 @@ ObjectType OEvoabTables::createObject(const OUString& aName) Reference< XRow > xRow(xResult,UNO_QUERY); if(xResult->next()) // there can be only one table with this name { - OEvoabTable* pRet = new OEvoabTable( + xRet = new OEvoabTable( this, static_cast<OEvoabCatalog&>(m_rParent).getConnection(), aName, @@ -56,7 +56,6 @@ ObjectType OEvoabTables::createObject(const OUString& aName) xRow->getString(5), "", ""); - xRet = pRet; } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits