summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-02-16 08:55:13 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-02-17 11:41:55 +0100
commit6ec7f2b22bc9e31c330dcef229f7ecfe98724a5e (patch)
tree0667883f360d024208ede10e193586f332c8dcfd
parentd3476d27ab77160dcd737194fc13081ee297db16 (diff)
loplugin:referencecasting in connectivity
Change-Id: I4b91c3e4a225323235ea37d77f0f96600bf412be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110969 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--connectivity/source/commontools/TTableHelper.cxx4
-rw-r--r--connectivity/source/commontools/parameters.cxx2
-rw-r--r--connectivity/source/commontools/paramwrapper.cxx2
-rw-r--r--connectivity/source/cpool/ZPoolCollection.cxx2
-rw-r--r--connectivity/source/cpool/ZPooledConnection.cxx2
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx4
-rw-r--r--connectivity/source/drivers/file/FPreparedStatement.cxx8
-rw-r--r--connectivity/source/drivers/file/FResultSet.cxx7
-rw-r--r--connectivity/source/drivers/file/FStatement.cxx2
-rw-r--r--connectivity/source/drivers/firebird/DatabaseMetaData.cxx2
-rw-r--r--connectivity/source/drivers/firebird/PreparedStatement.cxx2
-rw-r--r--connectivity/source/drivers/firebird/Statement.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/JStatement.cxx2
-rw-r--r--connectivity/source/drivers/jdbc/PreparedStatement.cxx2
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx2
-rw-r--r--connectivity/source/drivers/mysqlc/mysqlc_statement.cxx2
-rw-r--r--connectivity/source/drivers/odbc/OPreparedStatement.cxx2
-rw-r--r--connectivity/source/drivers/odbc/OStatement.cxx2
-rw-r--r--connectivity/source/manager/mdrivermanager.cxx2
-rw-r--r--connectivity/source/sdbcx/VTable.cxx4
20 files changed, 28 insertions, 29 deletions
diff --git a/connectivity/source/commontools/TTableHelper.cxx b/connectivity/source/commontools/TTableHelper.cxx
index 03724d669704..9c955a7e0104 100644
--- a/connectivity/source/commontools/TTableHelper.cxx
+++ b/connectivity/source/commontools/TTableHelper.cxx
@@ -181,7 +181,7 @@ void SAL_CALL OTableHelper::disposing()
::osl::MutexGuard aGuard(m_aMutex);
if ( m_pImpl->m_xTablePropertyListener.is() )
{
- m_pTables->removeContainerListener(m_pImpl->m_xTablePropertyListener.get());
+ m_pTables->removeContainerListener(m_pImpl->m_xTablePropertyListener);
m_pImpl->m_xTablePropertyListener->clear();
m_pImpl->m_xTablePropertyListener.clear();
}
@@ -387,7 +387,7 @@ void OTableHelper::refreshForeignKeys(::std::vector< OUString>& _rNames)
{
if ( !m_pImpl->m_xTablePropertyListener.is() )
m_pImpl->m_xTablePropertyListener = new OTableContainerListener(this);
- m_pTables->addContainerListener(m_pImpl->m_xTablePropertyListener.get());
+ m_pTables->addContainerListener(m_pImpl->m_xTablePropertyListener);
m_pImpl->m_xTablePropertyListener->add(sReferencedName);
} // if ( m_pTables->hasByName(sReferencedName) )
sOldFKName = sFkName;
diff --git a/connectivity/source/commontools/parameters.cxx b/connectivity/source/commontools/parameters.cxx
index 3eb116500e81..906dbc0d3f27 100644
--- a/connectivity/source/commontools/parameters.cxx
+++ b/connectivity/source/commontools/parameters.cxx
@@ -711,7 +711,7 @@ namespace dbtools
::comphelper::OInterfaceIteratorHelper2 aIter( m_aParameterListeners );
Reference< XPropertySet > xProp = m_xComponent;
OSL_ENSURE(xProp.is(),"Some already released my component!");
- DatabaseParameterEvent aEvent( xProp.get(), m_pOuterParameters.get() );
+ DatabaseParameterEvent aEvent( xProp, m_pOuterParameters );
_rClearForNotifies.clear();
while ( aIter.hasMoreElements() && !bCanceled )
diff --git a/connectivity/source/commontools/paramwrapper.cxx b/connectivity/source/commontools/paramwrapper.cxx
index 17cb58cab220..0aca56b65123 100644
--- a/connectivity/source/commontools/paramwrapper.cxx
+++ b/connectivity/source/commontools/paramwrapper.cxx
@@ -313,7 +313,7 @@ namespace dbtools::param
if ( ( _nIndex < 0 ) || ( _nIndex >= static_cast<sal_Int32>(m_aParameters.size()) ) )
throw IndexOutOfBoundsException();
- return makeAny( Reference< XPropertySet >( m_aParameters[ _nIndex ].get() ) );
+ return makeAny( Reference< XPropertySet >( m_aParameters[ _nIndex ] ) );
}
diff --git a/connectivity/source/cpool/ZPoolCollection.cxx b/connectivity/source/cpool/ZPoolCollection.cxx
index 34d24b0be4f9..17215ece7510 100644
--- a/connectivity/source/cpool/ZPoolCollection.cxx
+++ b/connectivity/source/cpool/ZPoolCollection.cxx
@@ -177,7 +177,7 @@ Reference< XDriver > SAL_CALL OPoolCollection::getDriverByURL( const OUString& _
else
{ // create a new proxy for the driver
// this allows us to control the connections created by it
- Reference< XAggregation > xDriverProxy = m_xProxyFactory->createProxy(xDriver.get());
+ Reference< XAggregation > xDriverProxy = m_xProxyFactory->createProxy(xDriver);
OSL_ENSURE(xDriverProxy.is(), "OConnectionPool::getDriverByURL: invalid proxy returned by the proxy factory!");
OConnectionPool* pConnectionPool = getConnectionPool(sImplName,xDriver,xDriverNode);
diff --git a/connectivity/source/cpool/ZPooledConnection.cxx b/connectivity/source/cpool/ZPooledConnection.cxx
index 2d0b83707905..42e8d6c02db7 100644
--- a/connectivity/source/cpool/ZPooledConnection.cxx
+++ b/connectivity/source/cpool/ZPooledConnection.cxx
@@ -59,7 +59,7 @@ Reference< XConnection > OPooledConnection::getConnection()
{
if(!m_xComponent.is() && m_xRealConnection.is())
{
- Reference< XAggregation > xConProxy = m_xProxyFactory->createProxy(m_xRealConnection.get());
+ Reference< XAggregation > xConProxy = m_xProxyFactory->createProxy(m_xRealConnection);
m_xComponent = new OConnectionWeakWrapper(xConProxy);
// register as event listener for the new connection
if (m_xComponent.is())
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index fece1bf7fb21..113fc5b5c41d 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -1635,7 +1635,7 @@ bool ODbaseTable::UpdateBuffer(OValueRefVector& rRow, const OValueRefRow& pOrgRo
::comphelper::UStringMixEqual aCase(isCaseSensitive());
- Reference<XIndexAccess> xColumns = m_xColumns.get();
+ Reference<XIndexAccess> xColumns = m_xColumns;
// first search a key that exist already in the table
for (sal_Int32 i = 0; i < nColumnCount; ++i)
{
@@ -2499,7 +2499,7 @@ void ODbaseTable::copyData(ODbaseTable* _pNewTable,sal_Int32 _nPos)
}
}
}
- bOk = _pNewTable->InsertRow(*aInsertRow,_pNewTable->m_xColumns.get());
+ bOk = _pNewTable->InsertRow(*aInsertRow,_pNewTable->m_xColumns);
SAL_WARN_IF(!bOk, "connectivity.drivers", "Row could not be inserted!");
}
else
diff --git a/connectivity/source/drivers/file/FPreparedStatement.cxx b/connectivity/source/drivers/file/FPreparedStatement.cxx
index fc5b81923cb4..4550f2053e80 100644
--- a/connectivity/source/drivers/file/FPreparedStatement.cxx
+++ b/connectivity/source/drivers/file/FPreparedStatement.cxx
@@ -100,7 +100,7 @@ rtl::Reference<OResultSet> OPreparedStatement::makeResultSet()
closeResultSet();
rtl::Reference<OResultSet> xResultSet(createResultSet());
- m_xResultSet = xResultSet.get();
+ m_xResultSet = xResultSet;
initializeResultSet(xResultSet.get());
initResultSet(xResultSet.get());
return xResultSet;
@@ -133,7 +133,7 @@ Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData( )
if(!m_xMetaData.is())
m_xMetaData = new OResultSetMetaData(m_aSQLIterator.getSelectColumns(),m_aSQLIterator.getTables().begin()->first,m_pTable.get());
- return m_xMetaData.get();
+ return m_xMetaData;
}
@@ -189,7 +189,7 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return Reference< XConnection >(m_pConnection.get());
+ return m_pConnection;
}
@@ -198,7 +198,7 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return makeResultSet().get();
+ return makeResultSet();
}
diff --git a/connectivity/source/drivers/file/FResultSet.cxx b/connectivity/source/drivers/file/FResultSet.cxx
index 5cf5d1ae862d..48aa7da9c737 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -133,9 +133,8 @@ void OResultSet::disposing()
m_xColumns = nullptr;
m_xColsIdx.clear();
- Reference<XComponent> xComp = m_pTable.get();
- if ( xComp.is() )
- xComp->removeEventListener(this);
+ if ( m_pTable.is() )
+ m_pTable->removeEventListener(this);
m_pTable.clear();
m_pFileSet = nullptr;
@@ -1585,7 +1584,7 @@ bool OResultSet::isRowDeleted() const
void SAL_CALL OResultSet::disposing( const EventObject& Source )
{
- Reference<XPropertySet> xProp = m_pTable.get();
+ Reference<XPropertySet> xProp = m_pTable;
if(m_pTable.is() && Source.Source == xProp)
{
m_pTable.clear();
diff --git a/connectivity/source/drivers/file/FStatement.cxx b/connectivity/source/drivers/file/FStatement.cxx
index 08c4f7fdd844..a78f7a096955 100644
--- a/connectivity/source/drivers/file/FStatement.cxx
+++ b/connectivity/source/drivers/file/FStatement.cxx
@@ -263,7 +263,7 @@ Reference< XResultSet > SAL_CALL OStatement::executeQuery( const OUString& sql )
Reference< XConnection > SAL_CALL OStatement::getConnection( )
{
- return Reference< XConnection >(m_pConnection.get());
+ return m_pConnection;
}
sal_Int32 SAL_CALL OStatement::executeUpdate( const OUString& sql )
diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index 15e89f86859d..1abc21d9accc 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -771,7 +771,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates()
uno::Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection()
{
- return uno::Reference<XConnection>(m_pConnection.get());
+ return m_pConnection;
}
// here follow all methods which return a resultset
diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 3f7859d1dba7..94485f7dc3cb 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -277,7 +277,7 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection()
MutexGuard aGuard( m_aMutex );
checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
- return Reference<XConnection>(m_pConnection.get());
+ return m_pConnection;
}
sal_Bool SAL_CALL OPreparedStatement::execute()
diff --git a/connectivity/source/drivers/firebird/Statement.cxx b/connectivity/source/drivers/firebird/Statement.cxx
index 418c66a7d0cd..5305761cfd3a 100644
--- a/connectivity/source/drivers/firebird/Statement.cxx
+++ b/connectivity/source/drivers/firebird/Statement.cxx
@@ -148,7 +148,7 @@ uno::Reference< XConnection > SAL_CALL OStatement::getConnection()
MutexGuard aGuard(m_aMutex);
checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
- return uno::Reference<XConnection>(m_pConnection.get());
+ return m_pConnection;
}
Any SAL_CALL OStatement::queryInterface( const Type & rType )
diff --git a/connectivity/source/drivers/jdbc/JStatement.cxx b/connectivity/source/drivers/jdbc/JStatement.cxx
index 147e09c0f362..fddd02a33a1a 100644
--- a/connectivity/source/drivers/jdbc/JStatement.cxx
+++ b/connectivity/source/drivers/jdbc/JStatement.cxx
@@ -279,7 +279,7 @@ Reference< XConnection > SAL_CALL java_sql_Statement_Base::getConnection( )
{
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(java_sql_Statement_BASE::rBHelper.bDisposed);
- return Reference< XConnection >(m_pConnection.get());
+ return m_pConnection;
}
diff --git a/connectivity/source/drivers/jdbc/PreparedStatement.cxx b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
index 083f1917e72a..c57dd20a983f 100644
--- a/connectivity/source/drivers/jdbc/PreparedStatement.cxx
+++ b/connectivity/source/drivers/jdbc/PreparedStatement.cxx
@@ -143,7 +143,7 @@ void SAL_CALL java_sql_PreparedStatement::setString( sal_Int32 parameterIndex, c
css::uno::Reference< css::sdbc::XConnection > SAL_CALL java_sql_PreparedStatement::getConnection( )
{
- return Reference< XConnection >(m_pConnection.get());
+ return m_pConnection;
}
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
index 2b344843deb2..e268c2fdba78 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx
@@ -193,7 +193,7 @@ Reference<XConnection> SAL_CALL OPreparedStatement::getConnection()
MutexGuard aGuard(m_aMutex);
checkDisposed(OPreparedStatement::rBHelper.bDisposed);
- return m_xConnection.get();
+ return m_xConnection;
}
Reference<XResultSet> SAL_CALL OPreparedStatement::executeQuery()
diff --git a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx
index 5e07982773ce..e5428ee34f9e 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_statement.cxx
@@ -165,7 +165,7 @@ Reference<XConnection> SAL_CALL OStatement::getConnection()
checkDisposed(rBHelper.bDisposed);
// just return our connection here
- return m_xConnection.get();
+ return m_xConnection;
}
sal_Int32 SAL_CALL OStatement::getUpdateCount() { return m_nAffectedRows; }
diff --git a/connectivity/source/drivers/odbc/OPreparedStatement.cxx b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
index 65cfbf5e7b5f..724e481ddc9b 100644
--- a/connectivity/source/drivers/odbc/OPreparedStatement.cxx
+++ b/connectivity/source/drivers/odbc/OPreparedStatement.cxx
@@ -227,7 +227,7 @@ Reference< XConnection > SAL_CALL OPreparedStatement::getConnection( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return Reference< XConnection >(m_pConnection.get());
+ return m_pConnection;
}
diff --git a/connectivity/source/drivers/odbc/OStatement.cxx b/connectivity/source/drivers/odbc/OStatement.cxx
index dc693b964d56..33b4af624de9 100644
--- a/connectivity/source/drivers/odbc/OStatement.cxx
+++ b/connectivity/source/drivers/odbc/OStatement.cxx
@@ -449,7 +449,7 @@ Reference< XConnection > SAL_CALL OStatement_Base::getConnection( )
::osl::MutexGuard aGuard( m_aMutex );
checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- return Reference< XConnection >(m_pConnection.get());
+ return m_pConnection;
}
diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx
index 0edf495bd8ab..8492eab2860e 100644
--- a/connectivity/source/manager/mdrivermanager.cxx
+++ b/connectivity/source/manager/mdrivermanager.cxx
@@ -530,7 +530,7 @@ Reference< XInterface > SAL_CALL OSDBCDriverManager::getRegisteredObject( const
if (aSearch == m_aDriversRT.end())
throwNoSuchElementException();
- return aSearch->second.get();
+ return aSearch->second;
}
diff --git a/connectivity/source/sdbcx/VTable.cxx b/connectivity/source/sdbcx/VTable.cxx
index 90c7427823c0..528399a172d4 100644
--- a/connectivity/source/sdbcx/VTable.cxx
+++ b/connectivity/source/sdbcx/VTable.cxx
@@ -164,7 +164,7 @@ Reference< XNameAccess > SAL_CALL OTable::getColumns( )
// allowed
}
- return m_xColumns.get();
+ return m_xColumns;
}
@@ -236,7 +236,7 @@ Reference< XNameAccess > SAL_CALL OTable::getIndexes( )
// allowed
}
- return m_xIndexes.get();
+ return m_xIndexes;
}
// XRename