[Libreoffice-commits] core.git: connectivity/source include/comphelper

Arkadiy Illarionov (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 24 07:10:46 UTC 2019


 connectivity/source/drivers/ado/AColumns.cxx |    4 ++--
 connectivity/source/drivers/ado/AGroups.cxx  |    4 ++--
 connectivity/source/drivers/ado/AIndexes.cxx |    4 ++--
 connectivity/source/drivers/ado/AKeys.cxx    |    4 ++--
 connectivity/source/drivers/ado/ATable.cxx   |    4 ++--
 connectivity/source/drivers/ado/ATables.cxx  |    4 ++--
 connectivity/source/drivers/ado/AUsers.cxx   |    4 ++--
 connectivity/source/drivers/ado/AViews.cxx   |    4 ++--
 include/comphelper/types.hxx                 |    7 +++----
 9 files changed, 19 insertions(+), 20 deletions(-)

New commits:
commit 3d4b1c0eee7a3055e67df6b0b342ea25b0f5bf55
Author:     Arkadiy Illarionov <qarkai at gmail.com>
AuthorDate: Sat Jun 22 00:17:00 2019 +0300
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Jun 24 09:09:50 2019 +0200

    tdf#39593 Change comphelper::getImplementation signature
    
    To merge with comphelper::getUnoTunnelImplementation
    
    Change-Id: I976d768d7fb159d50fa90e27ec36f2bea91ea2cb
    Reviewed-on: https://gerrit.libreoffice.org/74542
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/connectivity/source/drivers/ado/AColumns.cxx b/connectivity/source/drivers/ado/AColumns.cxx
index e72681b8d41f..ef010cfb4062 100644
--- a/connectivity/source/drivers/ado/AColumns.cxx
+++ b/connectivity/source/drivers/ado/AColumns.cxx
@@ -59,9 +59,9 @@ Reference< XPropertySet > OColumns::createDescriptor()
 // XAppend
 sdbcx::ObjectType OColumns::appendObject( const OUString&, const Reference< XPropertySet >& descriptor )
 {
-    OAdoColumn* pColumn = nullptr;
+    OAdoColumn* pColumn = getImplementation<OAdoColumn>( descriptor );
     Reference< XPropertySet > xColumn;
-    if ( !getImplementation( pColumn, descriptor ) || pColumn == nullptr )
+    if ( pColumn == nullptr )
     {
         // m_pConnection->throwGenericSQLException( STR_INVALID_COLUMN_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
         pColumn = new OAdoColumn(isCaseSensitive(),m_pConnection);
diff --git a/connectivity/source/drivers/ado/AGroups.cxx b/connectivity/source/drivers/ado/AGroups.cxx
index 80d23e20f9dc..506aead14f7d 100644
--- a/connectivity/source/drivers/ado/AGroups.cxx
+++ b/connectivity/source/drivers/ado/AGroups.cxx
@@ -57,8 +57,8 @@ Reference< XPropertySet > OGroups::createDescriptor()
 // XAppend
 sdbcx::ObjectType OGroups::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
 {
-    OAdoGroup* pGroup = nullptr;
-    if ( !getImplementation(pGroup,descriptor) || pGroup == nullptr )
+    OAdoGroup* pGroup = getImplementation<OAdoGroup>(descriptor);
+    if ( pGroup == nullptr )
         m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_GROUP_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
 
     m_aCollection.Append( pGroup->getImpl() );
diff --git a/connectivity/source/drivers/ado/AIndexes.cxx b/connectivity/source/drivers/ado/AIndexes.cxx
index a54887d2832e..46cd1c1a4b86 100644
--- a/connectivity/source/drivers/ado/AIndexes.cxx
+++ b/connectivity/source/drivers/ado/AIndexes.cxx
@@ -57,8 +57,8 @@ Reference< XPropertySet > OIndexes::createDescriptor()
 // XAppend
 sdbcx::ObjectType OIndexes::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
 {
-    OAdoIndex* pIndex = nullptr;
-    if ( !getImplementation(pIndex,descriptor) || pIndex == nullptr )
+    OAdoIndex* pIndex = getImplementation<OAdoIndex>(descriptor);
+    if ( pIndex == nullptr )
         m_pConnection->throwGenericSQLException( STR_INVALID_INDEX_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
 
     ADOIndexes* pIndexes = m_aCollection;
diff --git a/connectivity/source/drivers/ado/AKeys.cxx b/connectivity/source/drivers/ado/AKeys.cxx
index 559d7a7f101d..e306f918a726 100644
--- a/connectivity/source/drivers/ado/AKeys.cxx
+++ b/connectivity/source/drivers/ado/AKeys.cxx
@@ -57,8 +57,8 @@ Reference< XPropertySet > OKeys::createDescriptor()
 // XAppend
 sdbcx::ObjectType OKeys::appendObject( const OUString&, const Reference< XPropertySet >& descriptor )
 {
-    OAdoKey* pKey = nullptr;
-    if ( !getImplementation( pKey, descriptor ) || pKey == nullptr)
+    OAdoKey* pKey = getImplementation<OAdoKey>( descriptor );
+    if ( pKey == nullptr)
         m_pConnection->throwGenericSQLException( STR_INVALID_KEY_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
 
     // To pass as column parameter to Key's Append method
diff --git a/connectivity/source/drivers/ado/ATable.cxx b/connectivity/source/drivers/ado/ATable.cxx
index 09c4c397051d..34597d55fff5 100644
--- a/connectivity/source/drivers/ado/ATable.cxx
+++ b/connectivity/source/drivers/ado/ATable.cxx
@@ -163,8 +163,8 @@ void SAL_CALL OAdoTable::alterColumnByName( const OUString& colName, const Refer
     checkDisposed(OTableDescriptor_BASE_TYPEDEF::rBHelper.bDisposed);
 
     bool bError = true;
-    OAdoColumn* pColumn = nullptr;
-    if(::comphelper::getImplementation(pColumn,descriptor) && pColumn != nullptr)
+    OAdoColumn* pColumn = ::comphelper::getImplementation<OAdoColumn>(descriptor);
+    if(pColumn != nullptr)
     {
         WpADOColumns aColumns = m_aTable.get_Columns();
         bError = !aColumns.Delete(colName);
diff --git a/connectivity/source/drivers/ado/ATables.cxx b/connectivity/source/drivers/ado/ATables.cxx
index 95c06f39c6f8..75fbaba3b710 100644
--- a/connectivity/source/drivers/ado/ATables.cxx
+++ b/connectivity/source/drivers/ado/ATables.cxx
@@ -64,8 +64,8 @@ Reference< XPropertySet > OTables::createDescriptor()
 // XAppend
 sdbcx::ObjectType OTables::appendObject( const OUString&, const Reference< XPropertySet >& descriptor )
 {
-    OAdoTable* pTable = nullptr;
-    if ( !getImplementation( pTable, descriptor ) || pTable == nullptr )
+    OAdoTable* pTable = getImplementation<OAdoTable>( descriptor );
+    if ( pTable == nullptr )
         m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_TABLE_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
 
     OSL_ENSURE(m_aCollection.IsValid(),"Collection isn't valid");
diff --git a/connectivity/source/drivers/ado/AUsers.cxx b/connectivity/source/drivers/ado/AUsers.cxx
index 48075d5960c4..c7e3d6632bb0 100644
--- a/connectivity/source/drivers/ado/AUsers.cxx
+++ b/connectivity/source/drivers/ado/AUsers.cxx
@@ -55,8 +55,8 @@ Reference< XPropertySet > OUsers::createDescriptor()
 // XAppend
 sdbcx::ObjectType OUsers::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
 {
-    OUserExtend* pUser = nullptr;
-    if ( !getImplementation( pUser, descriptor ) || pUser == nullptr )
+    OUserExtend* pUser = getImplementation<OUserExtend>( descriptor );
+    if ( pUser == nullptr )
         m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_USER_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
 
     ADOUsers* pUsers = static_cast<ADOUsers*>(m_aCollection);
diff --git a/connectivity/source/drivers/ado/AViews.cxx b/connectivity/source/drivers/ado/AViews.cxx
index 7f6ccb0f3c15..01744952f023 100644
--- a/connectivity/source/drivers/ado/AViews.cxx
+++ b/connectivity/source/drivers/ado/AViews.cxx
@@ -59,8 +59,8 @@ Reference< XPropertySet > OViews::createDescriptor()
 // XAppend
 sdbcx::ObjectType OViews::appendObject( const OUString& _rForName, const Reference< XPropertySet >& descriptor )
 {
-    OAdoView* pView = nullptr;
-    if ( !getImplementation( pView, descriptor ) || pView == nullptr )
+    OAdoView* pView = getImplementation<OAdoView>( descriptor );
+    if ( pView == nullptr )
         m_pCatalog->getConnection()->throwGenericSQLException( STR_INVALID_VIEW_DESCRIPTOR_ERROR,static_cast<XTypeProvider*>(this) );
 
     WpADOCommand aCommand;
diff --git a/include/comphelper/types.hxx b/include/comphelper/types.hxx
index 1e5b2f9f0a90..3b9c3ef1617b 100644
--- a/include/comphelper/types.hxx
+++ b/include/comphelper/types.hxx
@@ -52,14 +52,13 @@ namespace comphelper
     }
 
     template <class TYPE>
-    bool getImplementation(TYPE*& _pObject, const css::uno::Reference< css::uno::XInterface >& _rxIFace)
+    TYPE* getImplementation(const css::uno::Reference< css::uno::XInterface >& _rxIFace)
     {
-        _pObject = nullptr;
         css::uno::Reference< css::lang::XUnoTunnel > xTunnel(_rxIFace, css::uno::UNO_QUERY);
         if (xTunnel.is())
-            _pObject = reinterpret_cast< TYPE* >(xTunnel->getSomething(TYPE::getUnoTunnelImplementationId()));
+            return reinterpret_cast< TYPE* >(xTunnel->getSomething(TYPE::getUnoTunnelImplementationId()));
 
-        return (_pObject != nullptr);
+        return nullptr;
     }
 
 


More information about the Libreoffice-commits mailing list