From 2f7b329297c65d75f428d389a53b5822e38b0ec5 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 13 Dec 2013 15:10:18 +0100 Subject: [PATCH] [API CHANGE] remove cppu::loadSharedLibComponentFactory w/ rPrefix again ...it was never meant to be called by client code anyway and is no longer needed to be exposed since the global service manager implementation moved to cppuhelper. Change-Id: If2d0510b2364084d36edeb156a3459d9b8aeb983 --- cppuhelper/source/compat.cxx | 11 +++++ .../source/loadsharedlibcomponentfactory.hxx | 34 +++++++++++++ cppuhelper/source/servicemanager.cxx | 7 +-- cppuhelper/source/shlib.cxx | 48 ++++++++++++------- include/cppuhelper/shlib.hxx | 30 ------------ stoc/source/loader/dllcomponentloader.cxx | 2 +- 6 files changed, 80 insertions(+), 52 deletions(-) create mode 100644 cppuhelper/source/loadsharedlibcomponentfactory.hxx diff --git a/cppuhelper/source/compat.cxx b/cppuhelper/source/compat.cxx index c5075402f5ad..97605b01826b 100644 --- a/cppuhelper/source/compat.cxx +++ b/cppuhelper/source/compat.cxx @@ -103,6 +103,17 @@ invokeStaticComponentFactory( for (;;) { std::abort(); } // avoid "must return a value" warnings } +SAL_DLLPUBLIC_EXPORT css::uno::Reference SAL_CALL +loadSharedLibComponentFactory( + rtl::OUString const &, rtl::OUString const &, rtl::OUString const &, + css::uno::Reference const &, + css::uno::Reference const &, + rtl::OUString const &) + SAL_THROW((css::loader::CannotActivateFactoryException)) +{ + for (;;) { std::abort(); } // avoid "must return a value" warnings +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/source/loadsharedlibcomponentfactory.hxx b/cppuhelper/source/loadsharedlibcomponentfactory.hxx new file mode 100644 index 000000000000..b0986dd76f48 --- /dev/null +++ b/cppuhelper/source/loadsharedlibcomponentfactory.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef CPPUHELPER_SOURCE_LOADSHAREDLIBCOMPONENTFACTORY_HXX +#define CPPUHELPER_SOURCE_LOADSHAREDLIBCOMPONENTFACTORY_HXX + +#include + +#include + +namespace com { namespace sun { namespace star { + namespace lang { class XMultiServiceFactory; } + namespace uno { class XInterface; } +} } } +namespace rtl { class OUString; } + +namespace cppuhelper { namespace detail { + +css::uno::Reference loadSharedLibComponentFactory( + rtl::OUString const & uri, rtl::OUString const & prefix, + rtl::OUString const & rImplName, + css::uno::Reference const & xMgr); + +} } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 055bdd37b6d0..ae2060d06058 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -41,6 +41,8 @@ #include "rtl/strbuf.hxx" #include "sal/log.hxx" +#include + using rtl::OUString; using rtl::OString; using rtl::OStringBuffer; @@ -652,9 +654,8 @@ void cppuhelper::ServiceManager::loadImplementation( if (!prefix.isEmpty()) { prefix += "_"; } - f0 = cppu::loadSharedLibComponentFactory( - uri, rtl::OUString(), info->name, this, - css::uno::Reference< css::registry::XRegistryKey >(), prefix); + f0 = cppuhelper::detail::loadSharedLibComponentFactory( + uri, prefix, info->name, this); } else { SAL_WARN_IF( !info->prefix.isEmpty(), "cppuhelper", diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx index e941b9d19f56..8ad77f516190 100644 --- a/cppuhelper/source/shlib.cxx +++ b/cppuhelper/source/shlib.cxx @@ -27,6 +27,8 @@ #include "com/sun/star/beans/XPropertySet.hpp" +#include + #include #ifdef ANDROID @@ -44,12 +46,11 @@ using namespace ::com::sun::star::uno; using rtl::OString; using rtl::OUString; -namespace cppu -{ +namespace { #ifndef DISABLE_DYNLOADING -static void getLibEnv(oslModule lib, +void getLibEnv(oslModule lib, uno::Environment * pEnv, OUString * pSourceEnv_name, uno::Environment const & cTargetEnv, @@ -104,7 +105,7 @@ static void getLibEnv(oslModule lib, #endif -extern "C" {static void s_getFactory(va_list * pParam) +extern "C" void s_getFactory(va_list * pParam) { component_getFactoryFunc pSym = va_arg(*pParam, component_getFactoryFunc); OString const * pImplName = va_arg(*pParam, OString const *); @@ -113,7 +114,12 @@ extern "C" {static void s_getFactory(va_list * pParam) void ** ppSSF = va_arg(*pParam, void **); *ppSSF = pSym(pImplName->getStr(), pSMgr, pKey); -}} +} + +} + +namespace cppu +{ /* For backwards compatibility */ Reference< XInterface > SAL_CALL loadSharedLibComponentFactory( @@ -122,7 +128,14 @@ Reference< XInterface > SAL_CALL loadSharedLibComponentFactory( Reference< registry::XRegistryKey > const & xKey ) SAL_THROW( (loader::CannotActivateFactoryException) ) { - return loadSharedLibComponentFactory( uri, rPath, rImplName, xMgr, xKey, rtl::OUString() ); + assert(rPath.isEmpty()); + assert(!xKey.is()); + (void) rPath; + (void) xKey; + return cppuhelper::detail::loadSharedLibComponentFactory( + uri, "", rImplName, xMgr); +} + } namespace @@ -255,17 +268,12 @@ extern "C" } #endif -Reference< XInterface > SAL_CALL loadSharedLibComponentFactory( - OUString const & uri, OUString const & rPath, OUString const & rImplName, - Reference< lang::XMultiServiceFactory > const & xMgr, - Reference< registry::XRegistryKey > const & xKey, - OUString const & rPrefix ) - SAL_THROW( (loader::CannotActivateFactoryException) ) +namespace cppuhelper { namespace detail { + +css::uno::Reference loadSharedLibComponentFactory( + OUString const & uri, OUString const & rPrefix, OUString const & rImplName, + css::uno::Reference const & xMgr) { - assert(rPath.isEmpty()); - assert(!xKey.is()); - (void) rPath; - (void) xKey; #ifndef DISABLE_DYNLOADING OUString moduleUri(uri); @@ -387,6 +395,8 @@ Reference< XInterface > SAL_CALL loadSharedLibComponentFactory( return xRet; } +} } + #ifndef DISABLE_DYNLOADING //============================================================================== @@ -401,6 +411,8 @@ extern "C" { static void s_writeInfo(va_list * pParam) }} +namespace cppu { + void SAL_CALL writeSharedLibComponentInfo( OUString const & uri, OUString const & rPath, Reference< lang::XMultiServiceFactory > const & xMgr, @@ -502,8 +514,8 @@ void SAL_CALL writeSharedLibComponentInfo( } } -#endif // DISABLE_DYNLOADING - } +#endif // DISABLE_DYNLOADING + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/cppuhelper/shlib.hxx b/include/cppuhelper/shlib.hxx index 0dc5705e6c18..f04a6ad12542 100644 --- a/include/cppuhelper/shlib.hxx +++ b/include/cppuhelper/shlib.hxx @@ -54,36 +54,6 @@ SAL_CALL loadSharedLibComponentFactory( ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > const & xKey ) SAL_THROW( (::com::sun::star::loader::CannotActivateFactoryException) ); -/** Loads a shared library component and gets the factory out of it. You can give either a - fully qualified libname or single lib name. The libname need not be pre/postfixed - (e.g. xxx.dll). An optional 'prefix' parameter is used to determine the symbol - name of the entry point in the library. - - @deprecated - This should never have been put into the URE interface. Do not call it from - client code. - - @param uri URI of the library - @param rPath deprecated, must be empty - @param rImplName implementation to be retrieved from the library - @param xMgr service manager to be provided to the component - @param xKey deprecated, must be null - @param rPrefix optional component prefix - @return - factory instance (com::sun::star::lang::XSingleComponentFactory or legacy - com::sun::star::lang::XSingleServiceFactory) - - @since LibreOffice 3.4 -*/ -CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > -SAL_CALL loadSharedLibComponentFactory( - ::rtl::OUString const & uri, ::rtl::OUString const & rPath, - ::rtl::OUString const & rImplName, - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & xMgr, - ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > const & xKey, - ::rtl::OUString const & rPrefix ) - SAL_THROW( (::com::sun::star::loader::CannotActivateFactoryException) ); - /** Invokes component_writeInfo() function of specified component library. You can give either a fully qualified libname or single lib name. The libname need not be pre/postfixed (e.g. xxx.dll). diff --git a/stoc/source/loader/dllcomponentloader.cxx b/stoc/source/loader/dllcomponentloader.cxx index f7570d347162..c10d8b3d2099 100644 --- a/stoc/source/loader/dllcomponentloader.cxx +++ b/stoc/source/loader/dllcomponentloader.cxx @@ -161,7 +161,7 @@ Reference SAL_CALL DllComponentLoader::activate( { return loadSharedLibComponentFactory( cppu::bootstrap_expandUri(rLibName), OUString(), rImplName, m_xSMgr, - css::uno::Reference(), OUString() ); + css::uno::Reference()); }