summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-19 09:51:02 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-19 13:28:41 +0200
commit242e1c42d975b2d8729cd150cf104b177033760a (patch)
treea44512de3ad3cb5a59cf3b658752dfe154ba5aa0
parentee2bb231036b1d9d954dec369855948e6ea1f53a (diff)
loplugin:referencecasting in comphelper..connectivity
Change-Id: I21896885c29e9ab58ebab17b59f1480c6a06fb38 Reviewed-on: https://gerrit.libreoffice.org/75936 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--comphelper/source/container/embeddedobjectcontainer.cxx8
-rw-r--r--comphelper/source/misc/backupfilehelper.cxx16
-rw-r--r--comphelper/source/misc/dispatchcommand.cxx2
-rw-r--r--comphelper/source/misc/proxyaggregation.cxx8
-rw-r--r--connectivity/source/commontools/TColumnsHelper.cxx4
-rw-r--r--connectivity/source/commontools/dbtools.cxx4
-rw-r--r--connectivity/source/drivers/firebird/Connection.cxx15
-rw-r--r--connectivity/source/drivers/firebird/Driver.cxx2
-rw-r--r--connectivity/source/drivers/firebird/StatementCommonBase.cxx2
-rw-r--r--connectivity/source/drivers/flat/ETable.cxx2
-rw-r--r--connectivity/source/drivers/hsqldb/HDriver.cxx4
-rw-r--r--connectivity/source/drivers/mysql_jdbc/YDriver.cxx4
-rw-r--r--connectivity/source/drivers/postgresql/pq_xtable.cxx2
-rw-r--r--connectivity/source/drivers/writer/WTable.cxx4
14 files changed, 35 insertions, 42 deletions
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index ba71089dc402..aa818d78ce5e 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -238,10 +238,9 @@ bool EmbeddedObjectContainer::HasEmbeddedObject( const OUString& rName )
auto aIt = pImpl->maNameToObjectMap.find( rName );
if (aIt != pImpl->maNameToObjectMap.end())
return true;
- uno::Reference <container::XNameAccess> xAccess(pImpl->mxStorage, uno::UNO_QUERY);
- if (!xAccess.is())
+ if (!pImpl->mxStorage.is())
return false;
- return xAccess->hasByName(rName);
+ return pImpl->mxStorage->hasByName(rName);
}
bool EmbeddedObjectContainer::HasEmbeddedObject( const uno::Reference < embed::XEmbeddedObject >& xObj ) const
@@ -999,10 +998,9 @@ void EmbeddedObjectContainer::CloseEmbeddedObject( const uno::Reference < embed:
pImpl->maObjectToNameMap.erase( aIter->second );
pImpl->maNameToObjectMap.erase( aIter );
- uno::Reference < ::util::XCloseable > xClose( xObj, uno::UNO_QUERY );
try
{
- xClose->close( true );
+ xObj->close( true );
}
catch (const uno::Exception&)
{
diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx
index aa81039ad89c..c60f9fa6e75e 100644
--- a/comphelper/source/misc/backupfilehelper.cxx
+++ b/comphelper/source/misc/backupfilehelper.cxx
@@ -819,12 +819,12 @@ namespace
{
// create a SAXWriter
uno::Reference< xml::sax::XWriter > const xSaxWriter = xml::sax::Writer::create(xContext);
- uno::Reference< io::XStream > xTempFile(io::TempFile::create(xContext), uno::UNO_QUERY);
- uno::Reference< io::XOutputStream > xOutStrm(xTempFile->getOutputStream(), uno::UNO_QUERY);
+ uno::Reference< io::XStream > xTempFile = io::TempFile::create(xContext);
+ uno::Reference< io::XOutputStream > xOutStrm = xTempFile->getOutputStream();
// set output stream and do the serialization
- xSaxWriter->setOutputStream(uno::Reference< css::io::XOutputStream >(xOutStrm, uno::UNO_QUERY));
- xSerializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(xSaxWriter, uno::UNO_QUERY), uno::Sequence< beans::StringPair >());
+ xSaxWriter->setOutputStream(xOutStrm);
+ xSerializer->serialize(xSaxWriter, uno::Sequence< beans::StringPair >());
// get URL from temp file
uno::Reference < beans::XPropertySet > xTempFileProps(xTempFile, uno::UNO_QUERY);
@@ -2115,12 +2115,12 @@ namespace comphelper
// create a SAXWriter
uno::Reference< xml::sax::XWriter > const xSaxWriter = xml::sax::Writer::create(xContext);
- uno::Reference< io::XStream > xTempFile(io::TempFile::create(xContext), uno::UNO_QUERY);
- uno::Reference< io::XOutputStream > xOutStrm(xTempFile->getOutputStream(), uno::UNO_QUERY);
+ uno::Reference< io::XStream > xTempFile = io::TempFile::create(xContext);
+ uno::Reference< io::XOutputStream > xOutStrm = xTempFile->getOutputStream();
// set output stream and do the serialization
- xSaxWriter->setOutputStream(uno::Reference< css::io::XOutputStream >(xOutStrm, uno::UNO_QUERY));
- xSerializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(xSaxWriter, uno::UNO_QUERY), uno::Sequence< beans::StringPair >());
+ xSaxWriter->setOutputStream(xOutStrm);
+ xSerializer->serialize(xSaxWriter, uno::Sequence< beans::StringPair >());
// get URL from temp file
uno::Reference < beans::XPropertySet > xTempFileProps(xTempFile, uno::UNO_QUERY);
diff --git a/comphelper/source/misc/dispatchcommand.cxx b/comphelper/source/misc/dispatchcommand.cxx
index 069a9d835032..d7b723c72574 100644
--- a/comphelper/source/misc/dispatchcommand.cxx
+++ b/comphelper/source/misc/dispatchcommand.cxx
@@ -71,7 +71,7 @@ bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::bea
uno::Reference<frame::XFrame> xFrame(xDesktop->getActiveFrame());
if (!xFrame.is())
- xFrame.set(xDesktop, uno::UNO_QUERY);
+ xFrame = xDesktop;
return dispatchCommand(rCommand, xFrame, rArguments, rListener);
}
diff --git a/comphelper/source/misc/proxyaggregation.cxx b/comphelper/source/misc/proxyaggregation.cxx
index 3ace74436dfc..13d59edfe679 100644
--- a/comphelper/source/misc/proxyaggregation.cxx
+++ b/comphelper/source/misc/proxyaggregation.cxx
@@ -168,12 +168,10 @@ namespace comphelper
// dispose our inner context
// before we do this, remove ourself as listener - else in disposing( EventObject ), we
// would dispose ourself a second time
- Reference< XComponent > xComp( m_xInner, UNO_QUERY );
- if ( xComp.is() )
+ if ( m_xInner.is() )
{
- xComp->removeEventListener( this );
- xComp->dispose();
- xComp.clear();
+ m_xInner->removeEventListener( this );
+ m_xInner->dispose();
}
}
diff --git a/connectivity/source/commontools/TColumnsHelper.cxx b/connectivity/source/commontools/TColumnsHelper.cxx
index 6155ec09443b..b5f6eba0e160 100644
--- a/connectivity/source/commontools/TColumnsHelper.cxx
+++ b/connectivity/source/commontools/TColumnsHelper.cxx
@@ -137,14 +137,14 @@ sdbcx::ObjectType OColumnsHelper::createObject(const OUString& _rName)
else
{
- xRet.set(::dbtools::createSDBCXColumn( m_pTable,
+ xRet = ::dbtools::createSDBCXColumn( m_pTable,
xConnection,
_rName,
isCaseSensitive(),
bQueryInfo,
bAutoIncrement,
bIsCurrency,
- nDataType),UNO_QUERY);
+ nDataType);
}
return xRet;
}
diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx
index 4771e276e130..d760a16a7fc6 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -292,8 +292,8 @@ static Reference< XConnection > getConnection_allowException(
Reference<XCompletedConnection> xConnectionCompletion(xProp, UNO_QUERY);
if (xConnectionCompletion.is())
{ // instantiate the default SDB interaction handler
- Reference< XInteractionHandler > xHandler(
- InteractionHandler::createWithParent(_rxContext, nullptr), UNO_QUERY );
+ Reference< XInteractionHandler > xHandler =
+ InteractionHandler::createWithParent(_rxContext, nullptr);
xConnection = xConnectionCompletion->connectWithCompletion(xHandler);
}
}
diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 6c2a6862e8bd..dd4917634dab 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -202,9 +202,8 @@ void Connection::construct(const OUString& url, const Sequence< PropertyValue >&
if (m_sFirebirdURL.startsWith("file://"))
{
m_bIsFile = true;
- uno::Reference< ucb::XSimpleFileAccess > xFileAccess(
- ucb::SimpleFileAccess::create(comphelper::getProcessComponentContext()),
- uno::UNO_QUERY);
+ uno::Reference< ucb::XSimpleFileAccess > xFileAccess =
+ ucb::SimpleFileAccess::create(comphelper::getProcessComponentContext());
if (!xFileAccess->exists(m_sFirebirdURL))
bIsNewDatabase = true;
@@ -526,9 +525,8 @@ void Connection::loadDatabaseFile(const OUString& srcLocation, const OUString& t
Reference< XStream > xDBStream(m_xEmbeddedStorage->openStreamElement(srcLocation,
ElementModes::READ));
- uno::Reference< ucb::XSimpleFileAccess2 > xFileAccess(
- ucb::SimpleFileAccess::create( comphelper::getProcessComponentContext() ),
- uno::UNO_QUERY );
+ uno::Reference< ucb::XSimpleFileAccess2 > xFileAccess =
+ ucb::SimpleFileAccess::create( comphelper::getProcessComponentContext() );
if ( !xFileAccess.is() )
{
::connectivity::SharedResources aResources;
@@ -827,9 +825,8 @@ void SAL_CALL Connection::documentEventOccured( const DocumentEvent& Event )
xDBStream->getOutputStream());
// remove old fdb file if exists
- uno::Reference< ucb::XSimpleFileAccess > xFileAccess(
- ucb::SimpleFileAccess::create(xContext),
- uno::UNO_QUERY);
+ uno::Reference< ucb::XSimpleFileAccess > xFileAccess =
+ ucb::SimpleFileAccess::create(xContext);
if (xFileAccess->exists(m_sFirebirdURL))
xFileAccess->kill(m_sFirebirdURL);
}
diff --git a/connectivity/source/drivers/firebird/Driver.cxx b/connectivity/source/drivers/firebird/Driver.cxx
index 8e81ae9ae9b8..bb926d5494bb 100644
--- a/connectivity/source/drivers/firebird/Driver.cxx
+++ b/connectivity/source/drivers/firebird/Driver.cxx
@@ -221,7 +221,7 @@ uno::Reference< XTablesSupplier > SAL_CALL FirebirdDriver::getDataDefinitionByCo
const uno::Reference< XConnection >& rConnection)
{
Connection* pConnection = static_cast< Connection* >(rConnection.get());
- return uno::Reference< XTablesSupplier >(pConnection->createCatalog(), UNO_QUERY);
+ return pConnection->createCatalog();
}
uno::Reference< XTablesSupplier > SAL_CALL FirebirdDriver::getDataDefinitionByURL(
diff --git a/connectivity/source/drivers/firebird/StatementCommonBase.cxx b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
index e7994cd21cad..c9a142667aef 100644
--- a/connectivity/source/drivers/firebird/StatementCommonBase.cxx
+++ b/connectivity/source/drivers/firebird/StatementCommonBase.cxx
@@ -63,7 +63,7 @@ OStatementCommonBase::~OStatementCommonBase()
void OStatementCommonBase::disposeResultSet()
{
- uno::Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
+ uno::Reference< XComponent > xComp(m_xResultSet, UNO_QUERY);
if (xComp.is())
xComp->dispose();
m_xResultSet.clear();
diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx
index 550fb6c9dcff..ff753ce484eb 100644
--- a/connectivity/source/drivers/flat/ETable.cxx
+++ b/connectivity/source/drivers/flat/ETable.cxx
@@ -418,7 +418,7 @@ void OFlatTable::construct()
Reference< XNumberFormatsSupplier > xSupplier = NumberFormatsSupplier::createWithLocale( m_pConnection->getDriver()->getComponentContext(), aAppLocale );
m_xNumberFormatter.set( NumberFormatter::create( m_pConnection->getDriver()->getComponentContext()), UNO_QUERY_THROW);
m_xNumberFormatter->attachNumberFormatsSupplier(xSupplier);
- Reference<XPropertySet> xProp(xSupplier->getNumberFormatSettings(),UNO_QUERY);
+ Reference<XPropertySet> xProp = xSupplier->getNumberFormatSettings();
xProp->getPropertyValue("NullDate") >>= m_aNullDate;
INetURLObject aURL;
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx
index c80826d4a79b..ce8eec444194 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -456,7 +456,7 @@ namespace connectivity
return rConnection.second.second.first.get() == connection.get(); });
if (i != m_aConnections.end())
{
- xTab.set(i->second.second.second.get().get(),UNO_QUERY);
+ xTab.set(i->second.second.second,UNO_QUERY);
if ( !xTab.is() )
{
xTab = new OHCatalog(connection);
@@ -529,7 +529,7 @@ namespace connectivity
Reference<XStatement> xStmt = _xConnection->createStatement();
if ( xStmt.is() )
{
- Reference<XResultSet> xRes(xStmt->executeQuery("SELECT COUNT(*) FROM INFORMATION_SCHEMA.SYSTEM_SESSIONS WHERE USER_NAME ='SA'"), UNO_QUERY);
+ Reference<XResultSet> xRes = xStmt->executeQuery("SELECT COUNT(*) FROM INFORMATION_SCHEMA.SYSTEM_SESSIONS WHERE USER_NAME ='SA'");
Reference<XRow> xRow(xRes,UNO_QUERY);
if ( xRow.is() && xRes->next() )
bLastOne = xRow->getInt(1) == 1;
diff --git a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
index 0d53ebe0d986..233313f6bd7d 100644
--- a/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
+++ b/connectivity/source/drivers/mysql_jdbc/YDriver.cxx
@@ -354,7 +354,7 @@ ODriverDelegator::getDataDefinitionByConnection(const Reference<XConnection>& co
});
if (i != m_aConnections.end())
{
- xTab.set(i->second.first.get().get(), UNO_QUERY);
+ xTab.set(i->second.first.get(), UNO_QUERY);
if (!xTab.is())
{
xTab = new OMySQLCatalog(connection);
@@ -373,7 +373,7 @@ ODriverDelegator::getDataDefinitionByConnection(const Reference<XConnection>& co
});
if (i != m_aConnections.end())
{
- xTab.set(i->second.first.get().get(), UNO_QUERY);
+ xTab.set(i->second.first.get(), UNO_QUERY);
if (!xTab.is())
{
xTab = new OMySQLCatalog(connection);
diff --git a/connectivity/source/drivers/postgresql/pq_xtable.cxx b/connectivity/source/drivers/postgresql/pq_xtable.cxx
index f6175126724e..5dee7f799b91 100644
--- a/connectivity/source/drivers/postgresql/pq_xtable.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtable.cxx
@@ -222,7 +222,7 @@ void Table::alterColumnByName(
const OUString& colName,
const Reference< XPropertySet >& descriptor )
{
- Reference< css::container::XNameAccess > columns( getColumns(), UNO_QUERY );
+ Reference< css::container::XNameAccess > columns = getColumns();
OUString newName = extractStringProperty(descriptor, getStatics().NAME );
::pq_sdbc_driver::alterColumnByDescriptor(
diff --git a/connectivity/source/drivers/writer/WTable.cxx b/connectivity/source/drivers/writer/WTable.cxx
index 80290bd5dde5..82aea711a4a9 100644
--- a/connectivity/source/drivers/writer/WTable.cxx
+++ b/connectivity/source/drivers/writer/WTable.cxx
@@ -49,11 +49,11 @@ using namespace ::com::sun::star;
static void lcl_GetDataArea(const uno::Reference<text::XTextTable>& xTable, sal_Int32& rColumnCount,
sal_Int32& rRowCount)
{
- uno::Reference<container::XIndexAccess> xColumns(xTable->getColumns(), uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xColumns = xTable->getColumns();
if (xColumns.is())
rColumnCount = xColumns->getCount();
- uno::Reference<container::XIndexAccess> xRows(xTable->getRows(), uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xRows = xTable->getRows();
if (xRows.is())
rRowCount = xRows->getCount() - 1; // first row (headers) is not counted
}