[Libreoffice-commits] .: cppuhelper/source

Tor Lillqvist tml at kemper.freedesktop.org
Mon Aug 8 03:02:00 PDT 2011


 cppuhelper/source/bootstrap.cxx      |   60 -----------------------------
 cppuhelper/source/servicefactory.cxx |   71 +++++++++++++++++++++++++++++++----
 2 files changed, 63 insertions(+), 68 deletions(-)

New commits:
commit 2fdacd0142fea608423c417a0b06e54e6a7915a3
Author: Tor Lillqvist <tml at iki.fi>
Date:   Mon Aug 8 12:50:52 2011 +0300

    Move function to the file where it is used

diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx
index 5b4a58d..0da5cb0 100644
--- a/cppuhelper/source/bootstrap.cxx
+++ b/cppuhelper/source/bootstrap.cxx
@@ -119,66 +119,6 @@ Bootstrap const & get_unorc() SAL_THROW( () )
     return *(Bootstrap const *)&s_bstrap;
 }
 
-
-void addFactories(
-    char const * const * ppNames /* lib, implname, ..., 0 */,
-    OUString const & bootstrapPath,
-    Reference< lang::XMultiComponentFactory > const & xMgr,
-    Reference< registry::XRegistryKey > const & xKey )
-    SAL_THROW( (Exception) )
-{
-    Reference< container::XSet > xSet( xMgr, UNO_QUERY );
-    OSL_ASSERT( xSet.is() );
-    Reference< lang::XMultiServiceFactory > xSF( xMgr, UNO_QUERY );
-
-    while (*ppNames)
-    {
-        OUString lib( OUString::createFromAscii( *ppNames++ ) );
-        OUString implName( OUString::createFromAscii( *ppNames++ ) );
-
-        Any aFac( makeAny( loadSharedLibComponentFactory(
-                               lib, bootstrapPath, implName, xSF, xKey ) ) );
-        xSet->insert( aFac );
-#if OSL_DEBUG_LEVEL > 1
-        if (xSet->has( aFac ))
-        {
-            Reference< lang::XServiceInfo > xInfo;
-            if (aFac >>= xInfo)
-            {
-                ::fprintf(
-                    stderr, "> implementation %s supports: ", ppNames[ -1 ] );
-                Sequence< OUString > supported(
-                    xInfo->getSupportedServiceNames() );
-                for ( sal_Int32 nPos = supported.getLength(); nPos--; )
-                {
-                    OString str( OUStringToOString(
-                        supported[ nPos ], RTL_TEXTENCODING_ASCII_US ) );
-                    ::fprintf( stderr, nPos ? "%s, " : "%s\n", str.getStr() );
-                }
-            }
-            else
-            {
-                ::fprintf(
-                    stderr,
-                    "> implementation %s provides NO lang::XServiceInfo!!!\n",
-                    ppNames[ -1 ] );
-            }
-        }
-#endif
-#if OSL_DEBUG_LEVEL > 0
-        if (! xSet->has( aFac ))
-        {
-            OStringBuffer buf( 64 );
-            buf.append( "### failed inserting shared lib \"" );
-            buf.append( ppNames[ -2 ] );
-            buf.append( "\"!!!" );
-            OString str( buf.makeStringAndClear() );
-            OSL_FAIL( str.getStr() );
-        }
-#endif
-    }
-}
-
 // private forward decl
 Reference< lang::XMultiComponentFactory > bootstrapInitialSF(
     OUString const & rBootstrapPath )
diff --git a/cppuhelper/source/servicefactory.cxx b/cppuhelper/source/servicefactory.cxx
index 742f94a..1e40cf3 100644
--- a/cppuhelper/source/servicefactory.cxx
+++ b/cppuhelper/source/servicefactory.cxx
@@ -33,6 +33,7 @@
 
 #include "rtl/string.hxx"
 #include "rtl/bootstrap.hxx"
+#include "rtl/strbuf.hxx"
 #include "osl/diagnose.h"
 #include "osl/file.h"
 #include "osl/module.h"
@@ -67,14 +68,6 @@ namespace css = com::sun::star;
 namespace cppu
 {
 
-// private forward decl
-void addFactories(
-    char const * const * ppNames /* lib, implname, ..., 0 */,
-    OUString const & bootstrapPath,
-    Reference< lang::XMultiComponentFactory > const & xMgr,
-    Reference< registry::XRegistryKey > const & xKey )
-    SAL_THROW( (Exception) );
-
 Reference< security::XAccessController >
 createDefaultAccessController() SAL_THROW( () );
 
@@ -321,6 +314,68 @@ static void add_access_control_entries(
     context_values.push_back( entry );
 }
 
+namespace {
+void addFactories(
+    char const * const * ppNames /* lib, implname, ..., 0 */,
+    OUString const & bootstrapPath,
+    Reference< lang::XMultiComponentFactory > const & xMgr,
+    Reference< registry::XRegistryKey > const & xKey )
+    SAL_THROW( (Exception) )
+{
+    Reference< container::XSet > xSet( xMgr, UNO_QUERY );
+    OSL_ASSERT( xSet.is() );
+    Reference< lang::XMultiServiceFactory > xSF( xMgr, UNO_QUERY );
+
+    while (*ppNames)
+    {
+        OUString lib( OUString::createFromAscii( *ppNames++ ) );
+        OUString implName( OUString::createFromAscii( *ppNames++ ) );
+
+        Any aFac( makeAny( loadSharedLibComponentFactory(
+                               lib, bootstrapPath, implName, xSF, xKey ) ) );
+        xSet->insert( aFac );
+#if OSL_DEBUG_LEVEL > 1
+        if (xSet->has( aFac ))
+        {
+            Reference< lang::XServiceInfo > xInfo;
+            if (aFac >>= xInfo)
+            {
+                ::fprintf(
+                    stderr, "> implementation %s supports: ", ppNames[ -1 ] );
+                Sequence< OUString > supported(
+                    xInfo->getSupportedServiceNames() );
+                for ( sal_Int32 nPos = supported.getLength(); nPos--; )
+                {
+                    OString str( OUStringToOString(
+                        supported[ nPos ], RTL_TEXTENCODING_ASCII_US ) );
+                    ::fprintf( stderr, nPos ? "%s, " : "%s\n", str.getStr() );
+                }
+            }
+            else
+            {
+                ::fprintf(
+                    stderr,
+                    "> implementation %s provides NO lang::XServiceInfo!!!\n",
+                    ppNames[ -1 ] );
+            }
+        }
+#endif
+#if OSL_DEBUG_LEVEL > 0
+        if (! xSet->has( aFac ))
+        {
+            OStringBuffer buf( 64 );
+            buf.append( "### failed inserting shared lib \"" );
+            buf.append( ppNames[ -2 ] );
+            buf.append( "\"!!!" );
+            OString str( buf.makeStringAndClear() );
+            OSL_FAIL( str.getStr() );
+        }
+#endif
+    }
+}
+
+} // namespace
+
 Reference< lang::XMultiComponentFactory > bootstrapInitialSF(
     OUString const & rBootstrapPath )
     SAL_THROW( (Exception) )


More information about the Libreoffice-commits mailing list