vcl/source/components/factory.cxx |   52 +++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

New commits:
commit 3faa61452a67bca97d223ee59748ac7b469cdd48
Author:     Christopher Sherlock <chris.sherloc...@gmail.com>
AuthorDate: Tue Dec 10 02:23:55 2024 +1100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Dec 10 11:44:47 2024 +0100

    vcl: flatten vcl_component_getFactory()
    
    Change-Id: I411c75ad491e5d755710bc6a4d38446e170abc47
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178159
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/source/components/factory.cxx 
b/vcl/source/components/factory.cxx
index 0a5b7e8f6f8c..2a2014125bee 100644
--- a/vcl/source/components/factory.cxx
+++ b/vcl/source/components/factory.cxx
@@ -32,36 +32,36 @@ extern "C" {
     VCL_DLLPUBLIC void* vcl_component_getFactory(
         const char* pImplementationName,
         void* pXUnoSMgr,
-        void* /*pXUnoKey*/
-        )
+        void* /*pXUnoKey*/)
     {
-        void* pRet = nullptr;
+        if (!pXUnoSMgr)
+            return nullptr;
 
-        if( pXUnoSMgr )
+        Reference< css::lang::XMultiServiceFactory > xMgr(
+            static_cast<css::lang::XMultiServiceFactory*>(pXUnoSMgr));
+
+        Reference< css::lang::XSingleServiceFactory > xFactory;
+
+        if( vcl::DragSource_getImplementationName().equalsAscii( 
pImplementationName ) )
+        {
+            xFactory = ::cppu::createSingleFactory(
+                xMgr, vcl::DragSource_getImplementationName(), 
vcl::DragSource_createInstance,
+                vcl::DragSource_getSupportedServiceNames() );
+        }
+        else if( vcl::DropTarget_getImplementationName().equalsAscii( 
pImplementationName ) )
         {
-            Reference< css::lang::XMultiServiceFactory > xMgr(
-                static_cast< css::lang::XMultiServiceFactory* >( pXUnoSMgr )
-                );
-            Reference< css::lang::XSingleServiceFactory > xFactory;
-            if( vcl::DragSource_getImplementationName().equalsAscii( 
pImplementationName ) )
-            {
-                xFactory = ::cppu::createSingleFactory(
-                    xMgr, vcl::DragSource_getImplementationName(), 
vcl::DragSource_createInstance,
-                    vcl::DragSource_getSupportedServiceNames() );
-            }
-            else if( vcl::DropTarget_getImplementationName().equalsAscii( 
pImplementationName ) )
-            {
-                xFactory = ::cppu::createSingleFactory(
-                    xMgr, vcl::DropTarget_getImplementationName(), 
vcl::DropTarget_createInstance,
-                    vcl::DropTarget_getSupportedServiceNames() );
-            }
-            if( xFactory.is() )
-            {
-                xFactory->acquire();
-                pRet = xFactory.get();
-            }
+            xFactory = ::cppu::createSingleFactory(
+                xMgr, vcl::DropTarget_getImplementationName(), 
vcl::DropTarget_createInstance,
+                vcl::DropTarget_getSupportedServiceNames() );
         }
-        return pRet;
+
+        if( xFactory.is() )
+        {
+            xFactory->acquire();
+            return xFactory.get();
+        }
+
+        return nullptr;
     }
 
 } /* extern "C" */

Reply via email to