diff options
author | Tor Lillqvist <tml@iki.fi> | 2012-04-09 22:40:17 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2012-04-09 22:43:52 +0300 |
commit | 0b67dd10f858caf46a1d55aff1de319d161f44cf (patch) | |
tree | 1518974427a556f2c1ab5e400544b8fd7e1371f0 /cppuhelper | |
parent | 0b165a6e0a2eb79b2267810edb8cfaa34107ba94 (diff) |
Use lo_get_libmap()
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/shlib.cxx | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx index 8c127843908e..0627e301631c 100644 --- a/cppuhelper/source/shlib.cxx +++ b/cppuhelper/source/shlib.cxx @@ -46,6 +46,10 @@ #endif #include <vector> +#ifdef IOS +#include <osl/detail/ios-bootstrap.h> +#endif + #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) @@ -463,7 +467,6 @@ extern "C" extern void * configmgr_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * fwk_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * i18npool_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ); - extern void * sc_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * ucb_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ); extern void * ucpfile_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ); } @@ -523,24 +526,33 @@ Reference< XInterface > SAL_CALL loadSharedLibComponentFactory( oslGenericFunction pSym = NULL; #ifdef DISABLE_DYNLOADING - if ( rLibName.equals( OUSTR("bootstrap.uno" SAL_DLLEXTENSION)) ) - pSym = (oslGenericFunction) bootstrap_component_getFactory; - else if ( rLibName.equals( OUSTR("libucb1.a")) ) - pSym = (oslGenericFunction) ucb_component_getFactory; - else if ( rLibName.equals( OUSTR("configmgr.uno.a")) ) - pSym = (oslGenericFunction) configmgr_component_getFactory; - else if ( rLibName.equals( OUSTR("libucpfile1.a")) ) - pSym = (oslGenericFunction) ucpfile_component_getFactory; - else if ( rLibName.equals( OUSTR("libsclo.a")) ) - pSym = (oslGenericFunction) sc_component_getFactory; - else if ( rLibName.equals( OUSTR("libfwklo.a")) ) - pSym = (oslGenericFunction) fwk_component_getFactory; - else if ( rLibName.equals( OUSTR("i18npool.uno.a")) ) - pSym = (oslGenericFunction) i18npool_component_getFactory; - else + // First test library names that aren't app-specific. + static lib_to_component_mapping non_app_specific_map[] = { + { "bootstrap.uno" SAL_DLLEXTENSION, bootstrap_component_getFactory }, + { "configmgr.uno.a", configmgr_component_getFactory }, + { "i18npool.uno.a", i18npool_component_getFactory }, + { "libfwklo.a", fwk_component_getFactory }, + { "libucb1.a", ucb_component_getFactory }, + { "libucpfile1.a", ucpfile_component_getFactory }, + { NULL, NULL } + }; + for (int i = 0; pSym == NULL && non_app_specific_map[i].lib != NULL; ++i) { + if ( rLibName.equalsAscii( non_app_specific_map[i].lib ) ) + pSym = (oslGenericFunction) non_app_specific_map[i].component_getFactory_function; + } + + if ( pSym == NULL) + { + const lib_to_component_mapping *map = lo_get_libmap(); + for (int i = 0; pSym == NULL && map[i].lib != NULL; ++i) + { + if ( rLibName.equalsAscii( map[i].lib ) ) + pSym = (oslGenericFunction) map[i].component_getFactory_function; + } #if OSL_DEBUG_LEVEL > 1 - OSL_TRACE( "attempting to load unknown library %s", OUStringToOString( rLibName, RTL_TEXTENCODING_ASCII_US ).getStr() ); + if ( pSym == NULL ) + OSL_TRACE( "attempting to load unknown library %s", OUStringToOString( rLibName, RTL_TEXTENCODING_ASCII_US ).getStr() ); #endif } #else |