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

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 12 06:53:33 UTC 2021


 connectivity/source/drivers/file/FDriver.cxx |   17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

New commits:
commit 4a7984960bf7d0af8342b360510c7e4e3d7399cf
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Sep 11 20:52:59 2021 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Sep 12 08:53:00 2021 +0200

    Simplify OFileDriver::getDataDefinitionByConnection
    
    Change-Id: Ia808f5e7867d474e36e60d163d1a556a59e2f89d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121974
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx
index c5afbd75f7e3..9bd0692bac26 100644
--- a/connectivity/source/drivers/file/FDriver.cxx
+++ b/connectivity/source/drivers/file/FDriver.cxx
@@ -20,6 +20,7 @@
 #include <file/FDriver.hxx>
 #include <file/FConnection.hxx>
 #include <file/fcode.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <comphelper/types.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <connectivity/dbexception.hxx>
@@ -171,25 +172,15 @@ Reference< XTablesSupplier > SAL_CALL OFileDriver::getDataDefinitionByConnection
     ::osl::MutexGuard aGuard( m_aMutex );
     checkDisposed(ODriver_BASE::rBHelper.bDisposed);
 
-    Reference< XTablesSupplier > xTab;
-    Reference< css::lang::XUnoTunnel> xTunnel(connection,UNO_QUERY);
-    if(xTunnel.is())
+    if (OConnection* pSearchConnection = comphelper::getUnoTunnelImplementation<OConnection>(connection))
     {
-        OConnection* pSearchConnection = reinterpret_cast< OConnection* >( xTunnel->getSomething(OConnection::getUnoTunnelId()) );
-        OConnection* pConnection = nullptr;
         for (auto const& elem : m_xConnections)
         {
             if (static_cast<OConnection*>( Reference< XConnection >::query(elem.get()).get() ) == pSearchConnection)
-            {
-                pConnection = pSearchConnection;
-                break;
-            }
+                return pSearchConnection->createCatalog();
         }
-
-        if(pConnection)
-            xTab = pConnection->createCatalog();
     }
-    return xTab;
+    return {};
 }
 
 


More information about the Libreoffice-commits mailing list