cppuhelper/source/defaultbootstrap.cxx | 3 cppuhelper/source/typedescriptionprovider.cxx | 124 ++++++------- cppuhelper/source/typedescriptionprovider.hxx | 11 - desktop/unx/source/start.c | 5 desktop/win32/source/officeloader/officeloader.cxx | 8 libxslt/libxslt-1.1.26-memdump.patch | 10 + libxslt/makefile.mk | 3 stoc/source/tdmanager/tdmgr.cxx | 195 +++++++++++---------- 8 files changed, 196 insertions(+), 163 deletions(-)
New commits: commit 6f6ed9c7e2212e5e7acb2c5b827e4e4f1e156ecd Author: Stephan Bergmann <sberg...@redhat.com> Date: Fri Jan 18 14:23:27 2013 +0100 Avoid .memdump files left behind by xsltproc in the build Change-Id: If79896a2f73cacd9880e8beb9cc42993b49cc3b5 diff --git a/libxslt/libxslt-1.1.26-memdump.patch b/libxslt/libxslt-1.1.26-memdump.patch new file mode 100644 index 0000000..28724f7 --- /dev/null +++ b/libxslt/libxslt-1.1.26-memdump.patch @@ -0,0 +1,10 @@ +--- misc/libxslt-1.1.26/xsltproc/xsltproc.c 2009-08-23 14:53:33.000000000 +0200 ++++ misc/build/libxslt-1.1.26/xsltproc/xsltproc.c 2013-01-18 14:16:12.202767222 +0100 +@@ -877,7 +877,6 @@ + xsltFreeSecurityPrefs(sec); + xsltCleanupGlobals(); + xmlCleanupParser(); +- xmlMemoryDump(); + return(errorno); + } + diff --git a/libxslt/makefile.mk b/libxslt/makefile.mk index 1574709..691c50b 100644 --- a/libxslt/makefile.mk +++ b/libxslt/makefile.mk @@ -57,7 +57,8 @@ PATCH_FILES=libxslt-configure.patch \ libxslt-mingw.patch \ libxslt-internal-symbols.patch \ libxslt-aix.patch \ - libxslt-vc10.patch + libxslt-vc10.patch \ + libxslt-1.1.26-memdump.patch .IF "$(OS)"=="ANDROID" PATCH_FILES+= libxslt-android.patch commit 2fcba16dc48ed7c0a507c18731a41a99f485ee46 Author: Stephan Bergmann <sberg...@redhat.com> Date: Fri Jan 18 13:19:45 2013 +0100 Never pass -env: arguments across OfficeIPC connection Change-Id: I1874ad0542bc8dcbe9ec588599a054030fd5d7d8 diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c index 0e32c59..c6b4339 100644 --- a/desktop/unx/source/start.c +++ b/desktop/unx/source/start.c @@ -45,6 +45,7 @@ #include <osl/thread.h> #include <rtl/bootstrap.h> #include <rtl/digest.h> +#include <rtl/process.h> #include <rtl/ustrbuf.h> #include <sal/main.h> @@ -454,7 +455,7 @@ send_args( int fd, rtl_uString *pCwdPath ) size_t nLen; rtl_uString *pEscapedCwdPath = escape_path( pCwdPath ); sal_uInt32 nArg = 0; - sal_uInt32 nArgCount = osl_getCommandArgCount(); + sal_uInt32 nArgCount = rtl_getAppCommandArgCount(); rtl_uString_new_WithLength( &pBuffer, nCapacity ); rtl_uString_new( &pTmp ); @@ -487,7 +488,7 @@ send_args( int fd, rtl_uString *pCwdPath ) rtl_uString_getLength( pBuffer ), ",", 1 ); - osl_getCommandArg( nArg, &pTmp ); + rtl_getAppCommandArg( nArg, &pTmp ); pEscapedTmp = escape_path( pTmp ); diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx index c7c91c6..527125f 100644 --- a/desktop/win32/source/officeloader/officeloader.cxx +++ b/desktop/win32/source/officeloader/officeloader.cxx @@ -21,6 +21,7 @@ #define _UNICODE #include <cstddef> +#include <cwchar> #define WIN32_LEAN_AND_MEAN #if defined _MSC_VER @@ -290,7 +291,12 @@ int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int ) } for ( int argn = 1; fSuccess && argn < argc2; argn++ ) { - fSuccess = writeArgument(hPipe, ',', argv2[argn]); + if (std::wcsncmp( + argv2[argn], L"-env:", std::wcslen(L"-env:")) + != 0) + { + fSuccess = writeArgument(hPipe, ',', argv2[argn]); + } } if ( fSuccess ) commit 36e8d5d137260decabb7d2436fff2d3a93278f9d Author: Stephan Bergmann <sberg...@redhat.com> Date: Fri Jan 18 12:46:16 2013 +0100 Insert type rdbs individually into theTypeDescriptionManager ...to make it easier in the future to replace the binary rdb format with something else, but also keep support for the old format for backwards compatibility (extensions). This should have no performance impact, as the type description manager (a) caches information about requested type descriptions, and (b) has been changed to process the bootstrap rdbs en bloc without doing costly consistency checks (which are useful though when inserting an rdb when installing an extension, but which would exhaustively read all type descriptions from the inserted rdb, so would negate any benefit of constructing any type descriptions on demand only). Change-Id: I80b22770bd9a5e0ab686f04d9c70295f2e3d0bf6 diff --git a/cppuhelper/source/defaultbootstrap.cxx b/cppuhelper/source/defaultbootstrap.cxx index 9f0cb52..39d5b22 100644 --- a/cppuhelper/source/defaultbootstrap.cxx +++ b/cppuhelper/source/defaultbootstrap.cxx @@ -35,6 +35,7 @@ #include "com/sun/star/container/XHierarchicalNameAccess.hpp" #include "com/sun/star/container/XSet.hpp" #include "com/sun/star/uno/DeploymentException.hpp" +#include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/XComponentContext.hpp" #include "cppuhelper/bootstrap.hxx" @@ -117,7 +118,7 @@ cppu::defaultBootstrap_InitialComponentContext(rtl::OUString const & iniUri) tdmgr, css::uno::UNO_QUERY_THROW)-> insert( css::uno::makeAny( - cppuhelper::createTypeDescriptionProvider( + cppuhelper::createTypeDescriptionProviders( getBootstrapVariable(bs, "UNO_TYPES"), smgr.get(), context))); cppu::installTypeDescriptionManager(tdmgr); diff --git a/cppuhelper/source/typedescriptionprovider.cxx b/cppuhelper/source/typedescriptionprovider.cxx index d99650b..17e447f 100644 --- a/cppuhelper/source/typedescriptionprovider.cxx +++ b/cppuhelper/source/typedescriptionprovider.cxx @@ -10,13 +10,16 @@ #include "sal/config.h" #include <cassert> +#include <vector> +#include "com/sun/star/container/XHierarchicalNameAccess.hpp" #include "com/sun/star/lang/XInitialization.hpp" #include "com/sun/star/lang/XMultiComponentFactory.hpp" #include "com/sun/star/registry/InvalidRegistryException.hpp" #include "com/sun/star/registry/XSimpleRegistry.hpp" #include "com/sun/star/uno/DeploymentException.hpp" #include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/uno/XInterface.hpp" #include "osl/file.hxx" @@ -27,52 +30,50 @@ namespace { -css::uno::Reference< css::registry::XSimpleRegistry > readTypeRdbFile( +void readTypeRdbFile( rtl::OUString const & uri, bool optional, - css::uno::Reference< css::registry::XSimpleRegistry > const & lastRegistry, css::uno::Reference< css::lang::XMultiComponentFactory > const & serviceManager, - css::uno::Reference< css::uno::XComponentContext > const & context) + css::uno::Reference< css::uno::XComponentContext > const & context, + std::vector< + css::uno::Reference< css::container::XHierarchicalNameAccess > > * + providers) { assert(serviceManager.is()); + assert(providers != 0); + css::uno::Reference< css::registry::XSimpleRegistry > reg( + serviceManager->createInstanceWithContext( + "com.sun.star.comp.stoc.SimpleRegistry", context), + css::uno::UNO_QUERY_THROW); try { - css::uno::Reference< css::registry::XSimpleRegistry > simple( - serviceManager->createInstanceWithContext( - "com.sun.star.comp.stoc.SimpleRegistry", context), - css::uno::UNO_QUERY_THROW); - simple->open(uri, true, false); - if (lastRegistry.is()) { - css::uno::Reference< css::registry::XSimpleRegistry > nested( - serviceManager->createInstanceWithContext( - "com.sun.star.comp.stoc.NestedRegistry", context), - css::uno::UNO_QUERY_THROW); - css::uno::Sequence< css::uno::Any > args(2); - args[0] <<= lastRegistry; - args[1] <<= simple; - css::uno::Reference< css::lang::XInitialization >( - nested, css::uno::UNO_QUERY_THROW)-> - initialize(args); - return nested; - } else { - return simple; - } + reg->open(uri, true, false); } catch (css::registry::InvalidRegistryException & e) { - if (!optional) { - throw css::uno::DeploymentException( - "Invalid registry " + uri + ":" + e.Message, - css::uno::Reference< css::uno::XInterface >()); + if (optional) { + SAL_INFO("cppuhelper", "Ignored optional " << uri); + return; } - SAL_INFO("cppuhelper", "Ignored optional " << uri); - return lastRegistry; + throw css::uno::DeploymentException( + "Invalid registry " + uri + ":" + e.Message, + css::uno::Reference< css::uno::XInterface >()); } + css::uno::Sequence< css::uno::Any > arg(1); + arg[0] <<= reg; + providers->push_back( + css::uno::Reference< css::container::XHierarchicalNameAccess >( + serviceManager->createInstanceWithArgumentsAndContext( + "com.sun.star.comp.stoc.RegistryTypeDescriptionProvider", arg, + context), + css::uno::UNO_QUERY_THROW)); } -css::uno::Reference< css::registry::XSimpleRegistry > readTypeRdbDirectory( +void readTypeRdbDirectory( rtl::OUString const & uri, bool optional, - css::uno::Reference< css::registry::XSimpleRegistry > const & lastRegistry, css::uno::Reference< css::lang::XMultiComponentFactory > const & serviceManager, - css::uno::Reference< css::uno::XComponentContext > const & context) + css::uno::Reference< css::uno::XComponentContext > const & context, + std::vector< + css::uno::Reference< css::container::XHierarchicalNameAccess > > * + providers) { osl::Directory dir(uri); switch (dir.open()) { @@ -81,7 +82,7 @@ css::uno::Reference< css::registry::XSimpleRegistry > readTypeRdbDirectory( case osl::FileBase::E_NOENT: if (optional) { SAL_INFO("cppuhelper", "Ignored optional " << uri); - return lastRegistry; + return; } // fall through default: @@ -89,25 +90,27 @@ css::uno::Reference< css::registry::XSimpleRegistry > readTypeRdbDirectory( "Cannot open directory " + uri, css::uno::Reference< css::uno::XInterface >()); } - css::uno::Reference< css::registry::XSimpleRegistry > last(lastRegistry); for (;;) { rtl::OUString fileUri; if (!cppu::nextDirectoryItem(dir, &fileUri)) { break; } - last = readTypeRdbFile( - fileUri, optional, last, serviceManager, context); + readTypeRdbFile(fileUri, optional, serviceManager, context, providers); } - return last; } -css::uno::Reference< css::registry::XSimpleRegistry > createTypeRegistry( +} + +css::uno::Sequence< + css::uno::Reference< css::container::XHierarchicalNameAccess > > +cppuhelper::createTypeDescriptionProviders( rtl::OUString const & uris, css::uno::Reference< css::lang::XMultiComponentFactory > const & serviceManager, css::uno::Reference< css::uno::XComponentContext > const & context) { - css::uno::Reference< css::registry::XSimpleRegistry > reg; + std::vector< + css::uno::Reference< css::container::XHierarchicalNameAccess > > provs; for (sal_Int32 i = 0; i != -1;) { rtl::OUString uri(uris.getToken(0, ' ', i)); if (uri.isEmpty()) { @@ -116,35 +119,24 @@ css::uno::Reference< css::registry::XSimpleRegistry > createTypeRegistry( bool optional; bool directory; cppu::decodeRdbUri(&uri, &optional, &directory); - reg = directory - ? readTypeRdbDirectory(uri, optional, reg, serviceManager, context) - : readTypeRdbFile(uri, optional, reg, serviceManager, context); + if (directory) { + readTypeRdbDirectory( + uri, optional, serviceManager, context, &provs); + } else { + readTypeRdbFile(uri, optional, serviceManager, context, &provs); + } } - return reg; -} - -} - -css::uno::Reference< css::uno::XInterface > -cppuhelper::createTypeDescriptionProvider( - rtl::OUString const & uris, - css::uno::Reference< css::lang::XMultiComponentFactory > const & - serviceManager, - css::uno::Reference< css::uno::XComponentContext > const & context) -{ - assert(serviceManager.is()); - css::uno::Sequence< css::uno::Any > args; - css::uno::Reference< css::registry::XSimpleRegistry > typereg( - createTypeRegistry(uris, serviceManager, context)); - if (typereg.is()) { - args.realloc(1); - args[0] <<= typereg; + css::uno::Sequence< + css::uno::Reference< css::container::XHierarchicalNameAccess > > provs2( + static_cast< sal_Int32 >(provs.size())); //TODO: check overflow + std::vector< + css::uno::Reference< + css::container::XHierarchicalNameAccess > >::iterator i( + provs.begin()); + for (sal_Int32 j = 0; j != provs2.getLength(); ++j) { + provs2[j] = *i++; } - return css::uno::Reference< css::uno::XInterface >( - serviceManager->createInstanceWithArgumentsAndContext( - "com.sun.star.comp.stoc.RegistryTypeDescriptionProvider", - args, context), - css::uno::UNO_SET_THROW); + return provs2; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/source/typedescriptionprovider.hxx b/cppuhelper/source/typedescriptionprovider.hxx index f3715e6..93336e8 100644 --- a/cppuhelper/source/typedescriptionprovider.hxx +++ b/cppuhelper/source/typedescriptionprovider.hxx @@ -13,19 +13,20 @@ #include "sal/config.h" #include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/Sequence.hxx" namespace com { namespace sun { namespace star { + namespace container { class XHierarchicalNameAccess; } namespace lang { class XMultiComponentFactory; } - namespace uno { - class XComponentContext; - class XInterface; - } + namespace uno { class XComponentContext; } } } } namespace rtl { class OUString; } namespace cppuhelper { -css::uno::Reference< css::uno::XInterface > createTypeDescriptionProvider( +css::uno::Sequence< + css::uno::Reference< css::container::XHierarchicalNameAccess > > +createTypeDescriptionProviders( rtl::OUString const & uris, css::uno::Reference< css::lang::XMultiComponentFactory > const & serviceManager, diff --git a/stoc/source/tdmanager/tdmgr.cxx b/stoc/source/tdmanager/tdmgr.cxx index b246e30..2047f4a 100644 --- a/stoc/source/tdmanager/tdmgr.cxx +++ b/stoc/source/tdmanager/tdmgr.cxx @@ -392,112 +392,133 @@ sal_Bool SAL_CALL ManagerImpl::has( const Any & rElement ) void SAL_CALL ManagerImpl::insert( const Any & rElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException) { - Reference< XHierarchicalNameAccess > xElem; - if (! (rElement >>= xElem) || !xElem.is()) - { - throw IllegalArgumentException( - OUString( RTL_CONSTASCII_USTRINGPARAM("no valid type description provider given!") ), - (XWeak *)(OWeakObject *)this, 0 ); + // Passing in a sequence of type providers instead of a single one bypasses + // the consistency checks; it is used during bootstrap: + bool doCheck = false; + css::uno::Sequence< + css::uno::Reference< css::container::XHierarchicalNameAccess > > provs; + if (!(rElement >>= provs)) { + css::uno::Reference< css::container::XHierarchicalNameAccess > prov; + if (!(rElement >>= prov)) { + throw css::lang::IllegalArgumentException( + "no type description provider (or sequence thereof)", + static_cast< cppu::OWeakObject * >(this), 0); + } + doCheck = true; + provs.realloc(1); + provs[0] = prov; } MutexGuard aGuard( _aComponentMutex ); - if (find( _aProviders.begin(), _aProviders.end(), xElem ) != _aProviders.end()) - { - throw ElementExistException( - OUString( RTL_CONSTASCII_USTRINGPARAM("provider already inserted!") ), - (XWeak *)(OWeakObject *)this ); - } + ProviderVector newProvs(_aProviders); + for (sal_Int32 i = 0; i != provs.getLength(); ++i) { + Reference< XHierarchicalNameAccess > xElem(provs[i]); + if (!xElem.is()) { + throw css::lang::IllegalArgumentException( + "null type description provider", + static_cast< cppu::OWeakObject * >(this), 0); + } - if (! _aProviders.empty()) - { - // check whether all types are compatible, if possible: - Reference<reflection::XTypeDescriptionEnumerationAccess> xTDEnumAccess( - xElem, UNO_QUERY ); - OSL_ENSURE( xTDEnumAccess.is(), - "### providers ought to implement " - "reflection::XTypeDescriptionEnumerationAccess!" ); - if (xTDEnumAccess.is()) - { - try + if (doCheck) { + if (find( newProvs.begin(), newProvs.end(), xElem ) != newProvs.end()) { - TypeClass ar [] = { - TypeClass_ENUM, TypeClass_TYPEDEF, TypeClass_SEQUENCE, - TypeClass_STRUCT, TypeClass_EXCEPTION, - /* TypeClass_UNION, TypeClass_ARRAY not supported */ - TypeClass_INTERFACE, - TypeClass_SERVICE, - TypeClass_INTERFACE_METHOD, TypeClass_INTERFACE_ATTRIBUTE, - TypeClass_PROPERTY, TypeClass_CONSTANT, TypeClass_CONSTANTS, - TypeClass_SINGLETON - }; - Reference<reflection::XTypeDescriptionEnumeration> xTDEnum( - xTDEnumAccess->createTypeDescriptionEnumeration( - OUString() /* all modules */, - Sequence<TypeClass>( ar, ARLEN(ar) ), - reflection::TypeDescriptionSearchDepth_INFINITE ) ); - - while (xTDEnum->hasMoreElements()) + throw ElementExistException( + OUString( RTL_CONSTASCII_USTRINGPARAM("provider already inserted!") ), + (XWeak *)(OWeakObject *)this ); + } + + // check whether all types are compatible, if possible: + Reference<reflection::XTypeDescriptionEnumerationAccess> xTDEnumAccess( + xElem, UNO_QUERY ); + OSL_ENSURE( xTDEnumAccess.is(), + "### providers ought to implement " + "reflection::XTypeDescriptionEnumerationAccess!" ); + if (xTDEnumAccess.is()) + { + try { - Reference<reflection::XTypeDescription> xNewTD; - try + TypeClass ar [] = { + TypeClass_ENUM, TypeClass_TYPEDEF, TypeClass_SEQUENCE, + TypeClass_STRUCT, TypeClass_EXCEPTION, + /* TypeClass_UNION, TypeClass_ARRAY not supported */ + TypeClass_INTERFACE, + TypeClass_SERVICE, + TypeClass_INTERFACE_METHOD, TypeClass_INTERFACE_ATTRIBUTE, + TypeClass_PROPERTY, TypeClass_CONSTANT, TypeClass_CONSTANTS, + TypeClass_SINGLETON + }; + Reference<reflection::XTypeDescriptionEnumeration> xTDEnum( + xTDEnumAccess->createTypeDescriptionEnumeration( + OUString() /* all modules */, + Sequence<TypeClass>( ar, ARLEN(ar) ), + reflection::TypeDescriptionSearchDepth_INFINITE ) ); + + while (xTDEnum->hasMoreElements()) { - xNewTD = xTDEnum->nextTypeDescription(); - } - catch (const container::NoSuchElementException & exc) - { - throw lang::IllegalArgumentException( - OUSTR("NoSuchElementException occurred: ") + - exc.Message, static_cast<OWeakObject *>(this), - -1 /* unknown */ ); - } + Reference<reflection::XTypeDescription> xNewTD; + try + { + xNewTD = xTDEnum->nextTypeDescription(); + } + catch (const container::NoSuchElementException & exc) + { + throw lang::IllegalArgumentException( + OUSTR("NoSuchElementException occurred: ") + + exc.Message, static_cast<OWeakObject *>(this), + -1 /* unknown */ ); + } - try - { - OUString newName( xNewTD->getName() ); - Reference<reflection::XTypeDescription> xExistingTD( - getByHierarchicalName( newName ), UNO_QUERY ); - OSL_ASSERT( xExistingTD.is() ); - // existing, check whether compatible: - if (xExistingTD.is()) + try { - try + OUString newName( xNewTD->getName() ); + Reference<reflection::XTypeDescription> xExistingTD( + getByHierarchicalName( newName ), UNO_QUERY ); + OSL_ASSERT( xExistingTD.is() ); + // existing, check whether compatible: + if (xExistingTD.is()) { - check( xNewTD, xExistingTD ); - } - catch (const IncompatibleTypeException & exc) - { - throw lang::IllegalArgumentException( - OUSTR("Rejecting types due to " - "incompatibility! ") + exc.m_cause, - static_cast<OWeakObject *>(this), 0 ); + try + { + check( xNewTD, xExistingTD ); + } + catch (const IncompatibleTypeException & exc) + { + throw lang::IllegalArgumentException( + OUSTR("Rejecting types due to " + "incompatibility! ") + exc.m_cause, + static_cast<OWeakObject *>(this), 0 ); + } } } - } - catch (container::NoSuchElementException &) - { - // type not in: ok + catch (container::NoSuchElementException &) + { + // type not in: ok + } } } + catch (const reflection::NoSuchTypeNameException & exc) + { + throw lang::IllegalArgumentException( + OUSTR("NoSuchTypeNameException occurred: ") + exc.Message, + static_cast<OWeakObject *>(this), -1 /* unknown */ ); } - catch (const reflection::NoSuchTypeNameException & exc) - { - throw lang::IllegalArgumentException( - OUSTR("NoSuchTypeNameException occurred: ") + exc.Message, - static_cast<OWeakObject *>(this), -1 /* unknown */ ); - } - catch (const reflection::InvalidTypeNameException & exc) - { - throw lang::IllegalArgumentException( - OUSTR("InvalidTypeNameException occurred: ") + exc.Message, - static_cast<OWeakObject *>(this), -1 /* unknown */ ); + catch (const reflection::InvalidTypeNameException & exc) + { + throw lang::IllegalArgumentException( + OUSTR("InvalidTypeNameException occurred: ") + exc.Message, + static_cast<OWeakObject *>(this), -1 /* unknown */ ); + } } } + newProvs.push_back( xElem ); } - _aProviders.push_back( xElem ); - Reference< XComponent > xComp( xElem, UNO_QUERY ); - if (xComp.is()) - xComp->addEventListener( &_aEventListener ); + _aProviders = newProvs; + for (sal_Int32 i = 0; i != provs.getLength(); ++i) { + Reference< XComponent > xComp( provs[i], UNO_QUERY ); + if (xComp.is()) + xComp->addEventListener( &_aEventListener ); + } } //__________________________________________________________________________________________________ void SAL_CALL ManagerImpl::remove( const Any & rElement ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits