From 28f6da5c12e479e4c020c4deb2fb51f1beee4141 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 23 Jun 2010 11:07:00 +0200 Subject: sb126: #i109853# no need to set CPPU_ENV in cppu/inc/uno/lbnames.h --- cppu/inc/uno/lbnames.h | 45 --------------------------------------------- 1 file changed, 45 deletions(-) diff --git a/cppu/inc/uno/lbnames.h b/cppu/inc/uno/lbnames.h index 285c43b40..7da2e25ea 100644 --- a/cppu/inc/uno/lbnames.h +++ b/cppu/inc/uno/lbnames.h @@ -29,49 +29,6 @@ #ifdef __cplusplus -/* environment type names for supported compilers */ -#if defined (_MSC_VER) -#if (_MSC_VER < 1000) -#error "ms visual c++ version must be at least 4.2" -#elif (_MSC_VER < 1100) // MSVC 4.x -#pragma warning( disable: 4290 ) -#define TMP_CPPU_ENV msci -#elif (_MSC_VER < 1600) // MSVC 5-9 -#define TMP_CPPU_ENV msci -#else -#error "ms visual c++ version must be between 4.2 and 9.x" -#endif /* (_MSC_VER < 1000) */ -/* sunpro cc */ -#elif defined (__SUNPRO_CC) -#if ((__SUNPRO_CC >= 0x5000 && __SUNPRO_CC < 0x6000) || (__SUNPRO_CC >= 0x500 && __SUNPRO_CC < 0x600)) -#define TMP_CPPU_ENV sunpro5 -#elif -#error "sunpro cc version must be 5.x" -provoking error here, because PP ignores #error -#endif /* defined (__SUNPRO_CC) */ -/* g++ 2.x, 3.0 */ -#elif defined (__GNUC__) -#if (__GNUC__ == 2 && __GNUC_MINOR__ == 91) -#define TMP_CPPU_ENV gcc2 -#elif (__GNUC__ == 2 && __GNUC_MINOR__ == 95) -#define TMP_CPPU_ENV gcc2 -#elif (__GNUC__ == 2) -#error "Tested gcc 2 versions are 2.91 and 2.95. Patch uno/lbnames.h to try your gcc 2 version." -#elif (__GNUC__ == 3 && __GNUC_MINOR__ <= 4) -#define __CPPU_ENV gcc3 -#elif (__GNUC__ == 4 && __GNUC_MINOR__ <= 4) -#define __CPPU_ENV gcc3 -#elif (__GNUC__ == 3) -#error "Tested gcc 3 version is <= 3.4. Patch uno/lbnames.h to try your gcc 3 version." -#else -#error "Supported gcc majors are 2 , 3 and 4 <= 4.4. Unsupported gcc major version." -#endif /* defined (__GNUC__) */ -#endif /* defined (_MSC_VER) */ - -#if (! defined (CPPU_ENV) && defined (TMP_CPPU_ENV)) -#define CPPU_ENV TMP_CPPU_ENV -#endif - #ifdef CPPU_ENV #define CPPU_STRINGIFY_EX( x ) #x @@ -87,8 +44,6 @@ provoking error here, because PP ignores #error #endif /* CPPU_ENV */ -#undef TMP_CPPU_ENV - #endif /* __cplusplus */ /** Environment type name for binary C UNO. */ -- cgit v1.2.3 From f33ed5240bcd3785ca78c7deb4de8b8ea5c28f66 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 25 Jun 2010 13:15:39 +0200 Subject: sb126: #i112681# make bridges match remotebridges (patch by cmc) --- bridges/source/remote/context/context.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bridges/source/remote/context/context.cxx b/bridges/source/remote/context/context.cxx index 4c9e1b066..532e7f07a 100644 --- a/bridges/source/remote/context/context.cxx +++ b/bridges/source/remote/context/context.cxx @@ -267,6 +267,10 @@ rtl_uString ** ContextAdmin::getConnectionList( ::osl::MutexGuard guard( m_mutex ); *pnStringCount = m_mapContext.size(); + + if (*pnStringCount == 0) + return NULL; + rtl_uString **ppReturn = ( rtl_uString ** ) memAlloc( sizeof( rtl_uString * ) * m_mapContext.size() ); memset( ppReturn , 0 , sizeof( rtl_uString * ) * m_mapContext.size() ); -- cgit v1.2.3 From 149ac56be57de26997daebd16ca611ec4ae8ae28 Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 28 Jun 2010 13:46:02 +0200 Subject: sb126: #i111793# make cppuhelper/interfacecontainer strict aliasing safe (patch by cmc, with slight modifications) --- cppuhelper/inc/cppuhelper/interfacecontainer.h | 23 ++++-- cppuhelper/source/interfacecontainer.cxx | 108 ++++++++++++------------- 2 files changed, 71 insertions(+), 60 deletions(-) diff --git a/cppuhelper/inc/cppuhelper/interfacecontainer.h b/cppuhelper/inc/cppuhelper/interfacecontainer.h index bb8ea3d0e..5e7d1ff4a 100644 --- a/cppuhelper/inc/cppuhelper/interfacecontainer.h +++ b/cppuhelper/inc/cppuhelper/interfacecontainer.h @@ -44,6 +44,17 @@ namespace cppu { +namespace detail { + + union element_alias + { + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > *pAsSequence; + ::com::sun::star::uno::XInterface * pAsInterface; + element_alias() : pAsInterface(0) {} + }; + +} + //=================================================================== class OInterfaceContainerHelper; /** @@ -95,7 +106,9 @@ public: private: OInterfaceContainerHelper & rCont; sal_Bool bIsList; - void * pData; + + detail::element_alias aData; + sal_Int32 nRemain; OInterfaceIteratorHelper( const OInterfaceIteratorHelper & ) SAL_THROW( () ); @@ -222,14 +235,14 @@ public: private: friend class OInterfaceIteratorHelper; /** - bIsList == TRUE -> pData of type Sequence< XInterfaceSequence >, - otherwise pData == of type (XEventListener *) + bIsList == TRUE -> aData.pAsSequence of type Sequence< XInterfaceSequence >, + otherwise aData.pAsInterface == of type (XEventListener *) */ - void * pData; + detail::element_alias aData; ::osl::Mutex & rMutex; /** TRUE -> used by an iterator. */ sal_Bool bInUse; - /** TRUE -> pData is of type Sequence< XInterfaceSequence >. */ + /** TRUE -> aData.pAsSequence is of type Sequence< XInterfaceSequence >. */ sal_Bool bIsList; OInterfaceContainerHelper( const OInterfaceContainerHelper & ) SAL_THROW( () ); diff --git a/cppuhelper/source/interfacecontainer.cxx b/cppuhelper/source/interfacecontainer.cxx index b1f45c687..b04b34b45 100644 --- a/cppuhelper/source/interfacecontainer.cxx +++ b/cppuhelper/source/interfacecontainer.cxx @@ -99,15 +99,15 @@ OInterfaceIteratorHelper::OInterfaceIteratorHelper( OInterfaceContainerHelper & // worst case, two iterators at the same time rCont.copyAndResetInUse(); bIsList = rCont_.bIsList; - pData = rCont_.pData; + aData = rCont_.aData; if( bIsList ) { rCont.bInUse = sal_True; - nRemain = ((Sequence< Reference< XInterface > >*)pData)->getLength(); + nRemain = aData.pAsSequence->getLength(); } - else if( pData ) + else if( aData.pAsInterface ) { - ((XInterface *)pData)->acquire(); + aData.pAsInterface->acquire(); nRemain = 1; } else @@ -120,7 +120,7 @@ OInterfaceIteratorHelper::~OInterfaceIteratorHelper() SAL_THROW( () ) { MutexGuard aGuard( rCont.rMutex ); // bResetInUse protect the iterator against recursion - bShared = pData == rCont.pData && rCont.bIsList; + bShared = aData.pAsSequence == rCont.aData.pAsSequence && rCont.bIsList; if( bShared ) { OSL_ENSURE( rCont.bInUse, "OInterfaceContainerHelper must be in use" ); @@ -132,10 +132,10 @@ OInterfaceIteratorHelper::~OInterfaceIteratorHelper() SAL_THROW( () ) { if( bIsList ) // Sequence owned by the iterator - delete (Sequence< Reference< XInterface > >*)pData; - else if( pData ) + delete aData.pAsSequence; + else if( aData.pAsInterface ) // Interface is acquired by the iterator - ((XInterface*)pData)->release(); + aData.pAsInterface->release(); } } @@ -146,9 +146,9 @@ XInterface * OInterfaceIteratorHelper::next() SAL_THROW( () ) nRemain--; if( bIsList ) // typecase to const,so the getArray method is faster - return ((const Sequence< Reference< XInterface > >*)pData)->getConstArray()[nRemain].get(); - else if( pData ) - return (XInterface*)pData; + return aData.pAsSequence->getConstArray()[nRemain].get(); + else if( aData.pAsInterface ) + return aData.pAsInterface; } // exception return 0; @@ -159,15 +159,14 @@ void OInterfaceIteratorHelper::remove() SAL_THROW( () ) if( bIsList ) { OSL_ASSERT( nRemain >= 0 && - nRemain < ((const Sequence< Reference< XInterface > >*)pData)->getLength() ); - XInterface * p = - ((const Sequence< Reference< XInterface > >*)pData)->getConstArray()[nRemain].get(); + nRemain < aData.pAsSequence->getLength() ); + XInterface * p = aData.pAsSequence->getConstArray()[nRemain].get(); rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >( &p ) ); } else { OSL_ASSERT( 0 == nRemain ); - rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >(&pData)); + rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >(&aData.pAsInterface)); } } @@ -177,8 +176,7 @@ void OInterfaceIteratorHelper::remove() SAL_THROW( () ) OInterfaceContainerHelper::OInterfaceContainerHelper( Mutex & rMutex_ ) SAL_THROW( () ) - : pData( 0 ) - , rMutex( rMutex_ ) + : rMutex( rMutex_ ) , bInUse( sal_False ) , bIsList( sal_False ) { @@ -188,17 +186,17 @@ OInterfaceContainerHelper::~OInterfaceContainerHelper() SAL_THROW( () ) { OSL_ENSURE( !bInUse, "~OInterfaceContainerHelper but is in use" ); if( bIsList ) - delete (Sequence< Reference< XInterface > >*)pData; - else if( pData ) - ((XInterface*)pData)->release(); + delete aData.pAsSequence; + else if( aData.pAsInterface ) + aData.pAsInterface->release(); } sal_Int32 OInterfaceContainerHelper::getLength() const SAL_THROW( () ) { MutexGuard aGuard( rMutex ); if( bIsList ) - return ((Sequence< Reference< XInterface > >*)pData)->getLength(); - else if( pData ) + return aData.pAsSequence->getLength(); + else if( aData.pAsInterface ) return 1; return 0; } @@ -207,10 +205,10 @@ Sequence< Reference > OInterfaceContainerHelper::getElements() const { MutexGuard aGuard( rMutex ); if( bIsList ) - return *(Sequence< Reference< XInterface > >*)pData; - else if( pData ) + return *aData.pAsSequence; + else if( aData.pAsInterface ) { - Reference x( (XInterface *)pData ); + Reference x( aData.pAsInterface ); return Sequence< Reference< XInterface > >( &x, 1 ); } return Sequence< Reference< XInterface > >(); @@ -224,9 +222,9 @@ void OInterfaceContainerHelper::copyAndResetInUse() SAL_THROW( () ) // this should be the worst case. If a iterator is active // and a new Listener is added. if( bIsList ) - pData = new Sequence< Reference< XInterface > >( *(Sequence< Reference< XInterface > >*)pData ); - else if( pData ) - ((XInterface*)pData)->acquire(); + aData.pAsSequence = new Sequence< Reference< XInterface > >( *aData.pAsSequence ); + else if( aData.pAsInterface ) + aData.pAsInterface->acquire(); bInUse = sal_False; } @@ -241,25 +239,25 @@ sal_Int32 OInterfaceContainerHelper::addInterface( const Reference & if( bIsList ) { - sal_Int32 nLen = ((Sequence< Reference< XInterface > >*)pData)->getLength(); - realloc( *(Sequence< Reference< XInterface > >*)pData, nLen +1 ); - ((Sequence< Reference< XInterface > >*)pData)->getArray()[ nLen ] = rListener; + sal_Int32 nLen = aData.pAsSequence->getLength(); + realloc( *aData.pAsSequence, nLen +1 ); + aData.pAsSequence->getArray()[ nLen ] = rListener; return nLen +1; } - else if( pData ) + else if( aData.pAsInterface ) { Sequence< Reference< XInterface > > * pSeq = new Sequence< Reference< XInterface > >( 2 ); Reference * pArray = pSeq->getArray(); - pArray[0] = (XInterface *)pData; + pArray[0] = aData.pAsInterface; pArray[1] = rListener; - ((XInterface *)pData)->release(); - pData = pSeq; + aData.pAsInterface->release(); + aData.pAsSequence = pSeq; bIsList = sal_True; return 2; } else { - pData = rListener.get(); + aData.pAsInterface = rListener.get(); if( rListener.is() ) rListener->acquire(); return 1; @@ -275,8 +273,8 @@ sal_Int32 OInterfaceContainerHelper::removeInterface( const Reference * pL = ((const Sequence< Reference< XInterface > >*)pData)->getConstArray(); - sal_Int32 nLen = ((Sequence< Reference< XInterface > >*)pData)->getLength(); + const Reference * pL = aData.pAsSequence->getConstArray(); + sal_Int32 nLen = aData.pAsSequence->getLength(); sal_Int32 i; for( i = 0; i < nLen; i++ ) { @@ -284,7 +282,7 @@ sal_Int32 OInterfaceContainerHelper::removeInterface( const Reference >*)pData, i ); + sequenceRemoveElementAt( *aData.pAsSequence, i ); break; } } @@ -296,30 +294,30 @@ sal_Int32 OInterfaceContainerHelper::removeInterface( const Reference >*)pData, i ); + sequenceRemoveElementAt(*aData.pAsSequence, i ); break; } } } - if( ((Sequence< Reference< XInterface > >*)pData)->getLength() == 1 ) + if( aData.pAsSequence->getLength() == 1 ) { - XInterface * p = ((const Sequence< Reference< XInterface > >*)pData)->getConstArray()[0].get(); + XInterface * p = aData.pAsSequence->getConstArray()[0].get(); p->acquire(); - delete (Sequence< Reference< XInterface > >*)pData; - pData = p; + delete aData.pAsSequence; + aData.pAsInterface = p; bIsList = sal_False; return 1; } else - return ((Sequence< Reference< XInterface > >*)pData)->getLength(); + return aData.pAsSequence->getLength(); } - else if( pData && Reference( (XInterface*)pData ) == rListener ) + else if( aData.pAsInterface && Reference( aData.pAsInterface ) == rListener ) { - ((XInterface *)pData)->release(); - pData = 0; + aData.pAsInterface->release(); + aData.pAsInterface = 0; } - return pData ? 1 : 0; + return aData.pAsInterface ? 1 : 0; } void OInterfaceContainerHelper::disposeAndClear( const EventObject & rEvt ) SAL_THROW( () ) @@ -328,10 +326,10 @@ void OInterfaceContainerHelper::disposeAndClear( const EventObject & rEvt ) SAL_ OInterfaceIteratorHelper aIt( *this ); // Container freigeben, falls im disposing neue Einträge kommen OSL_ENSURE( !bIsList || bInUse, "OInterfaceContainerHelper not in use" ); - if( !bIsList && pData ) - ((XInterface *)pData)->release(); + if( !bIsList && aData.pAsInterface ) + aData.pAsInterface->release(); // set the member to null, the iterator delete the values - pData = NULL; + aData.pAsInterface = NULL; bIsList = sal_False; bInUse = sal_False; aGuard.clear(); @@ -358,10 +356,10 @@ void OInterfaceContainerHelper::clear() SAL_THROW( () ) OInterfaceIteratorHelper aIt( *this ); // Container freigeben, falls im disposing neue Einträge kommen OSL_ENSURE( !bIsList || bInUse, "OInterfaceContainerHelper not in use" ); - if( !bIsList && pData ) - ((XInterface *)pData)->release(); + if( !bIsList && aData.pAsInterface ) + aData.pAsInterface->release(); // set the member to null, the iterator delete the values - pData = 0; + aData.pAsInterface = 0; bIsList = sal_False; bInUse = sal_False; // release mutex before aIt destructor call -- cgit v1.2.3 From ec7167e0f5dcd0f010414be673b0b98fda2a34f3 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 2 Jul 2010 15:53:28 +0200 Subject: sb126: #i112784# do not leak ContextAdmin (patch by cmc) --- bridges/source/remote/context/context.cxx | 41 +++++++++---------------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/bridges/source/remote/context/context.cxx b/bridges/source/remote/context/context.cxx index 532e7f07a..58b9dc1f7 100644 --- a/bridges/source/remote/context/context.cxx +++ b/bridges/source/remote/context/context.cxx @@ -38,6 +38,7 @@ #include #include "rtl/ustring.hxx" +#include "rtl/instance.hxx" #include #include @@ -109,17 +110,9 @@ ContextMap; static MyCounter thisCounter( "DEBUG : Context" ); #endif -class ContextAdmin; - -ContextAdmin *g_pTheContext = 0; - - - class ContextAdmin { public: - static ContextAdmin *getInstance(); - // listener administration void addContextListener( remote_contextListenerFunc listener , void *pObject ); void removeContextListener( remote_contextListenerFunc listener , void *pObject ); @@ -138,7 +131,7 @@ public: void revokeContext( uno_Context *pRemoteContext ); - uno_Context *get( rtl_uString *pHost ); + uno_Context *getContext( rtl_uString *pHost ); rtl_uString ** getConnectionList( sal_Int32 *pnStringCount, MemAlloc memAlloc ); @@ -152,19 +145,6 @@ private: List m_lstListener; }; -ContextAdmin *ContextAdmin::getInstance() -{ - if( ! g_pTheContext ) { - ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() ); - if( ! g_pTheContext ) { - //TODO This memory is leaked; see #i63473# for when this should be - // changed again: - g_pTheContext = new ContextAdmin; - } - } - return g_pTheContext; -} - void ContextAdmin::addContextListener( remote_contextListenerFunc listener , void *pObject ) { ::osl::MutexGuard guard( m_mutex ); @@ -209,7 +189,7 @@ uno_Context *ContextAdmin::createAndRegisterContext( remote_Connection *pConnect { ::osl::MutexGuard guard( m_mutex ); - uno_Context *pContext = get( pIdStr ); + uno_Context *pContext = getContext( pIdStr ); if( pContext ) { pContext->release( pContext ); @@ -245,7 +225,7 @@ void ContextAdmin::revokeContext( uno_Context *pRemoteContext ) } -uno_Context *ContextAdmin::get( rtl_uString *pHost ) +uno_Context *ContextAdmin::getContext( rtl_uString *pHost ) { ::osl::MutexGuard guard( m_mutex ); @@ -287,6 +267,7 @@ rtl_uString ** ContextAdmin::getConnectionList( } +struct theContextAdmin : public rtl::Static {}; /***************************** * remote_ContextImpl implementation @@ -383,7 +364,7 @@ void remote_ContextImpl::thisDispose( remote_Context *pRemoteC ) if( ! pImpl->m_bDisposed ) { pImpl->m_bDisposed = sal_True; - ContextAdmin::getInstance()->revokeContext( (uno_Context * ) pRemoteC ); + theContextAdmin::get().revokeContext( (uno_Context * ) pRemoteC ); if( pImpl->m_pInstanceProvider ) { @@ -460,7 +441,7 @@ using namespace remote_context; extern "C" remote_Context * SAL_CALL remote_getContext( rtl_uString *pIdString ) { - return (remote_Context *) ContextAdmin::getInstance()->get( pIdString ); + return (remote_Context *) theContextAdmin::get().getContext(pIdString); } @@ -473,7 +454,7 @@ remote_createContext( remote_Connection *pConnection, remote_InstanceProvider *pProvider ) { remote_ContextImpl *p = (remote_ContextImpl * ) - ContextAdmin::getInstance()->createAndRegisterContext( + theContextAdmin::get().createAndRegisterContext( pConnection , pIdStr , pDescription, @@ -487,17 +468,17 @@ remote_createContext( remote_Connection *pConnection, extern "C" void SAL_CALL remote_addContextListener( remote_contextListenerFunc listener, void *pObject ) { - ContextAdmin::getInstance()->addContextListener( listener , pObject ); + theContextAdmin::get().addContextListener( listener , pObject ); } extern "C" void SAL_CALL remote_removeContextListener( remote_contextListenerFunc listener , void *pObject ) { - ContextAdmin::getInstance()->removeContextListener( listener , pObject ); + theContextAdmin::get().removeContextListener( listener , pObject ); } extern "C" rtl_uString ** SAL_CALL remote_getContextList( sal_Int32 *pnStringCount, MemAlloc memAlloc ) { - return ContextAdmin::getInstance()->getConnectionList( pnStringCount , memAlloc ); + return theContextAdmin::get().getConnectionList( pnStringCount , memAlloc ); } -- cgit v1.2.3 From e1958783e73668a45176f7331636a18c8bef3f9d Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 7 Jul 2010 13:03:20 +0200 Subject: sb126: #i107490# cppu lifecycle cleanup (patch by cmc, plus removal of now obsolete CPPU_LEAK_STATIC_DATA) --- cppu/source/threadpool/current.cxx | 4 +-- cppu/source/threadpool/jobqueue.cxx | 3 +- cppu/source/threadpool/jobqueue.hxx | 6 ++++ cppu/source/threadpool/thread.cxx | 32 ++++++++++--------- cppu/source/threadpool/thread.hxx | 5 ++- cppu/source/threadpool/threadpool.cxx | 58 +++++++++++++++++++---------------- cppu/source/threadpool/threadpool.hxx | 15 +++++++-- cppu/source/typelib/static_types.cxx | 48 ++++++++--------------------- cppu/source/typelib/typelib.cxx | 10 ------ cppu/source/uno/lbenv.cxx | 15 ++++++--- cppu/util/target.pmk | 9 ------ 11 files changed, 96 insertions(+), 109 deletions(-) diff --git a/cppu/source/threadpool/current.cxx b/cppu/source/threadpool/current.cxx index 07323c2fd..805b5759a 100644 --- a/cppu/source/threadpool/current.cxx +++ b/cppu/source/threadpool/current.cxx @@ -106,11 +106,9 @@ static typelib_InterfaceTypeDescription * get_type_XCurrentContext() 1, aParameters, 1, pExceptions ); typelib_typedescription_register( (typelib_TypeDescription**)&pMethod ); typelib_typedescription_release( (typelib_TypeDescription*)pMethod ); -#if ! defined CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++reinterpret_cast< typelib_TypeDescription * >( pTD )-> nStaticRefCount; -#endif s_type_XCurrentContext = pTD; } } diff --git a/cppu/source/threadpool/jobqueue.cxx b/cppu/source/threadpool/jobqueue.cxx index 18693bef1..4f83261c9 100644 --- a/cppu/source/threadpool/jobqueue.cxx +++ b/cppu/source/threadpool/jobqueue.cxx @@ -42,6 +42,7 @@ namespace cppu_threadpool { m_cndWait( osl_createCondition() ) { osl_resetCondition( m_cndWait ); + m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance(); } JobQueue::~JobQueue() @@ -68,7 +69,7 @@ namespace cppu_threadpool { { // synchronize with the dispose calls MutexGuard guard( m_mutex ); - if( DisposedCallerAdmin::getInstance()->isDisposed( nDisposeId ) ) + if( m_DisposedCallerAdmin->isDisposed( nDisposeId ) ) { return 0; } diff --git a/cppu/source/threadpool/jobqueue.hxx b/cppu/source/threadpool/jobqueue.hxx index 7a50b8a0e..31ea0690e 100644 --- a/cppu/source/threadpool/jobqueue.hxx +++ b/cppu/source/threadpool/jobqueue.hxx @@ -34,6 +34,8 @@ #include #include +#include + namespace cppu_threadpool { extern "C" typedef void (SAL_CALL RequestFun)(void *); @@ -48,6 +50,9 @@ namespace cppu_threadpool typedef ::std::list < sal_Int64 > CallStackList; + class DisposedCallerAdmin; + typedef boost::shared_ptr DisposedCallerAdminHolder; + class JobQueue { public: @@ -73,6 +78,7 @@ namespace cppu_threadpool sal_Int32 m_nToDo; sal_Bool m_bSuspended; oslCondition m_cndWait; + DisposedCallerAdminHolder m_DisposedCallerAdmin; }; } diff --git a/cppu/source/threadpool/thread.cxx b/cppu/source/threadpool/thread.cxx index 565020850..f8e12a0aa 100644 --- a/cppu/source/threadpool/thread.cxx +++ b/cppu/source/threadpool/thread.cxx @@ -31,6 +31,8 @@ #include #include +#include + #include "thread.hxx" #include "jobqueue.hxx" #include "threadpool.hxx" @@ -98,20 +100,17 @@ namespace cppu_threadpool { } while( pCurrent ); } - ThreadAdmin* ThreadAdmin::getInstance() + struct theThreadAdmin : public rtl::StaticWithInit< ThreadAdminHolder, theThreadAdmin > { - static ThreadAdmin *pThreadAdmin = 0; - if( ! pThreadAdmin ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pThreadAdmin ) - { - static ThreadAdmin admin; - pThreadAdmin = &admin; - } + ThreadAdminHolder operator () () { + ThreadAdminHolder aRet(new ThreadAdmin()); + return aRet; } - return pThreadAdmin; + }; + ThreadAdminHolder& ThreadAdmin::getInstance() + { + return theThreadAdmin::get(); } // ---------------------------------------------------------------------------------- @@ -119,12 +118,13 @@ namespace cppu_threadpool { const ByteSequence &aThreadId, sal_Bool bAsynchron ) : m_thread( 0 ) + , m_aThreadAdmin( ThreadAdmin::getInstance() ) , m_pQueue( pQueue ) , m_aThreadId( aThreadId ) , m_bAsynchron( bAsynchron ) , m_bDeleteSelf( sal_True ) { - ThreadAdmin::getInstance()->add( this ); + m_aThreadAdmin->add( this ); } @@ -166,7 +166,7 @@ namespace cppu_threadpool { void ORequestThread::onTerminated() { - ThreadAdmin::getInstance()->remove( this ); + m_aThreadAdmin->remove( this ); if( m_bDeleteSelf ) { delete this; @@ -175,6 +175,8 @@ namespace cppu_threadpool { void ORequestThread::run() { + ThreadPoolHolder theThreadPool = cppu_threadpool::ThreadPool::getInstance(); + while ( m_pQueue ) { if( ! m_bAsynchron ) @@ -197,7 +199,7 @@ namespace cppu_threadpool { if( m_pQueue->isEmpty() ) { - ThreadPool::getInstance()->revokeQueue( m_aThreadId , m_bAsynchron ); + theThreadPool->revokeQueue( m_aThreadId , m_bAsynchron ); // Note : revokeQueue might have failed because m_pQueue.isEmpty() // may be false (race). } @@ -211,7 +213,7 @@ namespace cppu_threadpool { uno_releaseIdFromCurrentThread(); } - cppu_threadpool::ThreadPool::getInstance()->waitInPool( this ); + theThreadPool->waitInPool( this ); } } } diff --git a/cppu/source/threadpool/thread.hxx b/cppu/source/threadpool/thread.hxx index 642820e9e..becf50286 100644 --- a/cppu/source/threadpool/thread.hxx +++ b/cppu/source/threadpool/thread.hxx @@ -37,6 +37,8 @@ namespace cppu_threadpool { class JobQueue; + class ThreadAdmin; + typedef boost::shared_ptr ThreadAdminHolder; //----------------------------------------- // private thread class for the threadpool @@ -61,6 +63,7 @@ namespace cppu_threadpool { private: oslThread m_thread; + ThreadAdminHolder m_aThreadAdmin; JobQueue *m_pQueue; ::rtl::ByteSequence m_aThreadId; sal_Bool m_bAsynchron; @@ -71,7 +74,7 @@ namespace cppu_threadpool { { public: ~ThreadAdmin (); - static ThreadAdmin *getInstance(); + static ThreadAdminHolder &getInstance(); void add( ORequestThread * ); void remove( ORequestThread * ); void join(); diff --git a/cppu/source/threadpool/threadpool.cxx b/cppu/source/threadpool/threadpool.cxx index f09c8fbd3..1d68a5482 100644 --- a/cppu/source/threadpool/threadpool.cxx +++ b/cppu/source/threadpool/threadpool.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include @@ -44,19 +45,17 @@ using namespace ::osl; namespace cppu_threadpool { - DisposedCallerAdmin *DisposedCallerAdmin::getInstance() + struct theDisposedCallerAdmin : + public rtl::StaticWithInit< DisposedCallerAdminHolder, theDisposedCallerAdmin > { - static DisposedCallerAdmin *pDisposedCallerAdmin = 0; - if( ! pDisposedCallerAdmin ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pDisposedCallerAdmin ) - { - static DisposedCallerAdmin admin; - pDisposedCallerAdmin = &admin; - } + DisposedCallerAdminHolder operator () () { + return DisposedCallerAdminHolder(new DisposedCallerAdmin()); } - return pDisposedCallerAdmin; + }; + + DisposedCallerAdminHolder DisposedCallerAdmin::getInstance() + { + return theDisposedCallerAdmin::get(); } DisposedCallerAdmin::~DisposedCallerAdmin() @@ -107,6 +106,21 @@ namespace cppu_threadpool //------------------------------------------------------------------------------- + + struct theThreadPool : + public rtl::StaticWithInit< ThreadPoolHolder, theThreadPool > + { + ThreadPoolHolder operator () () { + ThreadPoolHolder aRet(new ThreadPool()); + return aRet; + } + }; + + ThreadPool::ThreadPool() + { + m_DisposedCallerAdmin = DisposedCallerAdmin::getInstance(); + } + ThreadPool::~ThreadPool() { #if OSL_DEBUG_LEVEL > 1 @@ -116,19 +130,9 @@ namespace cppu_threadpool } #endif } - ThreadPool *ThreadPool::getInstance() + ThreadPoolHolder ThreadPool::getInstance() { - static ThreadPool *pThreadPool = 0; - if( ! pThreadPool ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pThreadPool ) - { - static ThreadPool pool; - pThreadPool = &pool; - } - } - return pThreadPool; + return theThreadPool::get(); } @@ -136,7 +140,7 @@ namespace cppu_threadpool { if( nDisposeId ) { - DisposedCallerAdmin::getInstance()->dispose( nDisposeId ); + m_DisposedCallerAdmin->dispose( nDisposeId ); MutexGuard guard( m_mutex ); for( ThreadIdHashMap::iterator ii = m_mapQueue.begin() ; @@ -171,7 +175,7 @@ namespace cppu_threadpool void ThreadPool::stopDisposing( sal_Int64 nDisposeId ) { - DisposedCallerAdmin::getInstance()->stopDisposing( nDisposeId ); + m_DisposedCallerAdmin->stopDisposing( nDisposeId ); } /****************** @@ -400,7 +404,7 @@ struct uno_ThreadPool_Hash -typedef ::std::hash_set< uno_ThreadPool, uno_ThreadPool_Hash, uno_ThreadPool_Equal > ThreadpoolHashSet; +typedef ::std::hash_map< uno_ThreadPool, ThreadPoolHolder, uno_ThreadPool_Hash, uno_ThreadPool_Equal > ThreadpoolHashSet; static ThreadpoolHashSet *g_pThreadpoolHashSet; @@ -420,7 +424,7 @@ uno_threadpool_create() SAL_THROW_EXTERN_C() // Just ensure that the handle is unique in the process (via heap) uno_ThreadPool h = new struct _uno_ThreadPool; - g_pThreadpoolHashSet->insert( h ); + g_pThreadpoolHashSet->insert( ThreadpoolHashSet::value_type(h, ThreadPool::getInstance()) ); return h; } diff --git a/cppu/source/threadpool/threadpool.hxx b/cppu/source/threadpool/threadpool.hxx index 1ff1748fe..b9df49f43 100644 --- a/cppu/source/threadpool/threadpool.hxx +++ b/cppu/source/threadpool/threadpool.hxx @@ -30,6 +30,8 @@ #include +#include + #include "jobqueue.hxx" @@ -75,13 +77,16 @@ namespace cppu_threadpool { }; typedef ::std::list < struct ::cppu_threadpool::WaitingThread * > WaitingThreadList; + + class DisposedCallerAdmin; + typedef boost::shared_ptr DisposedCallerAdminHolder; class DisposedCallerAdmin { public: ~DisposedCallerAdmin(); - static DisposedCallerAdmin *getInstance(); + static DisposedCallerAdminHolder getInstance(); void dispose( sal_Int64 nDisposeId ); void stopDisposing( sal_Int64 nDisposeId ); @@ -92,11 +97,15 @@ namespace cppu_threadpool { DisposedCallerList m_lst; }; + class ThreadPool; + typedef boost::shared_ptr ThreadPoolHolder; + class ThreadPool { public: + ThreadPool(); ~ThreadPool(); - static ThreadPool *getInstance(); + static ThreadPoolHolder getInstance(); void dispose( sal_Int64 nDisposeId ); void stopDisposing( sal_Int64 nDisposeId ); @@ -124,6 +133,8 @@ namespace cppu_threadpool { ::osl::Mutex m_mutexWaitingThreadList; WaitingThreadList m_lstThreads; + + DisposedCallerAdminHolder m_DisposedCallerAdmin; }; } // end namespace cppu_threadpool diff --git a/cppu/source/typelib/static_types.cxx b/cppu/source/typelib/static_types.cxx index 202c55bf7..a95264379 100644 --- a/cppu/source/typelib/static_types.cxx +++ b/cppu/source/typelib/static_types.cxx @@ -168,10 +168,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM("type") ); ::typelib_typedescriptionreference_new( &s_aTypes[typelib_TypeClass_TYPE], typelib_TypeClass_TYPE, sTypeName.pData ); -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++s_aTypes[typelib_TypeClass_TYPE]->nStaticRefCount; -#endif } // any if (! s_aTypes[typelib_TypeClass_ANY]) @@ -179,10 +177,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM("any") ); ::typelib_typedescriptionreference_new( &s_aTypes[typelib_TypeClass_ANY], typelib_TypeClass_ANY, sTypeName.pData ); -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++s_aTypes[typelib_TypeClass_ANY]->nStaticRefCount; -#endif } // string if (! s_aTypes[typelib_TypeClass_STRING]) @@ -190,10 +186,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( OUString sTypeName( RTL_CONSTASCII_USTRINGPARAM("string") ); ::typelib_typedescriptionreference_new( &s_aTypes[typelib_TypeClass_STRING], typelib_TypeClass_STRING, sTypeName.pData ); -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++s_aTypes[typelib_TypeClass_STRING]->nStaticRefCount; -#endif } // XInterface if (! s_aTypes[typelib_TypeClass_INTERFACE]) @@ -220,10 +214,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( ::typelib_typedescription_register( (typelib_TypeDescription **)&pTD ); ::typelib_typedescriptionreference_acquire( s_aTypes[typelib_TypeClass_INTERFACE] = ((typelib_TypeDescription *)pTD)->pWeakRef ); -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++s_aTypes[typelib_TypeClass_INTERFACE]->nStaticRefCount; -#endif ::typelib_typedescription_release( (typelib_TypeDescription*)pTD ); ::typelib_typedescriptionreference_release( pMembers[0] ); @@ -252,10 +244,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( typelib_typedescription_register( &pTD1 ); typelib_typedescriptionreference_acquire( s_aTypes[typelib_TypeClass_EXCEPTION] = pTD1->pWeakRef ); -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++s_aTypes[typelib_TypeClass_EXCEPTION]->nStaticRefCount; -#endif // RuntimeException OUString sTypeName2( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.RuntimeException") ); ::typelib_typedescription_new( @@ -302,10 +292,8 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( { OUString aTypeName( OUString::createFromAscii( s_aTypeNames[eTypeClass] ) ); ::typelib_typedescriptionreference_new( &s_aTypes[eTypeClass], eTypeClass, aTypeName.pData ); -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++s_aTypes[eTypeClass]->nStaticRefCount; -#endif } } } @@ -327,10 +315,8 @@ void SAL_CALL typelib_static_type_init( OUString aTypeName( OUString::createFromAscii( pTypeName ) ); ::typelib_typedescriptionreference_new( ppRef, eTypeClass, aTypeName.pData ); -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++((*ppRef)->nStaticRefCount); -#endif } } } @@ -364,10 +350,8 @@ void SAL_CALL typelib_static_sequence_type_init( *ppRef = (typelib_TypeDescriptionReference *)pReg; OSL_ASSERT( *ppRef == pReg->pWeakRef ); } -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++((*ppRef)->nStaticRefCount); -#endif } } } @@ -450,10 +434,8 @@ void init( *ppRef = (typelib_TypeDescriptionReference *)pReg; OSL_ASSERT( *ppRef == pReg->pWeakRef ); } -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++((*ppRef)->nStaticRefCount); -#endif } } } @@ -551,10 +533,8 @@ void SAL_CALL typelib_static_mi_interface_type_init( *ppRef = (typelib_TypeDescriptionReference *)pReg; OSL_ASSERT( *ppRef == pReg->pWeakRef ); } -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++((*ppRef)->nStaticRefCount); -#endif } } } @@ -593,10 +573,8 @@ void SAL_CALL typelib_static_enum_type_init( *ppRef = (typelib_TypeDescriptionReference *)pReg; OSL_ASSERT( *ppRef == pReg->pWeakRef ); } -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++(*(sal_Int32 *)&(*ppRef)->pReserved); -#endif } } } @@ -660,10 +638,8 @@ void SAL_CALL typelib_static_array_type_init( OSL_ASSERT( *ppRef == pReg->pWeakRef ); } else delete [] pDimensions; -#ifndef CPPU_LEAK_STATIC_DATA - // another static ref + // another static ref: ++((*ppRef)->nStaticRefCount); -#endif } } } diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index 01c3311ea..60191a32a 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -264,17 +264,9 @@ inline void TypeDescriptor_Init_Impl::callChain( } } -// never called -#if defined(CPPU_LEAK_STATIC_DATA) && defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500) -static void dumb_sunpro5_must_have_dtor_stl_hashmap_code_if_compiled_with_minus_g() SAL_THROW( () ) -{ - delete (WeakMap_Impl *)0xbeef1e; -} -#endif //__________________________________________________________________________________________________ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () ) { -#ifndef CPPU_LEAK_STATIC_DATA if( pCache ) { TypeDescriptionList_Impl::const_iterator aIt = pCache->begin(); @@ -355,9 +347,7 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () ) #endif delete pCallbacks; pCallbacks = 0; -#endif // CPPU_LEAK_STATIC_DATA - // todo: maybe into leak block if( pMutex ) { delete pMutex; diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index e3b1cdf1e..e05847191 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -139,6 +139,7 @@ struct EnvironmentsData ::osl::Mutex mutex; OUString2EnvironmentMap aName2EnvMap; + EnvironmentsData() : isDisposing(false) {} ~EnvironmentsData(); inline void getEnvironment( @@ -147,6 +148,8 @@ struct EnvironmentsData inline void getRegisteredEnvironments( uno_Environment *** pppEnvs, sal_Int32 * pnLen, uno_memAlloc memAlloc, const OUString & rEnvDcp ); + + bool isDisposing; }; namespace @@ -595,9 +598,14 @@ static void SAL_CALL defenv_harden( *ppHardEnv = 0; } + EnvironmentsData & rData = theEnvironmentsData::get(); + + if (rData.isDisposing) + return; + uno_DefaultEnvironment * that = (uno_DefaultEnvironment *)pEnv; { - ::osl::MutexGuard guard( theEnvironmentsData::get().mutex ); + ::osl::MutexGuard guard( rData.mutex ); if (1 == ::osl_incrementInterlockedCount( &that->nRef )) // is dead { that->nRef = 0; @@ -914,6 +922,7 @@ static void SAL_CALL unoenv_releaseInterface( EnvironmentsData::~EnvironmentsData() { ::osl::MutexGuard guard( mutex ); + isDisposing = true; for ( OUString2EnvironmentMap::const_iterator iPos( aName2EnvMap.begin() ); iPos != aName2EnvMap.end(); ++iPos ) @@ -928,11 +937,7 @@ EnvironmentsData::~EnvironmentsData() #if OSL_DEBUG_LEVEL > 1 ::uno_dumpEnvironment( 0, pHard, 0 ); #endif -#if defined CPPU_LEAK_STATIC_DATA - pHard->environmentDisposing = 0; // set to null => wont be called -#else (*pHard->dispose)( pHard ); // send explicit dispose -#endif (*pHard->release)( pHard ); } } diff --git a/cppu/util/target.pmk b/cppu/util/target.pmk index 4e456b206..3befcb154 100644 --- a/cppu/util/target.pmk +++ b/cppu/util/target.pmk @@ -51,12 +51,3 @@ CFLAGS += -Ob0 .ENDIF .ENDIF - -# other stuff - -.IF "$(cppu_no_leak)" == "" -.IF "$(bndchk)" == "" -CFLAGS += -DCPPU_LEAK_STATIC_DATA -.ENDIF -.ENDIF - -- cgit v1.2.3 From fa8a6035614933694d1b0d5284a3e58de5ecff5a Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 7 Jul 2010 16:25:37 +0200 Subject: sb126: #i111184# introduced test::uniquePipeName --- sal/prj/build.lst | 1 + sal/qa/osl/pipe/makefile.mk | 2 +- sal/qa/osl/pipe/osl_Pipe.cxx | 87 ++++++++++++++++++++++---------------------- 3 files changed, 46 insertions(+), 44 deletions(-) diff --git a/sal/prj/build.lst b/sal/prj/build.lst index 638252ad4..c96c3977f 100644 --- a/sal/prj/build.lst +++ b/sal/prj/build.lst @@ -18,4 +18,5 @@ sa sal\cppunittester nmake - all sa_cppunittester sa_cpprt.u sa_util NULL sa sal\qa\ByteSequence nmake - all sa_qa_ByteSequence sa_cppunittester sa_util NULL sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_cppunittester sa_util NULL sa sal\qa\osl\mutex nmake - all sa_qa_osl_mutex sa_cppunittester sa_util NULL +sa sal\qa\osl\pipe nmake - all sa_qa_osl_pipe sa_cppunittester sa_util NULL sa sal\qa\osl\profile nmake - all sa_qa_osl_profile sa_cppunittester sa_util NULL diff --git a/sal/qa/osl/pipe/makefile.mk b/sal/qa/osl/pipe/makefile.mk index 6350cdba0..85452eac8 100644 --- a/sal/qa/osl/pipe/makefile.mk +++ b/sal/qa/osl/pipe/makefile.mk @@ -51,7 +51,7 @@ SHL1OBJS= \ $(SLO)$/osl_Pipe.obj SHL1TARGET= osl_Pipe -SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) +SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTLIB) SHL1IMPLIB= i$(SHL1TARGET) # SHL1DEF= $(MISC)$/$(SHL1TARGET).def diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx index 5a6e9afc5..8dfe261d9 100644 --- a/sal/qa/osl/pipe/osl_Pipe.cxx +++ b/sal/qa/osl/pipe/osl_Pipe.cxx @@ -36,6 +36,7 @@ #include "cppunit/TestFixture.h" #include "cppunit/extensions/HelperMacros.h" #include "cppunit/plugin/TestPlugIn.h" +#include "test/uniquepipename.hxx" #include #include @@ -186,8 +187,8 @@ namespace osl_Pipe void ctors_name_option( ) { /// create a named pipe. - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); - ::osl::Pipe aAssignPipe( aTestPipeName, osl_Pipe_OPEN ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); + ::osl::Pipe aAssignPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); bRes = aPipe.is( ) && aAssignPipe.is( ); @@ -199,7 +200,7 @@ namespace osl_Pipe { /// create a security pipe. const ::osl::Security rSecurity; - ::osl::Pipe aSecurityPipe( aTestPipeName, osl_Pipe_CREATE, rSecurity ); + ::osl::Pipe aSecurityPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSecurity ); bRes = aSecurityPipe.is( ); @@ -210,7 +211,7 @@ namespace osl_Pipe void ctors_copy( ) { /// create a pipe. - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); /// create a pipe using copy constructor. ::osl::Pipe aCopyPipe( aPipe ); @@ -233,7 +234,7 @@ namespace osl_Pipe void ctors_no_acquire( ) { /// create a pipe. - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); /// constructs a pipe reference without acquiring the handle. ::osl::Pipe aNoAcquirePipe( aPipe.getHandle( ), SAL_NO_ACQUIRE ); @@ -249,7 +250,7 @@ namespace osl_Pipe void ctors_acquire( ) { /// create a base pipe. - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); /// constructs two pipes without acquiring the handle on the base pipe. ::osl::Pipe aAcquirePipe( aPipe.getHandle( ) ); ::osl::Pipe aAcquirePipe1( NULL ); @@ -287,14 +288,14 @@ namespace osl_Pipe void is_002( ) { - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test is(), a normal pipe creation.", sal_True == aPipe.is( ) ); } void is_003( ) { - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); aPipe.clear( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test is(), an invalid case.", sal_False == aPipe.is( ) ); @@ -337,8 +338,8 @@ namespace osl_Pipe { const Security rSec; ::osl::Pipe aPipe; - bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec ); - bRes1 = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec ); + bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec ); + bRes1 = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec ); aPipe.clear( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation.", @@ -349,8 +350,8 @@ namespace osl_Pipe { const Security rSec; ::osl::Pipe aPipe, aPipe1; - bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE, rSec ); - bRes1 = aPipe1.create( aTestPipeName, osl_Pipe_OPEN, rSec ); + bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSec ); + bRes1 = aPipe1.create( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN, rSec ); aPipe.clear( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation and open.", @@ -360,8 +361,8 @@ namespace osl_Pipe void create_named_001( ) { ::osl::Pipe aPipe; - bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE ); - bRes1 = aPipe.create( aTestPipeName, osl_Pipe_CREATE ); + bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); + bRes1 = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); aPipe.clear( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation.", @@ -371,8 +372,8 @@ namespace osl_Pipe void create_named_002( ) { ::osl::Pipe aPipe, aPipe1; - bRes = aPipe.create( aTestPipeName, osl_Pipe_CREATE ); - bRes1 = aPipe1.create( aTestPipeName, osl_Pipe_OPEN ); + bRes = aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); + bRes1 = aPipe1.create( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); aPipe.clear( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test creation and open.", @@ -382,7 +383,7 @@ namespace osl_Pipe void create_named_003( ) { ::osl::Pipe aPipe; - bRes = aPipe.create( aTestPipeName ); + bRes = aPipe.create( test::uniquePipeName(aTestPipeName) ); aPipe.clear( ); CPPUNIT_ASSERT_MESSAGE( "#test comment#: test default option is open.", @@ -410,7 +411,7 @@ namespace osl_Pipe void clear_001( ) { ::osl::Pipe aPipe; - aPipe.create( aTestPipeName, osl_Pipe_CREATE ); + aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); aPipe.clear( ); bRes = aPipe.is( ); @@ -436,7 +437,7 @@ namespace osl_Pipe void assign_ref( ) { ::osl::Pipe aPipe, aPipe1; - aPipe.create( aTestPipeName, osl_Pipe_CREATE ); + aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); aPipe1 = aPipe; bRes = aPipe1.is( ); bRes1 = aPipe == aPipe1; @@ -450,7 +451,7 @@ namespace osl_Pipe void assign_handle( ) { ::osl::Pipe aPipe, aPipe1; - aPipe.create( aTestPipeName, osl_Pipe_CREATE ); + aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); aPipe1 = aPipe.getHandle( ); bRes = aPipe1.is( ); bRes1 = aPipe == aPipe1; @@ -500,7 +501,7 @@ namespace osl_Pipe void isEqual_001( ) { ::osl::Pipe aPipe; - aPipe.create( aTestPipeName, osl_Pipe_CREATE ); + aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); bRes = aPipe == aPipe; aPipe.close( ); @@ -511,10 +512,10 @@ namespace osl_Pipe void isEqual_002( ) { ::osl::Pipe aPipe, aPipe1, aPipe2; - aPipe.create( aTestPipeName, osl_Pipe_CREATE ); + aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); aPipe1 = aPipe; - aPipe2.create( aTestPipeName, osl_Pipe_CREATE ); + aPipe2.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); bRes = aPipe == aPipe1; bRes1 = aPipe == aPipe2; @@ -543,7 +544,7 @@ namespace osl_Pipe void close_001( ) { - ::osl::Pipe aPipe( aTestPipe1, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipe1), osl_Pipe_CREATE ); aPipe.close( ); bRes = aPipe.is( ); @@ -556,7 +557,7 @@ namespace osl_Pipe void close_002( ) { - ::osl::StreamPipe aPipe( aTestPipe1, osl_Pipe_CREATE ); + ::osl::StreamPipe aPipe( test::uniquePipeName(aTestPipe1), osl_Pipe_CREATE ); aPipe.close( ); int nRet = aPipe.send( m_pTestString1.getStr(), 3 ); @@ -624,7 +625,7 @@ namespace osl_Pipe void getError_001( ) { - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_OPEN ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); oslPipeError nError = aPipe.getError( ); printPipeError( aPipe ); aPipe.clear( ); @@ -635,8 +636,8 @@ namespace osl_Pipe void getError_002( ) { - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); - ::osl::Pipe aPipe1( aTestPipeName, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); + ::osl::Pipe aPipe1( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); oslPipeError nError = aPipe.getError( ); printPipeError( aPipe ); aPipe.clear( ); @@ -663,7 +664,7 @@ namespace osl_Pipe void getHandle_001( ) { - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_OPEN ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); bRes = aPipe == aPipe.getHandle( ); aPipe.clear( ); @@ -673,7 +674,7 @@ namespace osl_Pipe void getHandle_002( ) { - ::osl::Pipe aPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::Pipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); ::osl::Pipe aPipe1( aPipe.getHandle( ) ); bRes = aPipe == aPipe1; aPipe.clear( ); @@ -726,7 +727,7 @@ namespace osl_StreamPipe void ctors_none( ) { // create a pipe. - ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); // create an unattached pipe. ::osl::StreamPipe aStreamPipe1; bRes = aStreamPipe1.is( ); @@ -744,7 +745,7 @@ namespace osl_StreamPipe void ctors_handle( ) { // create a pipe. - ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); // create a pipe with last handle. ::osl::StreamPipe aStreamPipe1( aStreamPipe.getHandle( ) ); bRes = aStreamPipe1.is( ) && aStreamPipe == aStreamPipe1; @@ -758,7 +759,7 @@ namespace osl_StreamPipe void ctors_copy( ) { // create a pipe. - ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); // create an unattached pipe. ::osl::StreamPipe aStreamPipe1( aStreamPipe ); bRes = aStreamPipe1.is( ) && aStreamPipe == aStreamPipe1; @@ -772,9 +773,9 @@ namespace osl_StreamPipe void ctors_name_option( ) { // create a pipe. - ::osl::StreamPipe aStreamPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::StreamPipe aStreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); // create an unattached pipe. - ::osl::StreamPipe aStreamPipe1( aTestPipeName, osl_Pipe_OPEN ); + ::osl::StreamPipe aStreamPipe1( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); bRes = aStreamPipe1.is( ) && aStreamPipe.is( ); aStreamPipe.clear( ); aStreamPipe1.clear( ); @@ -787,7 +788,7 @@ namespace osl_StreamPipe { /// create a security pipe. const ::osl::Security rSecurity; - ::osl::StreamPipe aSecurityPipe( aTestPipeName, osl_Pipe_CREATE, rSecurity ); + ::osl::StreamPipe aSecurityPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE, rSecurity ); bRes = aSecurityPipe.is( ); aSecurityPipe.clear( ); @@ -809,7 +810,7 @@ namespace osl_StreamPipe void ctors_no_acquire( ) { // create a pipe. - ::osl::StreamPipe aPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::StreamPipe aPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); // constructs a pipe reference without acquiring the handle. ::osl::StreamPipe aNoAcquirePipe( aPipe.getHandle( ), SAL_NO_ACQUIRE ); @@ -846,7 +847,7 @@ namespace osl_StreamPipe void assign_ref( ) { ::osl::StreamPipe aPipe, aPipe1; - aPipe.create( aTestPipeName, osl_Pipe_CREATE ); + aPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); aPipe1 = aPipe; bRes = aPipe1.is( ); bRes1 = aPipe == aPipe1; @@ -859,7 +860,7 @@ namespace osl_StreamPipe void assign_handle( ) { - ::osl::StreamPipe * pPipe = new ::osl::StreamPipe( aTestPipeName, osl_Pipe_CREATE ); + ::osl::StreamPipe * pPipe = new ::osl::StreamPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); ::osl::StreamPipe * pAssignPipe = new ::osl::StreamPipe; *pAssignPipe = pPipe->getHandle( ); @@ -914,7 +915,7 @@ namespace osl_StreamPipe sal_Int32 nChars = 0; printf("open pipe\n"); - ::osl::StreamPipe aSenderPipe( aTestPipeName, osl_Pipe_OPEN ); // aTestPipeName is a string = "TestPipe" + ::osl::StreamPipe aSenderPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_OPEN ); // test::uniquePipeName(aTestPipeName) is a string = "TestPipe" if ( aSenderPipe.is() == sal_False ) { printf("pipe open failed! \n"); @@ -947,13 +948,13 @@ namespace osl_StreamPipe { public: sal_Char buf[256]; - //::osl::StreamPipe aListenPipe; //( aTestPipeName, osl_Pipe_CREATE ); + //::osl::StreamPipe aListenPipe; //( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); ::osl::Pipe aListenPipe; ::osl::StreamPipe aConnectionPipe; Pipe_DataSource_Thread( ) { printf("create pipe\n"); - aListenPipe.create( aTestPipeName, osl_Pipe_CREATE ); + aListenPipe.create( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); } ~Pipe_DataSource_Thread( ) { @@ -964,7 +965,7 @@ namespace osl_StreamPipe { //create pipe. sal_Int32 nChars; - //::osl::StreamPipe aListenPipe( aTestPipeName, osl_Pipe_CREATE ); + //::osl::StreamPipe aListenPipe( test::uniquePipeName(aTestPipeName), osl_Pipe_CREATE ); printf("listen\n"); if ( aListenPipe.is() == sal_False ) { -- cgit v1.2.3 From c7a871a2a15543900fb39c0d2c3e14ec6f88d9ff Mon Sep 17 00:00:00 2001 From: Mathias Bauer Date: Sat, 10 Jul 2010 18:21:24 +0200 Subject: CWS changehid: #i111874#: change code to support HelpIds as byte strings --- offapi/com/sun/star/inspection/LineDescriptor.idl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/offapi/com/sun/star/inspection/LineDescriptor.idl b/offapi/com/sun/star/inspection/LineDescriptor.idl index fc300d041..7787ea77a 100644 --- a/offapi/com/sun/star/inspection/LineDescriptor.idl +++ b/offapi/com/sun/star/inspection/LineDescriptor.idl @@ -94,7 +94,7 @@ struct LineDescriptor

If a primary button exists for a property's UI representation (HasPrimaryButton), it gets the ID specified herein.

*/ - long PrimaryButtonId; + string PrimaryButtonId; /** describes the URL of an image to display on the primary button, if any. @@ -139,7 +139,7 @@ struct LineDescriptor @see PrimaryButtonId */ - long SecondaryButtonId; + string SecondaryButtonId; /** describes the URL of an image to display on the secondary button, if any. -- cgit v1.2.3 From ecdfaf85c5793b9324a301a32ad9d9d79a67f18e Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 12 Jul 2010 11:44:25 +0200 Subject: sb126: #i107490# dead code not removed by previous cleanup --- cppu/source/typelib/typelib.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index 60191a32a..1745dd69b 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -295,7 +295,6 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () ) for( i = 0; i < nSize; i++ ) { typelib_TypeDescriptionReference * pTDR = ppTDR[i]; - sal_Int32 nStaticCounts = pTDR->nStaticRefCount; OSL_ASSERT( pTDR->nRefCount > pTDR->nStaticRefCount ); pTDR->nRefCount -= pTDR->nStaticRefCount; -- cgit v1.2.3 From 8f59192de2aeac36867355b434f00c0b77889f35 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 9 Sep 2010 10:48:03 +0200 Subject: hb22: #b6982587# treat null LD_LIBRARY_PATH like unset one --- pyuno/zipcore/python.sh | 2 +- ure/source/startup.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyuno/zipcore/python.sh b/pyuno/zipcore/python.sh index f471b1dfd..b53e369fe 100644 --- a/pyuno/zipcore/python.sh +++ b/pyuno/zipcore/python.sh @@ -44,7 +44,7 @@ PATH=$sd_prog${PATH+:$PATH} export PATH # Set LD_LIBRARY_PATH so that "import pyuno" finds libpyuno.so: -LD_LIBRARY_PATH=$sd_prog/../basis-link/program:$sd_prog/../basis-link/ure-link/lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH} +LD_LIBRARY_PATH=$sd_prog/../basis-link/program:$sd_prog/../basis-link/ure-link/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} export LD_LIBRARY_PATH # Set UNO_PATH so that "officehelper.bootstrap()" can find soffice executable: diff --git a/ure/source/startup.sh b/ure/source/startup.sh index 70748f262..7f973c5bf 100644 --- a/ure/source/startup.sh +++ b/ure/source/startup.sh @@ -39,7 +39,7 @@ epath=`dirname "$0"` if [ -x "${epath}/javaldx" ] ; then jpath=`"${epath}/javaldx" $my_envargs` if [ -n "${jpath}" ]; then - LD_LIBRARY_PATH=${jpath}${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}} + LD_LIBRARY_PATH=${jpath}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} export LD_LIBRARY_PATH fi fi -- cgit v1.2.3 From 1183e1e81b5f2c1aedb70a89b77cb5c51e6ebfcd Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 10 Sep 2010 13:09:33 +0200 Subject: sb129: #i113189# clean up stoc/source/simpleregistry so that subsequent changes can better modify it --- stoc/source/implementationregistration/implreg.cxx | 25 +- stoc/source/simpleregistry/simpleregistry.cxx | 2341 ++++++++++---------- 2 files changed, 1172 insertions(+), 1194 deletions(-) mode change 100644 => 100755 stoc/source/simpleregistry/simpleregistry.cxx diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index d803bd44c..eb3e6dc34 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -628,9 +628,9 @@ static void deleteUserLink(const Reference < XRegistryKey >& xRootKey, } else { oldImpl = implEntries.getConstArray()[0]; - + rtl::OUString path(xOldKey->getKeyName()); xOldKey->closeKey(); - xRootKey->deleteKey(xOldKey->getKeyName()); + xRootKey->deleteKey(path); } OUString oldTarget = searchLinkTargetForImpl(xRootKey, linkName, oldImpl); @@ -644,8 +644,9 @@ static void deleteUserLink(const Reference < XRegistryKey >& xRootKey, { bClean = sal_True; hasNoImplementations = sal_False; + rtl::OUString path(xOldKey->getKeyName()); xOldKey->closeKey(); - xRootKey->deleteKey(xOldKey->getKeyName()); + xRootKey->deleteKey(path); } } } else @@ -808,21 +809,24 @@ static void deleteAllImplementations( const Reference < XSimpleRegistry >& xReg, if (hasLocationUrl) { hasLocationUrl = sal_False; + rtl::OUString path(xImplKey->getKeyName()); xImplKey->closeKey(); - xReg->getRootKey()->deleteKey(xImplKey->getKeyName()); + xReg->getRootKey()->deleteKey(path); } } subKeys = xSource->openKeys(); if (subKeys.getLength() == 0) { + rtl::OUString path(xSource->getKeyName()); xSource->closeKey(); - xReg->getRootKey()->deleteKey(xSource->getKeyName()); + xReg->getRootKey()->deleteKey(path); } } else { + rtl::OUString path(xSource->getKeyName()); xSource->closeKey(); - xReg->getRootKey()->deleteKey(xSource->getKeyName()); + xReg->getRootKey()->deleteKey(path); } } @@ -947,21 +951,24 @@ static void deleteAllServiceEntries( const Reference < XSimpleRegistry >& xReg, if (hasNoImplementations) { hasNoImplementations = sal_False; + rtl::OUString path(xServiceKey->getKeyName()); xServiceKey->closeKey(); - xReg->getRootKey()->deleteKey(xServiceKey->getKeyName()); + xReg->getRootKey()->deleteKey(path); } } subKeys = xSource->openKeys(); if (subKeys.getLength() == 0) { + rtl::OUString path(xSource->getKeyName()); xSource->closeKey(); - xReg->getRootKey()->deleteKey(xSource->getKeyName()); + xReg->getRootKey()->deleteKey(path); } } else { + rtl::OUString path(xSource->getKeyName()); xSource->closeKey(); - xReg->getRootKey()->deleteKey(xSource->getKeyName()); + xReg->getRootKey()->deleteKey(path); } } diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx old mode 100644 new mode 100755 index 03faa9a2c..5a7c6f9cd --- a/stoc/source/simpleregistry/simpleregistry.cxx +++ b/stoc/source/simpleregistry/simpleregistry.cxx @@ -1,1306 +1,1277 @@ /************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + #include "precompiled_stoc.hxx" -#include -#include -#include -#ifndef _RTL_USTRBUF_H_ -#include -#endif -#include -#include -#include -#include -#include -#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_ -#include -#endif -#include - -#include -#include -#include -#include - -using namespace com::sun::star::uno; -using namespace com::sun::star::registry; -using namespace com::sun::star::lang; -using namespace cppu; -using namespace osl; -using namespace rtl; - -#define SERVICENAME "com.sun.star.registry.SimpleRegistry" -#define IMPLNAME "com.sun.star.comp.stoc.SimpleRegistry" +#include "sal/config.h" + +#include +#include + +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/registry/InvalidRegistryException.hpp" +#include "com/sun/star/registry/InvalidValueException.hpp" +#include "com/sun/star/registry/MergeConflictException.hpp" +#include "com/sun/star/registry/RegistryKeyType.hpp" +#include "com/sun/star/registry/XRegistryKey.hpp" +#include "com/sun/star/registry/XSimpleRegistry.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "com/sun/star/uno/Sequence.hxx" +#include "cppuhelper/implbase1.hxx" +#include "cppuhelper/implbase2.hxx" +#include "cppuhelper/weak.hxx" +#include "osl/mutex.hxx" +#include "registry/registry.hxx" +#include "registry/regtype.h" +#include "rtl/ref.hxx" +#include "rtl/string.h" +#include "rtl/string.hxx" +#include "rtl/textcvt.h" +#include "rtl/textenc.h" +#include "rtl/unload.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +#include "bootstrapservices.hxx" extern rtl_StandardModuleCount g_moduleCount; -namespace stoc_bootstrap -{ -Sequence< OUString > simreg_getSupportedServiceNames() -{ - static Sequence < OUString > *pNames = 0; - if( ! pNames ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( !pNames ) - { - static Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME)); - pNames = &seqNames; - } - } - return *pNames; -} +namespace { -OUString simreg_getImplementationName() -{ - static OUString *pImplName = 0; - if( ! pImplName ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pImplName ) - { - static OUString implName( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) ); - pImplName = &implName; - } - } - return *pImplName; -} -} - -namespace stoc_simreg { - -//************************************************************************* -// class RegistryKeyImpl the implenetation of interface XRegistryKey -//************************************************************************* -class RegistryKeyImpl; - -//************************************************************************* -// SimpleRegistryImpl -//************************************************************************* -class SimpleRegistryImpl : public WeakImplHelper2< XSimpleRegistry, XServiceInfo > +namespace css = com::sun::star; + +class SimpleRegistry: + public cppu::WeakImplHelper2< + css::registry::XSimpleRegistry, css::lang::XServiceInfo > { public: - SimpleRegistryImpl( const Registry& rRegistry ); - - ~SimpleRegistryImpl(); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) throw(RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(RuntimeException); - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(RuntimeException); - - // XSimpleRegistry - virtual OUString SAL_CALL getURL() throw(RuntimeException); - virtual void SAL_CALL open( const OUString& rURL, sal_Bool bReadOnly, sal_Bool bCreate ) throw(InvalidRegistryException, RuntimeException); - virtual sal_Bool SAL_CALL isValid( ) throw(RuntimeException); - virtual void SAL_CALL close( ) throw(InvalidRegistryException, RuntimeException); - virtual void SAL_CALL destroy( ) throw(InvalidRegistryException, RuntimeException); - virtual Reference< XRegistryKey > SAL_CALL getRootKey( ) throw(InvalidRegistryException, RuntimeException); - virtual sal_Bool SAL_CALL isReadOnly( ) throw(InvalidRegistryException, RuntimeException); - virtual void SAL_CALL mergeKey( const OUString& aKeyName, const OUString& aUrl ) throw(InvalidRegistryException, MergeConflictException, RuntimeException); - - friend class RegistryKeyImpl; -protected: - Mutex m_mutex; - OUString m_url; - Registry m_registry; -}; + SimpleRegistry() { g_moduleCount.modCnt.acquire(&g_moduleCount.modCnt); } + ~SimpleRegistry() { g_moduleCount.modCnt.release(&g_moduleCount.modCnt); } -class RegistryKeyImpl : public WeakImplHelper1< XRegistryKey > -{ -public: - RegistryKeyImpl( const RegistryKey& rKey, SimpleRegistryImpl* pRegistry ); - - RegistryKeyImpl( const OUString& rKeyName, SimpleRegistryImpl* pRegistry ); - - ~RegistryKeyImpl(); - - // XRegistryKey - virtual OUString SAL_CALL getKeyName() throw(RuntimeException); - virtual sal_Bool SAL_CALL isReadOnly( ) throw(InvalidRegistryException, RuntimeException); - virtual sal_Bool SAL_CALL isValid( ) throw(RuntimeException); - virtual RegistryKeyType SAL_CALL getKeyType( const OUString& rKeyName ) throw(InvalidRegistryException, RuntimeException); - virtual RegistryValueType SAL_CALL getValueType( ) throw(InvalidRegistryException, RuntimeException); - virtual sal_Int32 SAL_CALL getLongValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException); - virtual void SAL_CALL setLongValue( sal_Int32 value ) throw(InvalidRegistryException, RuntimeException); - virtual Sequence< sal_Int32 > SAL_CALL getLongListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException); - virtual void SAL_CALL setLongListValue( const ::com::sun::star::uno::Sequence< sal_Int32 >& seqValue ) throw(InvalidRegistryException, RuntimeException); - virtual OUString SAL_CALL getAsciiValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException); - virtual void SAL_CALL setAsciiValue( const OUString& value ) throw(InvalidRegistryException, RuntimeException); - virtual Sequence< OUString > SAL_CALL getAsciiListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException); - virtual void SAL_CALL setAsciiListValue( const ::com::sun::star::uno::Sequence< OUString >& seqValue ) throw(InvalidRegistryException, RuntimeException); - virtual OUString SAL_CALL getStringValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException); - virtual void SAL_CALL setStringValue( const OUString& value ) throw(InvalidRegistryException, RuntimeException); - virtual Sequence< OUString > SAL_CALL getStringListValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException); - virtual void SAL_CALL setStringListValue( const ::com::sun::star::uno::Sequence< OUString >& seqValue ) throw(InvalidRegistryException, RuntimeException); - virtual Sequence< sal_Int8 > SAL_CALL getBinaryValue( ) throw(InvalidRegistryException, InvalidValueException, RuntimeException); - virtual void SAL_CALL setBinaryValue( const ::com::sun::star::uno::Sequence< sal_Int8 >& value ) throw(InvalidRegistryException, RuntimeException); - virtual Reference< XRegistryKey > SAL_CALL openKey( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException); - virtual Reference< XRegistryKey > SAL_CALL createKey( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException); - virtual void SAL_CALL closeKey( ) throw(InvalidRegistryException, RuntimeException); - virtual void SAL_CALL deleteKey( const OUString& rKeyName ) throw(InvalidRegistryException, RuntimeException); - virtual Sequence< Reference< XRegistryKey > > SAL_CALL openKeys( ) throw(InvalidRegistryException, RuntimeException); - virtual Sequence< OUString > SAL_CALL getKeyNames( ) throw(InvalidRegistryException, RuntimeException); - virtual sal_Bool SAL_CALL createLink( const OUString& aLinkName, const OUString& aLinkTarget ) throw(InvalidRegistryException, RuntimeException); - virtual void SAL_CALL deleteLink( const OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException); - virtual OUString SAL_CALL getLinkTarget( const OUString& rLinkName ) throw(InvalidRegistryException, RuntimeException); - virtual OUString SAL_CALL getResolvedName( const OUString& aKeyName ) throw(InvalidRegistryException, RuntimeException); - -protected: - OUString m_name; - RegistryKey m_key; - SimpleRegistryImpl* m_pRegistry; -}; - -//************************************************************************* -RegistryKeyImpl::RegistryKeyImpl( const RegistryKey& key, SimpleRegistryImpl* pRegistry ) - : m_key(key) - , m_pRegistry(pRegistry) -{ - m_pRegistry->acquire(); - m_name = m_key.getName(); -} + osl::Mutex mutex_; -//************************************************************************* -RegistryKeyImpl::RegistryKeyImpl( const OUString& rKeyName, - SimpleRegistryImpl* pRegistry ) - : m_pRegistry(pRegistry) -{ - m_pRegistry->acquire(); +private: + virtual rtl::OUString SAL_CALL getURL() throw (css::uno::RuntimeException); - RegistryKey rootKey; - if (!pRegistry->m_registry.isValid() || - pRegistry->m_registry.openRootKey(rootKey)) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - if ( rootKey.openKey(rKeyName, m_key) ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - m_name = rKeyName; - } - } + virtual void SAL_CALL open( + rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isValid() throw (css::uno::RuntimeException); + + virtual void SAL_CALL close() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual void SAL_CALL destroy() throw( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL + getRootKey() throw( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isReadOnly() throw( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual void SAL_CALL mergeKey( + rtl::OUString const & aKeyName, rtl::OUString const & aUrl) + throw ( + css::registry::InvalidRegistryException, + css::registry::MergeConflictException, css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { return stoc_bootstrap::simreg_getImplementationName(); } + + virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName) + throw (css::uno::RuntimeException) + { return ServiceName == getSupportedServiceNames()[0]; } + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL + getSupportedServiceNames() throw (css::uno::RuntimeException) + { return stoc_bootstrap::simreg_getSupportedServiceNames(); } + + Registry registry_; +}; + +class Key: public cppu::WeakImplHelper1< css::registry::XRegistryKey > { +public: + Key( + rtl::Reference< SimpleRegistry > const & registry, + RegistryKey const & key): + registry_(registry), key_(key) {} + +private: + virtual rtl::OUString SAL_CALL getKeyName() + throw (css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isReadOnly() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isValid() throw(css::uno::RuntimeException); + + virtual css::registry::RegistryKeyType SAL_CALL getKeyType( + rtl::OUString const & rKeyName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::registry::RegistryValueType SAL_CALL getValueType() throw( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL getLongValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setLongValue(sal_Int32 value) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< sal_Int32 > SAL_CALL getLongListValue() throw( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setLongListValue( + com::sun::star::uno::Sequence< sal_Int32 > const & seqValue) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getAsciiValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setAsciiValue(rtl::OUString const & value) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getAsciiListValue() + throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setAsciiListValue( + css::uno::Sequence< rtl::OUString > const & seqValue) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getStringValue() throw( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setStringValue(rtl::OUString const & value) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getStringListValue() + throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setStringListValue( + css::uno::Sequence< rtl::OUString > const & seqValue) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setBinaryValue( + css::uno::Sequence< sal_Int8 > const & value) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL openKey( + rtl::OUString const & aKeyName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL + createKey(rtl::OUString const & aKeyName) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual void SAL_CALL closeKey() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual void SAL_CALL deleteKey(rtl::OUString const & rKeyName) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual + css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > + SAL_CALL openKeys() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getKeyNames() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL createLink( + rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual void SAL_CALL deleteLink(rtl::OUString const & rLinkName) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getLinkTarget( + rtl::OUString const & rLinkName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getResolvedName( + rtl::OUString const & aKeyName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + rtl::Reference< SimpleRegistry > registry_; + RegistryKey key_; +}; + +rtl::OUString Key::getKeyName() throw (css::uno::RuntimeException) { + osl::MutexGuard guard(registry_->mutex_); + return key_.getName(); } -//************************************************************************* -RegistryKeyImpl::~RegistryKeyImpl() +sal_Bool Key::isReadOnly() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - m_pRegistry->release(); + osl::MutexGuard guard(registry_->mutex_); + return key_.isReadOnly(); } -//************************************************************************* -OUString SAL_CALL RegistryKeyImpl::getKeyName() throw(RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - return m_name; -} +sal_Bool Key::isValid() throw (css::uno::RuntimeException) { + osl::MutexGuard guard(registry_->mutex_); + return key_.isValid(); +} -//************************************************************************* -sal_Bool SAL_CALL RegistryKeyImpl::isReadOnly( ) - throw(InvalidRegistryException, RuntimeException) +css::registry::RegistryKeyType Key::getKeyType(rtl::OUString const & rKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if (m_key.isValid()) - { - return(m_key.isReadOnly()); - } else - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(registry_->mutex_); + RegKeyType type; + RegError err = key_.getKeyType(rKeyName, &type); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getKeyType:" + " underlying RegistryKey::getKeyType() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } -} - -//************************************************************************* -sal_Bool SAL_CALL RegistryKeyImpl::isValid( ) throw(RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - return m_key.isValid(); -} + switch (type) { + default: + std::abort(); // this cannot happen + // pseudo-fall-through to avoid warnings on MSC + case RG_KEYTYPE: + return css::registry::RegistryKeyType_KEY; + case RG_LINKTYPE: + return css::registry::RegistryKeyType_LINK; + } +} -//************************************************************************* -RegistryKeyType SAL_CALL RegistryKeyImpl::getKeyType( const OUString& rKeyName ) - throw(InvalidRegistryException, RuntimeException) +css::registry::RegistryValueType Key::getValueType() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( m_key.isValid() ) - { - RegKeyType keyType; - if ( !m_key.getKeyType(rKeyName, &keyType) ) - { - switch (keyType) - { - case RG_KEYTYPE: - return RegistryKeyType_KEY; - case RG_LINKTYPE: - return RegistryKeyType_LINK; - } - } else - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - } else - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(registry_->mutex_); + RegValueType type; + sal_uInt32 size; + RegError err = key_.getValueInfo(rtl::OUString(), &type, &size); + switch (err) { + case REG_NO_ERROR: + break; + case REG_INVALID_VALUE: + type = RG_VALUETYPE_NOT_DEFINED; + break; + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getValueType:" + " underlying RegistryKey::getValueInfo() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + switch (type) { + default: + std::abort(); // this cannot happen + // pseudo-fall-through to avoid warnings on MSC + case RG_VALUETYPE_NOT_DEFINED: + return css::registry::RegistryValueType_NOT_DEFINED; + case RG_VALUETYPE_LONG: + return css::registry::RegistryValueType_LONG; + case RG_VALUETYPE_STRING: + return css::registry::RegistryValueType_ASCII; + case RG_VALUETYPE_UNICODE: + return css::registry::RegistryValueType_STRING; + case RG_VALUETYPE_BINARY: + return css::registry::RegistryValueType_BINARY; + case RG_VALUETYPE_LONGLIST: + return css::registry::RegistryValueType_LONGLIST; + case RG_VALUETYPE_STRINGLIST: + return css::registry::RegistryValueType_ASCIILIST; + case RG_VALUETYPE_UNICODELIST: + return css::registry::RegistryValueType_STRINGLIST; } - - return RegistryKeyType_KEY; -} +} -//************************************************************************* -RegistryValueType SAL_CALL RegistryKeyImpl::getValueType( ) - throw(InvalidRegistryException, RuntimeException) +sal_Int32 Key::getLongValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if (!m_key.isValid()) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegValueType type; - sal_uInt32 size; - - if (m_key.getValueInfo(OUString(), &type, &size)) - { - return RegistryValueType_NOT_DEFINED; - } else - { - switch (type) - { - case RG_VALUETYPE_LONG: return RegistryValueType_LONG; - case RG_VALUETYPE_STRING: return RegistryValueType_ASCII; - case RG_VALUETYPE_UNICODE: return RegistryValueType_STRING; - case RG_VALUETYPE_BINARY: return RegistryValueType_BINARY; - case RG_VALUETYPE_LONGLIST: return RegistryValueType_LONGLIST; - case RG_VALUETYPE_STRINGLIST: return RegistryValueType_ASCIILIST; - case RG_VALUETYPE_UNICODELIST: return RegistryValueType_STRINGLIST; - default: return RegistryValueType_NOT_DEFINED; - } - } + osl::MutexGuard guard(registry_->mutex_); + sal_Int32 value; + RegError err = key_.getValue(rtl::OUString(), &value); + switch (err) { + case REG_NO_ERROR: + break; + case REG_INVALID_VALUE: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getLongValue:" + " underlying RegistryKey::getValue() = REG_INVALID_VALUE")), + static_cast< OWeakObject * >(this)); + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getLongValue:" + " underlying RegistryKey::getValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } - - return RegistryValueType_NOT_DEFINED; -} + return value; +} -//************************************************************************* -sal_Int32 SAL_CALL RegistryKeyImpl::getLongValue( ) - throw(InvalidRegistryException, InvalidValueException, RuntimeException) +void Key::setLongValue(sal_Int32 value) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if (!m_key.isValid()) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegValueType type; - sal_uInt32 size; - - if ( !m_key.getValueInfo(OUString(), &type, &size) ) - { - if (type == RG_VALUETYPE_LONG) - { - sal_Int32 value; - if ( !m_key.getValue(OUString(), (RegValue)&value) ) - { - return value; - } - } - } - - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(registry_->mutex_); + RegError err = key_.setValue( + rtl::OUString(), RG_VALUETYPE_LONG, &value, sizeof (sal_Int32)); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key setLongValue:" + " underlying RegistryKey::setValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } -} +} -//************************************************************************* -void SAL_CALL RegistryKeyImpl::setLongValue( sal_Int32 value ) - throw(InvalidRegistryException, RuntimeException) +css::uno::Sequence< sal_Int32 > Key::getLongListValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - if (m_key.setValue(OUString(), RG_VALUETYPE_LONG, &value, sizeof(sal_Int32))) - { - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } + osl::MutexGuard guard(registry_->mutex_); + RegistryValueList< sal_Int32 > list; + RegError err = key_.getLongListValue(rtl::OUString(), list); + switch (err) { + case REG_NO_ERROR: + break; + case REG_VALUE_NOT_EXISTS: + return css::uno::Sequence< sal_Int32 >(); + case REG_INVALID_VALUE: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getLongListValue:" + " underlying RegistryKey::getLongListValue() =" + " REG_INVALID_VALUE")), + static_cast< OWeakObject * >(this)); + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getLongListValue:" + " underlying RegistryKey::getLongListValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + sal_uInt32 n = list.getLength(); + if (n > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getLongListValue:" + " underlying RegistryKey::getLongListValue() too large")), + static_cast< OWeakObject * >(this)); } -} + css::uno::Sequence< sal_Int32 > value(static_cast< sal_Int32 >(n)); + for (sal_uInt32 i = 0; i < n; ++i) { + value[static_cast< sal_Int32 >(i)] = list.getElement(i); + } + return value; +} -//************************************************************************* -Sequence< sal_Int32 > SAL_CALL RegistryKeyImpl::getLongListValue( ) - throw(InvalidRegistryException, InvalidValueException, RuntimeException) +void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const & seqValue) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegValueType type; - sal_uInt32 size; - - if ( !m_key.getValueInfo(OUString(), &type, &size) ) - { - if (type == RG_VALUETYPE_LONGLIST) - { - RegistryValueList tmpValue; - if ( !m_key.getLongListValue(OUString(), tmpValue) ) - { - Sequence seqValue(size); - - for (sal_uInt32 i=0; i < size; i++) - { - seqValue.getArray()[i] = tmpValue.getElement(i); - } - - return seqValue; - } - } - } - - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(registry_->mutex_); + std::vector< sal_Int32 > list; + for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) { + list.push_back(seqValue[i]); + } + RegError err = key_.setLongListValue( + rtl::OUString(), list.empty() ? 0 : &list[0], + static_cast< sal_uInt32 >(list.size())); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key setLongListValue:" + " underlying RegistryKey::setLongListValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } } - -//************************************************************************* -void SAL_CALL RegistryKeyImpl::setLongListValue( const Sequence< sal_Int32 >& seqValue ) - throw(InvalidRegistryException, RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - sal_uInt32 length = seqValue.getLength(); - sal_Int32* tmpValue = new sal_Int32[length]; - - for (sal_uInt32 i=0; i < length; i++) - { - tmpValue[i] = seqValue.getConstArray()[i]; - } - - if ( m_key.setLongListValue(OUString(), tmpValue, length) ) - { - delete[] tmpValue; - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } - - delete[] tmpValue; - } -} -//************************************************************************* -OUString SAL_CALL RegistryKeyImpl::getAsciiValue( ) - throw(InvalidRegistryException, InvalidValueException, RuntimeException) +rtl::OUString Key::getAsciiValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if (!m_key.isValid()) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegValueType type; - sal_uInt32 size; - - if ( !m_key.getValueInfo(OUString(), &type, &size) ) - { - if ( type == RG_VALUETYPE_STRING ) - { - char* value = new char[size]; - if ( m_key.getValue(OUString(), (RegValue)value) ) - { - delete [] value; - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } else - { - OUString ret(OStringToOUString(value, RTL_TEXTENCODING_UTF8)); - delete [] value; - return ret; - } - } - } - - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(registry_->mutex_); + RegValueType type; + sal_uInt32 size; + RegError err = key_.getValueInfo(rtl::OUString(), &type, &size); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getAsciiValue:" + " underlying RegistryKey::getValueInfo() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + if (type != RG_VALUETYPE_STRING) { + throw css::registry::InvalidValueException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getAsciiValue:" + " underlying RegistryKey type = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(type))), + static_cast< OWeakObject * >(this)); } -} + // size contains terminating null (error in underlying registry.cxx): + if (size == 0) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getAsciiValue:" + " underlying RegistryKey size 0 cannot happen due to" + " design error")), + static_cast< OWeakObject * >(this)); + } + if (size > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getAsciiValue:" + " underlying RegistryKey size too large")), + static_cast< OWeakObject * >(this)); + } + std::vector< char > list(size); + err = key_.getValue(rtl::OUString(), &list[0]); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getAsciiValue:" + " underlying RegistryKey::getValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + if (list[size - 1] != '\0') { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getAsciiValue:" + " underlying RegistryKey value must be null-terminated due" + " to design error")), + static_cast< OWeakObject * >(this)); + } + rtl::OUString value; + if (!rtl_convertStringToUString( + &value.pData, &list[0], + static_cast< sal_Int32 >(size - 1), RTL_TEXTENCODING_UTF8, + (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | + RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | + RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) + { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getAsciiValue:" + " underlying RegistryKey not UTF-8")), + static_cast< OWeakObject * >(this)); + } + return value; +} -//************************************************************************* -void SAL_CALL RegistryKeyImpl::setAsciiValue( const OUString& value ) - throw(InvalidRegistryException, RuntimeException) +void Key::setAsciiValue(rtl::OUString const & value) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - OString sValue = OUStringToOString(value, RTL_TEXTENCODING_UTF8); - sal_uInt32 size = sValue.getLength()+1; - if ( m_key.setValue(OUString(), RG_VALUETYPE_STRING, - (RegValue)(sValue.getStr()), size) ) - { - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } + osl::MutexGuard guard(registry_->mutex_); + rtl::OString utf8; + if (!value.convertToString( + &utf8, RTL_TEXTENCODING_UTF8, + (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | + RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))) + { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key setAsciiValue:" + " value not UTF-16")), + static_cast< OWeakObject * >(this)); + } + RegError err = key_.setValue( + rtl::OUString(), RG_VALUETYPE_STRING, + const_cast< char * >(utf8.getStr()), utf8.getLength() + 1); + // +1 for terminating null (error in underlying registry.cxx) + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key setAsciiValue:" + " underlying RegistryKey::setValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } -} +} -//************************************************************************* -Sequence< OUString > SAL_CALL RegistryKeyImpl::getAsciiListValue( ) - throw(InvalidRegistryException, InvalidValueException, RuntimeException) +css::uno::Sequence< rtl::OUString > Key::getAsciiListValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegValueType type; - sal_uInt32 size; - - if ( !m_key.getValueInfo(OUString(), &type, &size) ) + osl::MutexGuard guard(registry_->mutex_); + RegistryValueList< char * > list; + RegError err = key_.getStringListValue(rtl::OUString(), list); + switch (err) { + case REG_NO_ERROR: + break; + case REG_VALUE_NOT_EXISTS: + return css::uno::Sequence< rtl::OUString >(); + case REG_INVALID_VALUE: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " getAsciiListValue: underlying" + " RegistryKey::getStringListValue() = REG_INVALID_VALUE")), + static_cast< OWeakObject * >(this)); + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " getAsciiListValue: underlying" + " RegistryKey::getStringListValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + sal_uInt32 n = list.getLength(); + if (n > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " getAsciiListValue: underlying" + " RegistryKey::getStringListValue() too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > value(static_cast< sal_Int32 >(n)); + for (sal_uInt32 i = 0; i < n; ++i) { + char * el = list.getElement(i); + sal_Int32 size = rtl_str_getLength(el); + if (!rtl_convertStringToUString( + &value[static_cast< sal_Int32 >(i)].pData, el, size, + RTL_TEXTENCODING_UTF8, + (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | + RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | + RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) { - if (type == RG_VALUETYPE_STRINGLIST) - { - RegistryValueList tmpValue; - if ( !m_key.getStringListValue(OUString(), tmpValue) ) - { - Sequence seqValue(size); - - for (sal_uInt32 i=0; i < size; i++) - { - seqValue.getArray()[i] = - OStringToOUString(tmpValue.getElement(i), RTL_TEXTENCODING_UTF8); - } - - return seqValue; - } - } + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " getAsciiListValue: underlying RegistryKey not" + " UTF-8")), + static_cast< OWeakObject * >(this)); } - - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); } + return value; } - -//************************************************************************* -void SAL_CALL RegistryKeyImpl::setAsciiListValue( const Sequence< OUString >& seqValue ) - throw(InvalidRegistryException, RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - sal_uInt32 length = seqValue.getLength(); - OString* pSValue = new OString[length]; - char** tmpValue = new char*[length]; - for (sal_uInt32 i=0; i < length; i++) - { - pSValue[i] = OUStringToOString(seqValue.getConstArray()[i], RTL_TEXTENCODING_UTF8); - tmpValue[i] = (char*)pSValue[i].getStr(); - } - - if ( m_key.setStringListValue(OUString(), tmpValue, length) ) +void Key::setAsciiListValue( + css::uno::Sequence< rtl::OUString > const & seqValue) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + osl::MutexGuard guard(registry_->mutex_); + std::vector< rtl::OString > list; + for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) { + rtl::OString utf8; + if (!seqValue[i].convertToString( + &utf8, RTL_TEXTENCODING_UTF8, + (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | + RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))) { - delete[] pSValue; - delete[] tmpValue; - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " setAsciiListValue: value not UTF-16")), + static_cast< OWeakObject * >(this)); } - - delete[] pSValue; - delete[] tmpValue; + list.push_back(utf8); } -} - -//************************************************************************* -OUString SAL_CALL RegistryKeyImpl::getStringValue( ) - throw(InvalidRegistryException, InvalidValueException, RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else + std::vector< char * > list2; + for (std::vector< rtl::OString >::iterator i(list.begin()); i != list.end(); + ++i) { - RegValueType type; - sal_uInt32 size; - - if ( !m_key.getValueInfo(OUString(), &type, &size) ) - { - if (type == RG_VALUETYPE_UNICODE) - { - sal_Unicode* value = new sal_Unicode[size]; - if ( m_key.getValue(OUString(), (RegValue)value) ) - { - delete [] value; - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } else - { - OUString ret(value); - delete [] value; - return ret; - } - } - } - - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); + list2.push_back(const_cast< char * >(i->getStr())); + } + RegError err = key_.setStringListValue( + rtl::OUString(), list2.empty() ? 0 : &list2[0], + static_cast< sal_uInt32 >(list2.size())); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " setAsciiListValue: underlying" + " RegistryKey::setStringListValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } -} +} -//************************************************************************* -void SAL_CALL RegistryKeyImpl::setStringValue( const OUString& value ) - throw(InvalidRegistryException, RuntimeException) +rtl::OUString Key::getStringValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - sal_uInt32 size = (value.getLength() + 1) * sizeof(sal_Unicode); - if ( m_key.setValue(OUString(), RG_VALUETYPE_UNICODE, - (RegValue)(value.getStr()), size) ) - { - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } - } -} + osl::MutexGuard guard(registry_->mutex_); + RegValueType type; + sal_uInt32 size; + RegError err = key_.getValueInfo(rtl::OUString(), &type, &size); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getStringValue:" + " underlying RegistryKey::getValueInfo() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + if (type != RG_VALUETYPE_UNICODE) { + throw css::registry::InvalidValueException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getStringValue:" + " underlying RegistryKey type = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(type))), + static_cast< OWeakObject * >(this)); + } + // size contains terminating null and is *2 (error in underlying + // registry.cxx): + if (size == 0 || (size & 1) == 1) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getStringValue:" + " underlying RegistryKey size 0 or odd cannot happen due to" + " design error")), + static_cast< OWeakObject * >(this)); + } + if (size > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getStringValue:" + " underlying RegistryKey size too large")), + static_cast< OWeakObject * >(this)); + } + std::vector< sal_Unicode > list(size); + err = key_.getValue(rtl::OUString(), &list[0]); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getStringValue:" + " underlying RegistryKey::getValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + if (list[size/2 - 1] != 0) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getStringValue:" + " underlying RegistryKey value must be null-terminated due" + " to design error")), + static_cast< OWeakObject * >(this)); + } + return rtl::OUString(&list[0], static_cast< sal_Int32 >(size/2 - 1)); +} -//************************************************************************* -Sequence< OUString > SAL_CALL RegistryKeyImpl::getStringListValue( ) - throw(InvalidRegistryException, InvalidValueException, RuntimeException) +void Key::setStringValue(rtl::OUString const & value) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegValueType type; - sal_uInt32 size; - - if ( !m_key.getValueInfo(OUString(), &type, &size) ) - { - if (type == RG_VALUETYPE_UNICODELIST) - { - RegistryValueList tmpValue; - if ( !m_key.getUnicodeListValue(OUString(), tmpValue) ) - { - Sequence seqValue(size); - - for (sal_uInt32 i=0; i < size; i++) - { - seqValue.getArray()[i] = OUString(tmpValue.getElement(i)); - } - - return seqValue; - } - } - } - - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(registry_->mutex_); + RegError err = key_.setValue( + rtl::OUString(), RG_VALUETYPE_UNICODE, + const_cast< sal_Unicode * >(value.getStr()), + (value.getLength() + 1) * sizeof (sal_Unicode)); + // +1 for terminating null (error in underlying registry.cxx) + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key setStringValue:" + " underlying RegistryKey::setValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } } - -//************************************************************************* -void SAL_CALL RegistryKeyImpl::setStringListValue( const Sequence< OUString >& seqValue ) - throw(InvalidRegistryException, RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - sal_uInt32 length = seqValue.getLength(); - sal_Unicode** tmpValue = new sal_Unicode*[length]; - - for (sal_uInt32 i=0; i < length; i++) - { - tmpValue[i] = (sal_Unicode*)seqValue.getConstArray()[i].getStr(); - } - if (m_key.setUnicodeListValue(OUString(), tmpValue, length)) - { - delete[] tmpValue; - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } - - delete[] tmpValue; - } -} - -//************************************************************************* -Sequence< sal_Int8 > SAL_CALL RegistryKeyImpl::getBinaryValue( ) - throw(InvalidRegistryException, InvalidValueException, RuntimeException) +css::uno::Sequence< rtl::OUString > Key::getStringListValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegValueType type; - sal_uInt32 size; - - if ( !m_key.getValueInfo(OUString(), &type, &size) ) - { - if (type == RG_VALUETYPE_BINARY) - { - sal_Int8* value = new sal_Int8[size]; - if (m_key.getValue(OUString(), (RegValue)value)) - { - delete [] value; - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } else - { - Sequence seqBytes(value, size); - delete [] value; - return seqBytes; - } - } - } - - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(registry_->mutex_); + RegistryValueList< sal_Unicode * > list; + RegError err = key_.getUnicodeListValue(rtl::OUString(), list); + switch (err) { + case REG_NO_ERROR: + break; + case REG_VALUE_NOT_EXISTS: + return css::uno::Sequence< rtl::OUString >(); + case REG_INVALID_VALUE: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " getStringListValue: underlying" + " RegistryKey::getUnicodeListValue() = REG_INVALID_VALUE")), + static_cast< OWeakObject * >(this)); + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " getStringListValue: underlying" + " RegistryKey::getUnicodeListValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } -} + sal_uInt32 n = list.getLength(); + if (n > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " getStringListValue: underlying" + " RegistryKey::getUnicodeListValue() too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > value(static_cast< sal_Int32 >(n)); + for (sal_uInt32 i = 0; i < n; ++i) { + value[static_cast< sal_Int32 >(i)] = list.getElement(i); + } + return value; +} -//************************************************************************* -void SAL_CALL RegistryKeyImpl::setBinaryValue( const Sequence< sal_Int8 >& value ) - throw(InvalidRegistryException, RuntimeException) +void Key::setStringListValue( + css::uno::Sequence< rtl::OUString > const & seqValue) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - sal_uInt32 size = value.getLength(); - if ( m_key.setValue(OUString(), RG_VALUETYPE_BINARY, - (RegValue)(value.getConstArray()), size) ) - { - throw InvalidValueException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidValueException") ), - (OWeakObject *)this ); - } - } -} + osl::MutexGuard guard(registry_->mutex_); + std::vector< sal_Unicode * > list; + for (sal_Int32 i = 0; i < seqValue.getLength(); ++i) { + list.push_back(const_cast< sal_Unicode * >(seqValue[i].getStr())); + } + RegError err = key_.setUnicodeListValue( + rtl::OUString(), list.empty() ? 0 : &list[0], + static_cast< sal_uInt32 >(list.size())); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key" + " setStringListValue: underlying" + " RegistryKey::setUnicodeListValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } +} -//************************************************************************* -Reference< XRegistryKey > SAL_CALL RegistryKeyImpl::openKey( const OUString& aKeyName ) - throw(InvalidRegistryException, RuntimeException) +css::uno::Sequence< sal_Int8 > Key::getBinaryValue() + throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) { - RegistryKey newKey; - - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegError _ret = m_key.openKey(aKeyName, newKey); - if ( _ret ) - { - if ( _ret == REG_INVALID_KEY ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - - return Reference(); - } else - { - return ((XRegistryKey*)new RegistryKeyImpl(newKey, m_pRegistry)); - } - } -} + osl::MutexGuard guard(registry_->mutex_); + RegValueType type; + sal_uInt32 size; + RegError err = key_.getValueInfo(rtl::OUString(), &type, &size); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getBinaryValue:" + " underlying RegistryKey::getValueInfo() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + if (type != RG_VALUETYPE_BINARY) { + throw css::registry::InvalidValueException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getBinaryValue:" + " underlying RegistryKey type = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(type))), + static_cast< OWeakObject * >(this)); + } + if (size > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getBinaryValue:" + " underlying RegistryKey size too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< sal_Int8 > value(static_cast< sal_Int32 >(size)); + err = key_.getValue(rtl::OUString(), value.getArray()); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getBinaryValue:" + " underlying RegistryKey::getValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + return value; +} -//************************************************************************* -Reference< XRegistryKey > SAL_CALL RegistryKeyImpl::createKey( const OUString& aKeyName ) - throw(InvalidRegistryException, RuntimeException) +void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const & value) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - RegistryKey newKey; - - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegError _ret = m_key.createKey(aKeyName, newKey); - if ( _ret ) - { - if (_ret == REG_INVALID_KEY) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - - return Reference(); - } else - { - return ((XRegistryKey*)new RegistryKeyImpl(newKey, m_pRegistry)); - } - } -} + osl::MutexGuard guard(registry_->mutex_); + RegError err = key_.setValue( + rtl::OUString(), RG_VALUETYPE_BINARY, + const_cast< sal_Int8 * >(value.getConstArray()), + static_cast< sal_uInt32 >(value.getLength())); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key setBinaryValue:" + " underlying RegistryKey::setValue() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } +} -//************************************************************************* -void SAL_CALL RegistryKeyImpl::closeKey( ) - throw(InvalidRegistryException, RuntimeException) +css::uno::Reference< css::registry::XRegistryKey > Key::openKey( + rtl::OUString const & aKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( m_key.isValid() ) - { - if ( !m_key.closeKey() ) - return; - } - - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); -} - -//************************************************************************* -void SAL_CALL RegistryKeyImpl::deleteKey( const OUString& rKeyName ) - throw(InvalidRegistryException, RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( m_key.isValid() ) - { - if ( !m_key.deleteKey(rKeyName) ) - return; - } - - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); -} - -//************************************************************************* -Sequence< Reference< XRegistryKey > > SAL_CALL RegistryKeyImpl::openKeys( ) - throw(InvalidRegistryException, RuntimeException) -{ - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegistryKeyArray subKeys; - RegError _ret = REG_NO_ERROR; - if ( (_ret = m_key.openSubKeys(OUString(), subKeys)) ) - { - if ( _ret == REG_INVALID_KEY ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - - return Sequence< Reference >(); - } else - { - sal_uInt32 length = subKeys.getLength(); - Sequence< Reference > seqKeys(length); - - for (sal_uInt32 i=0; i < length; i++) - { - seqKeys.getArray()[i] = - (XRegistryKey*) new RegistryKeyImpl(subKeys.getElement(i), m_pRegistry); - } - return seqKeys; - } - } -} + osl::MutexGuard guard(registry_->mutex_); + RegistryKey key; + RegError err = key_.openKey(aKeyName, key); + switch (err) { + case REG_NO_ERROR: + return new Key(registry_, key); + case REG_KEY_NOT_EXISTS: + return css::uno::Reference< css::registry::XRegistryKey >(); + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key openKey:" + " underlying RegistryKey::openKey() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } +} -//************************************************************************* -Sequence< OUString > SAL_CALL RegistryKeyImpl::getKeyNames( ) - throw(InvalidRegistryException, RuntimeException) +css::uno::Reference< css::registry::XRegistryKey > Key::createKey( + rtl::OUString const & aKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegistryKeyNames subKeys; - RegError _ret = REG_NO_ERROR; - if ( (_ret = m_key.getKeyNames(OUString(), subKeys)) ) - { - if ( _ret == REG_INVALID_KEY ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - - return Sequence(); - } else - { - sal_uInt32 length = subKeys.getLength(); - Sequence seqKeys(length); - - for (sal_uInt32 i=0; i < length; i++) - { - seqKeys.getArray()[i] = subKeys.getElement(i); - } - return seqKeys; - } - } -} + osl::MutexGuard guard(registry_->mutex_); + RegistryKey key; + RegError err = key_.createKey(aKeyName, key); + switch (err) { + case REG_NO_ERROR: + return new Key(registry_, key); + case REG_INVALID_KEYNAME: + return css::uno::Reference< css::registry::XRegistryKey >(); + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key createKey:" + " underlying RegistryKey::createKey() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } +} -//************************************************************************* -sal_Bool SAL_CALL RegistryKeyImpl::createLink( const OUString& aLinkName, const OUString& aLinkTarget ) - throw(InvalidRegistryException, RuntimeException) +void Key::closeKey() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegError ret = m_key.createLink(aLinkName, aLinkTarget); - if ( ret ) - { - if ( ret == REG_DETECT_RECURSION || - ret == REG_INVALID_KEY ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - return sal_False; - } - } + osl::MutexGuard guard(registry_->mutex_); + RegError err = key_.closeKey(); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key closeKey:" + " underlying RegistryKey::closeKey() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } - return sal_True; } -//************************************************************************* -void SAL_CALL RegistryKeyImpl::deleteLink( const OUString& rLinkName ) - throw(InvalidRegistryException, RuntimeException) +void Key::deleteKey(rtl::OUString const & rKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - if ( m_key.deleteLink(rLinkName) ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - } + osl::MutexGuard guard(registry_->mutex_); + RegError err = key_.deleteKey(rKeyName); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key deleteKey:" + " underlying RegistryKey::deleteKey() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } } - -//************************************************************************* -OUString SAL_CALL RegistryKeyImpl::getLinkTarget( const OUString& rLinkName ) - throw(InvalidRegistryException, RuntimeException) -{ - OUString linkTarget; - - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegError ret = m_key.getLinkTarget(rLinkName, linkTarget); - if ( ret ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - } - - return linkTarget; -} -//************************************************************************* -OUString SAL_CALL RegistryKeyImpl::getResolvedName( const OUString& aKeyName ) - throw(InvalidRegistryException, RuntimeException) -{ - OUString resolvedName; - - Guard< Mutex > aGuard( m_pRegistry->m_mutex ); - if ( !m_key.isValid() ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } else - { - RegError ret = m_key.getResolvedKeyName( - aKeyName, sal_True, resolvedName); - if ( ret ) - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - } - - return resolvedName; -} - -//************************************************************************* -SimpleRegistryImpl::SimpleRegistryImpl( const Registry& rRegistry ) - : m_registry(rRegistry) +css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > +Key::openKeys() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); -} + osl::MutexGuard guard(registry_->mutex_); + RegistryKeyArray list; + RegError err = key_.openSubKeys(rtl::OUString(), list); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key openKeys:" + " underlying RegistryKey::openSubKeys() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + sal_uInt32 n = list.getLength(); + if (n > SAL_MAX_INT32) { + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getKeyNames:" + " underlying RegistryKey::getKeyNames() too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > + keys(static_cast< sal_Int32 >(n)); + for (sal_uInt32 i = 0; i < n; ++i) { + keys[static_cast< sal_Int32 >(i)] = new Key( + registry_, list.getElement(i)); + } + return keys; +} -//************************************************************************* -SimpleRegistryImpl::~SimpleRegistryImpl() +css::uno::Sequence< rtl::OUString > Key::getKeyNames() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); + osl::MutexGuard guard(registry_->mutex_); + RegistryKeyNames list; + RegError err = key_.getKeyNames(rtl::OUString(), list); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getKeyNames:" + " underlying RegistryKey::getKeyNames() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + sal_uInt32 n = list.getLength(); + if (n > SAL_MAX_INT32) { + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getKeyNames:" + " underlying RegistryKey::getKeyNames() too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > names(static_cast< sal_Int32 >(n)); + for (sal_uInt32 i = 0; i < n; ++i) { + names[static_cast< sal_Int32 >(i)] = list.getElement(i); + } + return names; } -//************************************************************************* -OUString SAL_CALL SimpleRegistryImpl::getImplementationName( ) - throw(RuntimeException) +sal_Bool Key::createLink( + rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - return stoc_bootstrap::simreg_getImplementationName(); -} + osl::MutexGuard guard(registry_->mutex_); + RegError err = key_.createLink(aLinkName, aLinkTarget); + switch (err) { + case REG_NO_ERROR: + return true; + case REG_INVALID_KEY: + case REG_DETECT_RECURSION: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key createLink:" + " underlying RegistryKey::createLink() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + default: + return false; + } +} -//************************************************************************* -sal_Bool SAL_CALL SimpleRegistryImpl::supportsService( const OUString& ServiceName ) - throw(RuntimeException) -{ - Guard< Mutex > aGuard( m_mutex ); - Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString * pArray = aSNL.getArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - return sal_False; -} - -//************************************************************************* -Sequence SAL_CALL SimpleRegistryImpl::getSupportedServiceNames( ) - throw(RuntimeException) +void Key::deleteLink(rtl::OUString const & rLinkName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - return stoc_bootstrap::simreg_getSupportedServiceNames(); -} + osl::MutexGuard guard(registry_->mutex_); + RegError err = key_.deleteLink(rLinkName); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key deleteLink:" + " underlying RegistryKey::deleteLink() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } +} -//************************************************************************* -OUString SAL_CALL SimpleRegistryImpl::getURL() throw(RuntimeException) +rtl::OUString Key::getLinkTarget(rtl::OUString const & rLinkName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_mutex ); - return m_url; -} + osl::MutexGuard guard(registry_->mutex_); + rtl::OUString target; + RegError err = key_.getLinkTarget(rLinkName, target); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getLinkTarget:" + " underlying RegistryKey::getLinkTarget() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); + } + return target; +} -//************************************************************************* -void SAL_CALL SimpleRegistryImpl::open( const OUString& rURL, sal_Bool bReadOnly, sal_Bool bCreate ) - throw(InvalidRegistryException, RuntimeException) +rtl::OUString Key::getResolvedName(rtl::OUString const & aKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_mutex ); - if ( m_registry.isValid() ) - { - m_registry.close(); + osl::MutexGuard guard(registry_->mutex_); + rtl::OUString resolved; + RegError err = key_.getResolvedKeyName(aKeyName, true, resolved); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry key getResolvedName:" + " underlying RegistryKey::getResolvedName() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } + return resolved; +} - RegAccessMode accessMode = REG_READWRITE; - - if ( bReadOnly ) - accessMode = REG_READONLY; - - if ( !m_registry.open(rURL, accessMode) ) - { - m_url = rURL; - return; - } - - if ( bCreate ) - { - if ( !m_registry.create(rURL) ) - { - m_url = rURL; - return; - } - } - - m_url = OUString(); +rtl::OUString SimpleRegistry::getURL() throw (css::uno::RuntimeException) { + osl::MutexGuard guard(mutex_); + return registry_.getName(); +} - OUStringBuffer reason( 128 ); - reason.appendAscii( RTL_CONSTASCII_STRINGPARAM("Couldn't ") ); - if( bCreate ) - { - reason.appendAscii( RTL_CONSTASCII_STRINGPARAM("create") ); +void SimpleRegistry::open( + rtl::OUString const & rURL, sal_Bool bReadOnly, sal_Bool bCreate) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + osl::MutexGuard guard(mutex_); + RegError err = (rURL.getLength() == 0 && bCreate) + ? REG_REGISTRY_NOT_EXISTS + : registry_.open(rURL, bReadOnly ? REG_READONLY : REG_READWRITE); + if (err == REG_REGISTRY_NOT_EXISTS && bCreate) { + err = registry_.create(rURL); } - else - { - reason.appendAscii( RTL_CONSTASCII_STRINGPARAM("open") ); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.open(")) + + rURL + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "): underlying Registry::open/create() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } - reason.appendAscii( RTL_CONSTASCII_STRINGPARAM(" registry ") ); - reason.append( rURL ); - if( bReadOnly ) - { - reason.appendAscii( RTL_CONSTASCII_STRINGPARAM(" for reading") ); - } - else - { - reason.appendAscii( RTL_CONSTASCII_STRINGPARAM(" for writing" ) ); - } - throw InvalidRegistryException( reason.makeStringAndClear() , Reference< XInterface >() ); -} +} -//************************************************************************* -sal_Bool SAL_CALL SimpleRegistryImpl::isValid( ) throw(RuntimeException) -{ - Guard< Mutex > aGuard( m_mutex ); - return m_registry.isValid(); -} +sal_Bool SimpleRegistry::isValid() throw (css::uno::RuntimeException) { + osl::MutexGuard guard(mutex_); + return registry_.isValid(); +} -//************************************************************************* -void SAL_CALL SimpleRegistryImpl::close( ) - throw(InvalidRegistryException, RuntimeException) +void SimpleRegistry::close() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_mutex ); - if ( m_registry.isValid() ) - { - if ( !m_registry.close() ) - { - m_url = OUString(); - return; - } + osl::MutexGuard guard(mutex_); + RegError err = registry_.close(); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.close:" + " underlying Registry::close() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } - - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); -} +} -//************************************************************************* -void SAL_CALL SimpleRegistryImpl::destroy( ) - throw(InvalidRegistryException, RuntimeException) +void SimpleRegistry::destroy() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_mutex ); - if ( m_registry.isValid() ) - { - if ( !m_registry.destroy(OUString()) ) - { - m_url = OUString(); - return; - } + osl::MutexGuard guard(mutex_); + RegError err = registry_.destroy(rtl::OUString()); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.destroy:" + " underlying Registry::destroy() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } +} - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); -} - -//************************************************************************* -Reference< XRegistryKey > SAL_CALL SimpleRegistryImpl::getRootKey( ) - throw(InvalidRegistryException, RuntimeException) +css::uno::Reference< css::registry::XRegistryKey > SimpleRegistry::getRootKey() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_mutex ); - if ( m_registry.isValid() ) - return ((XRegistryKey*)new RegistryKeyImpl(OUString( RTL_CONSTASCII_USTRINGPARAM("/") ), this)); - else - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); + osl::MutexGuard guard(mutex_); + RegistryKey root; + RegError err = registry_.openRootKey(root); + if (err != REG_NO_ERROR) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.getRootKey:" + " underlying Registry::getRootKey() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } -} + return new Key(this, root); +} -//************************************************************************* -sal_Bool SAL_CALL SimpleRegistryImpl::isReadOnly( ) - throw(InvalidRegistryException, RuntimeException) +sal_Bool SimpleRegistry::isReadOnly() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_mutex ); - if ( m_registry.isValid() ) - return m_registry.isReadOnly(); - else - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } -} + osl::MutexGuard guard(mutex_); + return registry_.isReadOnly(); +} -//************************************************************************* -void SAL_CALL SimpleRegistryImpl::mergeKey( const OUString& aKeyName, const OUString& aUrl ) - throw(InvalidRegistryException, MergeConflictException, RuntimeException) +void SimpleRegistry::mergeKey( + rtl::OUString const & aKeyName, rtl::OUString const & aUrl) + throw ( + css::registry::InvalidRegistryException, + css::registry::MergeConflictException, css::uno::RuntimeException) { - Guard< Mutex > aGuard( m_mutex ); - if ( m_registry.isValid() ) - { - RegistryKey rootKey; - if ( !m_registry.openRootKey(rootKey) ) - { - RegError ret = m_registry.mergeKey(rootKey, aKeyName, aUrl, sal_False, sal_False); - if (ret) - { - if ( ret == REG_MERGE_CONFLICT ) - return; - if ( ret == REG_MERGE_ERROR ) - { - throw MergeConflictException( - OUString( RTL_CONSTASCII_USTRINGPARAM("MergeConflictException") ), - (OWeakObject *)this ); - } - else - { - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); - } - } - - return; - } + osl::MutexGuard guard(mutex_); + RegistryKey root; + RegError err = registry_.openRootKey(root); + if (err == REG_NO_ERROR) { + err = registry_.mergeKey(root, aKeyName, aUrl, false, false); + } + switch (err) { + case REG_NO_ERROR: + case REG_MERGE_CONFLICT: + break; + case REG_MERGE_ERROR: + throw css::registry::MergeConflictException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.mergeKey:" + " underlying Registry::mergeKey() = REG_MERGE_ERROR")), + static_cast< cppu::OWeakObject * >(this)); + default: + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.mergeKey:" + " underlying Registry::getRootKey/mergeKey() = ")) + + rtl::OUString::valueOf(static_cast< sal_Int32 >(err))), + static_cast< OWeakObject * >(this)); } +} - throw InvalidRegistryException( - OUString( RTL_CONSTASCII_USTRINGPARAM("InvalidRegistryException") ), - (OWeakObject *)this ); -} } -namespace stoc_bootstrap -{ -//************************************************************************* -Reference SAL_CALL SimpleRegistry_CreateInstance( const Reference& ) -{ - Reference xRet; +namespace stoc_bootstrap { - Registry reg; - - XSimpleRegistry *pRegistry = (XSimpleRegistry*) new stoc_simreg::SimpleRegistryImpl(reg); +css::uno::Reference< css::uno::XInterface > SimpleRegistry_CreateInstance( + css::uno::Reference< css::uno::XComponentContext > const &) +{ + return static_cast< cppu::OWeakObject * >(new SimpleRegistry); +} - if (pRegistry) - { - xRet = Reference::query(pRegistry); - } - - return xRet; +css::uno::Sequence< rtl::OUString > simreg_getSupportedServiceNames() { + css::uno::Sequence< rtl::OUString > names(1); + names[0] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.registry.SimpleRegistry")); + return names; } + +rtl::OUString simreg_getImplementationName() { + return rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.SimpleRegistry")); } +} -- cgit v1.2.3 From dea72c76e86f8d3764285923d436f2e76639b1ec Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 10 Sep 2010 13:09:38 +0200 Subject: sb129: #i113189# move XmlReader from configmgr to URE --- ure/source/README | 2 + xmlreader/inc/makefile.mk | 40 + xmlreader/inc/pch/precompiled_xmlreader.cxx | 28 + xmlreader/inc/pch/precompiled_xmlreader.hxx | 32 + xmlreader/inc/xmlreader/detail/xmlreaderdllapi.hxx | 41 + xmlreader/inc/xmlreader/pad.hxx | 61 ++ xmlreader/inc/xmlreader/span.hxx | 69 ++ xmlreader/inc/xmlreader/xmlreader.hxx | 199 ++++ xmlreader/prj/build.lst | 3 + xmlreader/prj/d.lst | 10 + xmlreader/source/makefile.mk | 53 + xmlreader/source/pad.cxx | 90 ++ xmlreader/source/span.cxx | 66 ++ xmlreader/source/xmlreader.cxx | 1054 ++++++++++++++++++++ 14 files changed, 1748 insertions(+) create mode 100644 xmlreader/inc/makefile.mk create mode 100644 xmlreader/inc/pch/precompiled_xmlreader.cxx create mode 100644 xmlreader/inc/pch/precompiled_xmlreader.hxx create mode 100644 xmlreader/inc/xmlreader/detail/xmlreaderdllapi.hxx create mode 100644 xmlreader/inc/xmlreader/pad.hxx create mode 100644 xmlreader/inc/xmlreader/span.hxx create mode 100644 xmlreader/inc/xmlreader/xmlreader.hxx create mode 100644 xmlreader/prj/build.lst create mode 100755 xmlreader/prj/d.lst create mode 100644 xmlreader/source/makefile.mk create mode 100644 xmlreader/source/pad.cxx create mode 100644 xmlreader/source/span.cxx create mode 100644 xmlreader/source/xmlreader.cxx diff --git a/ure/source/README b/ure/source/README index 6e5162d8f..3bbdaa43d 100644 --- a/ure/source/README +++ b/ure/source/README @@ -65,6 +65,7 @@ Linux x86, Solaris x86, and Solaris SPARC: /opt/openoffice.org/ure/lib/libreg.so.3 [private] /opt/openoffice.org/ure/lib/librmcxt.so.3 [private] /opt/openoffice.org/ure/lib/libstore.so.3 [private] +/opt/openoffice.org/ure/lib/libxmlreader.so [private] /opt/openoffice.org/ure/lib/libjvmaccessgcc3.so.3 [private; Linux x86 only] /opt/openoffice.org/ure/lib/libjvmaccessC52.so.3 [private; Solaris only] /opt/openoffice.org/ure/lib/libjvmfwk.so.3 [private] @@ -128,6 +129,7 @@ Program Files\URE\bin\uno.ini [private] Program Files\URE\bin\reg3.dll [private] Program Files\URE\bin\rmcxt3.dll [private] Program Files\URE\bin\store3.dll [private] +Program Files\URE\bin\xmlreader.dll [private] Program Files\URE\bin\jvmaccess3MSC.dll [private] Program Files\URE\bin\jvmfwk3.dll [private] Program Files\URE\bin\sunjavaplugin.dll [private] diff --git a/xmlreader/inc/makefile.mk b/xmlreader/inc/makefile.mk new file mode 100644 index 000000000..9f8443470 --- /dev/null +++ b/xmlreader/inc/makefile.mk @@ -0,0 +1,40 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +PRJ = .. +PRJNAME = xmlreader +TARGET = inc + +ENABLE_EXCEPTIONS = TRUE +VISIBILITY_HIDDEN = TRUE + +.INCLUDE: settings.mk +.INCLUDE: target.mk + +.IF "$(ENABLE_PCH)" != "" +ALLTAR: $(SLO)/precompiled.pch $(SLO)/precompiled_ex.pch +.ENDIF diff --git a/xmlreader/inc/pch/precompiled_xmlreader.cxx b/xmlreader/inc/pch/precompiled_xmlreader.cxx new file mode 100644 index 000000000..e5d584855 --- /dev/null +++ b/xmlreader/inc/pch/precompiled_xmlreader.cxx @@ -0,0 +1,28 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#include "precompiled_xmlreader.hxx" diff --git a/xmlreader/inc/pch/precompiled_xmlreader.hxx b/xmlreader/inc/pch/precompiled_xmlreader.hxx new file mode 100644 index 000000000..7561fe89f --- /dev/null +++ b/xmlreader/inc/pch/precompiled_xmlreader.hxx @@ -0,0 +1,32 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#if defined PRECOMPILED_HEADERS + +#include "sal/config.h" + +#endif diff --git a/xmlreader/inc/xmlreader/detail/xmlreaderdllapi.hxx b/xmlreader/inc/xmlreader/detail/xmlreaderdllapi.hxx new file mode 100644 index 000000000..238661a24 --- /dev/null +++ b/xmlreader/inc/xmlreader/detail/xmlreaderdllapi.hxx @@ -0,0 +1,41 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#ifndef INCLUDED_XMLREADER_DETAIL_XMLREADERDLLAPI_HXX +#define INCLUDED_XMLREADER_DETAIL_XMLREADERDLLAPI_HXX + +#include "sal/config.h" + +#include "sal/types.h" + +#if defined OOO_DLLIMPLEMENTATION_XMLREADER +#define OOO_DLLPUBLIC_XMLREADER SAL_DLLPUBLIC_EXPORT +#else +#define OOO_DLLPUBLIC_XMLREADER SAL_DLLPUBLIC_IMPORT +#endif + +#endif diff --git a/xmlreader/inc/xmlreader/pad.hxx b/xmlreader/inc/xmlreader/pad.hxx new file mode 100644 index 000000000..2ea8aa7ca --- /dev/null +++ b/xmlreader/inc/xmlreader/pad.hxx @@ -0,0 +1,61 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#ifndef INCLUDED_XMLREADER_PAD_HXX +#define INCLUDED_XMLREADER_PAD_HXX + +#include "sal/config.h" + +#include "rtl/strbuf.hxx" +#include "sal/types.h" +#include "xmlreader/detail/xmlreaderdllapi.hxx" +#include "xmlreader/span.hxx" + +namespace xmlreader { + +class OOO_DLLPUBLIC_XMLREADER Pad { +public: + void add(char const * begin, sal_Int32 length); + + void addEphemeral(char const * begin, sal_Int32 length); + + void clear(); + + bool is() const; + + Span get() const; + +private: + SAL_DLLPRIVATE void flushSpan(); + + Span span_; + rtl::OStringBuffer buffer_; +}; + +} + +#endif diff --git a/xmlreader/inc/xmlreader/span.hxx b/xmlreader/inc/xmlreader/span.hxx new file mode 100644 index 000000000..4ec8b574f --- /dev/null +++ b/xmlreader/inc/xmlreader/span.hxx @@ -0,0 +1,69 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#ifndef INCLUDED_XMLREADER_SPAN_HXX +#define INCLUDED_XMLREADER_SPAN_HXX + +#include "sal/config.h" + +#include "rtl/string.h" +#include "sal/types.h" +#include "xmlreader/detail/xmlreaderdllapi.hxx" + +namespace rtl { class OUString; } + +namespace xmlreader { + +struct OOO_DLLPUBLIC_XMLREADER Span { + char const * begin; + sal_Int32 length; + + inline Span(): begin(0), length(0) {} + // init length to avoid compiler warnings + + inline Span(char const * theBegin, sal_Int32 theLength): + begin(theBegin), length(theLength) {} + + inline void clear() throw() { begin = 0; } + + inline bool is() const { return begin != 0; } + + inline bool equals(Span const & text) const { + return rtl_str_compare_WithLength( + begin, length, text.begin, text.length) == 0; + } + + inline bool equals(char const * textBegin, sal_Int32 textLength) const { + return equals(Span(textBegin, textLength)); + } + + rtl::OUString convertFromUtf8() const; +}; + +} + +#endif diff --git a/xmlreader/inc/xmlreader/xmlreader.hxx b/xmlreader/inc/xmlreader/xmlreader.hxx new file mode 100644 index 000000000..242af58c7 --- /dev/null +++ b/xmlreader/inc/xmlreader/xmlreader.hxx @@ -0,0 +1,199 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#ifndef INCLUDED_XMLREADER_XMLREADER_HXX +#define INCLUDED_XMLREADER_XMLREADER_HXX + +#include "sal/config.h" + +#include +#include + +#include "boost/noncopyable.hpp" +#include "com/sun/star/container/NoSuchElementException.hpp" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "osl/file.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "xmlreader/detail/xmlreaderdllapi.hxx" +#include "xmlreader/pad.hxx" +#include "xmlreader/span.hxx" + +namespace xmlreader { + +class OOO_DLLPUBLIC_XMLREADER XmlReader: private boost::noncopyable { +public: + explicit XmlReader(rtl::OUString const & fileUrl) + SAL_THROW(( + com::sun::star::container::NoSuchElementException, + com::sun::star::uno::RuntimeException)); + + ~XmlReader(); + + enum { NAMESPACE_NONE = -2, NAMESPACE_UNKNOWN = -1, NAMESPACE_XML = 0 }; + + enum Text { TEXT_NONE, TEXT_RAW, TEXT_NORMALIZED }; + + enum Result { RESULT_BEGIN, RESULT_END, RESULT_TEXT, RESULT_DONE }; + + int registerNamespaceIri(Span const & iri); + + // RESULT_BEGIN: data = localName, ns = ns + // RESULT_END: data, ns unused + // RESULT_TEXT: data = text, ns unused + Result nextItem(Text reportText, Span * data, int * nsId); + + bool nextAttribute(int * nsId, Span * localName); + + // the span returned by getAttributeValue is only valid until the next call + // to nextItem or getAttributeValue + Span getAttributeValue(bool fullyNormalize); + + int getNamespaceId(Span const & prefix) const; + + rtl::OUString getUrl() const; + +private: + typedef std::vector< Span > NamespaceIris; + + // If NamespaceData (and similarly ElementData and AttributeData) is made + // SAL_DLLPRIVATE, at least gcc 4.2.3 erroneously warns about + // "'xmlreader::XmlReader' declared with greater visibility than the type of + // its field 'xmlreader::XmlReader::namespaces_'" (and similarly for + // elements_ and attributes_): + + struct NamespaceData { + Span prefix; + int nsId; + + NamespaceData() {} + + NamespaceData(Span const & thePrefix, int theNsId): + prefix(thePrefix), nsId(theNsId) {} + }; + + typedef std::vector< NamespaceData > NamespaceList; + + struct ElementData { + Span name; + NamespaceList::size_type inheritedNamespaces; + int defaultNamespaceId; + + ElementData( + Span const & theName, + NamespaceList::size_type theInheritedNamespaces, + int theDefaultNamespaceId): + name(theName), inheritedNamespaces(theInheritedNamespaces), + defaultNamespaceId(theDefaultNamespaceId) + {} + }; + + typedef std::stack< ElementData > ElementStack; + + struct AttributeData { + char const * nameBegin; + char const * nameEnd; + char const * nameColon; + char const * valueBegin; + char const * valueEnd; + + AttributeData( + char const * theNameBegin, char const * theNameEnd, + char const * theNameColon, char const * theValueBegin, + char const * theValueEnd): + nameBegin(theNameBegin), nameEnd(theNameEnd), + nameColon(theNameColon), valueBegin(theValueBegin), + valueEnd(theValueEnd) + {} + }; + + typedef std::vector< AttributeData > Attributes; + + enum State { + STATE_CONTENT, STATE_START_TAG, STATE_END_TAG, STATE_EMPTY_ELEMENT_TAG, + STATE_DONE }; + + SAL_DLLPRIVATE inline char read() { return pos_ == end_ ? '\0' : *pos_++; } + + SAL_DLLPRIVATE inline char peek() { return pos_ == end_ ? '\0' : *pos_; } + + SAL_DLLPRIVATE void normalizeLineEnds(Span const & text); + + SAL_DLLPRIVATE void skipSpace(); + + SAL_DLLPRIVATE bool skipComment(); + + SAL_DLLPRIVATE void skipProcessingInstruction(); + + SAL_DLLPRIVATE void skipDocumentTypeDeclaration(); + + SAL_DLLPRIVATE Span scanCdataSection(); + + SAL_DLLPRIVATE bool scanName(char const ** nameColon); + + SAL_DLLPRIVATE int scanNamespaceIri( + char const * begin, char const * end); + + SAL_DLLPRIVATE char const * handleReference( + char const * position, char const * end); + + SAL_DLLPRIVATE Span handleAttributeValue( + char const * begin, char const * end, bool fullyNormalize); + + SAL_DLLPRIVATE Result handleStartTag(int * nsId, Span * localName); + + SAL_DLLPRIVATE Result handleEndTag(); + + SAL_DLLPRIVATE void handleElementEnd(); + + SAL_DLLPRIVATE Result handleSkippedText(Span * data, int * nsId); + + SAL_DLLPRIVATE Result handleRawText(Span * text); + + SAL_DLLPRIVATE Result handleNormalizedText(Span * text); + + SAL_DLLPRIVATE int toNamespaceId(NamespaceIris::size_type pos); + + rtl::OUString fileUrl_; + oslFileHandle fileHandle_; + sal_uInt64 fileSize_; + void * fileAddress_; + NamespaceIris namespaceIris_; + NamespaceList namespaces_; + ElementStack elements_; + char const * pos_; + char const * end_; + State state_; + Attributes attributes_; + Attributes::iterator currentAttribute_; + bool firstAttribute_; + Pad pad_; +}; + +} + +#endif diff --git a/xmlreader/prj/build.lst b/xmlreader/prj/build.lst new file mode 100644 index 000000000..5408a5255 --- /dev/null +++ b/xmlreader/prj/build.lst @@ -0,0 +1,3 @@ +xr xmlreader : BOOST:boost cppu offuh sal stlport NULL +xr xmlreader\inc nmake - all xr_inc NULL +xr xmlreader\source nmake - all xr_source xr_inc NULL diff --git a/xmlreader/prj/d.lst b/xmlreader/prj/d.lst new file mode 100755 index 000000000..fcb99bd30 --- /dev/null +++ b/xmlreader/prj/d.lst @@ -0,0 +1,10 @@ +mkdir: %_DEST%\inc%_EXT%\xmlreader +mkdir: %_DEST%\inc%_EXT%\xmlreader\detail +..\%__SRC%\bin\xmlreader.dll %_DEST%\bin%_EXT%\xmlreader.dll +..\%__SRC%\lib\ixmlreader.lib %_DEST%\lib%_EXT%\ixmlreader.lib +..\%__SRC%\lib\libxmlreader.dylib %_DEST%\lib%_EXT%\libxmlreader.dylib +..\%__SRC%\lib\libxmlreader.so %_DEST%\lib%_EXT%\libxmlreader.so +..\inc\xmlreader\detail\xmlreaderdllapi.hxx %_DEST%\inc%_EXT%\xmlreader\detail\xmlreaderdllapi.hxx +..\inc\xmlreader\pad.hxx %_DEST%\inc%_EXT%\xmlreader\pad.hxx +..\inc\xmlreader\span.hxx %_DEST%\inc%_EXT%\xmlreader\span.hxx +..\inc\xmlreader\xmlreader.hxx %_DEST%\inc%_EXT%\xmlreader\xmlreader.hxx diff --git a/xmlreader/source/makefile.mk b/xmlreader/source/makefile.mk new file mode 100644 index 000000000..cb71e21a1 --- /dev/null +++ b/xmlreader/source/makefile.mk @@ -0,0 +1,53 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +PRJ = .. +PRJNAME = xmlreader +TARGET = xmlreader + +ENABLE_EXCEPTIONS = TRUE +VISIBILITY_HIDDEN = TRUE + +.INCLUDE: settings.mk + +CDEFS += -DOOO_DLLIMPLEMENTATION_XMLREADER + +SLOFILES = \ + $(SLO)/pad.obj \ + $(SLO)/span.obj \ + $(SLO)/xmlreader.obj + +SHL1IMPLIB = i$(SHL1TARGET) +SHL1OBJS = $(SLOFILES) +SHL1RPATH = URELIB +SHL1STDLIBS = \ + $(SALLIB) +SHL1TARGET = xmlreader +SHL1USE_EXPORTS = name +DEF1NAME = $(SHL1TARGET) + +.INCLUDE: target.mk diff --git a/xmlreader/source/pad.cxx b/xmlreader/source/pad.cxx new file mode 100644 index 000000000..01a84e84d --- /dev/null +++ b/xmlreader/source/pad.cxx @@ -0,0 +1,90 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#include "precompiled_xmlreader.hxx" +#include "sal/config.h" + +#include "osl/diagnose.h" +#include "rtl/string.h" +#include "sal/types.h" +#include "xmlreader/pad.hxx" +#include "xmlreader/span.hxx" + +namespace xmlreader { + +void Pad::add(char const * begin, sal_Int32 length) { + OSL_ASSERT( + begin != 0 && length >= 0 && !(span_.is() && buffer_.getLength() != 0)); + if (length != 0) { + flushSpan(); + if (buffer_.getLength() == 0) { + span_ = Span(begin, length); + } else { + buffer_.append(begin, length); + } + } +} + +void Pad::addEphemeral(char const * begin, sal_Int32 length) { + OSL_ASSERT( + begin != 0 && length >= 0 && !(span_.is() && buffer_.getLength() != 0)); + if (length != 0) { + flushSpan(); + buffer_.append(begin, length); + } +} + +void Pad::clear() { + OSL_ASSERT(!(span_.is() && buffer_.getLength() != 0)); + span_.clear(); + buffer_.setLength(0); +} + +bool Pad::is() const { + OSL_ASSERT(!(span_.is() && buffer_.getLength() != 0)); + return span_.is() || buffer_.getLength() != 0; +} + +Span Pad::get() const { + OSL_ASSERT(!(span_.is() && buffer_.getLength() != 0)); + if (span_.is()) { + return span_; + } else if (buffer_.getLength() == 0) { + return Span(RTL_CONSTASCII_STRINGPARAM("")); + } else { + return Span(buffer_.getStr(), buffer_.getLength()); + } +} + +void Pad::flushSpan() { + if (span_.is()) { + buffer_.append(span_.begin, span_.length); + span_.clear(); + } +} + +} diff --git a/xmlreader/source/span.cxx b/xmlreader/source/span.cxx new file mode 100644 index 000000000..3b936553b --- /dev/null +++ b/xmlreader/source/span.cxx @@ -0,0 +1,66 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#include "precompiled_xmlreader.hxx" +#include "sal/config.h" + +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "osl/diagnose.h" +#include "rtl/textcvt.h" +#include "rtl/textenc.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "xmlreader/span.hxx" + +namespace xmlreader { + +namespace { + +namespace css = com::sun::star; + +} + +rtl::OUString Span::convertFromUtf8() const { + OSL_ASSERT(is()); + rtl_uString * s = 0; + if (!rtl_convertStringToUString( + &s, begin, length, RTL_TEXTENCODING_UTF8, + (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | + RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | + RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR))) + { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("cannot convert from UTF-8")), + css::uno::Reference< css::uno::XInterface >()); + } + return rtl::OUString(s, SAL_NO_ACQUIRE); +} + +} diff --git a/xmlreader/source/xmlreader.cxx b/xmlreader/source/xmlreader.cxx new file mode 100644 index 000000000..6c852605b --- /dev/null +++ b/xmlreader/source/xmlreader.cxx @@ -0,0 +1,1054 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#include "precompiled_xmlreader.hxx" +#include "sal/config.h" + +#include +#include + +#include "com/sun/star/container/NoSuchElementException.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/RuntimeException.hpp" +#include "com/sun/star/uno/XInterface.hpp" +#include "osl/diagnose.h" +#include "osl/file.h" +#include "rtl/string.h" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" +#include "xmlreader/pad.hxx" +#include "xmlreader/span.hxx" +#include "xmlreader/xmlreader.hxx" + +namespace xmlreader { + +namespace { + +namespace css = com::sun::star; + +bool isSpace(char c) { + switch (c) { + case '\x09': + case '\x0A': + case '\x0D': + case ' ': + return true; + default: + return false; + } +} + +} + +XmlReader::XmlReader(rtl::OUString const & fileUrl) + SAL_THROW(( + css::container::NoSuchElementException, css::uno::RuntimeException)): + fileUrl_(fileUrl) +{ + switch (osl_openFile(fileUrl_.pData, &fileHandle_, osl_File_OpenFlag_Read)) + { + case osl_File_E_None: + break; + case osl_File_E_NOENT: + throw css::container::NoSuchElementException( + fileUrl_, css::uno::Reference< css::uno::XInterface >()); + default: + throw css::uno::RuntimeException( + (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cannot open ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + oslFileError e = osl_getFileSize(fileHandle_, &fileSize_); + if (e == osl_File_E_None) { + e = osl_mapFile( + fileHandle_, &fileAddress_, fileSize_, 0, + osl_File_MapFlag_WillNeed); + } + if (e != osl_File_E_None) { + e = osl_closeFile(fileHandle_); + if (e != osl_File_E_None) { + OSL_TRACE("osl_closeFile failed with %ld", static_cast< long >(e)); + } + throw css::uno::RuntimeException( + (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cannot mmap ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + namespaceIris_.push_back( + Span( + RTL_CONSTASCII_STRINGPARAM( + "http://www.w3.org/XML/1998/namespace"))); + namespaces_.push_back( + NamespaceData(Span(RTL_CONSTASCII_STRINGPARAM("xml")), NAMESPACE_XML)); + pos_ = static_cast< char * >(fileAddress_); + end_ = pos_ + fileSize_; + state_ = STATE_CONTENT; +} + +XmlReader::~XmlReader() { + oslFileError e = osl_unmapFile(fileAddress_, fileSize_); + if (e != osl_File_E_None) { + OSL_TRACE("osl_unmapFile failed with %ld", static_cast< long >(e)); + } + e = osl_closeFile(fileHandle_); + if (e != osl_File_E_None) { + OSL_TRACE("osl_closeFile failed with %ld", static_cast< long >(e)); + } +} + +int XmlReader::registerNamespaceIri(Span const & iri) { + int id = toNamespaceId(namespaceIris_.size()); + namespaceIris_.push_back(iri); + if (iri.equals( + Span( + RTL_CONSTASCII_STRINGPARAM( + "http://www.w3.org/2001/XMLSchema-instance")))) + { + // Old user layer .xcu files used the xsi namespace prefix without + // declaring a corresponding namespace binding, see issue 77174; reading + // those files during migration would fail without this hack that can be + // removed once migration is no longer relevant (see + // Components::parseModificationLayer): + namespaces_.push_back( + NamespaceData(Span(RTL_CONSTASCII_STRINGPARAM("xsi")), id)); + } + return id; +} + +XmlReader::Result XmlReader::nextItem(Text reportText, Span * data, int * nsId) +{ + switch (state_) { + case STATE_CONTENT: + switch (reportText) { + case TEXT_NONE: + return handleSkippedText(data, nsId); + case TEXT_RAW: + return handleRawText(data); + case TEXT_NORMALIZED: + return handleNormalizedText(data); + } + case STATE_START_TAG: + return handleStartTag(nsId, data); + case STATE_END_TAG: + return handleEndTag(); + case STATE_EMPTY_ELEMENT_TAG: + handleElementEnd(); + return RESULT_END; + default: // STATE_DONE + return RESULT_DONE; + } +} + +bool XmlReader::nextAttribute(int * nsId, Span * localName) { + OSL_ASSERT(nsId != 0 && localName != 0); + if (firstAttribute_) { + currentAttribute_ = attributes_.begin(); + firstAttribute_ = false; + } else { + ++currentAttribute_; + } + if (currentAttribute_ == attributes_.end()) { + return false; + } + if (currentAttribute_->nameColon == 0) { + *nsId = NAMESPACE_NONE; + *localName = Span( + currentAttribute_->nameBegin, + currentAttribute_->nameEnd - currentAttribute_->nameBegin); + } else { + *nsId = getNamespaceId( + Span( + currentAttribute_->nameBegin, + currentAttribute_->nameColon - currentAttribute_->nameBegin)); + *localName = Span( + currentAttribute_->nameColon + 1, + currentAttribute_->nameEnd - (currentAttribute_->nameColon + 1)); + } + return true; +} + +Span XmlReader::getAttributeValue(bool fullyNormalize) { + return handleAttributeValue( + currentAttribute_->valueBegin, currentAttribute_->valueEnd, + fullyNormalize); +} + +int XmlReader::getNamespaceId(Span const & prefix) const { + for (NamespaceList::const_reverse_iterator i(namespaces_.rbegin()); + i != namespaces_.rend(); ++i) + { + if (prefix.equals(i->prefix)) { + return i->nsId; + } + } + return NAMESPACE_UNKNOWN; +} + +rtl::OUString XmlReader::getUrl() const { + return fileUrl_; +} + +void XmlReader::normalizeLineEnds(Span const & text) { + char const * p = text.begin; + sal_Int32 n = text.length; + for (;;) { + sal_Int32 i = rtl_str_indexOfChar_WithLength(p, n, '\x0D'); + if (i < 0) { + break; + } + pad_.add(p, i); + p += i + 1; + n -= i + 1; + if (n == 0 || *p != '\x0A') { + pad_.add(RTL_CONSTASCII_STRINGPARAM("\x0A")); + } + } + pad_.add(p, n); +} + +void XmlReader::skipSpace() { + while (isSpace(peek())) { + ++pos_; + } +} + +bool XmlReader::skipComment() { + if (rtl_str_shortenedCompare_WithLength( + pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("--"), + RTL_CONSTASCII_LENGTH("--")) != + 0) + { + return false; + } + pos_ += RTL_CONSTASCII_LENGTH("--"); + sal_Int32 i = rtl_str_indexOfStr_WithLength( + pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("--")); + if (i < 0) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "premature end (within comment) of ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + pos_ += i + RTL_CONSTASCII_LENGTH("--"); + if (read() != '>') { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "illegal \"--\" within comment in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + return true; +} + +void XmlReader::skipProcessingInstruction() { + sal_Int32 i = rtl_str_indexOfStr_WithLength( + pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("?>")); + if (i < 0) { + throw css::uno::RuntimeException( + (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad '()); + } + pos_ += i + RTL_CONSTASCII_LENGTH("?>"); +} + +void XmlReader::skipDocumentTypeDeclaration() { + // Neither is it checked that the doctypedecl is at the correct position in + // the document, nor that it is well-formed: + for (;;) { + char c = read(); + switch (c) { + case '\0': // i.e., EOF + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "premature end (within DTD) of ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + case '"': + case '\'': + { + sal_Int32 i = rtl_str_indexOfChar_WithLength( + pos_, end_ - pos_, c); + if (i < 0) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "premature end (within DTD) of ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + pos_ += i + 1; + } + break; + case '>': + return; + case '[': + for (;;) { + c = read(); + switch (c) { + case '\0': // i.e., EOF + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "premature end (within DTD) of ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + case '"': + case '\'': + { + sal_Int32 i = rtl_str_indexOfChar_WithLength( + pos_, end_ - pos_, c); + if (i < 0) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "premature end (within DTD) of ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + pos_ += i + 1; + } + break; + case '<': + switch (read()) { + case '\0': // i.e., EOF + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "premature end (within DTD) of ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + case '!': + skipComment(); + break; + case '?': + skipProcessingInstruction(); + break; + default: + break; + } + break; + case ']': + skipSpace(); + if (read() != '>') { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "missing \">\" of DTD in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + return; + default: + break; + } + } + default: + break; + } + } +} + +Span XmlReader::scanCdataSection() { + if (rtl_str_shortenedCompare_WithLength( + pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("[CDATA["), + RTL_CONSTASCII_LENGTH("[CDATA[")) != + 0) + { + return Span(); + } + pos_ += RTL_CONSTASCII_LENGTH("[CDATA["); + char const * begin = pos_; + sal_Int32 i = rtl_str_indexOfStr_WithLength( + pos_, end_ - pos_, RTL_CONSTASCII_STRINGPARAM("]]>")); + if (i < 0) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "premature end (within CDATA section) of ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + pos_ += i + RTL_CONSTASCII_LENGTH("]]>"); + return Span(begin, i); +} + +bool XmlReader::scanName(char const ** nameColon) { + OSL_ASSERT(nameColon != 0 && *nameColon == 0); + for (char const * begin = pos_;; ++pos_) { + switch (peek()) { + case '\0': // i.e., EOF + case '\x09': + case '\x0A': + case '\x0D': + case ' ': + case '/': + case '=': + case '>': + return pos_ != begin; + case ':': + *nameColon = pos_; + break; + default: + break; + } + } +} + +int XmlReader::scanNamespaceIri(char const * begin, char const * end) { + OSL_ASSERT(begin != 0 && begin <= end); + Span iri(handleAttributeValue(begin, end, false)); + for (NamespaceIris::size_type i = 0; i < namespaceIris_.size(); ++i) { + if (namespaceIris_[i].equals(iri)) { + return toNamespaceId(i); + } + } + return XmlReader::NAMESPACE_UNKNOWN; +} + +char const * XmlReader::handleReference(char const * position, char const * end) +{ + OSL_ASSERT(position != 0 && *position == '&' && position < end); + ++position; + if (*position == '#') { + ++position; + sal_Int32 val = 0; + char const * p; + if (*position == 'x') { + ++position; + p = position; + for (;; ++position) { + char c = *position; + if (c >= '0' && c <= '9') { + val = 16 * val + (c - '0'); + } else if (c >= 'A' && c <= 'F') { + val = 16 * val + (c - 'A') + 10; + } else if (c >= 'a' && c <= 'f') { + val = 16 * val + (c - 'a') + 10; + } else { + break; + } + if (val > 0x10FFFF) { // avoid overflow + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "'&#x...' too large in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + } + } else { + p = position; + for (;; ++position) { + char c = *position; + if (c >= '0' && c <= '9') { + val = 10 * val + (c - '0'); + } else { + break; + } + if (val > 0x10FFFF) { // avoid overflow + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "'&#...' too large in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + } + } + if (position == p || *position++ != ';') { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("'&#...' missing ';' in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + OSL_ASSERT(val >= 0 && val <= 0x10FFFF); + if ((val < 0x20 && val != 0x9 && val != 0xA && val != 0xD) || + (val >= 0xD800 && val <= 0xDFFF) || val == 0xFFFE || val == 0xFFFF) + { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "character reference denoting invalid character in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + char buf[4]; + sal_Int32 len; + if (val < 0x80) { + buf[0] = static_cast< char >(val); + len = 1; + } else if (val < 0x800) { + buf[0] = static_cast< char >((val >> 6) | 0xC0); + buf[1] = static_cast< char >((val & 0x3F) | 0x80); + len = 2; + } else if (val < 0x10000) { + buf[0] = static_cast< char >((val >> 12) | 0xE0); + buf[1] = static_cast< char >(((val >> 6) & 0x3F) | 0x80); + buf[2] = static_cast< char >((val & 0x3F) | 0x80); + len = 3; + } else { + buf[0] = static_cast< char >((val >> 18) | 0xF0); + buf[1] = static_cast< char >(((val >> 12) & 0x3F) | 0x80); + buf[2] = static_cast< char >(((val >> 6) & 0x3F) | 0x80); + buf[3] = static_cast< char >((val & 0x3F) | 0x80); + len = 4; + } + pad_.addEphemeral(buf, len); + return position; + } else { + struct EntityRef { + char const * inBegin; + sal_Int32 inLength; + char const * outBegin; + sal_Int32 outLength; + }; + static EntityRef const refs[] = { + { RTL_CONSTASCII_STRINGPARAM("amp;"), + RTL_CONSTASCII_STRINGPARAM("&") }, + { RTL_CONSTASCII_STRINGPARAM("lt;"), + RTL_CONSTASCII_STRINGPARAM("<") }, + { RTL_CONSTASCII_STRINGPARAM("gt;"), + RTL_CONSTASCII_STRINGPARAM(">") }, + { RTL_CONSTASCII_STRINGPARAM("apos;"), + RTL_CONSTASCII_STRINGPARAM("'") }, + { RTL_CONSTASCII_STRINGPARAM("quot;"), + RTL_CONSTASCII_STRINGPARAM("\"") } }; + for (std::size_t i = 0; i < sizeof refs / sizeof refs[0]; ++i) { + if (rtl_str_shortenedCompare_WithLength( + position, end - position, refs[i].inBegin, refs[i].inLength, + refs[i].inLength) == + 0) + { + position += refs[i].inLength; + pad_.add(refs[i].outBegin, refs[i].outLength); + return position; + } + } + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("unknown entity reference in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } +} + +Span XmlReader::handleAttributeValue( + char const * begin, char const * end, bool fullyNormalize) +{ + pad_.clear(); + if (fullyNormalize) { + while (begin != end && isSpace(*begin)) { + ++begin; + } + while (end != begin && isSpace(end[-1])) { + --end; + } + char const * p = begin; + enum Space { SPACE_NONE, SPACE_SPAN, SPACE_BREAK }; + // a single true space character can go into the current span, + // everything else breaks the span + Space space = SPACE_NONE; + while (p != end) { + switch (*p) { + case '\x09': + case '\x0A': + case '\x0D': + switch (space) { + case SPACE_NONE: + pad_.add(begin, p - begin); + pad_.add(RTL_CONSTASCII_STRINGPARAM(" ")); + space = SPACE_BREAK; + break; + case SPACE_SPAN: + pad_.add(begin, p - begin); + space = SPACE_BREAK; + break; + case SPACE_BREAK: + break; + } + begin = ++p; + break; + case ' ': + switch (space) { + case SPACE_NONE: + ++p; + space = SPACE_SPAN; + break; + case SPACE_SPAN: + pad_.add(begin, p - begin); + begin = ++p; + space = SPACE_BREAK; + break; + case SPACE_BREAK: + begin = ++p; + break; + } + break; + case '&': + pad_.add(begin, p - begin); + p = handleReference(p, end); + begin = p; + space = SPACE_NONE; + break; + default: + ++p; + space = SPACE_NONE; + break; + } + } + pad_.add(begin, p - begin); + } else { + char const * p = begin; + while (p != end) { + switch (*p) { + case '\x09': + case '\x0A': + pad_.add(begin, p - begin); + begin = ++p; + pad_.add(RTL_CONSTASCII_STRINGPARAM(" ")); + break; + case '\x0D': + pad_.add(begin, p - begin); + ++p; + if (peek() == '\x0A') { + ++p; + } + begin = p; + pad_.add(RTL_CONSTASCII_STRINGPARAM(" ")); + break; + case '&': + pad_.add(begin, p - begin); + p = handleReference(p, end); + begin = p; + break; + default: + ++p; + break; + } + } + pad_.add(begin, p - begin); + } + return pad_.get(); +} + +XmlReader::Result XmlReader::handleStartTag(int * nsId, Span * localName) { + OSL_ASSERT(nsId != 0 && localName); + char const * nameBegin = pos_; + char const * nameColon = 0; + if (!scanName(&nameColon)) { + throw css::uno::RuntimeException( + (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("bad tag name in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + char const * nameEnd = pos_; + NamespaceList::size_type inheritedNamespaces = namespaces_.size(); + bool hasDefaultNs = false; + int defaultNsId = NAMESPACE_NONE; + attributes_.clear(); + for (;;) { + char const * p = pos_; + skipSpace(); + if (peek() == '/' || peek() == '>') { + break; + } + if (pos_ == p) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "missing whitespace before attribute in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + char const * attrNameBegin = pos_; + char const * attrNameColon = 0; + if (!scanName(&attrNameColon)) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("bad attribute name in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + char const * attrNameEnd = pos_; + skipSpace(); + if (read() != '=') { + throw css::uno::RuntimeException( + (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("missing '=' in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + skipSpace(); + char del = read(); + if (del != '\'' && del != '"') { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("bad attribute value in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + char const * valueBegin = pos_; + sal_Int32 i = rtl_str_indexOfChar_WithLength(pos_, end_ - pos_, del); + if (i < 0) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "unterminated attribute value in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + char const * valueEnd = pos_ + i; + pos_ += i + 1; + if (attrNameColon == 0 && + Span(attrNameBegin, attrNameEnd - attrNameBegin).equals( + RTL_CONSTASCII_STRINGPARAM("xmlns"))) + { + hasDefaultNs = true; + defaultNsId = scanNamespaceIri(valueBegin, valueEnd); + } else if (attrNameColon != 0 && + Span(attrNameBegin, attrNameColon - attrNameBegin).equals( + RTL_CONSTASCII_STRINGPARAM("xmlns"))) + { + namespaces_.push_back( + NamespaceData( + Span(attrNameColon + 1, attrNameEnd - (attrNameColon + 1)), + scanNamespaceIri(valueBegin, valueEnd))); + } else { + attributes_.push_back( + AttributeData( + attrNameBegin, attrNameEnd, attrNameColon, valueBegin, + valueEnd)); + } + } + if (!hasDefaultNs && !elements_.empty()) { + defaultNsId = elements_.top().defaultNamespaceId; + } + firstAttribute_ = true; + if (peek() == '/') { + state_ = STATE_EMPTY_ELEMENT_TAG; + ++pos_; + } else { + state_ = STATE_CONTENT; + } + if (peek() != '>') { + throw css::uno::RuntimeException( + (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("missing '>' in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + ++pos_; + elements_.push( + ElementData( + Span(nameBegin, nameEnd - nameBegin), inheritedNamespaces, + defaultNsId)); + if (nameColon == 0) { + *nsId = defaultNsId; + *localName = Span(nameBegin, nameEnd - nameBegin); + } else { + *nsId = getNamespaceId(Span(nameBegin, nameColon - nameBegin)); + *localName = Span(nameColon + 1, nameEnd - (nameColon + 1)); + } + return RESULT_BEGIN; +} + +XmlReader::Result XmlReader::handleEndTag() { + if (elements_.empty()) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("spurious end tag in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + char const * nameBegin = pos_; + char const * nameColon = 0; + if (!scanName(&nameColon) || + !elements_.top().name.equals(nameBegin, pos_ - nameBegin)) + { + throw css::uno::RuntimeException( + (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("tag mismatch in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + handleElementEnd(); + skipSpace(); + if (peek() != '>') { + throw css::uno::RuntimeException( + (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("missing '>' in ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + ++pos_; + return RESULT_END; +} + +void XmlReader::handleElementEnd() { + OSL_ASSERT(!elements_.empty()); + namespaces_.resize(elements_.top().inheritedNamespaces); + elements_.pop(); + state_ = elements_.empty() ? STATE_DONE : STATE_CONTENT; +} + +XmlReader::Result XmlReader::handleSkippedText(Span * data, int * nsId) { + for (;;) { + sal_Int32 i = rtl_str_indexOfChar_WithLength(pos_, end_ - pos_, '<'); + if (i < 0) { + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("premature end of ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + } + pos_ += i + 1; + switch (peek()) { + case '!': + ++pos_; + if (!skipComment() && !scanCdataSection().is()) { + skipDocumentTypeDeclaration(); + } + break; + case '/': + ++pos_; + return handleEndTag(); + case '?': + ++pos_; + skipProcessingInstruction(); + break; + default: + return handleStartTag(nsId, data); + } + } +} + +XmlReader::Result XmlReader::handleRawText(Span * text) { + pad_.clear(); + for (char const * begin = pos_;;) { + switch (peek()) { + case '\0': // i.e., EOF + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("premature end of ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + case '\x0D': + pad_.add(begin, pos_ - begin); + ++pos_; + if (peek() != '\x0A') { + pad_.add(RTL_CONSTASCII_STRINGPARAM("\x0A")); + } + begin = pos_; + break; + case '&': + pad_.add(begin, pos_ - begin); + pos_ = handleReference(pos_, end_); + begin = pos_; + break; + case '<': + pad_.add(begin, pos_ - begin); + ++pos_; + switch (peek()) { + case '!': + ++pos_; + if (!skipComment()) { + Span cdata(scanCdataSection()); + if (cdata.is()) { + normalizeLineEnds(cdata); + } else { + skipDocumentTypeDeclaration(); + } + } + begin = pos_; + break; + case '/': + *text = pad_.get(); + ++pos_; + state_ = STATE_END_TAG; + return RESULT_TEXT; + case '?': + ++pos_; + skipProcessingInstruction(); + begin = pos_; + break; + default: + *text = pad_.get(); + state_ = STATE_START_TAG; + return RESULT_TEXT; + } + break; + default: + ++pos_; + break; + } + } +} + +XmlReader::Result XmlReader::handleNormalizedText(Span * text) { + pad_.clear(); + char const * flowBegin = pos_; + char const * flowEnd = pos_; + enum Space { SPACE_START, SPACE_NONE, SPACE_SPAN, SPACE_BREAK }; + // a single true space character can go into the current flow, + // everything else breaks the flow + Space space = SPACE_START; + for (;;) { + switch (peek()) { + case '\0': // i.e., EOF + throw css::uno::RuntimeException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("premature end of ")) + + fileUrl_), + css::uno::Reference< css::uno::XInterface >()); + case '\x09': + case '\x0A': + case '\x0D': + switch (space) { + case SPACE_START: + case SPACE_BREAK: + break; + case SPACE_NONE: + case SPACE_SPAN: + space = SPACE_BREAK; + break; + } + ++pos_; + break; + case ' ': + switch (space) { + case SPACE_START: + case SPACE_BREAK: + break; + case SPACE_NONE: + space = SPACE_SPAN; + break; + case SPACE_SPAN: + space = SPACE_BREAK; + break; + } + ++pos_; + break; + case '&': + switch (space) { + case SPACE_START: + break; + case SPACE_NONE: + case SPACE_SPAN: + pad_.add(flowBegin, pos_ - flowBegin); + break; + case SPACE_BREAK: + pad_.add(flowBegin, flowEnd - flowBegin); + pad_.add(RTL_CONSTASCII_STRINGPARAM(" ")); + break; + } + pos_ = handleReference(pos_, end_); + flowBegin = pos_; + flowEnd = pos_; + space = SPACE_NONE; + break; + case '<': + ++pos_; + switch (peek()) { + case '!': + ++pos_; + if (skipComment()) { + space = SPACE_BREAK; + } else { + Span cdata(scanCdataSection()); + if (cdata.is()) { + // CDATA is not normalized (similar to character + // references; it keeps the code simple), but it might + // arguably be better to normalize it: + switch (space) { + case SPACE_START: + break; + case SPACE_NONE: + case SPACE_SPAN: + pad_.add(flowBegin, pos_ - flowBegin); + break; + case SPACE_BREAK: + pad_.add(flowBegin, flowEnd - flowBegin); + pad_.add(RTL_CONSTASCII_STRINGPARAM(" ")); + break; + } + normalizeLineEnds(cdata); + flowBegin = pos_; + flowEnd = pos_; + space = SPACE_NONE; + } else { + skipDocumentTypeDeclaration(); + } + } + break; + case '/': + ++pos_; + pad_.add(flowBegin, flowEnd - flowBegin); + *text = pad_.get(); + state_ = STATE_END_TAG; + return RESULT_TEXT; + case '?': + ++pos_; + skipProcessingInstruction(); + space = SPACE_BREAK; + break; + default: + pad_.add(flowBegin, flowEnd - flowBegin); + *text = pad_.get(); + state_ = STATE_START_TAG; + return RESULT_TEXT; + } + break; + default: + switch (space) { + case SPACE_START: + flowBegin = pos_; + break; + case SPACE_NONE: + case SPACE_SPAN: + break; + case SPACE_BREAK: + pad_.add(flowBegin, flowEnd - flowBegin); + pad_.add(RTL_CONSTASCII_STRINGPARAM(" ")); + flowBegin = pos_; + break; + } + flowEnd = ++pos_; + space = SPACE_NONE; + break; + } + } +} + +int XmlReader::toNamespaceId(NamespaceIris::size_type pos) { + OSL_ASSERT(pos <= INT_MAX); + return static_cast< int >(pos); +} + +} -- cgit v1.2.3 From 9297efd2835ce6a46918ff6f603e4da95b4c4a12 Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 10 Sep 2010 13:09:39 +0200 Subject: sb129: #i113189# support XML-based services.rdb in com.sun.star.registry.SimpleRegistry --- stoc/prj/build.lst | 2 +- stoc/source/simpleregistry/makefile.mk | 3 +- stoc/source/simpleregistry/simpleregistry.cxx | 51 +- stoc/source/simpleregistry/textualservices.cxx | 1224 ++++++++++++++++++++++++ stoc/source/simpleregistry/textualservices.hxx | 67 ++ stoc/util/makefile.mk | 3 +- 6 files changed, 1343 insertions(+), 7 deletions(-) create mode 100755 stoc/source/simpleregistry/textualservices.cxx create mode 100644 stoc/source/simpleregistry/textualservices.hxx diff --git a/stoc/prj/build.lst b/stoc/prj/build.lst index 1fb7d34ee..b671e0a62 100644 --- a/stoc/prj/build.lst +++ b/stoc/prj/build.lst @@ -1,4 +1,4 @@ -tc stoc : rdbmaker cppuhelper cppu jvmaccess sal salhelper jvmfwk NULL +tc stoc : rdbmaker cppuhelper cppu jvmaccess sal salhelper jvmfwk xmlreader NULL tc stoc usr1 - all tc_mkout NULL tc stoc\inc nmake - all tc_inc NULL tc stoc\source\defaultregistry nmake - all tc_defr tc_boot tc_inc NULL diff --git a/stoc/source/simpleregistry/makefile.mk b/stoc/source/simpleregistry/makefile.mk index 510e7b466..bc0ddf7cc 100644 --- a/stoc/source/simpleregistry/makefile.mk +++ b/stoc/source/simpleregistry/makefile.mk @@ -39,7 +39,8 @@ UNOUCROUT=$(OUT)$/inc$/bootstrap # ------------------------------------------------------------------ SLOFILES= \ - $(SLO)$/simpleregistry.obj + $(SLO)/simpleregistry.obj \ + $(SLO)/textualservices.obj # --- Targets ------------------------------------------------------ diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx index 5a7c6f9cd..9c6b71bc6 100755 --- a/stoc/source/simpleregistry/simpleregistry.cxx +++ b/stoc/source/simpleregistry/simpleregistry.cxx @@ -29,6 +29,7 @@ #include "sal/config.h" #include +#include #include #include "com/sun/star/lang/XServiceInfo.hpp" @@ -61,6 +62,8 @@ #include "bootstrapservices.hxx" +#include "textualservices.hxx" + extern rtl_StandardModuleCount g_moduleCount; namespace { @@ -121,6 +124,7 @@ private: { return stoc_bootstrap::simreg_getSupportedServiceNames(); } Registry registry_; + std::auto_ptr< stoc::simpleregistry::TextualServices > textual_; }; class Key: public cppu::WeakImplHelper1< css::registry::XRegistryKey > { @@ -1128,7 +1132,7 @@ rtl::OUString Key::getResolvedName(rtl::OUString const & aKeyName) rtl::OUString SimpleRegistry::getURL() throw (css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); - return registry_.getName(); + return textual_.get() == 0 ? registry_.getName() : textual_->getUri(); } void SimpleRegistry::open( @@ -1136,13 +1140,33 @@ void SimpleRegistry::open( throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); + if (textual_.get() != 0) { + throw css::registry::InvalidRegistryException( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.open(")) + + rURL + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "): instance already open"))), + static_cast< OWeakObject * >(this)); + } RegError err = (rURL.getLength() == 0 && bCreate) ? REG_REGISTRY_NOT_EXISTS : registry_.open(rURL, bReadOnly ? REG_READONLY : REG_READWRITE); if (err == REG_REGISTRY_NOT_EXISTS && bCreate) { err = registry_.create(rURL); } - if (err != REG_NO_ERROR) { + switch (err) { + case REG_NO_ERROR: + break; + case REG_INVALID_REGISTRY: + if (bReadOnly && !bCreate) { + textual_.reset(new stoc::simpleregistry::TextualServices(rURL)); + break; + } + // fall through + default: throw css::registry::InvalidRegistryException( (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( @@ -1158,13 +1182,17 @@ void SimpleRegistry::open( sal_Bool SimpleRegistry::isValid() throw (css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); - return registry_.isValid(); + return textual_.get() != 0 || registry_.isValid(); } void SimpleRegistry::close() throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); + if (textual_.get() != 0) { + textual_.reset(); + return; + } RegError err = registry_.close(); if (err != REG_NO_ERROR) { throw css::registry::InvalidRegistryException( @@ -1181,6 +1209,10 @@ void SimpleRegistry::destroy() throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); + if (textual_.get() != 0) { + textual_.reset(); + return; + } RegError err = registry_.destroy(rtl::OUString()); if (err != REG_NO_ERROR) { throw css::registry::InvalidRegistryException( @@ -1197,6 +1229,9 @@ css::uno::Reference< css::registry::XRegistryKey > SimpleRegistry::getRootKey() throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); + if (textual_.get() != 0) { + return textual_->getRootKey(); + } RegistryKey root; RegError err = registry_.openRootKey(root); if (err != REG_NO_ERROR) { @@ -1215,7 +1250,7 @@ sal_Bool SimpleRegistry::isReadOnly() throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); - return registry_.isReadOnly(); + return textual_.get() != 0 || registry_.isReadOnly(); } void SimpleRegistry::mergeKey( @@ -1225,6 +1260,14 @@ void SimpleRegistry::mergeKey( css::registry::MergeConflictException, css::uno::RuntimeException) { osl::MutexGuard guard(mutex_); + if (textual_.get() != 0) { + throw css::uno::RuntimeException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry.mergeKey: not" + " supported for textual representation")), + static_cast< cppu::OWeakObject * >(this)); + } RegistryKey root; RegError err = registry_.openRootKey(root); if (err == REG_NO_ERROR) { diff --git a/stoc/source/simpleregistry/textualservices.cxx b/stoc/source/simpleregistry/textualservices.cxx new file mode 100755 index 000000000..11196b76a --- /dev/null +++ b/stoc/source/simpleregistry/textualservices.cxx @@ -0,0 +1,1224 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#include "precompiled_stoc.hxx" +#include "sal/config.h" + +#include +#include + +#include "boost/noncopyable.hpp" +#include "com/sun/star/container/NoSuchElementException.hpp" +#include "com/sun/star/registry/InvalidRegistryException.hpp" +#include "com/sun/star/registry/XRegistryKey.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "com/sun/star/uno/XInterface.hpp" +#include "cppuhelper/implbase1.hxx" +#include "osl/diagnose.h" +#include "rtl/ref.hxx" +#include "rtl/string.h" +#include "rtl/ustrbuf.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "salhelper/simplereferenceobject.hxx" +#include "xmlreader/span.hxx" +#include "xmlreader/xmlreader.hxx" + +#include "textualservices.hxx" + +namespace stoc { namespace simpleregistry { + +namespace { + +namespace css = com::sun::star; + +struct Implementation { + rtl::OUString uri; + rtl::OUString loader; + std::vector< rtl::OUString > services; + std::vector< rtl::OUString > singletons; +}; + +typedef std::map< rtl::OUString, Implementation > Implementations; + +struct Service { + std::vector< rtl::OUString > implementations; +}; + +typedef std::map< rtl::OUString, Service > Services; + +struct Singleton { + rtl::OUString service; + std::vector< rtl::OUString > implementations; +}; + +typedef std::map< rtl::OUString, Singleton > Singletons; + +} + +class Data: public salhelper::SimpleReferenceObject, private boost::noncopyable +{ +public: + Implementations implementations; + Services services; + Singletons singletons; +}; + +namespace { + +class Parser: private boost::noncopyable { +public: + Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data); + +private: + void handleComponent(); + + void handleImplementation(); + + void handleService(); + + void handleSingleton(); + + rtl::OUString getNameAttribute(); + + xmlreader::XmlReader reader_; + rtl::Reference< Data > data_; + rtl::OUString attrUri_; + rtl::OUString attrLoader_; + rtl::OUString attrImplementation_; +}; + +Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): + reader_(uri), data_(data) +{ + OSL_ASSERT(data.is()); + int ucNsId = reader_.registerNamespaceIri( + xmlreader::Span( + RTL_CONSTASCII_STRINGPARAM( + "http://openoffice.org/2010/uno-components"))); + enum State { + STATE_BEGIN, STATE_END, STATE_COMPONENTS, STATE_COMPONENT_INITIAL, + STATE_COMPONENT, STATE_IMPLEMENTATION_INITIAL, + STATE_IMPLEMENTATION_SERVICE, STATE_IMPLEMENTATION_SINGLETON, + STATE_SERVICE, STATE_SINGLETON }; + for (State state = STATE_BEGIN;;) { + xmlreader::Span name; + int nsId; + xmlreader::XmlReader::Result res = reader_.nextItem( + xmlreader::XmlReader::TEXT_NONE, &name, &nsId); + switch (state) { + case STATE_BEGIN: + if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + name.equals(RTL_CONSTASCII_STRINGPARAM("components"))) + { + state = STATE_COMPONENTS; + break; + } + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": unexpected item in outer level"))), + css::uno::Reference< css::uno::XInterface >()); + case STATE_END: + if (res == xmlreader::XmlReader::RESULT_DONE) { + return; + } + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": unexpected item in outer level"))), + css::uno::Reference< css::uno::XInterface >()); + case STATE_COMPONENTS: + if (res == xmlreader::XmlReader::RESULT_END) { + state = STATE_END; + break; + } + if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + name.equals(RTL_CONSTASCII_STRINGPARAM("component"))) + { + handleComponent(); + state = STATE_COMPONENT_INITIAL; + break; + } + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": unexpected item in "))), + css::uno::Reference< css::uno::XInterface >()); + case STATE_COMPONENT: + if (res == xmlreader::XmlReader::RESULT_END) { + state = STATE_COMPONENTS; + break; + } + // fall through + case STATE_COMPONENT_INITIAL: + if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + name.equals(RTL_CONSTASCII_STRINGPARAM("implementation"))) + { + handleImplementation(); + state = STATE_IMPLEMENTATION_INITIAL; + break; + } + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": unexpected item in "))), + css::uno::Reference< css::uno::XInterface >()); + case STATE_IMPLEMENTATION_SERVICE: + case STATE_IMPLEMENTATION_SINGLETON: + if (res == xmlreader::XmlReader::RESULT_END) { + state = STATE_COMPONENT; + break; + } + if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + name.equals(RTL_CONSTASCII_STRINGPARAM("singleton"))) + { + handleSingleton(); + state = STATE_SINGLETON; + break; + } + // fall through + case STATE_IMPLEMENTATION_INITIAL: + if (state != STATE_IMPLEMENTATION_SINGLETON && + res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + name.equals(RTL_CONSTASCII_STRINGPARAM("service"))) + { + handleService(); + state = STATE_SERVICE; + break; + } + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": unexpected item in "))), + css::uno::Reference< css::uno::XInterface >()); + case STATE_SERVICE: + if (res == xmlreader::XmlReader::RESULT_END) { + state = STATE_IMPLEMENTATION_SERVICE; + break; + } + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": unexpected item in "))), + css::uno::Reference< css::uno::XInterface >()); + case STATE_SINGLETON: + if (res == xmlreader::XmlReader::RESULT_END) { + state = STATE_IMPLEMENTATION_SINGLETON; + break; + } + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": unexpected item in "))), + css::uno::Reference< css::uno::XInterface >()); + } + } +} + +void Parser::handleComponent() { + attrUri_ = rtl::OUString(); + attrLoader_ = rtl::OUString(); + xmlreader::Span name; + int nsId; + while (reader_.nextAttribute(&nsId, &name)) { + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && + name.equals(RTL_CONSTASCII_STRINGPARAM("uri"))) + { + if (attrUri_.getLength() != 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": has multiple \"uri\" attributes"))), + css::uno::Reference< css::uno::XInterface >()); + } + attrUri_ = reader_.getAttributeValue(false).convertFromUtf8(); + if (attrUri_.getLength() == 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": has empty \"uri\" attribute"))), + css::uno::Reference< css::uno::XInterface >()); + } + } else if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && + name.equals(RTL_CONSTASCII_STRINGPARAM("loader"))) + { + if (attrLoader_.getLength() != 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": has multiple \"loader\"" + " attributes"))), + css::uno::Reference< css::uno::XInterface >()); + } + attrLoader_ = reader_.getAttributeValue(false).convertFromUtf8(); + if (attrLoader_.getLength() == 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": has empty \"loader\" attribute"))), + css::uno::Reference< css::uno::XInterface >()); + } + } else { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": expected attribute \"uri\" or" + " \"loader\""))), + css::uno::Reference< css::uno::XInterface >()); + } + } + if (attrUri_.getLength() == 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": is missing \"uri\" attribute"))), + css::uno::Reference< css::uno::XInterface >()); + } + if (attrLoader_.getLength() == 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": is missing \"loader\" attribute"))), + css::uno::Reference< css::uno::XInterface >()); + } +} + +void Parser::handleImplementation() { + attrImplementation_ = getNameAttribute(); + if (data_->implementations.find(attrImplementation_) != + data_->implementations.end()) + { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": duplicate "))), + css::uno::Reference< css::uno::XInterface >()); + } + data_->implementations[attrImplementation_].uri = attrUri_; + data_->implementations[attrImplementation_].loader = attrLoader_; +} + +void Parser::handleService() { + rtl::OUString name = getNameAttribute(); + data_->implementations[attrImplementation_].services.push_back(name); + data_->services[name].implementations.push_back(attrImplementation_); +} + +void Parser::handleSingleton() { + rtl::OUString name = getNameAttribute(); + data_->implementations[attrImplementation_].singletons.push_back(name); + data_->singletons[name].service = + data_->implementations[attrImplementation_].services[0]; + data_->singletons[name].implementations.push_back(attrImplementation_); +} + +rtl::OUString Parser::getNameAttribute() { + rtl::OUString attrName; + xmlreader::Span name; + int nsId; + while (reader_.nextAttribute(&nsId, &name)) { + if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && + name.equals(RTL_CONSTASCII_STRINGPARAM("name"))) + { + if (attrName.getLength() != 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": element has multiple \"name\" attributes"))), + css::uno::Reference< css::uno::XInterface >()); + } + attrName = reader_.getAttributeValue(false).convertFromUtf8(); + if (attrName.getLength() == 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": element has empty \"name\" attribute"))), + css::uno::Reference< css::uno::XInterface >()); + } + } else { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": expected element attribute \"name\""))), + css::uno::Reference< css::uno::XInterface >()); + } + } + if (attrName.getLength() == 0) { + throw css::registry::InvalidRegistryException( + (reader_.getUrl() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + ": element is missing \"name\" attribute"))), + css::uno::Reference< css::uno::XInterface >()); + } + return attrName; +} + +rtl::OUString pathToString(std::vector< rtl::OUString > const & path) { + rtl::OUStringBuffer buf; + for (std::vector< rtl::OUString >::const_iterator i(path.begin()); + i != path.end(); ++i) + { + buf.append(sal_Unicode('/')); + buf.append(*i); + } + if (buf.getLength() == 0) { + buf.append(sal_Unicode('/')); + } + return buf.makeStringAndClear(); +} + +class Key: public cppu::WeakImplHelper1< css::registry::XRegistryKey > { +public: + Key( + rtl::Reference< Data > const & data, + std::vector< rtl::OUString > const & path): + data_(data), path_(path) { OSL_ASSERT(data.is()); + } + +private: + /* + / + IMPLEMENTATIONS + + UNO + LOCATION utf-8 + ACTIVATOR utf-8 + SERVICES + + ... + SINGLETONS + utf-16 + ... + ... + SERVICES + utf-8-list + ... + SINGLETONS + utf-16 + REGISTERED_BY utf-8-list + ... + */ + enum State { + STATE_ROOT, STATE_IMPLEMENTATIONS, STATE_IMPLEMENTATION, STATE_UNO, + STATE_LOCATION, STATE_ACTIVATOR, STATE_IMPLEMENTATION_SERVICES, + STATE_IMPLEMENTATION_SERVICE, STATE_IMPLEMENTATION_SINGLETONS, + STATE_IMPLEMENTATION_SINGLETON, STATE_SERVICES, STATE_SERVICE, + STATE_SINGLETONS, STATE_SINGLETON, STATE_REGISTEREDBY }; + + virtual rtl::OUString SAL_CALL getKeyName() + throw (css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isReadOnly() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isValid() throw(css::uno::RuntimeException); + + virtual css::registry::RegistryKeyType SAL_CALL getKeyType( + rtl::OUString const & rKeyName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::registry::RegistryValueType SAL_CALL getValueType() throw( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL getLongValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setLongValue(sal_Int32 value) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< sal_Int32 > SAL_CALL getLongListValue() throw( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setLongListValue( + com::sun::star::uno::Sequence< sal_Int32 > const & seqValue) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getAsciiValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setAsciiValue(rtl::OUString const & value) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getAsciiListValue() + throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setAsciiListValue( + css::uno::Sequence< rtl::OUString > const & seqValue) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getStringValue() throw( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setStringValue(rtl::OUString const & value) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getStringListValue() + throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setStringListValue( + css::uno::Sequence< rtl::OUString > const & seqValue) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getBinaryValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException); + + virtual void SAL_CALL setBinaryValue( + css::uno::Sequence< sal_Int8 > const & value) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL openKey( + rtl::OUString const & aKeyName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual css::uno::Reference< css::registry::XRegistryKey > SAL_CALL + createKey(rtl::OUString const & aKeyName) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual void SAL_CALL closeKey() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual void SAL_CALL deleteKey(rtl::OUString const & rKeyName) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual + css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > + SAL_CALL openKeys() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual css::uno::Sequence< rtl::OUString > SAL_CALL getKeyNames() throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL createLink( + rtl::OUString const & aLinkName, rtl::OUString const & aLinkTarget) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual void SAL_CALL deleteLink(rtl::OUString const & rLinkName) throw ( + css::registry::InvalidRegistryException, css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getLinkTarget( + rtl::OUString const & rLinkName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + virtual rtl::OUString SAL_CALL getResolvedName( + rtl::OUString const & aKeyName) + throw ( + css::registry::InvalidRegistryException, + css::uno::RuntimeException); + + bool find( + rtl::OUString const & relative, std::vector< rtl::OUString > * path, + State * state, css::registry::RegistryValueType * type) const; + + css::uno::Sequence< rtl::OUString > getChildren(); + + rtl::Reference< Data > data_; + std::vector< rtl::OUString > path_; +}; + +rtl::OUString Key::getKeyName() throw (css::uno::RuntimeException) { + return pathToString(path_); +} + +sal_Bool Key::isReadOnly() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + return true; +} + +sal_Bool Key::isValid() throw(css::uno::RuntimeException) { + return true; +} + +css::registry::RegistryKeyType Key::getKeyType(rtl::OUString const & rKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + if (!find(rtl::OUString(), 0, 0, 0)) { + throw css::registry::InvalidRegistryException( + (rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("unknown key ")) + + rKeyName), + static_cast< cppu::OWeakObject * >(this)); + } + return css::registry::RegistryKeyType_KEY; +} + +css::registry::RegistryValueType Key::getValueType() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + css::registry::RegistryValueType type = + css::registry::RegistryValueType_NOT_DEFINED; + OSL_VERIFY(find(rtl::OUString(), 0, 0, &type)); + return type; +} + +sal_Int32 Key::getLongValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) +{ + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getLongValue not supported")), + static_cast< OWeakObject * >(this)); +} + +void Key::setLongValue(sal_Int32) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " setLongValue not supported")), + static_cast< OWeakObject * >(this)); +} + +css::uno::Sequence< sal_Int32 > Key::getLongListValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) +{ + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getLongListValue not supported")), + static_cast< OWeakObject * >(this)); +} + +void Key::setLongListValue(css::uno::Sequence< sal_Int32 > const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " setLongListValue not supported")), + static_cast< OWeakObject * >(this)); +} + +rtl::OUString Key::getAsciiValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) +{ + State state = STATE_ROOT; + OSL_VERIFY(find(rtl::OUString(), 0, &state, 0)); + switch (state) { + case STATE_LOCATION: + return data_->implementations[path_[1]].uri; + case STATE_ACTIVATOR: + return data_->implementations[path_[1]].loader; + default: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getAsciiValue: wrong type")), + static_cast< OWeakObject * >(this)); + } +} + +void Key::setAsciiValue(rtl::OUString const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " setAsciiValue not supported")), + static_cast< OWeakObject * >(this)); +} + +css::uno::Sequence< rtl::OUString > Key::getAsciiListValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) +{ + State state = STATE_ROOT; + OSL_VERIFY(find(rtl::OUString(), 0, &state, 0)); + std::vector< rtl::OUString > const * list; + switch (state) { + case STATE_SERVICE: + list = &data_->services[path_[1]].implementations; + break; + case STATE_REGISTEREDBY: + list = &data_->singletons[path_[1]].implementations; + break; + default: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getAsciiListValue: wrong type")), + static_cast< OWeakObject * >(this)); + } + if (list->size() > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getAsciiListValue: too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > seq( + static_cast< sal_Int32 >(list->size())); + sal_Int32 i = 0; + for (std::vector< rtl::OUString >::const_iterator j(list->begin()); + j != list->end(); ++j) + { + seq[i++] = *j; + } + return seq; +} + +void Key::setAsciiListValue(css::uno::Sequence< rtl::OUString > const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " setAsciiListValue not supported")), + static_cast< OWeakObject * >(this)); +} + +rtl::OUString Key::getStringValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) +{ + State state = STATE_ROOT; + OSL_VERIFY(find(rtl::OUString(), 0, &state, 0)); + switch (state) { + case STATE_IMPLEMENTATION_SINGLETON: + return data_->implementations[path_[1]].services[0]; + case STATE_SINGLETON: + return data_->singletons[path_[1]].service; + default: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getStringValue: wrong type")), + static_cast< OWeakObject * >(this)); + } +} + +void Key::setStringValue(rtl::OUString const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " setStringValue not supported")), + static_cast< OWeakObject * >(this)); +} + +css::uno::Sequence< rtl::OUString > Key::getStringListValue() throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) +{ + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getStringListValue not supported")), + static_cast< OWeakObject * >(this)); +} + +void Key::setStringListValue(css::uno::Sequence< rtl::OUString > const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " setStringListValue not supported")), + static_cast< OWeakObject * >(this)); +} + +css::uno::Sequence< sal_Int8 > Key::getBinaryValue() + throw ( + css::registry::InvalidRegistryException, + css::registry::InvalidValueException, css::uno::RuntimeException) +{ + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getBinarValue not supported")), + static_cast< OWeakObject * >(this)); +} + +void Key::setBinaryValue(css::uno::Sequence< sal_Int8 > const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " setBinaryValue not supported")), + static_cast< OWeakObject * >(this)); +} + +css::uno::Reference< css::registry::XRegistryKey > Key::openKey( + rtl::OUString const & aKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + std::vector< rtl::OUString > path; + if (!find(aKeyName, &path, 0, 0)) { + return css::uno::Reference< css::registry::XRegistryKey >(); + } + return new Key(data_, path); +} + +css::uno::Reference< css::registry::XRegistryKey > Key::createKey( + rtl::OUString const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " createKey not supported")), + static_cast< OWeakObject * >(this)); +} + +void Key::closeKey() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{} + +void Key::deleteKey(rtl::OUString const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " deleteKey not supported")), + static_cast< OWeakObject * >(this)); +} + +css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > +Key::openKeys() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + css::uno::Sequence< rtl::OUString > names(getChildren()); + css::uno::Sequence< css::uno::Reference< css::registry::XRegistryKey > > + keys(names.getLength()); + for (sal_Int32 i = 0; i < keys.getLength(); ++i) { + keys[i] = openKey(names[i]); + OSL_ASSERT(keys[i].is()); + } + return keys; +} + +css::uno::Sequence< rtl::OUString > Key::getKeyNames() + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + css::uno::Sequence< rtl::OUString > names(getChildren()); + rtl::OUString prefix(pathToString(path_)); + prefix += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/")); + for (sal_Int32 i = 0; i < names.getLength(); ++i) { + names[i] = prefix + names[i]; + } + return names; +} + +sal_Bool Key::createLink(rtl::OUString const &, rtl::OUString const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " createLink not supported")), + static_cast< OWeakObject * >(this)); +} + +void Key::deleteLink(rtl::OUString const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " deleteLink not supported")), + static_cast< OWeakObject * >(this)); +} + +rtl::OUString Key::getLinkTarget(rtl::OUString const &) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + throw css::registry::InvalidRegistryException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getLinkTarget not supported")), + static_cast< OWeakObject * >(this)); +} + +rtl::OUString Key::getResolvedName(rtl::OUString const & aKeyName) + throw (css::registry::InvalidRegistryException, css::uno::RuntimeException) +{ + std::vector< rtl::OUString > path; + find(aKeyName, &path, 0, 0); + return pathToString(path); +} + +bool Key::find( + rtl::OUString const & relative, std::vector< rtl::OUString > * path, + State * state, css::registry::RegistryValueType * type) const +{ + std::vector< rtl::OUString > p(path_); + sal_Int32 i = 0; + do { + rtl::OUString seg(relative.getToken(0, '/', i)); + if (seg.getLength() != 0) { + p.push_back(seg); + } + } while (i >= 0); + if (path != 0) { + *path = p; + } + std::size_t const MAX_TRANSITIONS = 4; + struct StateInfo { + css::registry::RegistryValueType type; + std::size_t count; + struct { char const * segment; State state; } + transitions[MAX_TRANSITIONS]; + }; + static StateInfo const info[] = { + // STATE_ROOT: + { css::registry::RegistryValueType_NOT_DEFINED, 3, + { { "IMPLEMENTATIONS", STATE_IMPLEMENTATIONS }, + { "SERVICES", STATE_SERVICES }, + { "SINGLETONS", STATE_SINGLETONS } } }, + // STATE_IMPLEMENTATIONS: + { css::registry::RegistryValueType_NOT_DEFINED, 1, + { { 0, STATE_IMPLEMENTATION } } }, + // STATE_IMPLEMENTATION: + { css::registry::RegistryValueType_NOT_DEFINED, 1, + { { "UNO", STATE_UNO } } }, + // STATE_UNO: + { css::registry::RegistryValueType_NOT_DEFINED, 4, + { { "LOCATION", STATE_LOCATION }, + { "ACTIVATOR", STATE_ACTIVATOR }, + { "SERVICES", STATE_IMPLEMENTATION_SERVICES }, + { "SINGLETONS", STATE_IMPLEMENTATION_SINGLETONS } } }, + // STATE_LOCATION: + { css::registry::RegistryValueType_ASCII, 0, {} }, + // STATE_ACTIVATOR: + { css::registry::RegistryValueType_ASCII, 0, {} }, + // STATE_IMPLEMENTATION_SERVICES: + { css::registry::RegistryValueType_NOT_DEFINED, 1, + { { 0, STATE_IMPLEMENTATION_SERVICE } } }, + // STATE_IMPLEMENTATION_SERVICE: + { css::registry::RegistryValueType_NOT_DEFINED, 0, {} }, + // STATE_IMPLEMENTATION_SINGLETONS: + { css::registry::RegistryValueType_NOT_DEFINED, 1, + { { 0, STATE_IMPLEMENTATION_SINGLETON } } }, + // STATE_IMPLEMENTATION_SINGLETON: + { css::registry::RegistryValueType_STRING, 0, {} }, + // STATE_SERVICES: + { css::registry::RegistryValueType_NOT_DEFINED, 1, + { { 0, STATE_SERVICE } } }, + // STATE_SERVICE: + { css::registry::RegistryValueType_ASCIILIST, 0, {} }, + // STATE_SINGLETONS: + { css::registry::RegistryValueType_NOT_DEFINED, 1, + { { 0, STATE_SINGLETON } } }, + // STATE_SINGLETON: + { css::registry::RegistryValueType_STRING, 1, + { { "REGISTERED_BY", STATE_REGISTEREDBY } } }, + // STATE_REGISTEREDBY: + { css::registry::RegistryValueType_ASCIILIST, 0, {} } }; + State s = STATE_ROOT; + for (std::vector< rtl::OUString >::iterator j(p.begin()); j != p.end(); ++j) + { + bool found = false; + for (std::size_t k = 0; k < info[s].count; ++k) { + if (info[s].transitions[k].segment == 0) { + switch (info[s].transitions[k].state) { + case STATE_IMPLEMENTATION: + found = data_->implementations.find(*j) != + data_->implementations.end(); + break; + case STATE_IMPLEMENTATION_SERVICE: + case STATE_IMPLEMENTATION_SINGLETON: + found = true; //TODO + break; + case STATE_SERVICE: + found = data_->services.find(*j) != data_->services.end(); + break; + case STATE_SINGLETON: + found = data_->singletons.find(*j) != + data_->singletons.end(); + break; + default: + std::abort(); // this cannot happen + } + } else { + found = j->equalsAscii(info[s].transitions[k].segment); + } + if (found) { + s = info[s].transitions[k].state; + break; + } + } + if (!found) { + return false; + } + } + if (state != 0) { + *state = s; + } + if (type != 0) { + *type = info[s].type; + } + return true; +} + +css::uno::Sequence< rtl::OUString > Key::getChildren() { + State state = STATE_ROOT; + OSL_VERIFY(find(rtl::OUString(), 0, &state, 0)); + switch (state) { + default: + std::abort(); // this cannot happen + // pseudo-fall-through to avoid warnings on MSC + case STATE_ROOT: + { + css::uno::Sequence< rtl::OUString > seq(3); + seq[0] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("IMPLEMENTATIONS")); + seq[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SERVICES")); + seq[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SINGLETONS")); + return seq; + } + case STATE_IMPLEMENTATIONS: + { + if (data_->implementations.size() > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual" + " services key openKeys: too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > seq( + static_cast< sal_Int32 >(data_->implementations.size())); + sal_Int32 i = 0; + for (Implementations::iterator j(data_->implementations.begin()); + j != data_->implementations.end(); ++j) + { + seq[i++] = j->first; + } + return seq; + } + case STATE_UNO: + { + css::uno::Sequence< rtl::OUString > seq(4); + seq[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LOCATION")); + seq[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ACTIVATOR")); + seq[2] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SERVICES")); + seq[3] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SINGLETONS")); + return seq; + } + case STATE_LOCATION: + case STATE_ACTIVATOR: + case STATE_IMPLEMENTATION_SERVICE: + case STATE_IMPLEMENTATION_SINGLETON: + case STATE_SERVICE: + case STATE_REGISTEREDBY: + return css::uno::Sequence< rtl::OUString >(); + case STATE_IMPLEMENTATION_SERVICES: + { + if (data_->implementations[path_[1]].services.size() > + SAL_MAX_INT32) + { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual" + " services key openKeys: too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > seq( + static_cast< sal_Int32 >( + data_->implementations[path_[1]].services.size())); + sal_Int32 i = 0; + for (std::vector< rtl::OUString >::iterator j( + data_->implementations[path_[1]].services.begin()); + j != data_->implementations[path_[1]].services.end(); ++j) + { + seq[i++] = *j; + } + return seq; + } + case STATE_IMPLEMENTATION_SINGLETONS: + { + if (data_->implementations[path_[1]].singletons.size() > + SAL_MAX_INT32) + { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual" + " services key openKeys: too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > seq( + static_cast< sal_Int32 >( + data_->implementations[path_[1]].singletons.size())); + sal_Int32 i = 0; + for (std::vector< rtl::OUString >::iterator j( + data_->implementations[path_[1]].singletons.begin()); + j != data_->implementations[path_[1]].singletons.end(); ++j) + { + seq[i++] = *j; + } + return seq; + } + case STATE_SERVICES: + { + if (data_->services.size() > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual" + " services key openKeys: too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > seq( + static_cast< sal_Int32 >(data_->services.size())); + sal_Int32 i = 0; + for (Services::iterator j(data_->services.begin()); + j != data_->services.end(); ++j) + { + seq[i++] = j->first; + } + return seq; + } + case STATE_SINGLETONS: + { + if (data_->singletons.size() > SAL_MAX_INT32) { + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual" + " services key openKeys: too large")), + static_cast< OWeakObject * >(this)); + } + css::uno::Sequence< rtl::OUString > seq( + static_cast< sal_Int32 >(data_->singletons.size())); + sal_Int32 i = 0; + for (Singletons::iterator j(data_->singletons.begin()); + j != data_->singletons.end(); ++j) + { + seq[i++] = j->first; + } + return seq; + } + case STATE_SINGLETON: + { + css::uno::Sequence< rtl::OUString > seq(1); + seq[0] = rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("REGISTERED_BY")); + return seq; + } + } +} + +} + +TextualServices::TextualServices(rtl::OUString const & uri): + uri_(uri), data_(new Data) +{ + try { + Parser(uri, data_); + } catch (css::container::NoSuchElementException &) { + throw css::registry::InvalidRegistryException( + (uri + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM(": no such file"))), + css::uno::Reference< css::uno::XInterface >()); + } +} + +TextualServices::~TextualServices() {} + +css::uno::Reference< css::registry::XRegistryKey > TextualServices::getRootKey() +{ + return new Key(data_, std::vector< rtl::OUString >()); +} + +} } diff --git a/stoc/source/simpleregistry/textualservices.hxx b/stoc/source/simpleregistry/textualservices.hxx new file mode 100644 index 000000000..0261e2604 --- /dev/null +++ b/stoc/source/simpleregistry/textualservices.hxx @@ -0,0 +1,67 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#ifndef INCLUDED_STOC_SOURCE_SIMPLEREGISTRY_TEXTUALSERVICES_HXX +#define INCLUDED_STOC_SOURCE_SIMPLEREGISTRY_TEXTUALSERVICES_HXX + +#include "sal/config.h" + +#include + +#include "boost/noncopyable.hpp" +#include "com/sun/star/uno/Reference.hxx" +#include "rtl/ref.hxx" +#include "rtl/ustring.hxx" + +namespace com { namespace sun { namespace star { namespace registry { + class XRegistryKey; +} } } } + +namespace stoc { namespace simpleregistry { + +class Data; + +class TextualServices: private boost::noncopyable { +public: + explicit TextualServices(rtl::OUString const & uri); + // throws com::sun::star::registry::InvalidRegistryException + + virtual ~TextualServices(); + + inline rtl::OUString getUri() { return uri_; } + + com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > + getRootKey(); + +private: + rtl::OUString uri_; + rtl::Reference< Data > data_; +}; + +} } + +#endif diff --git a/stoc/util/makefile.mk b/stoc/util/makefile.mk index 4243d4551..54232aa4c 100644 --- a/stoc/util/makefile.mk +++ b/stoc/util/makefile.mk @@ -57,7 +57,8 @@ SHL1STDLIBS= \ $(SALHELPERLIB) \ $(CPPUHELPERLIB) \ $(SALLIB) \ - $(REGLIB) + $(REGLIB) \ + $(XMLREADERLIB) SHL1DEPN= SHL1IMPLIB= i$(TARGET) -- cgit v1.2.3 From 0cff1ed2867962c27db50752adaa41dba6dfc41a Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 10 Sep 2010 13:10:07 +0200 Subject: sb129: #i113189# change UNO components to use passive registration --- cppuhelper/inc/cppuhelper/factory.hxx | 3 + cppuhelper/inc/cppuhelper/implementationentry.hxx | 6 +- cppuhelper/inc/cppuhelper/shlib.hxx | 4 +- cpputools/prj/build.lst | 1 - cpputools/prj/d.lst | 2 - cpputools/source/regcomplazy/makefile.mk | 54 ---- cpputools/source/regcomplazy/regcomplazy.cxx | 282 --------------------- io/prj/d.lst | 5 + io/source/TextInputStream/TextInputStream.cxx | 6 - io/source/TextInputStream/makefile.mk | 8 + io/source/TextInputStream/textinstream.component | 34 +++ io/source/TextOutputStream/TextOutputStream.cxx | 6 - io/source/TextOutputStream/makefile.mk | 8 + io/source/TextOutputStream/textoutstream.component | 34 +++ io/source/acceptor/acceptor.component | 34 +++ io/source/acceptor/acceptor.cxx | 6 - io/source/acceptor/makefile.mk | 8 + io/source/connector/connector.component | 34 +++ io/source/connector/connector.cxx | 6 - io/source/connector/makefile.mk | 8 + io/source/stm/factreg.cxx | 6 - io/source/stm/makefile.mk | 7 + io/source/stm/streams.component | 55 ++++ .../com/sun/star/comp/JavaUNOHelperServices.java | 17 -- javaunohelper/prj/d.lst | 1 + javaunohelper/util/juh.component | 34 +++ javaunohelper/util/makefile.mk | 5 + .../sun/star/comp/bridgefactory/BridgeFactory.java | 12 - jurt/com/sun/star/comp/connections/Acceptor.java | 15 -- jurt/com/sun/star/comp/connections/Connector.java | 15 -- .../comp/connections/ConstantInstanceProvider.java | 14 - .../sun/star/comp/connections/PipedConnection.java | 13 - .../com/sun/star/comp/urlresolver/UrlResolver.java | 14 - .../star/lib/connections/pipe/pipeAcceptor.java | 15 -- .../star/lib/connections/pipe/pipeConnector.java | 15 -- .../lib/connections/socket/socketAcceptor.java | 15 -- .../lib/connections/socket/socketConnector.java | 15 -- pyuno/prj/d.lst | 3 +- pyuno/source/loader/makefile.mk | 34 +-- pyuno/source/loader/pythonloader.component | 34 +++ pyuno/source/loader/pyuno_loader.cxx | 6 - remotebridges/prj/d.lst | 3 + remotebridges/source/bridge/makefile.mk | 8 + remotebridges/source/bridge/remote_bridge.cxx | 6 - remotebridges/source/bridge/remotebridge.component | 36 +++ .../source/dynamicloader/dynamicloader.cxx | 28 -- remotebridges/source/factory/bridgefac.component | 34 +++ remotebridges/source/factory/bridgefactory.cxx | 6 - remotebridges/source/factory/makefile.mk | 7 + remotebridges/source/unourl_resolver/makefile.mk | 8 + .../source/unourl_resolver/unourl_resolver.cxx | 6 - .../source/unourl_resolver/uuresolver.component | 34 +++ stoc/prj/d.lst | 10 + stoc/source/bootstrap/services.cxx | 6 - stoc/source/corereflection/base.hxx | 3 - stoc/source/corereflection/crefl.cxx | 30 --- stoc/source/corereflection/makefile.mk | 7 + stoc/source/corereflection/reflection.component | 35 +++ stoc/source/inspect/introspection.component | 34 +++ stoc/source/inspect/introspection.cxx | 27 -- stoc/source/inspect/makefile.mk | 7 + stoc/source/invocation/invocation.component | 34 +++ stoc/source/invocation/invocation.cxx | 6 - stoc/source/invocation/makefile.mk | 6 + .../source/invocation_adapterfactory/iafactory.cxx | 8 - .../invocation_adapterfactory/invocadapt.component | 34 +++ stoc/source/invocation_adapterfactory/makefile.mk | 8 + stoc/source/javaloader/javaloader.component | 35 +++ stoc/source/javaloader/javaloader.cxx | 6 - stoc/source/javaloader/makefile.mk | 7 + stoc/source/javavm/javavm.component | 35 +++ stoc/source/javavm/javavm.cxx | 37 +-- stoc/source/javavm/makefile.mk | 7 + stoc/source/namingservice/makefile.mk | 7 + stoc/source/namingservice/namingservice.component | 34 +++ stoc/source/namingservice/namingservice.cxx | 6 - stoc/source/proxy_factory/makefile.mk | 8 + stoc/source/proxy_factory/proxyfac.component | 34 +++ stoc/source/proxy_factory/proxyfac.cxx | 7 - stoc/source/stocservices/stocservices.cxx | 6 - stoc/util/bootstrap.component | 66 +++++ stoc/util/makefile.mk | 13 + stoc/util/stocservices.component | 51 ++++ ure/prj/build.lst | 2 +- ure/prj/d.lst | 16 +- ure/source/makefile.mk | 77 +++--- 86 files changed, 978 insertions(+), 801 deletions(-) delete mode 100755 cpputools/source/regcomplazy/makefile.mk delete mode 100755 cpputools/source/regcomplazy/regcomplazy.cxx create mode 100644 io/source/TextInputStream/textinstream.component create mode 100644 io/source/TextOutputStream/textoutstream.component create mode 100644 io/source/acceptor/acceptor.component create mode 100644 io/source/connector/connector.component create mode 100644 io/source/stm/streams.component create mode 100644 javaunohelper/util/juh.component create mode 100644 pyuno/source/loader/pythonloader.component create mode 100644 remotebridges/source/bridge/remotebridge.component create mode 100644 remotebridges/source/factory/bridgefac.component create mode 100644 remotebridges/source/unourl_resolver/uuresolver.component create mode 100644 stoc/source/corereflection/reflection.component create mode 100644 stoc/source/inspect/introspection.component create mode 100644 stoc/source/invocation/invocation.component create mode 100644 stoc/source/invocation_adapterfactory/invocadapt.component create mode 100644 stoc/source/javaloader/javaloader.component create mode 100644 stoc/source/javavm/javavm.component create mode 100644 stoc/source/namingservice/namingservice.component create mode 100644 stoc/source/proxy_factory/proxyfac.component create mode 100644 stoc/util/bootstrap.component create mode 100644 stoc/util/stocservices.component diff --git a/cppuhelper/inc/cppuhelper/factory.hxx b/cppuhelper/inc/cppuhelper/factory.hxx index 4320acb98..1dd04173c 100644 --- a/cppuhelper/inc/cppuhelper/factory.hxx +++ b/cppuhelper/inc/cppuhelper/factory.hxx @@ -87,6 +87,9 @@ typedef void (SAL_CALL * component_getImplementationEnvironmentExtFunc)( typedef const sal_Char * (SAL_CALL * component_getDescriptionFunc)(void); /** Function pointer declaration. + + @obsolete component_writeInfo should no longer be used in new components + Function writes component registry info, at least writing the supported service names. @param pServiceManager diff --git a/cppuhelper/inc/cppuhelper/implementationentry.hxx b/cppuhelper/inc/cppuhelper/implementationentry.hxx index f74493210..e52e658d8 100644 --- a/cppuhelper/inc/cppuhelper/implementationentry.hxx +++ b/cppuhelper/inc/cppuhelper/implementationentry.hxx @@ -72,6 +72,8 @@ struct ImplementationEntry /** Helper function for implementation of the component_writeInfo()-function. + @obsolete component_writeInfo should no longer be used in new components + @param pServiceManager The first parameter passed to component_writeInfo()-function (This is an instance of the service manager, that creates the factory). @param pRegistryKey The second parameter passed to the component_writeInfo()-function. @@ -90,9 +92,9 @@ sal_Bool component_writeInfoHelper( @param pImplName The implementation-name to be instantiated ( This is the first parameter passed to the component_getFactory - @param pServiceManager The first parameter passed to component_writeInfo()-function + @param pServiceManager The second parameter passed to component_getFactory()-function (This is a of the service manager, that creates the factory). - @param pRegistryKey The second parameter passed to the component_writeInfo()-function. + @param pRegistryKey The third parameter passed to the component_getFactory()-function. This is a reference to the registry key, where the implementation data has been written to. @param entries Each element of the entries-array must contains a function pointer diff --git a/cppuhelper/inc/cppuhelper/shlib.hxx b/cppuhelper/inc/cppuhelper/shlib.hxx index 044b30758..42299fa08 100644 --- a/cppuhelper/inc/cppuhelper/shlib.hxx +++ b/cppuhelper/inc/cppuhelper/shlib.hxx @@ -64,7 +64,9 @@ SAL_CALL loadSharedLibComponentFactory( (e.g. xxx.dll). You can give parameter rPath to force lookup of the library in a specific directory. The resulting path of the library will be checked against environment variable CPLD_ACCESSPATH if set. - + + @obsolete component_writeInfo should no longer be used in new components + @param rLibName name of the library @param rPath optional path @param xMgr service manager to be provided to the component diff --git a/cpputools/prj/build.lst b/cpputools/prj/build.lst index 7cd9053c5..ca820871b 100644 --- a/cpputools/prj/build.lst +++ b/cpputools/prj/build.lst @@ -2,7 +2,6 @@ pt cpputools : cppuhelper offuh LIBXML2:libxml2 NULL pt cpputools usr1 - all pt_mkout NULL pt cpputools\prj get - all pt_prj NULL pt cpputools\source\registercomponent nmake - all pt_regcomp NULL -pt cpputools\source\regcomplazy nmake - all pt_regcomplazy NULL pt cpputools\source\regsingleton nmake - all pt_regsingleton NULL pt cpputools\source\unoexe nmake - all pt_unoexe NULL pt cpputools\source\sp2bv nmake - all pt_sp2bv NULL diff --git a/cpputools/prj/d.lst b/cpputools/prj/d.lst index fa029cc4d..14de5e78a 100644 --- a/cpputools/prj/d.lst +++ b/cpputools/prj/d.lst @@ -1,8 +1,6 @@ ..\%__SRC%\bin\regcomp.exe %_DEST%\bin%_EXT%\regcomp.exe ..\%__SRC%\bin\regcomp %_DEST%\bin%_EXT%\regcomp ..\%__SRC%\bin\regcomp %_DEST%\bin%_EXT%\regcomp.bin -..\%__SRC%\bin\regcomplazy.exe %_DEST%\bin%_EXT%\regcomplazy.exe -..\%__SRC%\bin\regcomplazy %_DEST%\bin%_EXT%\regcomplazy ..\%__SRC%\bin\uno.exe %_DEST%\bin%_EXT%\uno.exe ..\%__SRC%\bin\uno %_DEST%\bin%_EXT%\uno ..\%__SRC%\bin\uno %_DEST%\bin%_EXT%\uno.bin diff --git a/cpputools/source/regcomplazy/makefile.mk b/cpputools/source/regcomplazy/makefile.mk deleted file mode 100755 index 0a4fe8477..000000000 --- a/cpputools/source/regcomplazy/makefile.mk +++ /dev/null @@ -1,54 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME=cpputools -TARGET=regcomplazy -TARGETTYPE=CUI -LIBTARGET=NO - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -DEPOBJFILES= \ - $(OBJ)$/regcomplazy.obj - -APP1TARGET=$(TARGET) -APP1OBJS=$(DEPOBJFILES) - -APP1STDLIBS= \ - $(SALLIB) \ - $(SALHELPERLIB) \ - $(REGLIB) - -.INCLUDE : target.mk - diff --git a/cpputools/source/regcomplazy/regcomplazy.cxx b/cpputools/source/regcomplazy/regcomplazy.cxx deleted file mode 100755 index 00907602f..000000000 --- a/cpputools/source/regcomplazy/regcomplazy.cxx +++ /dev/null @@ -1,282 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include - -#include "sal/main.h" -#include -#include -#include -#include -#include - -#include - -#include - - -#define OUSTR(x) ::rtl::OUString::createFromAscii( x ) -#define OSToOUS(x) ::rtl::OStringToOUString(x, osl_getThreadTextEncoding()) -#define OUSToOS(x) ::rtl::OUStringToOString(x, osl_getThreadTextEncoding()) -using namespace ::rtl; - -typedef ::std::vector< ::rtl::OString > OSVector; - -struct CompDescriptor { - OString sImplementationName; - OString sComponentName; - OString sLoaderName; - OSVector vSupportedServices; -}; - -typedef ::std::vector< CompDescriptor > CDescrVector; - -static void print_options() SAL_THROW( () ) -{ - printf( - "\nusage: regcomplazy [-v]registry_file cmp_descr_file ...\n\n" - "Register a cmponent using a comp description file.\n" - "Option -v prints verbose output on stdout.\n" ); -} - -static bool checkImplValue(RegistryValueList* pValueList, OString sImplName) { - for (sal_uInt32 i=0; i < pValueList->getLength(); i++) { - if (sImplName.equals(pValueList->getElement(i))) - return true; - } - - return false; -} - -//================================================================================================== -SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) -{ - if (argc < 3) - { - print_options(); - return 1; - } - - bool bVerbose = false; - int nPos = 1; - if ('-' == argv[ nPos ][ 0 ] && 'v' == argv[ nPos ][ 1 ]) - { - if ('\0' != argv[ nPos ][ 2 ]) - { - print_options(); - return 1; - } - bVerbose = true; - ++nPos; - } - - OUString sys_path( OUSTR( argv[ nPos ] ) ); - OUString reg_url; - oslFileError rc = osl_getFileURLFromSystemPath( sys_path.pData, ®_url.pData ); - if (osl_File_E_None != rc) - { - if (bVerbose) - fprintf( stderr, "\nERROR: cannot make file url out of %s\n", argv[nPos]); - return 1; - } - - FILE* fDescr = fopen(argv[ ++nPos ], "r"); - OStringBuffer sBuffer(512); - - if ( fDescr) { - size_t totalSize = 0; - size_t readSize = 0; - char pBuffer[513]; - - while ( !feof(fDescr) ) - { - if ( (readSize = fread(pBuffer, 1, 512, fDescr)) > 0 - && !ferror(fDescr) ) { - totalSize += readSize; - if (totalSize >= 512) - sBuffer.ensureCapacity(totalSize * 2); - - sBuffer.append(pBuffer, readSize); - } - } - fclose(fDescr); - fDescr = 0; // just to be sure noone tries to use the file ever after - } - - OString sDescr = sBuffer.makeStringAndClear(); - sal_Int32 nTokenIndex = 0; - - CDescrVector vDescr; - CompDescriptor descr; - bool bFirst = true; - - do { - OString sTmp = sDescr.getToken(0, '\x0A', nTokenIndex); - OString sToken(sTmp); - if (sTmp.pData->buffer[sTmp.getLength()-1] == '\x0D') - sToken = sTmp.copy(0, sTmp.getLength()-1); - if ( sToken.indexOf("[ComponentDescriptor]") >= 0) { - if (bFirst) - bFirst = false; - else - vDescr.push_back(descr); - - descr = CompDescriptor(); - } - else if ( sToken.indexOf("ImplementationName=") >= 0) { - descr.sImplementationName = sToken.copy(19); - } - else if ( sToken.indexOf("ComponentName=") >= 0) { - descr.sComponentName = sToken.copy(14); - } - else if ( sToken.indexOf("LoaderName=") >= 0) { - descr.sLoaderName = sToken.copy(11); - } - else if ( (sToken.indexOf("[SupportedServices]") < 0) && - (sToken.getLength() > 0) && - (sToken.pData->buffer[0] != '[') ) { - descr.vSupportedServices.push_back(sToken); - } - } while (nTokenIndex >= 0 ); - // insert the last descriptor - vDescr.push_back(descr); - - Registry *pReg = new Registry; - - RegistryKey rootKey, key, subKey, serviceKey; - - if (pReg->open(reg_url, REG_READWRITE)) - { - if (pReg->create(reg_url)) - { - if (bVerbose) - fprintf(stderr, "ERROR: open registry \"%s\" failed\n", argv[1]); - return 1; - } - } - if (pReg->openRootKey(rootKey)) { - if (bVerbose) - fprintf(stderr, "ERROR: open root key failed\n"); - return 1; - } - - CDescrVector::const_iterator comp_iter = vDescr.begin(); - do { - OString sImplName = (*comp_iter).sImplementationName; - OUStringBuffer sbImpl; - sbImpl.appendAscii("/IMPLEMENTATIONS/"); - sbImpl.append(OSToOUS(sImplName)); - OUString sImplKeyName = sbImpl.makeStringAndClear(); - - if (rootKey.openKey(sImplKeyName, key) == REG_NO_ERROR) { - if (bVerbose) { - fprintf(stderr, "WARNING: implementation entry for \"%s\" already exists, existing entries are overwritten\n", sImplName.getStr()); - } - } else { - if (rootKey.createKey(sImplKeyName, key)) { - if (bVerbose) { - fprintf(stderr, "ERROR: can't create new implementation entry \"%s\".\n", sImplName.getStr()); - } - return 1; - } - } - - OString sLoaderName = (*comp_iter).sLoaderName; - OUString usKeyName(OUSTR("UNO/ACTIVATOR")); - key.createKey(usKeyName, subKey); - subKey.setValue(OUString(), RG_VALUETYPE_STRING, - (sal_Char*)sLoaderName.getStr(), sLoaderName.getLength()+1); - - OString sCompName = (*comp_iter).sComponentName; - usKeyName = OUSTR("UNO/LOCATION"); - key.createKey(usKeyName, subKey); - subKey.setValue(OUString(), RG_VALUETYPE_STRING, - (sal_Char*)sCompName.getStr(), sCompName.getLength()+1); - - usKeyName = OUSTR("UNO/SERVICES"); - key.createKey(usKeyName, subKey); - - rootKey.createKey(OUSTR("/SERVICES"), serviceKey); - - OSVector::const_iterator serv_iter = ((*comp_iter).vSupportedServices).begin(); - OUString usServiceKeyName; - do { - usServiceKeyName = OSToOUS(*serv_iter); - // write service key in impl section - subKey.createKey(usServiceKeyName, key); - - if (serviceKey.openKey(usServiceKeyName, key) == REG_NO_ERROR) { - RegistryValueList valueList; - serviceKey.getStringListValue(usServiceKeyName, valueList); - if ( checkImplValue(&valueList, sImplName) ) { - serv_iter++; - continue; - } - - sal_uInt32 nServices = valueList.getLength()+1; - sal_Char** pImplList = (sal_Char**)rtl_allocateZeroMemory( - nServices * sizeof(sal_Char*)); - pImplList[0] = (sal_Char*)rtl_allocateZeroMemory( - sImplName.getLength()+1 * sizeof(sal_Char)); - rtl_copyMemory(pImplList[0], (sal_Char*)sImplName.getStr(), - sImplName.getLength()+1); - for (sal_uInt32 i=0; i < valueList.getLength(); i++) { - pImplList[i+1]=valueList.getElement(i); - } - key.setStringListValue(OUString(), pImplList, nServices); - - // free memory - rtl_freeMemory(pImplList[0]); - rtl_freeMemory(pImplList); - - } else { - serviceKey.createKey(usServiceKeyName, key); - - sal_Char* pImplList[1]; - pImplList[0] = (sal_Char*)rtl_allocateZeroMemory( - sImplName.getLength()+1 * sizeof(sal_Char)); - rtl_copyMemory(pImplList[0], (sal_Char*)sImplName.getStr(), - sImplName.getLength()+1); - key.setStringListValue(OUString(), pImplList, 1); - - // free memory - rtl_freeMemory(pImplList[0]); - } - serv_iter++; - } while (serv_iter != (*comp_iter).vSupportedServices.end()); - - comp_iter++; - } while (comp_iter != vDescr.end()); - - key.closeKey(); - subKey.closeKey(); - serviceKey.closeKey(); - rootKey.closeKey(); - pReg->close(); - - return 0; -} diff --git a/io/prj/d.lst b/io/prj/d.lst index 9d19e5f8e..eaadf64db 100644 --- a/io/prj/d.lst +++ b/io/prj/d.lst @@ -5,3 +5,8 @@ ..\source\stm\stm.xml %_DEST%\xml%_EXT%\streams.uno.xml ..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* +..\%__SRC%\misc\acceptor.component %_DEST%\xml%_EXT%\acceptor.component +..\%__SRC%\misc\connector.component %_DEST%\xml%_EXT%\connector.component +..\%__SRC%\misc\streams.component %_DEST%\xml%_EXT%\streams.component +..\%__SRC%\misc\textinstream.component %_DEST%\xml%_EXT%\textinstream.component +..\%__SRC%\misc\textoutstream.component %_DEST%\xml%_EXT%\textoutstream.component diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx index 3fa833139..c7ea60d7d 100644 --- a/io/source/TextInputStream/TextInputStream.cxx +++ b/io/source/TextInputStream/TextInputStream.cxx @@ -521,12 +521,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/io/source/TextInputStream/makefile.mk b/io/source/TextInputStream/makefile.mk index 3c0cd5c57..ea476c57c 100644 --- a/io/source/TextInputStream/makefile.mk +++ b/io/source/TextInputStream/makefile.mk @@ -59,3 +59,11 @@ DEF1NAME= $(SHL1TARGET) .ENDIF # L10N_framework .INCLUDE : target.mk + +ALLTAR : $(MISC)/textinstream.component + +$(MISC)/textinstream.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt textinstream.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt textinstream.component diff --git a/io/source/TextInputStream/textinstream.component b/io/source/TextInputStream/textinstream.component new file mode 100644 index 000000000..6ac7d2a98 --- /dev/null +++ b/io/source/TextInputStream/textinstream.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/io/source/TextOutputStream/TextOutputStream.cxx b/io/source/TextOutputStream/TextOutputStream.cxx index b0a70f55c..3232d43cc 100644 --- a/io/source/TextOutputStream/TextOutputStream.cxx +++ b/io/source/TextOutputStream/TextOutputStream.cxx @@ -319,12 +319,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/io/source/TextOutputStream/makefile.mk b/io/source/TextOutputStream/makefile.mk index ad78178f8..2c9d4eb2e 100644 --- a/io/source/TextOutputStream/makefile.mk +++ b/io/source/TextOutputStream/makefile.mk @@ -60,3 +60,11 @@ DEF1NAME= $(SHL1TARGET) .ENDIF # L10N_framework .INCLUDE : target.mk + +ALLTAR : $(MISC)/textoutstream.component + +$(MISC)/textoutstream.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt textoutstream.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt textoutstream.component diff --git a/io/source/TextOutputStream/textoutstream.component b/io/source/TextOutputStream/textoutstream.component new file mode 100644 index 000000000..afbc50ab8 --- /dev/null +++ b/io/source/TextOutputStream/textoutstream.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/io/source/acceptor/acceptor.component b/io/source/acceptor/acceptor.component new file mode 100644 index 000000000..81e0399b2 --- /dev/null +++ b/io/source/acceptor/acceptor.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/io/source/acceptor/acceptor.cxx b/io/source/acceptor/acceptor.cxx index 9cc2d0ebd..a21b05ddb 100644 --- a/io/source/acceptor/acceptor.cxx +++ b/io/source/acceptor/acceptor.cxx @@ -366,12 +366,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/io/source/acceptor/makefile.mk b/io/source/acceptor/makefile.mk index 3da3fbe18..bbc7ac6d3 100644 --- a/io/source/acceptor/makefile.mk +++ b/io/source/acceptor/makefile.mk @@ -71,3 +71,11 @@ DEF1NAME= $(SHL1TARGET) .ENDIF # L10N_framework .INCLUDE : target.mk + +ALLTAR : $(MISC)/acceptor.component + +$(MISC)/acceptor.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + acceptor.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt acceptor.component diff --git a/io/source/connector/connector.component b/io/source/connector/connector.component new file mode 100644 index 000000000..95fa72aa5 --- /dev/null +++ b/io/source/connector/connector.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/io/source/connector/connector.cxx b/io/source/connector/connector.cxx index a9a69a351..49b6c860b 100644 --- a/io/source/connector/connector.cxx +++ b/io/source/connector/connector.cxx @@ -278,12 +278,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/io/source/connector/makefile.mk b/io/source/connector/makefile.mk index 7f12b850f..e3a67abe6 100644 --- a/io/source/connector/makefile.mk +++ b/io/source/connector/makefile.mk @@ -71,3 +71,11 @@ DEF1NAME= $(SHL1TARGET) .ENDIF # L10N_framework .INCLUDE : target.mk + +ALLTAR : $(MISC)/connector.component + +$(MISC)/connector.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + connector.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt connector.component diff --git a/io/source/stm/factreg.cxx b/io/source/stm/factreg.cxx index 50a2f673b..24c858efa 100644 --- a/io/source/stm/factreg.cxx +++ b/io/source/stm/factreg.cxx @@ -110,12 +110,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/io/source/stm/makefile.mk b/io/source/stm/makefile.mk index a6a163eca..52dd0c492 100644 --- a/io/source/stm/makefile.mk +++ b/io/source/stm/makefile.mk @@ -75,3 +75,10 @@ DEF1NAME= $(SHL1TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/streams.component + +$(MISC)/streams.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + streams.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt streams.component diff --git a/io/source/stm/streams.component b/io/source/stm/streams.component new file mode 100644 index 000000000..76890d360 --- /dev/null +++ b/io/source/stm/streams.component @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java b/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java index 411779faf..7df6497a1 100644 --- a/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java +++ b/javaunohelper/com/sun/star/comp/JavaUNOHelperServices.java @@ -28,7 +28,6 @@ package com.sun.star.comp; import com.sun.star.lib.uno.helper.Factory; import com.sun.star.lang.XSingleComponentFactory; -import com.sun.star.registry.XRegistryKey; import com.sun.star.comp.juhtest.SmoketestCommandEnvironment; @@ -62,20 +61,4 @@ public class JavaUNOHelperServices { return xFactory; } - - /** - * Writes the service information into the given registry key. - * This method is called by the JavaLoader - *

- * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return Factory.writeRegistryServiceInfo(SmoketestCommandEnvironment.class.getName(), - SmoketestCommandEnvironment.getServiceNames(), - regKey); - } } - - diff --git a/javaunohelper/prj/d.lst b/javaunohelper/prj/d.lst index 1fbd9c223..d58290843 100644 --- a/javaunohelper/prj/d.lst +++ b/javaunohelper/prj/d.lst @@ -2,5 +2,6 @@ ..\%__SRC%\bin\juh*.dll %_DEST%\bin%_EXT%\juh*.dll ..\%__SRC%\lib\libjuh*.so %_DEST%\lib%_EXT%\libjuh*.so ..\%__SRC%\lib\libjuh*.dylib %_DEST%\lib%_EXT%\libjuh*.dylib +..\%__SRC%\misc\juh.component %_DEST%\xml%_EXT%\juh.component ..\%__SRC%\bin\juh_src.zip %COMMON_DEST%\bin%_EXT%\juh_src.zip diff --git a/javaunohelper/util/juh.component b/javaunohelper/util/juh.component new file mode 100644 index 000000000..790a2a2b1 --- /dev/null +++ b/javaunohelper/util/juh.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/javaunohelper/util/makefile.mk b/javaunohelper/util/makefile.mk index 22b3a72be..796280eb3 100644 --- a/javaunohelper/util/makefile.mk +++ b/javaunohelper/util/makefile.mk @@ -50,4 +50,9 @@ ZIP1LIST=com -x "*makefile.mk" .INCLUDE : target.mk +ALLTAR : $(MISC)/juh.component +$(MISC)/juh.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + juh.component + $(XSLTPROC) --nonet --stringparam uri '$(COMPONENTPREFIX_URE_JAVA)juh.jar' \ + -o $@ $(SOLARENV)/bin/createcomponent.xslt juh.component diff --git a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java index 89174467a..23516fef0 100644 --- a/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java +++ b/jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java @@ -92,18 +92,6 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ { return xSingleServiceFactory; } - - /** - * Writes the service information into the given registry key. - * This method is called by the JavaLoader - *

- * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(BridgeFactory.class.getName(), __serviceName, regKey); - } /** * Creates a remote bridge and memorizes it under sName. diff --git a/jurt/com/sun/star/comp/connections/Acceptor.java b/jurt/com/sun/star/comp/connections/Acceptor.java index 2539bb528..1b0cf9c6e 100644 --- a/jurt/com/sun/star/comp/connections/Acceptor.java +++ b/jurt/com/sun/star/comp/connections/Acceptor.java @@ -83,21 +83,6 @@ public final class Acceptor implements XAcceptor { : null; } - /** - * Writes the service information into the given registry key. - * - *

This method is called by the JavaLoader.

- * - * @param regKey the registry key. - * @return true if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(Acceptor.class.getName(), - __serviceName, regKey); - } - /** * Constructs a new Acceptor that uses the given service * factory to create a specific XAcceptor. diff --git a/jurt/com/sun/star/comp/connections/Connector.java b/jurt/com/sun/star/comp/connections/Connector.java index 6f0f351e2..3e0c38aed 100644 --- a/jurt/com/sun/star/comp/connections/Connector.java +++ b/jurt/com/sun/star/comp/connections/Connector.java @@ -83,21 +83,6 @@ public class Connector implements XConnector { : null; } - /** - * Writes the service information into the given registry key. - * - *

This method is called by the JavaLoader.

- * - * @param regKey the registry key. - * @return true if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(Connector.class.getName(), - __serviceName, regKey); - } - /** * Constructs a new Connector that uses the given service * factory to create a specific XConnector. diff --git a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java index d3e188f3f..ce64cb95d 100644 --- a/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java +++ b/jurt/com/sun/star/comp/connections/ConstantInstanceProvider.java @@ -84,20 +84,6 @@ public class ConstantInstanceProvider implements XInstanceProvider { return xSingleServiceFactory; } - - /** - * Writes the service information into the given registry key. - * This method is called by the JavaLoader - *

- * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(ConstantInstanceProvider.class.getName(), __serviceName, regKey); - } - - protected XMultiServiceFactory _serviceManager; protected String _serviceName; diff --git a/jurt/com/sun/star/comp/connections/PipedConnection.java b/jurt/com/sun/star/comp/connections/PipedConnection.java index ee772124e..719e24b15 100644 --- a/jurt/com/sun/star/comp/connections/PipedConnection.java +++ b/jurt/com/sun/star/comp/connections/PipedConnection.java @@ -84,19 +84,6 @@ public class PipedConnection implements XConnection { return xSingleServiceFactory; } - - /** - * Writes the service information into the given registry key. - * This method is called by the JavaLoader - *

- * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(PipedConnection.class.getName(), __serviceName, regKey); - } - /** * The amount of time in milliseconds, to wait to diff --git a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java index a73b24098..7b8dce558 100644 --- a/jurt/com/sun/star/comp/urlresolver/UrlResolver.java +++ b/jurt/com/sun/star/comp/urlresolver/UrlResolver.java @@ -154,18 +154,4 @@ public class UrlResolver { return xSingleServiceFactory; } - - /** - * Writes the service information into the given registry key. - * This method is called by the JavaLoader - *

- * @return returns true if the operation succeeded - * @param regKey the registryKey - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo(_UrlResolver.class.getName(), _UrlResolver.__serviceName, regKey); - } - } - diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java index f9e2a43bc..63a3fb3a6 100644 --- a/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java +++ b/jurt/com/sun/star/lib/connections/pipe/pipeAcceptor.java @@ -83,21 +83,6 @@ public final class pipeAcceptor implements XAcceptor { : null; } - /** - * Writes the service information into the given registry key. - * - *

This method is called by the JavaLoader.

- * - * @param regKey the registry key. - * @return true if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - pipeAcceptor.class.getName(), __serviceName, regKey); - } - /** * Accepts a connection request via the described pipe. * diff --git a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java index 7128a5b3f..2f631a788 100644 --- a/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java +++ b/jurt/com/sun/star/lib/connections/pipe/pipeConnector.java @@ -83,21 +83,6 @@ public final class pipeConnector implements XConnector { : null; } - /** - * Writes the service information into the given registry key. - * - *

This method is called by the JavaLoader.

- * - * @param regKey the registry key. - * @return true if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - pipeConnector.class.getName(), __serviceName, regKey); - } - /** * Connects via the described pipe to a waiting server. * diff --git a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java index 930eeecf4..1f64d16c8 100644 --- a/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java +++ b/jurt/com/sun/star/lib/connections/socket/socketAcceptor.java @@ -88,21 +88,6 @@ public final class socketAcceptor implements XAcceptor { : null; } - /** - * Writes the service information into the given registry key. - * - *

This method is called by the JavaLoader.

- * - * @param regKey the registry key. - * @return true if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - socketAcceptor.class.getName(), __serviceName, regKey); - } - /** * Accepts a connection request via the described socket. * diff --git a/jurt/com/sun/star/lib/connections/socket/socketConnector.java b/jurt/com/sun/star/lib/connections/socket/socketConnector.java index 287274356..11ffcb174 100644 --- a/jurt/com/sun/star/lib/connections/socket/socketConnector.java +++ b/jurt/com/sun/star/lib/connections/socket/socketConnector.java @@ -88,21 +88,6 @@ public final class socketConnector implements XConnector { : null; } - /** - * Writes the service information into the given registry key. - * - *

This method is called by the JavaLoader.

- * - * @param regKey the registry key. - * @return true if the operation succeeded. - * - * @see com.sun.star.comp.loader.JavaLoader - */ - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - socketConnector.class.getName(), __serviceName, regKey); - } - /** * Connects via the described socket to a waiting server. * diff --git a/pyuno/prj/d.lst b/pyuno/prj/d.lst index 5fe7400a8..1dd212ea9 100644 --- a/pyuno/prj/d.lst +++ b/pyuno/prj/d.lst @@ -9,12 +9,11 @@ mkdir: %_DEST%\lib%_EXT%\pyuno ..\%__SRC%\lib\unohelper.py %_DEST%\lib%_EXT%\pyuno\unohelper.py ..\%__SRC%\lib\pythonloader.py %_DEST%\lib%_EXT%\pyuno\pythonloader.py ..\%__SRC%\lib\uno.py %_DEST%\lib%_EXT%\pyuno\uno.py -..\%__SRC%\lib\pyuno_services.rdb %_DEST%\bin%_EXT%\pyuno_services.rdb +..\%__SRC%\misc\pythonloader.component %_DEST%\xml\pythonloader.component ..\%__SRC%\bin\unohelper.py %_DEST%\bin%_EXT%\pyuno\unohelper.py ..\%__SRC%\bin\pythonloader.py %_DEST%\bin%_EXT%\pyuno\pythonloader.py ..\%__SRC%\bin\uno.py %_DEST%\bin%_EXT%\pyuno\uno.py -..\%__SRC%\bin\pyuno_services.rdb %_DEST%\bin%_EXT%\pyuno_services.rdb ..\%__SRC%\bin\pyuno.pyd %_DEST%\bin%_EXT%\pyuno.pyd ..\%__SRC%\bin\pyuno.dll %_DEST%\bin%_EXT%\pyuno.dll ..\%__SRC%\bin\pythonl*.dll %_DEST%\bin%_EXT%\pythonl*.dll diff --git a/pyuno/source/loader/makefile.mk b/pyuno/source/loader/makefile.mk index 6f8648ce5..65ec8116f 100644 --- a/pyuno/source/loader/makefile.mk +++ b/pyuno/source/loader/makefile.mk @@ -73,40 +73,22 @@ SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) SLOFILES= $(SLO)$/pyuno_loader.obj -#COMPONENTS= \ -# tcv \ -# inv \ -# corefl \ -# insp \ -# invadp \ -# proxyfac \ -# pythonloader.uno \ - - -COMPONENTS= \ - stocservices.uno \ - invocation.uno \ - introspection.uno \ - invocadapt.uno \ - proxyfac.uno \ - reflection.uno \ - .$/pythonloader.uno - # --- Targets ------------------------------------------------------ ALL : ALLTAR \ - $(DLLDEST)$/pythonloader.py \ - $(DLLDEST)$/pyuno_services.rdb + $(DLLDEST)$/pythonloader.py .ENDIF # L10N_framework .INCLUDE : target.mk .IF "$(L10N_framework)"=="" $(DLLDEST)$/%.py: %.py cp $? $@ - -$(DLLDEST)$/pyuno_services.rdb : makefile.mk $(DLLDEST)$/$(DLLPRE)$(TARGET)$(DLLPOST) - -rm -f $@ $(DLLDEST)$/pyuno_services.tmp $(DLLDEST)$/pyuno_services.rdb - cd $(DLLDEST) && $(REGCOMP) -register -r pyuno_services.tmp -wop $(foreach,i,$(COMPONENTS) -c $(i)) - cd $(DLLDEST) && mv pyuno_services.tmp pyuno_services.rdb .ENDIF # L10N_framework +ALLTAR : $(MISC)/pythonloader.component + +$(MISC)/pythonloader.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt pythonloader.component + $(XSLTPROC) --nonet --stringparam uri \ + 'vnd.sun.star.expand:$$OOO_BASE_DIR/program/$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt pythonloader.component diff --git a/pyuno/source/loader/pythonloader.component b/pyuno/source/loader/pythonloader.component new file mode 100644 index 000000000..583b6ed38 --- /dev/null +++ b/pyuno/source/loader/pythonloader.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx index cddb42f63..f94b4ea51 100644 --- a/pyuno/source/loader/pyuno_loader.cxx +++ b/pyuno/source/loader/pyuno_loader.cxx @@ -229,12 +229,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return cppu::component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/remotebridges/prj/d.lst b/remotebridges/prj/d.lst index 04b8bf4f7..b304680e2 100644 --- a/remotebridges/prj/d.lst +++ b/remotebridges/prj/d.lst @@ -15,3 +15,6 @@ ..\%__SRC%\lib\dynamicloader.uno.so %_DEST%\lib%_EXT%\dynamicloader.uno.so ..\%__SRC%\lib\uuresolver.uno.so %_DEST%\lib%_EXT%\uuresolver.uno.so ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* +..\%__SRC%\misc\bridgefac.component %_DEST%\xml%_EXT%\bridgefac.component +..\%__SRC%\misc\remotebridge.component %_DEST%\xml%_EXT%\remotebridge.component +..\%__SRC%\misc\uuresolver.component %_DEST%\xml%_EXT%\uuresolver.component diff --git a/remotebridges/source/bridge/makefile.mk b/remotebridges/source/bridge/makefile.mk index 1b712bef1..2a5ea130d 100644 --- a/remotebridges/source/bridge/makefile.mk +++ b/remotebridges/source/bridge/makefile.mk @@ -62,3 +62,11 @@ DEF1NAME= $(SHL1TARGET) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk + +ALLTAR : $(MISC)/remotebridge.component + +$(MISC)/remotebridge.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt remotebridge.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt remotebridge.component diff --git a/remotebridges/source/bridge/remote_bridge.cxx b/remotebridges/source/bridge/remote_bridge.cxx index 40f233625..67272df80 100644 --- a/remotebridges/source/bridge/remote_bridge.cxx +++ b/remotebridges/source/bridge/remote_bridge.cxx @@ -457,12 +457,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/remotebridges/source/bridge/remotebridge.component b/remotebridges/source/bridge/remotebridge.component new file mode 100644 index 000000000..bbc6bede1 --- /dev/null +++ b/remotebridges/source/bridge/remotebridge.component @@ -0,0 +1,36 @@ + + + + + + + + + + diff --git a/remotebridges/source/dynamicloader/dynamicloader.cxx b/remotebridges/source/dynamicloader/dynamicloader.cxx index ec87b5212..08001cb0b 100644 --- a/remotebridges/source/dynamicloader/dynamicloader.cxx +++ b/remotebridges/source/dynamicloader/dynamicloader.cxx @@ -381,34 +381,6 @@ extern "C" { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - sal_Bool SAL_CALL component_writeInfo(XMultiServiceFactory *, XRegistryKey * pRegistryKey) { - sal_Bool bRes = sal_False; - - if (pRegistryKey) { - try { - OUString x = OUString::createFromAscii("/"); - x += ::dynamic_loader::DynamicLoader::implname; - x += OUString::createFromAscii("/UNO/SERVICES"); - - - Reference xNewKey(pRegistryKey->createKey(x)); - - const Sequence rSNL = ::dynamic_loader::DynamicLoader::getSupportedServiceNames_Static(); - const OUString * pArray = rSNL.getConstArray(); - for (sal_Int32 nPos = rSNL.getLength(); nPos--;) - xNewKey->createKey(pArray[nPos]); - - - bRes = sal_True; - } - catch (InvalidRegistryException &) { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - - return bRes; - } - void * SAL_CALL component_getFactory(const sal_Char * pImplName, XMultiServiceFactory * pServiceManager, XRegistryKey *) { void * pRet = 0; diff --git a/remotebridges/source/factory/bridgefac.component b/remotebridges/source/factory/bridgefac.component new file mode 100644 index 000000000..e20bc3425 --- /dev/null +++ b/remotebridges/source/factory/bridgefac.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/remotebridges/source/factory/bridgefactory.cxx b/remotebridges/source/factory/bridgefactory.cxx index e9e183525..fbe39339c 100644 --- a/remotebridges/source/factory/bridgefactory.cxx +++ b/remotebridges/source/factory/bridgefactory.cxx @@ -481,12 +481,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/remotebridges/source/factory/makefile.mk b/remotebridges/source/factory/makefile.mk index 7cd3875bc..b47207077 100644 --- a/remotebridges/source/factory/makefile.mk +++ b/remotebridges/source/factory/makefile.mk @@ -64,3 +64,10 @@ DEF1NAME= $(SHL1TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/bridgefac.component + +$(MISC)/bridgefac.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + bridgefac.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt bridgefac.component diff --git a/remotebridges/source/unourl_resolver/makefile.mk b/remotebridges/source/unourl_resolver/makefile.mk index a3e4af7f0..edf5aa72c 100644 --- a/remotebridges/source/unourl_resolver/makefile.mk +++ b/remotebridges/source/unourl_resolver/makefile.mk @@ -62,3 +62,11 @@ DEF1NAME= $(SHL1TARGET) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk + +ALLTAR : $(MISC)/uuresolver.component + +$(MISC)/uuresolver.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + uuresolver.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt uuresolver.component diff --git a/remotebridges/source/unourl_resolver/unourl_resolver.cxx b/remotebridges/source/unourl_resolver/unourl_resolver.cxx index f7d8b92ec..bdddf783d 100644 --- a/remotebridges/source/unourl_resolver/unourl_resolver.cxx +++ b/remotebridges/source/unourl_resolver/unourl_resolver.cxx @@ -239,12 +239,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/remotebridges/source/unourl_resolver/uuresolver.component b/remotebridges/source/unourl_resolver/uuresolver.component new file mode 100644 index 000000000..f9dcd71d8 --- /dev/null +++ b/remotebridges/source/unourl_resolver/uuresolver.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/stoc/prj/d.lst b/stoc/prj/d.lst index 1f01434bf..79b2d7734 100644 --- a/stoc/prj/d.lst +++ b/stoc/prj/d.lst @@ -4,6 +4,16 @@ mkdir: %_DEST%\inc%_EXT%\stoc ..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib ..\%__SRC%\bin\*.rdb %_DEST%\rdb%_EXT%\* +..\%__SRC%\misc\bootstrap.component %_DEST%\xml%_EXT%\bootstrap.component +..\%__SRC%\misc\introspection.component %_DEST%\xml%_EXT%\introspection.component +..\%__SRC%\misc\invocadapt.component %_DEST%\xml%_EXT%\invocadapt.component +..\%__SRC%\misc\invocation.component %_DEST%\xml%_EXT%\invocation.component +..\%__SRC%\misc\javaloader.component %_DEST%\xml%_EXT%\javaloader.component +..\%__SRC%\misc\javavm.component %_DEST%\xml%_EXT%\javavm.component +..\%__SRC%\misc\namingservice.component %_DEST%\xml%_EXT%\namingservice.component +..\%__SRC%\misc\proxyfac.component %_DEST%\xml%_EXT%\proxyfac.component +..\%__SRC%\misc\reflection.component %_DEST%\xml%_EXT%\reflection.component +..\%__SRC%\misc\stocservices.component %_DEST%\xml%_EXT%\stocservices.component ..\source\module-description.dtd %_DEST%\xml%_EXT%\module-description.dtd ..\source\corereflection\corefl.xml %_DEST%\xml%_EXT%\reflection.uno.xml diff --git a/stoc/source/bootstrap/services.cxx b/stoc/source/bootstrap/services.cxx index 2fb68a0cc..d5ce619c6 100644 --- a/stoc/source/bootstrap/services.cxx +++ b/stoc/source/bootstrap/services.cxx @@ -132,12 +132,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx index ba35d4f80..faf3e56bc 100644 --- a/stoc/source/corereflection/base.hxx +++ b/stoc/source/corereflection/base.hxx @@ -55,9 +55,6 @@ #include #include -#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) - - using namespace std; using namespace osl; using namespace rtl; diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx index c706e233a..dac197e6f 100644 --- a/stoc/source/corereflection/crefl.cxx +++ b/stoc/source/corereflection/crefl.cxx @@ -32,7 +32,6 @@ #include #endif -#include #include #include #include "com/sun/star/uno/RuntimeException.hpp" @@ -509,35 +508,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - if (component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries )) - { - try - { - // register singleton - registry::XRegistryKey * pKey = - reinterpret_cast< registry::XRegistryKey * >( pRegistryKey ); - Reference< registry::XRegistryKey > xKey( - pKey->createKey( - OUSTR(IMPLNAME "/UNO/SINGLETONS/com.sun.star.reflection.theCoreReflection") ) ); - xKey->setStringValue( OUSTR("com.sun.star.reflection.CoreReflection") ); - return sal_True; - } - catch (Exception & exc) - { -#if OSL_DEBUG_LEVEL > 0 - OString cstr( OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US ) ); - OSL_ENSURE( 0, cstr.getStr() ); -#else - (void) exc; // unused -#endif - } - } - return sal_False; -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/stoc/source/corereflection/makefile.mk b/stoc/source/corereflection/makefile.mk index b61eb13aa..7156f6d63 100644 --- a/stoc/source/corereflection/makefile.mk +++ b/stoc/source/corereflection/makefile.mk @@ -73,3 +73,10 @@ DEF1NAME= $(SHL1TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/reflection.component + +$(MISC)/reflection.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + reflection.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt reflection.component diff --git a/stoc/source/corereflection/reflection.component b/stoc/source/corereflection/reflection.component new file mode 100644 index 000000000..00772a448 --- /dev/null +++ b/stoc/source/corereflection/reflection.component @@ -0,0 +1,35 @@ + + + + + + + + + diff --git a/stoc/source/inspect/introspection.component b/stoc/source/inspect/introspection.component new file mode 100644 index 000000000..349fb0c9d --- /dev/null +++ b/stoc/source/inspect/introspection.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index b8ae012d2..0b9857abe 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -71,7 +71,6 @@ #include #include #include -#include #include #include @@ -3065,32 +3064,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( void *, void * pRegistryKey ) -{ - if (pRegistryKey) - { - try - { - Reference< XRegistryKey > xNewKey( - reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( - OUString::createFromAscii( "/" IMPLEMENTATION_NAME "/UNO/SERVICES" ) ) ); - - const Sequence< OUString > & rSNL = - stoc_inspect::ImplIntrospection::getSupportedServiceNames_Static(); - const OUString * pArray = rSNL.getConstArray(); - for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) - xNewKey->createKey( pArray[nPos] ); - - return sal_True; - } - catch (InvalidRegistryException &) - { - OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); - } - } - return sal_False; -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * ) { diff --git a/stoc/source/inspect/makefile.mk b/stoc/source/inspect/makefile.mk index 80e87dbf7..60864eea2 100644 --- a/stoc/source/inspect/makefile.mk +++ b/stoc/source/inspect/makefile.mk @@ -64,3 +64,10 @@ DEF1NAME= $(SHL1TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/introspection.component + +$(MISC)/introspection.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt introspection.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt introspection.component diff --git a/stoc/source/invocation/invocation.component b/stoc/source/invocation/invocation.component new file mode 100644 index 000000000..67178ef2e --- /dev/null +++ b/stoc/source/invocation/invocation.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx index b321d97cd..c5813efac 100644 --- a/stoc/source/invocation/invocation.cxx +++ b/stoc/source/invocation/invocation.cxx @@ -1251,12 +1251,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/stoc/source/invocation/makefile.mk b/stoc/source/invocation/makefile.mk index c170bf6b6..72eeea37c 100644 --- a/stoc/source/invocation/makefile.mk +++ b/stoc/source/invocation/makefile.mk @@ -62,4 +62,10 @@ DEF1NAME= $(SHL1TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/invocation.component +$(MISC)/invocation.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + invocation.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt invocation.component diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx index e42aae68d..4c2bc37b5 100644 --- a/stoc/source/invocation_adapterfactory/iafactory.cxx +++ b/stoc/source/invocation_adapterfactory/iafactory.cxx @@ -1015,14 +1015,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -//============================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return ::cppu::component_writeInfoHelper( - pServiceManager, pRegistryKey, g_entries ); -} - //============================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) diff --git a/stoc/source/invocation_adapterfactory/invocadapt.component b/stoc/source/invocation_adapterfactory/invocadapt.component new file mode 100644 index 000000000..64f7b2b36 --- /dev/null +++ b/stoc/source/invocation_adapterfactory/invocadapt.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/stoc/source/invocation_adapterfactory/makefile.mk b/stoc/source/invocation_adapterfactory/makefile.mk index 66568af03..4c3450ac8 100644 --- a/stoc/source/invocation_adapterfactory/makefile.mk +++ b/stoc/source/invocation_adapterfactory/makefile.mk @@ -63,3 +63,11 @@ DEF1NAME= $(SHL1TARGET) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk + +ALLTAR : $(MISC)/invocadapt.component + +$(MISC)/invocadapt.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + invocadapt.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt invocadapt.component diff --git a/stoc/source/javaloader/javaloader.component b/stoc/source/javaloader/javaloader.component new file mode 100644 index 000000000..bdd3b82d5 --- /dev/null +++ b/stoc/source/javaloader/javaloader.component @@ -0,0 +1,35 @@ + + + + + + + + + diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx index 069c9b1ea..ee4f5c8b4 100644 --- a/stoc/source/javaloader/javaloader.cxx +++ b/stoc/source/javaloader/javaloader.cxx @@ -472,12 +472,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/stoc/source/javaloader/makefile.mk b/stoc/source/javaloader/makefile.mk index 60eea6a23..e53b90d5e 100644 --- a/stoc/source/javaloader/makefile.mk +++ b/stoc/source/javaloader/makefile.mk @@ -70,3 +70,10 @@ all: .INCLUDE : target.mk +ALLTAR : $(MISC)/javaloader.component + +$(MISC)/javaloader.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + javaloader.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt javaloader.component diff --git a/stoc/source/javavm/javavm.component b/stoc/source/javavm/javavm.component new file mode 100644 index 000000000..f78d8af3a --- /dev/null +++ b/stoc/source/javavm/javavm.component @@ -0,0 +1,35 @@ + + + + + + + + + diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index f2c018418..ba1c3cf17 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -226,15 +226,10 @@ rtl::OUString serviceGetImplementationName() "com.sun.star.comp.stoc.JavaVirtualMachine")); } -rtl::OUString serviceGetServiceName() -{ - return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.java.JavaVirtualMachine")); -} - css::uno::Sequence< rtl::OUString > serviceGetSupportedServiceNames() { - rtl::OUString aServiceName = serviceGetServiceName(); + rtl::OUString aServiceName( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.java.JavaVirtualMachine")); return css::uno::Sequence< rtl::OUString >(&aServiceName, 1); } @@ -619,34 +614,6 @@ component_getImplementationEnvironment(sal_Char const ** pEnvTypeName, *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -extern "C" sal_Bool SAL_CALL component_writeInfo(void * pServiceManager, - void * pRegistryKey) -{ - if (cppu::component_writeInfoHelper(pServiceManager, pRegistryKey, - aServiceImplementation)) - { - try - { - css::uno::Reference< css::registry::XRegistryKey >( - reinterpret_cast< css::registry::XRegistryKey * >( - pRegistryKey)-> - createKey( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.stoc.JavaVirtualMachine" - "/UNO/SINGLETONS/" - "com.sun.star.java.theJavaVirtualMachine"))))-> - setStringValue(serviceGetServiceName()); - return true; - } - catch (css::uno::Exception &) - { - OSL_ENSURE(false, "com.sun.star.uno.Exception caught"); - } - } - return false; -} - extern "C" void * SAL_CALL component_getFactory(sal_Char const * pImplName, void * pServiceManager, void * pRegistryKey) diff --git a/stoc/source/javavm/makefile.mk b/stoc/source/javavm/makefile.mk index 96908d10d..bcd36e696 100644 --- a/stoc/source/javavm/makefile.mk +++ b/stoc/source/javavm/makefile.mk @@ -85,3 +85,10 @@ all: .INCLUDE : target.mk +ALLTAR : $(MISC)/javavm.component + +$(MISC)/javavm.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + javavm.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt javavm.component diff --git a/stoc/source/namingservice/makefile.mk b/stoc/source/namingservice/makefile.mk index 424180e11..cc98cdfc3 100644 --- a/stoc/source/namingservice/makefile.mk +++ b/stoc/source/namingservice/makefile.mk @@ -64,3 +64,10 @@ DEF1NAME= $(SHL1TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/namingservice.component + +$(MISC)/namingservice.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt namingservice.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt namingservice.component diff --git a/stoc/source/namingservice/namingservice.component b/stoc/source/namingservice/namingservice.component new file mode 100644 index 000000000..8450cdee6 --- /dev/null +++ b/stoc/source/namingservice/namingservice.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/stoc/source/namingservice/namingservice.cxx b/stoc/source/namingservice/namingservice.cxx index 761fccf64..e5aae9a74 100644 --- a/stoc/source/namingservice/namingservice.cxx +++ b/stoc/source/namingservice/namingservice.cxx @@ -238,12 +238,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/stoc/source/proxy_factory/makefile.mk b/stoc/source/proxy_factory/makefile.mk index b38dac146..23146e678 100644 --- a/stoc/source/proxy_factory/makefile.mk +++ b/stoc/source/proxy_factory/makefile.mk @@ -63,3 +63,11 @@ DEF1NAME=$(SHL1TARGET) # --- Targets ------------------------------------------------------ .INCLUDE : target.mk + +ALLTAR : $(MISC)/proxyfac.component + +$(MISC)/proxyfac.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + proxyfac.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt proxyfac.component diff --git a/stoc/source/proxy_factory/proxyfac.component b/stoc/source/proxy_factory/proxyfac.component new file mode 100644 index 000000000..bfe2c9c42 --- /dev/null +++ b/stoc/source/proxy_factory/proxyfac.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/stoc/source/proxy_factory/proxyfac.cxx b/stoc/source/proxy_factory/proxyfac.cxx index 4b69487f3..8547900b1 100644 --- a/stoc/source/proxy_factory/proxyfac.cxx +++ b/stoc/source/proxy_factory/proxyfac.cxx @@ -526,13 +526,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return ::cppu::component_writeInfoHelper( - pServiceManager, pRegistryKey, g_entries ); -} - void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/stoc/source/stocservices/stocservices.cxx b/stoc/source/stocservices/stocservices.cxx index 7b8cfdb90..73787a5f3 100644 --- a/stoc/source/stocservices/stocservices.cxx +++ b/stoc/source/stocservices/stocservices.cxx @@ -102,12 +102,6 @@ void SAL_CALL component_getImplementationEnvironment( *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== -sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) -{ - return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); -} -//================================================================================================== void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) { diff --git a/stoc/util/bootstrap.component b/stoc/util/bootstrap.component new file mode 100644 index 000000000..a77b21ede --- /dev/null +++ b/stoc/util/bootstrap.component @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/stoc/util/makefile.mk b/stoc/util/makefile.mk index 54232aa4c..32f229cc3 100644 --- a/stoc/util/makefile.mk +++ b/stoc/util/makefile.mk @@ -95,3 +95,16 @@ DEF2NAME= $(SHL2TARGET) .INCLUDE : target.mk +ALLTAR : $(MISC)/bootstrap.component $(MISC)/stocservices.component + +$(MISC)/bootstrap.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + bootstrap.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt bootstrap.component + +$(MISC)/stocservices.component .ERRREMOVE : \ + $(SOLARENV)/bin/createcomponent.xslt stocservices.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_URE_NATIVE)$(SHL2TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt stocservices.component diff --git a/stoc/util/stocservices.component b/stoc/util/stocservices.component new file mode 100644 index 000000000..fb3528728 --- /dev/null +++ b/stoc/util/stocservices.component @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ure/prj/build.lst b/ure/prj/build.lst index 07fbfc484..7d3e23edc 100644 --- a/ure/prj/build.lst +++ b/ure/prj/build.lst @@ -1,2 +1,2 @@ -ur ure : cli_ure solenv NULL +ur ure : cli_ure io javaunohelper remotebridges solenv stoc NULL ur ure\source nmake - all ur_source NULL diff --git a/ure/prj/d.lst b/ure/prj/d.lst index 23524c981..22cfb161c 100644 --- a/ure/prj/d.lst +++ b/ure/prj/d.lst @@ -1,9 +1,11 @@ mkdir: %_DEST%\bin%_EXT%\ure -..\%__SRC%\bin\ure\README %_DEST%\bin%_EXT%\ure\README -..\%__SRC%\bin\ure\THIRDPARTYLICENSEREADME.html %_DEST%\bin%_EXT%\ure\THIRDPARTYLICENSEREADME.html -..\%__SRC%\bin\ure\jvmfwk3.ini %_DEST%\bin%_EXT%\ure\jvmfwk3.ini -..\%__SRC%\bin\ure\jvmfwk3rc %_DEST%\bin%_EXT%\ure\jvmfwk3rc -..\%__SRC%\bin\ure\startup.sh %_DEST%\bin%_EXT%\ure\startup.sh -..\%__SRC%\bin\ure\uno.ini %_DEST%\bin%_EXT%\ure\uno.ini -..\%__SRC%\bin\ure\unorc %_DEST%\bin%_EXT%\ure\unorc +mkdir: %_DEST%\xml%_EXT%\ure ..\%__SRC%\bin\uretest.zip %COMMON_DEST%\bin%_EXT%\uretest.zip +..\%__SRC%\misc\services.rdb %_DEST%\xml%_EXT%\ure\services.rdb +..\source\README %_DEST%\bin%_EXT%\ure\README +..\source\THIRDPARTYLICENSEREADME.html %_DEST%\bin%_EXT%\ure\THIRDPARTYLICENSEREADME.html +..\source\jvmfwk3.ini %_DEST%\bin%_EXT%\ure\jvmfwk3.ini +..\source\jvmfwk3rc %_DEST%\bin%_EXT%\ure\jvmfwk3rc +..\source\startup.sh %_DEST%\bin%_EXT%\ure\startup.sh +..\source\uno.ini %_DEST%\bin%_EXT%\ure\uno.ini +..\source\unorc %_DEST%\bin%_EXT%\ure\unorc diff --git a/ure/source/makefile.mk b/ure/source/makefile.mk index a1728b277..d10e276c4 100644 --- a/ure/source/makefile.mk +++ b/ure/source/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite @@ -25,52 +25,47 @@ # #************************************************************************* -PRJ := .. -PRJNAME := ure -TARGET := $(PRJNAME) - -.INCLUDE: settings.mk - -.IF "$(OS)" == "WNT" || "$(OS)" == "OS2" -MY_RC = .ini -.ELSE -MY_RC = rc -.ENDIF +PRJ = .. +PRJNAME = ure +TARGET = source ZIP1TARGET = uretest ZIP1FLAGS = -r ZIP1LIST = uretest -.INCLUDE: target.mk - -ALLTAR: \ - $(BIN)$/ure$/README \ - $(BIN)$/ure$/THIRDPARTYLICENSEREADME.html \ - $(BIN)$/ure$/jvmfwk3$(MY_RC) \ - $(BIN)$/ure$/uno$(MY_RC) +my_components = \ + acceptor \ + bootstrap \ + bridgefac \ + connector \ + introspection \ + invocadapt \ + invocation \ + javaloader \ + javavm \ + juh \ + namingservice \ + proxyfac \ + reflection \ + remotebridge \ + stocservices \ + streams \ + textinstream \ + textoutstream \ + uuresolver -$(BIN)$/ure$/README: README - -$(MKDIR) $(@:d) - $(COPY) $< $@ - -$(BIN)$/ure$/THIRDPARTYLICENSEREADME.html: THIRDPARTYLICENSEREADME.html - - $(MKDIR) $(@:d) - $(COPY) $< $@ - -$(BIN)$/ure$/jvmfwk3$(MY_RC): jvmfwk3$(MY_RC) - -$(MKDIR) $(@:d) - $(COPY) $< $@ - -$(BIN)$/ure$/uno$(MY_RC): uno$(MY_RC) - -$(MKDIR) $(@:d) - $(COPY) $< $@ - -.IF "$(OS)" != "WNT" +.INCLUDE: settings.mk +.INCLUDE: target.mk -ALLTAR: $(BIN)$/ure$/startup.sh +ALLTAR : $(MISC)/services.rdb -$(BIN)$/ure$/startup.sh: startup.sh - -$(MKDIR) $(@:d) - $(COPY) $< $@ +$(MISC)/services.rdb .ERRREMOVE : $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/services.input $(my_components:^"$(SOLARXMLDIR)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(SOLARXMLDIR)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt $(MISC)/services.input -.ENDIF +$(MISC)/services.input .ERRREMOVE : + - $(RM) $@ + echo \ + '$(my_components:^"":+".component")' \ + > $@ -- cgit v1.2.3 From 85826e325f865679e95d17cfeaf94e0c161f946f Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 10 Sep 2010 13:41:49 +0200 Subject: sb123: #i113189# missing includes --- stoc/source/simpleregistry/textualservices.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stoc/source/simpleregistry/textualservices.cxx b/stoc/source/simpleregistry/textualservices.cxx index 11196b76a..a3e44d643 100755 --- a/stoc/source/simpleregistry/textualservices.cxx +++ b/stoc/source/simpleregistry/textualservices.cxx @@ -28,6 +28,8 @@ #include "precompiled_stoc.hxx" #include "sal/config.h" +#include +#include #include #include -- cgit v1.2.3 From e184e20b318dd917241deccad98a88ead8a8a271 Mon Sep 17 00:00:00 2001 From: "Thomas Lange [tl]" Date: Mon, 13 Sep 2010 15:04:50 +0200 Subject: cws tl82: #i114267# code clean-up --- offapi/com/sun/star/text/PrintPreviewSettings.idl | 2 ++ 1 file changed, 2 insertions(+) mode change 100644 => 100755 offapi/com/sun/star/text/PrintPreviewSettings.idl diff --git a/offapi/com/sun/star/text/PrintPreviewSettings.idl b/offapi/com/sun/star/text/PrintPreviewSettings.idl old mode 100644 new mode 100755 index bec086e30..bd6c61d2f --- a/offapi/com/sun/star/text/PrintPreviewSettings.idl +++ b/offapi/com/sun/star/text/PrintPreviewSettings.idl @@ -39,6 +39,8 @@ //============================================================================= /** These properties describe the printing of the content of a text document. + * + * @deprecated since OOo 3.3 */ published service PrintPreviewSettings { -- cgit v1.2.3 From f93a859e5c7b42bc7f3a5ccc0e6a063f87869505 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 14 Sep 2010 09:15:02 +0200 Subject: sb129: #i113189# adapted tests; improved subsequenttests --- cppuhelper/qa/propertysetmixin/JavaSupplier.java | 5 -- .../qa/propertysetmixin/comp_propertysetmixin.cxx | 7 --- cppuhelper/qa/propertysetmixin/makefile.mk | 60 +++++++++++++--------- .../qa_propertysetmixin.cpp.component | 34 ++++++++++++ .../qa_propertysetmixin.java.component | 34 ++++++++++++ .../qa/propertysetmixin/test_propertysetmixin.cxx | 40 +++------------ cppuhelper/source/bootstrap.cxx | 10 +++- stoc/test/uriproc/makefile.mk | 21 +++++--- 8 files changed, 134 insertions(+), 77 deletions(-) create mode 100644 cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component create mode 100644 cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component diff --git a/cppuhelper/qa/propertysetmixin/JavaSupplier.java b/cppuhelper/qa/propertysetmixin/JavaSupplier.java index 513f207ab..834e448c6 100644 --- a/cppuhelper/qa/propertysetmixin/JavaSupplier.java +++ b/cppuhelper/qa/propertysetmixin/JavaSupplier.java @@ -75,11 +75,6 @@ public final class JavaSupplier extends WeakBase implements XSupplier { : null; } - public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { - return FactoryHelper.writeRegistryServiceInfo( - implementationName, serviceName, regKey); - } - private static final String implementationName = JavaSupplier.class.getName(); private static final String serviceName diff --git a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx index 67571e82c..c6eccecb4 100644 --- a/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx +++ b/cppuhelper/qa/propertysetmixin/comp_propertysetmixin.cxx @@ -427,10 +427,3 @@ extern "C" void SAL_CALL component_getImplementationEnvironment( { *envTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - -extern "C" sal_Bool SAL_CALL component_writeInfo( - void * serviceManager, void * registryKey) -{ - return cppu::component_writeInfoHelper( - serviceManager, registryKey, entries); -} diff --git a/cppuhelper/qa/propertysetmixin/makefile.mk b/cppuhelper/qa/propertysetmixin/makefile.mk index edd4795fc..41b72d8a8 100644 --- a/cppuhelper/qa/propertysetmixin/makefile.mk +++ b/cppuhelper/qa/propertysetmixin/makefile.mk @@ -37,6 +37,8 @@ PACKAGE = test/cppuhelper/propertysetmixin/comp ENABLE_EXCEPTIONS := TRUE +my_components = $(TARGET).cpp $(TARGET).java + .INCLUDE: settings.mk .IF "$(OS)" == "WNT" @@ -75,51 +77,63 @@ JARFILES = java_uno.jar juh.jar jurt.jar ridl.jar ALLTAR: test $(MISC)/$(TARGET)/types.urd: types.idl - - $(MKDIR) $(@:d) + $(MKDIRHIER) $(@:d) $(IDLC) -O$(@:d) -I$(SOLARIDLDIR) -cid -we $< $(MISC)/$(TARGET)/types.rdb: $(MISC)/$(TARGET)/types.urd - $(RM) $@ $(REGMERGE) $@ /UCR $< -$(MISC)/$(TARGET)/uno.rdb: $(MISC)/$(TARGET)/types.rdb $(SHL2TARGETN) \ - $(MISC)/$(TARGET)/$(TARGET).uno.jar $(MISC)/$(TARGET)/bootstrap.rdb - - $(MKDIR) $(@:d) - $(COPY) $(SOLARBINDIR)/types.rdb $@ - $(REGMERGE) $@ / $(MISC)/$(TARGET)/types.rdb - $(REGCOMP) -register -r $@ -wop -c javaloader.uno -c javavm.uno \ - -c reflection.uno -c stocservices.uno -c $(SHL2TARGETN) - $(REGCOMP) -register -br $(MISC)/$(TARGET)/bootstrap.rdb -r $@ \ - -c $(my_file)$(PWD)/$(MISC)/$(TARGET)/$(TARGET).uno.jar \ - -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) - -$(MISC)/$(TARGET)/bootstrap.rdb: - - $(MKDIR) $(@:d) - $(COPY) $(SOLARBINDIR)/types.rdb $@ - $(REGCOMP) -register -r $@ -wop -c javaloader.uno -c javavm.uno \ - -c stocservices.uno - $(MISC)/$(TARGET)/cppumaker.flag: $(MISC)/$(TARGET)/types.rdb $(CPPUMAKER) -O$(MISC)/$(TARGET)/inc -BUCR -Gc \ - -X$(SOLARBINDIR)/types.rdb $< + -X$(SOLARBINDIR)/udkapi.rdb $< $(TOUCH) $@ $(SLOFILES): $(MISC)/$(TARGET)/cppumaker.flag $(MISC)/$(TARGET)/javamaker.flag: $(MISC)/$(TARGET)/types.rdb - $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -Gc -X$(SOLARBINDIR)/types.rdb $< + $(JAVAMAKER) -O$(CLASSDIR) -BUCR -nD -Gc -X$(SOLARBINDIR)/udkapi.rdb $< $(TOUCH) $@ $(JAVATARGET): $(MISC)/$(TARGET)/javamaker.flag +$(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/services.input \ + $(my_components:^"$(MISC)/$(TARGET)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/$(TARGET)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input + +$(MISC)/$(TARGET)/services.input .ERRREMOVE: + $(MKDIRHIER) $(@:d) + - $(RM) $@ + echo \ + '$(my_components:^"":+".component")' \ + > $@ + +$(MISC)/$(TARGET)/$(TARGET).cpp.component .ERRREMOVE: \ + $(SOLARENV)/bin/createcomponent.xslt $(TARGET).cpp.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_INBUILD_NATIVE)$(SHL2TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt $(TARGET).cpp.component + +$(MISC)/$(TARGET)/$(TARGET).java.component .ERRREMOVE: \ + $(SOLARENV)/bin/createcomponent.xslt $(TARGET).java.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_INBUILD_JAVA)$(TARGET).uno.jar' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt $(TARGET).java.component + $(MISC)/$(TARGET)/$(TARGET).uno.jar: $(JAVATARGET) \ $(MISC)/$(TARGET)/javamaker.flag manifest jar cfm $@ manifest -C $(CLASSDIR) test/cppuhelper/propertysetmixin -test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/uno.rdb +test .PHONY: $(SHL1TARGETN) $(SHL2TARGETN) $(MISC)/$(TARGET)/$(TARGET).uno.jar \ + $(MISC)/$(TARGET)/types.rdb $(MISC)/$(TARGET)/services.rdb $(CPPUNITTESTER) $(SHL1TARGETN) \ - -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) \ + '-env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/types.rdb' \ + '-env:UNO_SERVICES=$(my_file)$(SOLARXMLDIR)/ure/services.rdb $(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb'\ -env:URE_INTERNAL_LIB_DIR=$(my_file)$(SOLARSHAREDBIN) \ - -env:arg-reg=$(MISC)/$(TARGET)/uno.rdb -env:arg-path=$(SOLARSHAREDBIN) + -env:URE_INTERNAL_JAVA_DIR=$(my_file)$(SOLARBINDIR) \ + -env:OOO_INBUILD_SHAREDLIB_DIR=$(my_file)$(PWD)/$(DLLDEST) \ + -env:OOO_INBUILD_JAR_DIR=$(my_file)$(PWD)/$(MISC)/$(TARGET) .END diff --git a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component new file mode 100644 index 000000000..a654e0758 --- /dev/null +++ b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.cpp.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component new file mode 100644 index 000000000..9711563b7 --- /dev/null +++ b/cppuhelper/qa/propertysetmixin/qa_propertysetmixin.java.component @@ -0,0 +1,34 @@ + + + + + + + + diff --git a/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx b/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx index 82256c634..9a25e9885 100644 --- a/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx +++ b/cppuhelper/qa/propertysetmixin/test_propertysetmixin.cxx @@ -52,21 +52,19 @@ #include "com/sun/star/beans/XPropertySetInfo.hpp" #include "com/sun/star/beans/XVetoableChangeListener.hpp" #include "com/sun/star/lang/XComponent.hpp" -#include "com/sun/star/lang/XMultiComponentFactory.hpp" #include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/Type.hxx" #include "com/sun/star/uno/XComponentContext.hpp" +#include "cppuhelper/bootstrap.hxx" #include "cppuhelper/implbase1.hxx" -#include "cppuhelper/servicefactory.hxx" #include "cppunit/TestAssert.h" #include "cppunit/TestFixture.h" #include "cppunit/extensions/HelperMacros.h" #include "cppunit/plugin/TestPlugIn.h" #include "osl/mutex.hxx" -#include "rtl/bootstrap.hxx" #include "rtl/ref.hxx" #include "rtl/string.h" #include "rtl/textenc.h" @@ -98,14 +96,6 @@ std::ostream & operator <<(std::ostream & out, css::uno::Any const & value) { out << "com::sun::star::uno::Any[" << value.getValueType() << ", ...]"; } -rtl::OUString getArgument(rtl::OUString const & name) { - rtl::OUString val; - CPPUNIT_ASSERT( - rtl::Bootstrap::get( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("arg-")) + name, val)); - return val; -} - class BoundListener: public cppu::WeakImplHelper1< css::beans::XPropertyChangeListener > { @@ -178,7 +168,7 @@ class Test: public CppUnit::TestFixture { public: virtual void setUp(); - void finish(); + virtual void tearDown(); void testCppEmpty1() { testEmpty1(getCppSupplier()); } @@ -199,7 +189,6 @@ public: CPPUNIT_TEST(testJavaEmpty1); CPPUNIT_TEST(testJavaEmpty2); CPPUNIT_TEST(testJavaFull); - CPPUNIT_TEST(finish); CPPUNIT_TEST_SUITE_END(); private: @@ -221,30 +210,15 @@ private: css::uno::Reference< test::cppuhelper::propertysetmixin::XSupplier > const & supplier) const; - static css::uno::Reference< css::uno::XComponentContext > m_context; + css::uno::Reference< css::uno::XComponentContext > m_context; }; void Test::setUp() { - // For whatever reason, on W32 it does not work to create/destroy a fresh - // component context for each test in Test::setUp/tearDown; therefore, a - // single component context is used for all tests and destroyed in the last - // pseudo-test "finish": - if (!m_context.is()) { - css::uno::Reference< css::lang::XMultiComponentFactory > factory( - cppu::createRegistryServiceFactory( - getArgument(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("reg"))), - sal_False, - getArgument( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("path")))), - css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::beans::XPropertySet >( - factory, css::uno::UNO_QUERY_THROW)->getPropertyValue( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext"))) - >>= m_context; - } + m_context = cppu::defaultBootstrap_InitialComponentContext(); + CPPUNIT_ASSERT(m_context.is()); } -void Test::finish() { +void Test::tearDown() { css::uno::Reference< css::lang::XComponent >( m_context, css::uno::UNO_QUERY_THROW)->dispose(); } @@ -671,8 +645,6 @@ void Test::testFull( } catch (css::beans::UnknownPropertyException &) {} } -css::uno::Reference< css::uno::XComponentContext > Test::m_context; - CPPUNIT_TEST_SUITE_REGISTRATION(Test); } diff --git a/cppuhelper/source/bootstrap.cxx b/cppuhelper/source/bootstrap.cxx index 0dcb24b5a..b8af92fed 100644 --- a/cppuhelper/source/bootstrap.cxx +++ b/cppuhelper/source/bootstrap.cxx @@ -380,9 +380,15 @@ SAL_CALL defaultBootstrap_InitialComponentContext( Bootstrap const & bootstrap ) SAL_THROW( (Exception) ) { - OUString bootstrapPath( get_this_libpath() ); - OUString iniDir; + OUString bootstrapPath; + if (!bootstrap.getFrom( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URE_INTERNAL_LIB_DIR")), + bootstrapPath)) + { + bootstrapPath = get_this_libpath(); + } + OUString iniDir; osl_getProcessWorkingDir(&iniDir.pData); Reference smgr_XMultiComponentFactory( diff --git a/stoc/test/uriproc/makefile.mk b/stoc/test/uriproc/makefile.mk index cfdc33e75..84f852689 100644 --- a/stoc/test/uriproc/makefile.mk +++ b/stoc/test/uriproc/makefile.mk @@ -35,6 +35,8 @@ TARGET := test_uriproc ENABLE_EXCEPTIONS := TRUE +my_components = stocservices + .INCLUDE: settings.mk CFLAGSCXX += $(CPPUNIT_CFLAGS) @@ -62,14 +64,21 @@ ALLTAR: test test .PHONY: $(SHL1TARGETN) $(MISC)/$(TARGET)/services.rdb $(CPPUNITTESTER) $(SHL1TARGETN) \ - -env:UNO_SERVICES=$(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb \ -env:UNO_TYPES=$(my_file)$(SOLARBINDIR)/udkapi.rdb \ - -env:OOO_TEST_PREFIX=$(my_file)$(PWD)/$(DLLDEST)/ + -env:UNO_SERVICES=$(my_file)$(PWD)/$(MISC)/$(TARGET)/services.rdb \ + -env:URE_INTERNAL_LIB_DIR=$(my_file)$(PWD)/$(DLLDEST) + +$(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \ + $(MISC)/$(TARGET)/services.input \ + $(my_components:^"$(MISC)/":+".component") + $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/ -o $@ \ + $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input -$(MISC)/$(TARGET)/services.rdb: +$(MISC)/$(TARGET)/services.input .ERRREMOVE: $(MKDIRHIER) $(@:d) - $(RM) $@ - $(REGCOMP) -register -r $@ -wop=vnd.sun.star.expand:\$${{OOO_TEST_PREFIX}} \ - -c $(DLLDEST)/stocservices.uno$(DLLPOST) + - $(RM) $@ + echo \ + '$(my_components:^"":+".component")' \ + > $@ .END -- cgit v1.2.3 From adc2e2b2a5a56667a5dc2bad91390caf24c68327 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 14 Sep 2010 15:14:56 +0200 Subject: sb129: #i113189# removed obviously unnecessary service registrations; allow empty --- stoc/source/simpleregistry/textualservices.cxx | 18 +++++++++--------- stoc/util/bootstrap.component | 6 +----- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/stoc/source/simpleregistry/textualservices.cxx b/stoc/source/simpleregistry/textualservices.cxx index a3e44d643..44315b689 100755 --- a/stoc/source/simpleregistry/textualservices.cxx +++ b/stoc/source/simpleregistry/textualservices.cxx @@ -194,21 +194,13 @@ Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): RTL_CONSTASCII_USTRINGPARAM( ": unexpected item in "))), css::uno::Reference< css::uno::XInterface >()); + case STATE_IMPLEMENTATION_INITIAL: case STATE_IMPLEMENTATION_SERVICE: case STATE_IMPLEMENTATION_SINGLETON: if (res == xmlreader::XmlReader::RESULT_END) { state = STATE_COMPONENT; break; } - if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && - name.equals(RTL_CONSTASCII_STRINGPARAM("singleton"))) - { - handleSingleton(); - state = STATE_SINGLETON; - break; - } - // fall through - case STATE_IMPLEMENTATION_INITIAL: if (state != STATE_IMPLEMENTATION_SINGLETON && res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && name.equals(RTL_CONSTASCII_STRINGPARAM("service"))) @@ -217,6 +209,14 @@ Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): state = STATE_SERVICE; break; } + if (state != STATE_IMPLEMENTATION_INITIAL && + res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + name.equals(RTL_CONSTASCII_STRINGPARAM("singleton"))) + { + handleSingleton(); + state = STATE_SINGLETON; + break; + } throw css::registry::InvalidRegistryException( (reader_.getUrl() + rtl::OUString( diff --git a/stoc/util/bootstrap.component b/stoc/util/bootstrap.component index a77b21ede..ccc131b4a 100644 --- a/stoc/util/bootstrap.component +++ b/stoc/util/bootstrap.component @@ -38,16 +38,12 @@ - - - - - + -- cgit v1.2.3 From 559c8fc2d7fdec9216b739bced674521a10120db Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 15 Sep 2010 11:45:04 +0200 Subject: sb129: #i113189# cleaned up makefile rules; deliver services.input to have it modifiable for special one-off products --- cppuhelper/qa/propertysetmixin/makefile.mk | 3 +-- stoc/test/uriproc/makefile.mk | 3 +-- ure/source/makefile.mk | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cppuhelper/qa/propertysetmixin/makefile.mk b/cppuhelper/qa/propertysetmixin/makefile.mk index 41b72d8a8..04aa2479c 100644 --- a/cppuhelper/qa/propertysetmixin/makefile.mk +++ b/cppuhelper/qa/propertysetmixin/makefile.mk @@ -103,9 +103,8 @@ $(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \ $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/$(TARGET)/ -o $@ \ $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input -$(MISC)/$(TARGET)/services.input .ERRREMOVE: +$(MISC)/$(TARGET)/services.input: $(MKDIRHIER) $(@:d) - - $(RM) $@ echo \ '$(my_components:^"":+".component")' \ > $@ diff --git a/stoc/test/uriproc/makefile.mk b/stoc/test/uriproc/makefile.mk index 84f852689..05ffd5fdd 100644 --- a/stoc/test/uriproc/makefile.mk +++ b/stoc/test/uriproc/makefile.mk @@ -74,9 +74,8 @@ $(MISC)/$(TARGET)/services.rdb .ERRREMOVE: $(SOLARENV)/bin/packcomponents.xslt \ $(XSLTPROC) --nonet --stringparam prefix $(PWD)/$(MISC)/ -o $@ \ $(SOLARENV)/bin/packcomponents.xslt $(MISC)/$(TARGET)/services.input -$(MISC)/$(TARGET)/services.input .ERRREMOVE: +$(MISC)/$(TARGET)/services.input: $(MKDIRHIER) $(@:d) - - $(RM) $@ echo \ '$(my_components:^"":+".component")' \ > $@ diff --git a/ure/source/makefile.mk b/ure/source/makefile.mk index d10e276c4..cd6fab210 100644 --- a/ure/source/makefile.mk +++ b/ure/source/makefile.mk @@ -64,8 +64,7 @@ $(MISC)/services.rdb .ERRREMOVE : $(SOLARENV)/bin/packcomponents.xslt \ $(XSLTPROC) --nonet --stringparam prefix $(SOLARXMLDIR)/ -o $@ \ $(SOLARENV)/bin/packcomponents.xslt $(MISC)/services.input -$(MISC)/services.input .ERRREMOVE : - - $(RM) $@ +$(MISC)/services.input : echo \ '$(my_components:^"":+".component")' \ > $@ -- cgit v1.2.3 From 07c1dd42867925dfec98cc724d354c9bc93cc2e4 Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 15 Sep 2010 16:35:54 +0200 Subject: sb129: #i113189# textualservices no longer associates singletons with services, adapted bootstrapInitialContext accordingly --- cppuhelper/source/servicefactory.cxx | 73 +++++++++++++------------- stoc/source/simpleregistry/textualservices.cxx | 68 ++++++++++-------------- 2 files changed, 65 insertions(+), 76 deletions(-) diff --git a/cppuhelper/source/servicefactory.cxx b/cppuhelper/source/servicefactory.cxx index d1ae7f1a9..3dcea15c7 100644 --- a/cppuhelper/source/servicefactory.cxx +++ b/cppuhelper/source/servicefactory.cxx @@ -28,13 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_cppuhelper.hxx" -#if OSL_DEBUG_LEVEL > 0 -#include -#endif #include #include "rtl/string.hxx" -#include "rtl/ustrbuf.hxx" #include "rtl/bootstrap.hxx" #include "osl/diagnose.h" #include "osl/file.h" @@ -46,6 +42,7 @@ #include "cppuhelper/servicefactory.hxx" #include "cppuhelper/bootstrap.hxx" +#include "com/sun/star/uno/DeploymentException.hpp" #include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/lang/XInitialization.hpp" #include "com/sun/star/lang/XSingleServiceFactory.hpp" @@ -64,6 +61,7 @@ using namespace ::rtl; using namespace ::osl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +namespace css = com::sun::star; namespace cppu { @@ -417,39 +415,42 @@ Reference< XComponentContext > bootstrapInitialContext( keys.getConstArray(); for ( sal_Int32 nPos = keys.getLength(); nPos--; ) { - Reference< registry::XRegistryKey > const & xKey2 = - pKeys[ nPos ]; - try - { - OUStringBuffer buf( 32 ); - buf.appendAscii( - RTL_CONSTASCII_STRINGPARAM("/singletons/") ); - buf.append( - xKey2->getKeyName().copy( - sizeof("/SINGLETONS") /* -\0 +'/' */ ) ); - entry.name = buf.makeStringAndClear(); - entry.value <<= xKey2->getStringValue(); - context_values.push_back( entry ); - } - catch (Exception & rExc) - { -#if OSL_DEBUG_LEVEL > 0 - OString aStr( - OUStringToOString( - xKey2->getKeyName().copy( 11 ), - RTL_TEXTENCODING_ASCII_US ) ); - OString aStr2( - OUStringToOString( - rExc.Message, RTL_TEXTENCODING_ASCII_US ) ); - fprintf( - stderr, - "### failed reading singleton [%s]" - " service name from registry: %s\n", - aStr.getStr(), aStr2.getStr() ); -#else - (void) rExc; // avoid warning about unused variable -#endif + css::uno::Sequence< rtl::OUString > impls( + css::uno::Reference< css::registry::XRegistryKey >( + pKeys[nPos]->openKey( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "REGISTERED_BY"))), + css::uno::UNO_SET_THROW)->getAsciiListValue()); + switch (impls.getLength()) { + case 0: + throw css::uno::DeploymentException( + (pKeys[nPos]->getKeyName() + + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "/REGISTERED_BY is empty"))), + css::uno::Reference< css::uno::XInterface >()); + case 1: + break; + default: + OSL_TRACE( + ("arbitrarily chosing \"%s\" among multiple" + " implementations for \"%s\""), + rtl::OUStringToOString( + impls[0], RTL_TEXTENCODING_UTF8).getStr(), + rtl::OUStringToOString( + pKeys[nPos]->getKeyName(), + RTL_TEXTENCODING_UTF8).getStr()); + break; } + context_values.push_back( + ContextEntry_Init( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("/singletons/")) + + pKeys[nPos]->getKeyName().copy( + RTL_CONSTASCII_LENGTH("/SINGLETONS/"))), + css::uno::makeAny(impls[0]), + true)); } } } diff --git a/stoc/source/simpleregistry/textualservices.cxx b/stoc/source/simpleregistry/textualservices.cxx index 44315b689..462007b6c 100755 --- a/stoc/source/simpleregistry/textualservices.cxx +++ b/stoc/source/simpleregistry/textualservices.cxx @@ -67,18 +67,8 @@ struct Implementation { typedef std::map< rtl::OUString, Implementation > Implementations; -struct Service { - std::vector< rtl::OUString > implementations; -}; - -typedef std::map< rtl::OUString, Service > Services; - -struct Singleton { - rtl::OUString service; - std::vector< rtl::OUString > implementations; -}; - -typedef std::map< rtl::OUString, Singleton > Singletons; +typedef std::map< rtl::OUString, std::vector< rtl::OUString > > + ImplementationMap; } @@ -86,8 +76,8 @@ class Data: public salhelper::SimpleReferenceObject, private boost::noncopyable { public: Implementations implementations; - Services services; - Singletons singletons; + ImplementationMap services; + ImplementationMap singletons; }; namespace { @@ -124,9 +114,7 @@ Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): "http://openoffice.org/2010/uno-components"))); enum State { STATE_BEGIN, STATE_END, STATE_COMPONENTS, STATE_COMPONENT_INITIAL, - STATE_COMPONENT, STATE_IMPLEMENTATION_INITIAL, - STATE_IMPLEMENTATION_SERVICE, STATE_IMPLEMENTATION_SINGLETON, - STATE_SERVICE, STATE_SINGLETON }; + STATE_COMPONENT, STATE_IMPLEMENTATION, STATE_SERVICE, STATE_SINGLETON }; for (State state = STATE_BEGIN;;) { xmlreader::Span name; int nsId; @@ -185,7 +173,7 @@ Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): name.equals(RTL_CONSTASCII_STRINGPARAM("implementation"))) { handleImplementation(); - state = STATE_IMPLEMENTATION_INITIAL; + state = STATE_IMPLEMENTATION; break; } throw css::registry::InvalidRegistryException( @@ -194,23 +182,19 @@ Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): RTL_CONSTASCII_USTRINGPARAM( ": unexpected item in "))), css::uno::Reference< css::uno::XInterface >()); - case STATE_IMPLEMENTATION_INITIAL: - case STATE_IMPLEMENTATION_SERVICE: - case STATE_IMPLEMENTATION_SINGLETON: + case STATE_IMPLEMENTATION: if (res == xmlreader::XmlReader::RESULT_END) { state = STATE_COMPONENT; break; } - if (state != STATE_IMPLEMENTATION_SINGLETON && - res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && name.equals(RTL_CONSTASCII_STRINGPARAM("service"))) { handleService(); state = STATE_SERVICE; break; } - if (state != STATE_IMPLEMENTATION_INITIAL && - res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && + if (res == xmlreader::XmlReader::RESULT_BEGIN && nsId == ucNsId && name.equals(RTL_CONSTASCII_STRINGPARAM("singleton"))) { handleSingleton(); @@ -225,7 +209,7 @@ Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): css::uno::Reference< css::uno::XInterface >()); case STATE_SERVICE: if (res == xmlreader::XmlReader::RESULT_END) { - state = STATE_IMPLEMENTATION_SERVICE; + state = STATE_IMPLEMENTATION; break; } throw css::registry::InvalidRegistryException( @@ -236,7 +220,7 @@ Parser::Parser(rtl::OUString const & uri, rtl::Reference< Data > const & data): css::uno::Reference< css::uno::XInterface >()); case STATE_SINGLETON: if (res == xmlreader::XmlReader::RESULT_END) { - state = STATE_IMPLEMENTATION_SINGLETON; + state = STATE_IMPLEMENTATION; break; } throw css::registry::InvalidRegistryException( @@ -345,15 +329,13 @@ void Parser::handleImplementation() { void Parser::handleService() { rtl::OUString name = getNameAttribute(); data_->implementations[attrImplementation_].services.push_back(name); - data_->services[name].implementations.push_back(attrImplementation_); + data_->services[name].push_back(attrImplementation_); } void Parser::handleSingleton() { rtl::OUString name = getNameAttribute(); data_->implementations[attrImplementation_].singletons.push_back(name); - data_->singletons[name].service = - data_->implementations[attrImplementation_].services[0]; - data_->singletons[name].implementations.push_back(attrImplementation_); + data_->singletons[name].push_back(attrImplementation_); } rtl::OUString Parser::getNameAttribute() { @@ -710,10 +692,10 @@ css::uno::Sequence< rtl::OUString > Key::getAsciiListValue() throw ( std::vector< rtl::OUString > const * list; switch (state) { case STATE_SERVICE: - list = &data_->services[path_[1]].implementations; + list = &data_->services[path_[1]]; break; case STATE_REGISTEREDBY: - list = &data_->singletons[path_[1]].implementations; + list = &data_->singletons[path_[1]]; break; default: throw css::registry::InvalidValueException( @@ -761,17 +743,23 @@ rtl::OUString Key::getStringValue() throw ( OSL_VERIFY(find(rtl::OUString(), 0, &state, 0)); switch (state) { case STATE_IMPLEMENTATION_SINGLETON: - return data_->implementations[path_[1]].services[0]; case STATE_SINGLETON: - return data_->singletons[path_[1]].service; - default: - throw css::registry::InvalidValueException( + throw css::registry::InvalidRegistryException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.registry.SimpleRegistry textual services key" - " getStringValue: wrong type")), + " getStringValue: does not associate singletons with" + " services")), static_cast< OWeakObject * >(this)); } + // default case extracted from switch to avoid erroneous compiler warnings + // on Solaris: + throw css::registry::InvalidValueException( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.registry.SimpleRegistry textual services key" + " getStringValue: wrong type")), + static_cast< OWeakObject * >(this)); } void Key::setStringValue(rtl::OUString const &) @@ -1163,7 +1151,7 @@ css::uno::Sequence< rtl::OUString > Key::getChildren() { css::uno::Sequence< rtl::OUString > seq( static_cast< sal_Int32 >(data_->services.size())); sal_Int32 i = 0; - for (Services::iterator j(data_->services.begin()); + for (ImplementationMap::iterator j(data_->services.begin()); j != data_->services.end(); ++j) { seq[i++] = j->first; @@ -1183,7 +1171,7 @@ css::uno::Sequence< rtl::OUString > Key::getChildren() { css::uno::Sequence< rtl::OUString > seq( static_cast< sal_Int32 >(data_->singletons.size())); sal_Int32 i = 0; - for (Singletons::iterator j(data_->singletons.begin()); + for (ImplementationMap::iterator j(data_->singletons.begin()); j != data_->singletons.end(); ++j) { seq[i++] = j->first; -- cgit v1.2.3 From edcb1e681fca71d303f615265b2cabec1e870d83 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 16 Sep 2010 09:56:55 +0200 Subject: sb129: #i113189# work around unhelpful compiler warnings --- stoc/source/simpleregistry/textualservices.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stoc/source/simpleregistry/textualservices.cxx b/stoc/source/simpleregistry/textualservices.cxx index 462007b6c..932c63912 100755 --- a/stoc/source/simpleregistry/textualservices.cxx +++ b/stoc/source/simpleregistry/textualservices.cxx @@ -751,6 +751,8 @@ rtl::OUString Key::getStringValue() throw ( " getStringValue: does not associate singletons with" " services")), static_cast< OWeakObject * >(this)); + default: + break; } // default case extracted from switch to avoid erroneous compiler warnings // on Solaris: -- cgit v1.2.3 From 2bf7395cc5af00e02e1057a1a58490e1362f7ac5 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 16 Sep 2010 11:00:47 +0200 Subject: sb129: #i113189# adjusted comments --- xmlreader/source/xmlreader.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmlreader/source/xmlreader.cxx b/xmlreader/source/xmlreader.cxx index 6c852605b..27350a8f0 100644 --- a/xmlreader/source/xmlreader.cxx +++ b/xmlreader/source/xmlreader.cxx @@ -133,7 +133,7 @@ int XmlReader::registerNamespaceIri(Span const & iri) { // declaring a corresponding namespace binding, see issue 77174; reading // those files during migration would fail without this hack that can be // removed once migration is no longer relevant (see - // Components::parseModificationLayer): + // configmgr::Components::parseModificationLayer): namespaces_.push_back( NamespaceData(Span(RTL_CONSTASCII_STRINGPARAM("xsi")), id)); } -- cgit v1.2.3 From 1de218111cf1b814d939e810264895c004fe3bf9 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Thu, 16 Sep 2010 14:25:54 +0200 Subject: dba34a: #i111148# do not call setPropertyValue from within setFastPropertyValue_NoBroadcast, this is prone to deadlocks. Instead, use the newly introduced setDependentFastPropertyValue, which postpones the notifications to a more appropriate point in time --- cppuhelper/inc/cppuhelper/propshlp.hxx | 35 ++++++++++- cppuhelper/source/cc5_solaris_sparc.map | 6 ++ cppuhelper/source/gcc3.map | 6 ++ cppuhelper/source/msvc_win32_intel.map | 6 ++ cppuhelper/source/propshlp.cxx | 105 +++++++++++++++++++++++++++++--- 5 files changed, 149 insertions(+), 9 deletions(-) diff --git a/cppuhelper/inc/cppuhelper/propshlp.hxx b/cppuhelper/inc/cppuhelper/propshlp.hxx index 61c8a2269..ea9a13877 100644 --- a/cppuhelper/inc/cppuhelper/propshlp.hxx +++ b/cppuhelper/inc/cppuhelper/propshlp.hxx @@ -595,6 +595,29 @@ protected: ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const = 0; + /** sets an dependent property's value + +

Sometimes setting a given property needs to implicitly modify another property's value. Calling |setPropertyValue| + from within |setFastPropertyValue_NoBroadcast| is not an option here, as it would notify the property listeners + while our mutex is still locked. Setting the dependent property's value directly (e.g. by calling |setFastPropertyValue_NoBroadcast| + recursively) is not an option, too, since it would miss firing the property change event.

+ +

So, in such cases, you use |setDependentFastPropertyValue| from within |setFastPropertyValue_NoBroadcast|. + It will convert and actually set the property value (invoking |convertFastPropertyValue| and |setFastPropertyValue_NoBroadcast| + for the given handle and value), and add the property change event to the list of events to be notified + when the bottom-most |setFastPropertyValue_NoBroadcast| on the stack returns.

+ +

Note: The method will not invoke veto listeners for the property.

+ +

Note: It's the caller's responsibility to ensure that our mutex is locked. This is + canonically given when the method is invoked from within |setFastPropertyValue_NoBroadcast|, in other + contexts, you might need to take own measures.

+ */ + void setDependentFastPropertyValue( + sal_Int32 i_handle, + const ::com::sun::star::uno::Any& i_value + ); + /** The common data of a broadcaster. Use the mutex, disposing state and the listener container. */ OBroadcastHelper &rBHelper; /** @@ -610,12 +633,22 @@ protected: /** reserved for future use. finally, the future has arrived... */ - const std::auto_ptr m_pReserved; + const std::auto_ptr m_pReserved; private: OPropertySetHelper( const OPropertySetHelper & ) SAL_THROW( () ); OPropertySetHelper & operator = ( const OPropertySetHelper & ) SAL_THROW( () ); + /** notifies the given changes in property's values, plus all property changes collected during recent + |setDependentFastPropertyValue| calls. + */ + void impl_fireAll( + sal_Int32* i_handles, + const ::com::sun::star::uno::Any * i_newValues, + const ::com::sun::star::uno::Any * i_oldValues, + sal_Int32 i_count + ); + public: // Suppress warning about virtual functions but non-virtual destructor: #if defined __GNUC__ diff --git a/cppuhelper/source/cc5_solaris_sparc.map b/cppuhelper/source/cc5_solaris_sparc.map index 090f8a1cc..2202d6fa8 100755 --- a/cppuhelper/source/cc5_solaris_sparc.map +++ b/cppuhelper/source/cc5_solaris_sparc.map @@ -387,3 +387,9 @@ UDK_3.7 { # OOo 3.3 __1cDcomDsunEstarDunoTWeakReferenceHelperFclear6M_v_; __1cEcppubHcreateOneInstanceComponentFactory6FpFrknDcomDsunEstarDunoJReference4n0ERXComponentContext____n0EJReference4n0EKXInterface___rknDrtlIOUString_rkn0EISequence4n0K___pnQ_rtl_ModuleCount__n0EJReference4n0DElangXXSingleComponentFactory____; } UDK_3.6; + +UDK_3.8 { # OOo 3.4 + global: + __1cEcppuSOPropertySetHelperbDsetDependentFastPropertyValue6MklrknDcomDsunEstarDunoDAny__v_; +} UDK_3.7; + diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map index 88e58df65..f842854e2 100644 --- a/cppuhelper/source/gcc3.map +++ b/cppuhelper/source/gcc3.map @@ -382,3 +382,9 @@ UDK_3.6 { # OOo 3.3 _ZN4cppu33createOneInstanceComponentFactoryEPFN3com3sun4star3uno9ReferenceINS3_10XInterfaceEEERKNS4_INS3_17XComponentContextEEEERKN3rtl8OUStringERKNS3_8SequenceISE_EEP16_rtl_ModuleCount; } UDK_3.5; + +UDK_3.7 { # OOo 3.4 + global: + _ZN4cppu18OPropertySetHelper29setDependentFastPropertyValueElRKN3com3sun4star3uno3AnyE; +} UDK_3.6; + diff --git a/cppuhelper/source/msvc_win32_intel.map b/cppuhelper/source/msvc_win32_intel.map index 6d5a491ab..7069276e2 100644 --- a/cppuhelper/source/msvc_win32_intel.map +++ b/cppuhelper/source/msvc_win32_intel.map @@ -278,3 +278,9 @@ UDK_3.6 { # OOo 3.3 ?clear@WeakReferenceHelper@uno@star@sun@com@@QAAXXZ; ?createOneInstanceComponentFactory@cppu@@YA?AV?$Reference@VXSingleComponentFactory@lang@star@sun@com@@@uno@star@sun@com@@P6A?AV?$Reference@VXInterface@uno@star@sun@com@@@3456@ABV?$Reference@VXComponentContext@uno@star@sun@com@@@3456@@ZABVOUString@rtl@@ABV?$Sequence@VOUString@rtl@@@3456@PAU_rtl_ModuleCount@@@Z; } UDK_3.5; + +UDK_3.7 { # OOo 3.4 + global: + ?setDependentFastPropertyValue@OPropertySetHelper@cppu@@IAEXJABVAny@uno@star@sun@com@@@Z; +} UDK_3.6; + diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx index eb71723e1..fc45ccf89 100644 --- a/cppuhelper/source/propshlp.cxx +++ b/cppuhelper/source/propshlp.cxx @@ -32,6 +32,7 @@ #include "cppuhelper/implbase1.hxx" #include "cppuhelper/weak.hxx" #include "cppuhelper/propshlp.hxx" +#include "cppuhelper/exc_hlp.hxx" #include "com/sun/star/beans/PropertyAttribute.hpp" #include "com/sun/star/lang/DisposedException.hpp" @@ -144,15 +145,20 @@ sal_Bool OPropertySetHelperInfo_Impl::hasPropertyByName( const OUString & Proper class OPropertySetHelper::Impl { public: - Impl ( bool i_bIgnoreRuntimeExceptionsWhileFiring, - IEventNotificationHook *i_pFireEvents) - : m_bIgnoreRuntimeExceptionsWhileFiring( - i_bIgnoreRuntimeExceptionsWhileFiring ), - m_pFireEvents( i_pFireEvents ) - { } + Impl( bool i_bIgnoreRuntimeExceptionsWhileFiring, + IEventNotificationHook *i_pFireEvents + ) + :m_bIgnoreRuntimeExceptionsWhileFiring( i_bIgnoreRuntimeExceptionsWhileFiring ) + ,m_pFireEvents( i_pFireEvents ) + { + } bool m_bIgnoreRuntimeExceptionsWhileFiring; class IEventNotificationHook * const m_pFireEvents; + + ::std::vector< sal_Int32 > m_handles; + ::std::vector< Any > m_newValues; + ::std::vector< Any > m_oldValues; }; @@ -432,6 +438,57 @@ void OPropertySetHelper::removeVetoableChangeListener( } } +void OPropertySetHelper::setDependentFastPropertyValue( sal_Int32 i_handle, const ::com::sun::star::uno::Any& i_value ) +{ + //OSL_PRECOND( rBHelper.rMutex.isAcquired(), "OPropertySetHelper::setDependentFastPropertyValue: to be called with a locked mutex only!" ); + // there is no such thing as Mutex.isAcquired, sadly ... + + sal_Int16 nAttributes(0); + IPropertyArrayHelper& rInfo = getInfoHelper(); + if ( !rInfo.fillPropertyMembersByHandle( NULL, &nAttributes, i_handle ) ) + // unknown property + throw UnknownPropertyException(); + + // no need to check for READONLY-ness of the property. The method is intended to be called internally, which + // implies it might be invoked for properties which are read-only to the instance's clients, but well allowed + // to change their value. + + Any aConverted, aOld; + sal_Bool bChanged = convertFastPropertyValue( aConverted, aOld, i_handle, i_value ); + if ( !bChanged ) + return; + + // don't fire vetoable events. This method is called with our mutex locked, so calling into listeners would not be + // a good idea. The caler is responsible for not invoking this for constrained properties. + OSL_ENSURE( ( nAttributes & PropertyAttribute::CONSTRAINED ) == 0, + "OPropertySetHelper::setDependentFastPropertyValue: not to be used for constrained properties!" ); + (void)nAttributes; + + // actually set the new value + try + { + setFastPropertyValue_NoBroadcast( i_handle, aConverted ); + } + catch (const UnknownPropertyException& ) { throw; /* allowed to leave */ } + catch (const PropertyVetoException& ) { throw; /* allowed to leave */ } + catch (const IllegalArgumentException& ) { throw; /* allowed to leave */ } + catch (const WrappedTargetException& ) { throw; /* allowed to leave */ } + catch (const RuntimeException& ) { throw; /* allowed to leave */ } + catch (const Exception& ) + { + // not allowed to leave this meathod + WrappedTargetException aWrapped; + aWrapped.TargetException <<= ::cppu::getCaughtException(); + aWrapped.Context = static_cast< XPropertySet* >( this ); + throw aWrapped; + } + + // remember the handle/values, for the events to be fired later + m_pReserved->m_handles.push_back( i_handle ); + m_pReserved->m_newValues.push_back( aConverted ); // TODO: setFastPropertyValue notifies the unconverted value here ...? + m_pReserved->m_oldValues.push_back( aOld ); +} + // XFastPropertySet void OPropertySetHelper::setFastPropertyValue( sal_Int32 nHandle, const Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, @@ -498,7 +555,7 @@ void OPropertySetHelper::setFastPropertyValue( sal_Int32 nHandle, const Any& rVa // release guard to fire events } // file a change event, if the value changed - fire( &nHandle, &rValue, &aOldVal, 1, sal_False ); + impl_fireAll( &nHandle, &rValue, &aOldVal, 1 ); } } @@ -520,6 +577,38 @@ Any OPropertySetHelper::getFastPropertyValue( sal_Int32 nHandle ) return aRet; } +//-------------------------------------------------------------------------- +void OPropertySetHelper::impl_fireAll( sal_Int32* i_handles, const Any* i_newValues, const Any* i_oldValues, sal_Int32 i_count ) +{ + ClearableMutexGuard aGuard( rBHelper.rMutex ); + if ( m_pReserved->m_handles.empty() ) + { + aGuard.clear(); + fire( i_handles, i_newValues, i_oldValues, i_count, sal_False ); + return; + } + + const size_t additionalEvents = m_pReserved->m_handles.size(); + OSL_ENSURE( additionalEvents == m_pReserved->m_newValues.size() + && additionalEvents == m_pReserved->m_oldValues.size(), + "OPropertySetHelper::impl_fireAll: inconsistency!" ); + + ::std::vector< sal_Int32 > allHandles( additionalEvents + i_count ); + ::std::copy( m_pReserved->m_handles.begin(), m_pReserved->m_handles.end(), allHandles.begin() ); + ::std::copy( i_handles, i_handles + i_count, allHandles.begin() + additionalEvents ); + + ::std::vector< Any > allNewValues( additionalEvents + i_count ); + ::std::copy( m_pReserved->m_newValues.begin(), m_pReserved->m_newValues.end(), allNewValues.begin() ); + ::std::copy( i_newValues, i_newValues + i_count, allNewValues.begin() + additionalEvents ); + + ::std::vector< Any > allOldValues( additionalEvents + i_count ); + ::std::copy( m_pReserved->m_oldValues.begin(), m_pReserved->m_oldValues.end(), allOldValues.begin() ); + ::std::copy( i_oldValues, i_oldValues + i_count, allOldValues.begin() + additionalEvents ); + + aGuard.clear(); + fire( &allHandles[0], &allNewValues[0], &allOldValues[0], additionalEvents + i_count, sal_False ); +} + //-------------------------------------------------------------------------- void OPropertySetHelper::fire ( @@ -803,7 +892,7 @@ void OPropertySetHelper::setFastPropertyValues( } // fire change events - fire( pHandles, pConvertedValues, pOldValues, n, sal_False ); + impl_fireAll( pHandles, pConvertedValues, pOldValues, n ); } catch( ... ) { -- cgit v1.2.3 From bc5710036f1c19213bd6ce1f9f76b9deb8294145 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 16 Sep 2010 17:42:11 +0200 Subject: sb123: #i113005# fixed test code for MinGW --- sal/qa/OStringBuffer/rtl_OStringBuffer.cxx | 30 +++++------------------------- sal/qa/OStringBuffer/rtl_String_Const.h | 6 +----- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx index 2b091f440..bdbd41bc2 100644 --- a/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx +++ b/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx @@ -14789,11 +14789,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix, { ::rtl::OStringBuffer aStrBuf( *arrOUS[0] ); OString expVal( kTestStr116 ); -#if defined(UNX) || defined(OS2) - sal_Int64 input = 9223372036854775807LL; -#else - sal_Int64 input = 9223372036854775807; -#endif + sal_Int64 input = SAL_CONST_INT64(9223372036854775807); aStrBuf.append( input ); CPPUNIT_ASSERT_MESSAGE @@ -14873,11 +14869,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix, { ::rtl::OStringBuffer aStrBuf( *arrOUS[1] ); OString expVal( kTestStr118 ); -#if defined(UNX) || defined(OS2) - sal_Int64 input = 9223372036854775807LL; -#else - sal_Int64 input = 9223372036854775807; -#endif + sal_Int64 input = SAL_CONST_INT64(9223372036854775807); aStrBuf.append( input ); CPPUNIT_ASSERT_MESSAGE @@ -14956,11 +14948,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix, { ::rtl::OStringBuffer aStrBuf( *arrOUS[2] ); OString expVal( kTestStr118 ); -#if defined(UNX) || defined(OS2) - sal_Int64 input = 9223372036854775807LL; -#else - sal_Int64 input = 9223372036854775807; -#endif + sal_Int64 input = SAL_CONST_INT64(9223372036854775807); aStrBuf.append( input ); CPPUNIT_ASSERT_MESSAGE @@ -15039,11 +15027,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix, { ::rtl::OStringBuffer aStrBuf( *arrOUS[3] ); OString expVal( kTestStr118 ); -#if defined(UNX) || defined(OS2) - sal_Int64 input = 9223372036854775807LL; -#else - sal_Int64 input = 9223372036854775807; -#endif + sal_Int64 input = SAL_CONST_INT64(9223372036854775807); aStrBuf.append( input ); CPPUNIT_ASSERT_MESSAGE @@ -15122,11 +15106,7 @@ sal_Bool test_append( const char** resArray, int n, sal_Int16 radix, { ::rtl::OStringBuffer aStrBuf( *arrOUS[4] ); OString expVal( kTestStr120 ); -#if defined(UNX) || defined(OS2) - sal_Int64 input = 9223372036854775807LL; -#else - sal_Int64 input = 9223372036854775807; -#endif + sal_Int64 input = SAL_CONST_INT64(9223372036854775807); aStrBuf.append( input ); CPPUNIT_ASSERT_MESSAGE diff --git a/sal/qa/OStringBuffer/rtl_String_Const.h b/sal/qa/OStringBuffer/rtl_String_Const.h index dc905ac60..0c058273c 100644 --- a/sal/qa/OStringBuffer/rtl_String_Const.h +++ b/sal/qa/OStringBuffer/rtl_String_Const.h @@ -357,11 +357,7 @@ static const sal_Int16 kSInt16Max = SHRT_MAX; static const sal_Int32 kUInt16Max = USHRT_MAX; static const sal_Int32 kSInt32Max = INT_MAX; static const sal_Int64 kUInt32Max = UINT_MAX; -#if defined(UNX) || defined(OS2) -static const sal_Int64 kSInt64Max = 9223372036854775807LL; -#else -static const sal_Int64 kSInt64Max = 9223372036854775807; -#endif +static const sal_Int64 kSInt64Max = SAL_CONST_INT64(9223372036854775807); //------------------------------------------------------------------------ -- cgit v1.2.3 From 2782beef38b449a8d54a3361709b3452ea754db1 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Fri, 17 Sep 2010 07:47:49 +0200 Subject: dba34a: impl_fireAll: oops ... don't forget to reset handles/newValues/oldValues ... --- cppuhelper/source/propshlp.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx index fc45ccf89..b0a41bb40 100644 --- a/cppuhelper/source/propshlp.cxx +++ b/cppuhelper/source/propshlp.cxx @@ -605,6 +605,10 @@ void OPropertySetHelper::impl_fireAll( sal_Int32* i_handles, const Any* i_newVal ::std::copy( m_pReserved->m_oldValues.begin(), m_pReserved->m_oldValues.end(), allOldValues.begin() ); ::std::copy( i_oldValues, i_oldValues + i_count, allOldValues.begin() + additionalEvents ); + m_pReserved->m_handles.clear(); + m_pReserved->m_newValues.clear(); + m_pReserved->m_oldValues.clear(); + aGuard.clear(); fire( &allHandles[0], &allNewValues[0], &allOldValues[0], additionalEvents + i_count, sal_False ); } -- cgit v1.2.3 From b9669e463f2e3a18f53a1f911dfc91c96fee265e Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Mon, 20 Sep 2010 11:00:07 +0200 Subject: dba34a: corrected identified in map file --- cppuhelper/source/cc5_solaris_sparc.map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cppuhelper/source/cc5_solaris_sparc.map b/cppuhelper/source/cc5_solaris_sparc.map index 2202d6fa8..6d4c9e6ce 100755 --- a/cppuhelper/source/cc5_solaris_sparc.map +++ b/cppuhelper/source/cc5_solaris_sparc.map @@ -390,6 +390,6 @@ UDK_3.7 { # OOo 3.3 UDK_3.8 { # OOo 3.4 global: - __1cEcppuSOPropertySetHelperbDsetDependentFastPropertyValue6MklrknDcomDsunEstarDunoDAny__v_; + __1cEcppuSOPropertySetHelperbDsetDependentFastPropertyValue6MlrknDcomDsunEstarDunoDAny__v_; } UDK_3.7; -- cgit v1.2.3 From 58d4ab9b5b7fa9716e6a03cd8108b6b7153c11a3 Mon Sep 17 00:00:00 2001 From: sb Date: Tue, 21 Sep 2010 09:10:04 +0200 Subject: sb123: #i114635# handle non-UNO exceptions in C++ UNO bridge, for unxlngx6, rest to follow --- .../source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx | 49 ++++++++++++++++++---- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx index 37fab3d8b..d2c8f3312 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx @@ -28,10 +28,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_bridges.hxx" +#include +#include #include #include #include -#include + +#include "rtl/alloc.h" +#include "rtl/ustrbuf.hxx" #include #include "com/sun/star/uno/RuntimeException.hpp" @@ -237,6 +241,18 @@ static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex, //================================================================================================== +namespace { + +void appendCString(OUStringBuffer & buffer, char const * text) { + if (text != 0) { + buffer.append( + OStringToOUString(OString(text), RTL_TEXTENCODING_ISO_8859_1)); + // use 8859-1 to avoid conversion failure + } +} + +} + static void cpp_call( bridges::cpp_uno::shared::UnoInterfaceProxy * pThis, bridges::cpp_uno::shared::VtableSlot aVtableSlot, @@ -369,12 +385,31 @@ static void cpp_call( try { - callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeRef, bSimpleReturn, - pStackStart, ( pStack - pStackStart ), - pGPR, nGPR, - pFPR, nFPR ); + try { + callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeRef, bSimpleReturn, + pStackStart, ( pStack - pStackStart ), + pGPR, nGPR, + pFPR, nFPR ); + } catch (Exception &) { + throw; + } catch (std::exception & e) { + OUStringBuffer buf; + buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("C++ code threw ")); + appendCString(buf, typeid(e).name()); + buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(": ")); + appendCString(buf, e.what()); + throw RuntimeException( + buf.makeStringAndClear(), Reference< XInterface >()); + } catch (...) { + throw RuntimeException( + OUString( + RTL_CONSTASCII_USTRINGPARAM( + "C++ code threw unknown exception")), + Reference< XInterface >()); + } + // NO exception occured... *ppUnoExc = 0; -- cgit v1.2.3 From 32a3114fb0773916637238caf213763684d7fe2c Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 23 Sep 2010 16:09:13 +0200 Subject: sb132: #i114145# removed unused TESTDIR and NO_TESTS --- sal/qa/OStringBuffer/makefile.mk | 2 -- sal/qa/osl/process/makefile.mk | 2 -- sal/qa/osl/profile/makefile.mk | 1 - sal/qa/rtl/alloc/makefile.mk | 2 -- sal/qa/rtl/crc32/makefile.mk | 2 -- sal/qa/rtl/digest/makefile.mk | 2 -- sal/qa/rtl/doublelock/makefile.mk | 2 -- sal/qa/rtl/locale/makefile.mk | 2 -- sal/qa/rtl/math/makefile.mk | 2 -- sal/qa/rtl/random/makefile.mk | 2 -- sal/qa/rtl_strings/makefile.mk | 1 - 11 files changed, 20 deletions(-) diff --git a/sal/qa/OStringBuffer/makefile.mk b/sal/qa/OStringBuffer/makefile.mk index d46168dc4..e0c1a81d6 100644 --- a/sal/qa/OStringBuffer/makefile.mk +++ b/sal/qa/OStringBuffer/makefile.mk @@ -33,8 +33,6 @@ PRJ=..$/.. PRJNAME=sal TARGET=qa_ostringbuffer -# this is removed at the moment because we need some enhancements -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE diff --git a/sal/qa/osl/process/makefile.mk b/sal/qa/osl/process/makefile.mk index 6bbee03b6..e113ac86e 100644 --- a/sal/qa/osl/process/makefile.mk +++ b/sal/qa/osl/process/makefile.mk @@ -28,8 +28,6 @@ PRJ=..$/..$/.. PRJNAME=sal TARGET=qa_osl_process -# this is removed at the moment because we need some enhancements -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE diff --git a/sal/qa/osl/profile/makefile.mk b/sal/qa/osl/profile/makefile.mk index a95db211c..67ad60057 100644 --- a/sal/qa/osl/profile/makefile.mk +++ b/sal/qa/osl/profile/makefile.mk @@ -33,7 +33,6 @@ PRJ=..$/..$/.. PRJNAME=sal TARGET=qa_osl_profile -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE diff --git a/sal/qa/rtl/alloc/makefile.mk b/sal/qa/rtl/alloc/makefile.mk index 37ae3718b..db4f01eb4 100755 --- a/sal/qa/rtl/alloc/makefile.mk +++ b/sal/qa/rtl/alloc/makefile.mk @@ -28,8 +28,6 @@ PRJ=..$/..$/.. PRJNAME=sal TARGET=qa_rtl_alloc -# this is removed at the moment because we need some enhancements -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE diff --git a/sal/qa/rtl/crc32/makefile.mk b/sal/qa/rtl/crc32/makefile.mk index 6bd3bd89d..704c149d4 100755 --- a/sal/qa/rtl/crc32/makefile.mk +++ b/sal/qa/rtl/crc32/makefile.mk @@ -28,8 +28,6 @@ PRJ=..$/..$/.. PRJNAME=sal TARGET=qa_rtl_crc32 -# this is removed at the moment because we need some enhancements -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE diff --git a/sal/qa/rtl/digest/makefile.mk b/sal/qa/rtl/digest/makefile.mk index 415183b7e..7798004ed 100644 --- a/sal/qa/rtl/digest/makefile.mk +++ b/sal/qa/rtl/digest/makefile.mk @@ -29,8 +29,6 @@ INCPRE+= $(PRJ)$/qa$/inc PRJNAME=sal TARGET=rtl_digest -# this is removed at the moment because we need some enhancements -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE diff --git a/sal/qa/rtl/doublelock/makefile.mk b/sal/qa/rtl/doublelock/makefile.mk index b13ccf420..45259fd3c 100644 --- a/sal/qa/rtl/doublelock/makefile.mk +++ b/sal/qa/rtl/doublelock/makefile.mk @@ -28,8 +28,6 @@ PRJ=..$/..$/.. PRJNAME=sal TARGET=qa_rtl_doublelock -# this is removed at the moment because we need some enhancements -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE diff --git a/sal/qa/rtl/locale/makefile.mk b/sal/qa/rtl/locale/makefile.mk index 329769b5d..d6c9c6b67 100644 --- a/sal/qa/rtl/locale/makefile.mk +++ b/sal/qa/rtl/locale/makefile.mk @@ -28,8 +28,6 @@ PRJ=..$/..$/.. PRJNAME=sal TARGET=qa_rtl_locale -# this is removed at the moment because we need some enhancements -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE diff --git a/sal/qa/rtl/math/makefile.mk b/sal/qa/rtl/math/makefile.mk index 3b35e52ab..deb2a7939 100644 --- a/sal/qa/rtl/math/makefile.mk +++ b/sal/qa/rtl/math/makefile.mk @@ -29,8 +29,6 @@ INCPRE+= $(PRJ)$/qa$/inc PRJNAME=sal TARGET=rtl_math -# this is removed at the moment because we need some enhancements -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE diff --git a/sal/qa/rtl/random/makefile.mk b/sal/qa/rtl/random/makefile.mk index cd57ec9bc..ef8616a90 100644 --- a/sal/qa/rtl/random/makefile.mk +++ b/sal/qa/rtl/random/makefile.mk @@ -28,8 +28,6 @@ PRJ=..$/..$/.. PRJNAME=sal TARGET=qa_rtl_random -# this is removed at the moment because we need some enhancements -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE diff --git a/sal/qa/rtl_strings/makefile.mk b/sal/qa/rtl_strings/makefile.mk index 387f0675a..708a41a87 100644 --- a/sal/qa/rtl_strings/makefile.mk +++ b/sal/qa/rtl_strings/makefile.mk @@ -28,7 +28,6 @@ PRJ=..$/.. PRJNAME=sal TARGET=qa_rtl_strings -# TESTDIR=TRUE ENABLE_EXCEPTIONS=TRUE -- cgit v1.2.3 From 68489f64ea9a2510700ac109090e909aac452508 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 23 Sep 2010 16:35:55 +0200 Subject: sb132: #i113211# correctly pass char* to %s --- sal/systools/win32/kill/kill.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sal/systools/win32/kill/kill.cxx b/sal/systools/win32/kill/kill.cxx index 0273f300b..b67518753 100644 --- a/sal/systools/win32/kill/kill.cxx +++ b/sal/systools/win32/kill/kill.cxx @@ -272,7 +272,7 @@ static void ParseCommandArgs( LPDWORD lpProcesses, LPDWORD lpdwNumProcesses, int { for ( int n = 0; n < NumSupportedSignals; n++ ) { - _tprintf( _T("%s "), SupportedSignals[n] ); + _tprintf( _T("%s "), SupportedSignals[n].lpSignalName ); } _tprintf( _T("\n") ); ExitProcess( 0 ); -- cgit v1.2.3 From af494e58926d415b01b2dc2c92f8363946da0891 Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Tue, 28 Sep 2010 14:40:28 +0200 Subject: fwk149: #i106591# do not use mmap to copy files --- sal/osl/unx/file_misc.cxx | 57 +++++++++-------------------------------------- 1 file changed, 11 insertions(+), 46 deletions(-) diff --git a/sal/osl/unx/file_misc.cxx b/sal/osl/unx/file_misc.cxx index 95141420e..708b01d3c 100644 --- a/sal/osl/unx/file_misc.cxx +++ b/sal/osl/unx/file_misc.cxx @@ -1022,66 +1022,31 @@ static int oslDoCopyFile(const sal_Char* pszSourceFileName, const sal_Char* pszD return nRet; } - /* HACK: because memory mapping fails on various - platforms if the size of the source file is 0 byte */ - if (0 == nSourceSize) - { - close(SourceFileFD); - close(DestFileFD); - return 0; - } - - // read and lseek are used to check the possibility to access the data - // not a nice solution, but it allows to avoid a crash in case it is an opened samba file - // generally, reading of one byte should not affect the performance - char nCh; - if ( 1 != read( SourceFileFD, &nCh, 1 ) - || -1 == lseek( SourceFileFD, 0, SEEK_SET ) ) - { - nRet = errno; - close( SourceFileFD ); - close( DestFileFD ); - return nRet; - } - size_t nWritten = 0; size_t nRemains = nSourceSize; - /* mmap file -- open dest file -- write -- fsync it at the end */ - void* pSourceFile = mmap( 0, nSourceSize, PROT_READ, MAP_SHARED, SourceFileFD, 0 ); - if ( pSourceFile != MAP_FAILED ) - { - nWritten = write( DestFileFD, pSourceFile, nSourceSize ); - nRemains -= nWritten; - munmap( (char*)pSourceFile, nSourceSize ); - } - if ( nRemains ) { /* mmap has problems, try the direct streaming */ - char pBuffer[32000]; + char pBuffer[0x8000]; size_t nRead = 0; nRemains = nSourceSize; - if ( -1 != lseek( SourceFileFD, 0, SEEK_SET ) - && -1 != lseek( DestFileFD, 0, SEEK_SET ) ) + do { - do - { - nRead = 0; - nWritten = 0; + nRead = 0; + nWritten = 0; - size_t nToRead = std::min( (size_t)32000, nRemains ); - nRead = read( SourceFileFD, pBuffer, nToRead ); - if ( (size_t)-1 != nRead ) - nWritten = write( DestFileFD, pBuffer, nRead ); + size_t nToRead = std::min( (size_t)0x8000, nRemains ); + nRead = read( SourceFileFD, pBuffer, nToRead ); + if ( (size_t)-1 != nRead ) + nWritten = write( DestFileFD, pBuffer, nRead ); - if ( (size_t)-1 != nWritten ) - nRemains -= nWritten; - } - while( nRemains && (size_t)-1 != nRead && nRead == nWritten ); + if ( (size_t)-1 != nWritten ) + nRemains -= nWritten; } + while( nRemains && (size_t)-1 != nRead && nRead == nWritten ); } if ( nRemains ) -- cgit v1.2.3 From b79c9285a5c28237367d91214b567face76df206 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Mon, 18 Oct 2010 14:50:08 +0200 Subject: #i114924# --- stoc/prj/build.lst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stoc/prj/build.lst b/stoc/prj/build.lst index b671e0a62..256f09474 100644 --- a/stoc/prj/build.lst +++ b/stoc/prj/build.lst @@ -1,4 +1,4 @@ -tc stoc : rdbmaker cppuhelper cppu jvmaccess sal salhelper jvmfwk xmlreader NULL +tc stoc : rdbmaker cppuhelper cppu jvmaccess sal salhelper jvmfwk xmlreader LIBXSTL:libxslt NULL tc stoc usr1 - all tc_mkout NULL tc stoc\inc nmake - all tc_inc NULL tc stoc\source\defaultregistry nmake - all tc_defr tc_boot tc_inc NULL -- cgit v1.2.3 From 33deb5b2f43e189cb2d98bce2331597250e6b218 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Tue, 19 Oct 2010 14:40:18 +0200 Subject: #i100000# new name for parameter to prevent hiding variables --- sal/inc/rtl/malformeduriexception.hxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sal/inc/rtl/malformeduriexception.hxx b/sal/inc/rtl/malformeduriexception.hxx index 4a5bfbe85..5d824c3bf 100644 --- a/sal/inc/rtl/malformeduriexception.hxx +++ b/sal/inc/rtl/malformeduriexception.hxx @@ -53,8 +53,8 @@ public: inline SAL_EXCEPTION_DLLPRIVATE ~MalformedUriException() {} inline SAL_EXCEPTION_DLLPRIVATE MalformedUriException operator =( - MalformedUriException const & other) - { m_aMessage = other.m_aMessage; return *this; } + MalformedUriException const & rOther) + { m_aMessage = rOther.m_aMessage; return *this; } /** Get the message. -- cgit v1.2.3 From 06a5ed97b8ccff99b13cee8a101881b10216fba1 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Thu, 21 Oct 2010 16:14:09 +0200 Subject: jl162 #i115180# OOo does not find VM runtime library of Java 1.6.0_22 on Mac --- jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx b/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx index 352c13c3c..4a607a071 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx @@ -73,7 +73,8 @@ char const* const* OtherInfo::getRuntimePaths(int * size) "/bin/hotspot/jvm.dll" #elif UNX #ifdef MACOSX - "/../../../JavaVM" + "/../../../JavaVM", + "/../../../../../Frameworks/JavaVM.framework/JavaVM" //as of 1.6.0_22 #else "/lib/" JFW_PLUGIN_ARCH "/client/libjvm.so", // for Blackdown PPC "/lib/" JFW_PLUGIN_ARCH "/server/libjvm.so", // for Blackdown AMD64 -- cgit v1.2.3 From a32ae91a521b5b2d60c7d6ff80428f05967b72f0 Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 25 Oct 2010 14:56:00 +0200 Subject: sb132: #i113212# support x-iscii-de (based on a patch by cmc) --- sal/textenc/convertiscii.tab | 2 +- sal/textenc/tencinfo.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sal/textenc/convertiscii.tab b/sal/textenc/convertiscii.tab index 713309df3..891ee8369 100644 --- a/sal/textenc/convertiscii.tab +++ b/sal/textenc/convertiscii.tab @@ -108,5 +108,5 @@ static ImplTextEncodingData const aImplIsciiDevanagariTextEncodingData 1, 1, NULL, - NULL, + "x-iscii-de", RTL_TEXTENCODING_INFO_ASCII }; diff --git a/sal/textenc/tencinfo.c b/sal/textenc/tencinfo.c index 4e8bf7c06..e05f08f86 100644 --- a/sal/textenc/tencinfo.c +++ b/sal/textenc/tencinfo.c @@ -910,6 +910,9 @@ rtl_TextEncoding SAL_CALL rtl_getTextEncodingFromMimeCharset( const sal_Char* pM { "csptcp154", RTL_TEXTENCODING_PT154 }, { "pt154", RTL_TEXTENCODING_PT154 }, { "cp154", RTL_TEXTENCODING_PT154 }, + { "xisciide", RTL_TEXTENCODING_ISCII_DEVANAGARI }, + /* This is no official MIME character set name, but is in use by + various windows APIs. */ { NULL, RTL_TEXTENCODING_DONTKNOW } }; @@ -1072,6 +1075,7 @@ rtl_getTextEncodingFromWindowsCodePage(sal_uInt32 nCodePage) case 51932: return RTL_TEXTENCODING_EUC_JP; case 51936: return RTL_TEXTENCODING_EUC_CN; case 51949: return RTL_TEXTENCODING_EUC_KR; + case 57002: return RTL_TEXTENCODING_ISCII_DEVANAGARI; case 65000: return RTL_TEXTENCODING_UTF7; case 65001: return RTL_TEXTENCODING_UTF8; default: return RTL_TEXTENCODING_DONTKNOW; @@ -1147,6 +1151,7 @@ rtl_getWindowsCodePageFromTextEncoding(rtl_TextEncoding nEncoding) case RTL_TEXTENCODING_EUC_JP: return 51932; case RTL_TEXTENCODING_EUC_CN: return 51936; case RTL_TEXTENCODING_EUC_KR: return 51949; + case RTL_TEXTENCODING_ISCII_DEVANAGARI: return 57002; case RTL_TEXTENCODING_UTF7: return 65000; case RTL_TEXTENCODING_UTF8: return 65001; default: return 0; -- cgit v1.2.3 From b0689581ddb5bdb1cd25fb464858a2e8d8c716da Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 25 Oct 2010 15:37:14 +0200 Subject: sb132: #i112448# proper clean up in JobQueue::enter (patch by olistraub) --- cppu/source/threadpool/jobqueue.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cppu/source/threadpool/jobqueue.cxx b/cppu/source/threadpool/jobqueue.cxx index 4f83261c9..338a94cf2 100644 --- a/cppu/source/threadpool/jobqueue.cxx +++ b/cppu/source/threadpool/jobqueue.cxx @@ -98,6 +98,10 @@ namespace cppu_threadpool { if( 0 == m_lstCallstack.front() ) { // disposed ! + if( m_lstJob.empty() ) + { + osl_resetCondition( m_cndWait ); + } break; } -- cgit v1.2.3 From 5ad20a1cdc02437a991b0100d0a6273be69544e6 Mon Sep 17 00:00:00 2001 From: sb Date: Mon, 25 Oct 2010 15:42:40 +0200 Subject: sb132: #i112448# proper initialization of ClientJob (patch by olistraub) --- bridges/source/remote/urp/urp_job.hxx | 1 + 1 file changed, 1 insertion(+) diff --git a/bridges/source/remote/urp/urp_job.hxx b/bridges/source/remote/urp/urp_job.hxx index 8f6f95936..f1829f7ff 100644 --- a/bridges/source/remote/urp/urp_job.hxx +++ b/bridges/source/remote/urp/urp_job.hxx @@ -303,6 +303,7 @@ inline ClientJob::ClientJob( uno_Any **ppException ) : Job( pEnvRemote, pContext, pBridgeImpl, ::bridges_remote::RTC_HOLDENVWEAK ) + , m_bExceptionOccured( false ) , m_ppArgs( ppArgs ) , m_pReturn( pReturn ) , m_pInterfaceType( pInterfaceType ) // weak -- cgit v1.2.3 From 33b3fb4a005f9822b3a3547db3395c816fb870c0 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Tue, 26 Oct 2010 12:28:33 +0200 Subject: jl162 #i115180# fix problems with latest java 1.6.0_22 on MacOS 10.6 --- jvmfwk/inc/jvmfwk/framework.h | 1 + jvmfwk/inc/jvmfwk/vendorplugin.h | 19 +++++++ jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx | 4 +- .../plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 62 +++++++++++++++++++++- .../plugins/sunmajor/pluginlib/sunjavaplugin.map | 5 ++ jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx | 4 +- jvmfwk/plugins/sunmajor/pluginlib/util.cxx | 8 +-- jvmfwk/source/elements.cxx | 10 ++++ jvmfwk/source/framework.cxx | 48 ++++++++++------- jvmfwk/source/framework.hxx | 4 ++ 10 files changed, 135 insertions(+), 30 deletions(-) diff --git a/jvmfwk/inc/jvmfwk/framework.h b/jvmfwk/inc/jvmfwk/framework.h index 00c2b0fe5..30e5bdc0f 100644 --- a/jvmfwk/inc/jvmfwk/framework.h +++ b/jvmfwk/inc/jvmfwk/framework.h @@ -830,6 +830,7 @@ javaFrameworkError SAL_CALL jfw_getJRELocations( JFW_E_NONE the function ran successfully.
JFW_E_ERROR an error occurred during execution.
JFW_E_INVALID_ARG pInfo contains invalid data
+ JFW_E_NO_PLUGIN a plug-in library could not be found.
*/ javaFrameworkError SAL_CALL jfw_existJRE(const JavaInfo *pInfo, sal_Bool *exist); diff --git a/jvmfwk/inc/jvmfwk/vendorplugin.h b/jvmfwk/inc/jvmfwk/vendorplugin.h index 3df1a98b9..7844ee433 100644 --- a/jvmfwk/inc/jvmfwk/vendorplugin.h +++ b/jvmfwk/inc/jvmfwk/vendorplugin.h @@ -238,6 +238,25 @@ javaPluginError jfw_plugin_startJavaVirtualMachine( +/** checks if the installation of the jre still exists. + + This function checks if the JRE described by pInfo still + exists. The check must be very quick because it is called by javaldx + (Linux, Solaris) at start up. + + @param pInfo + [in] the JavaInfo object with information about the JRE. + @param pp_exist + [out] the parameter is set to either sal_True or sal_False. The value is + only valid if the function returns JFW_E_NONE. + + @return + JFW_PLUGIN_E_NONE the function ran successfully.
+ JFW_PLUGIN_E_ERROR an error occurred during execution.
+ JFW_PLUGIN_E_INVALID_ARG pInfo contains invalid data
+ */ +javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist); + #ifdef __cplusplus } #endif diff --git a/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx b/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx index 4a607a071..c21fbff6d 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/otherjre.cxx @@ -73,7 +73,6 @@ char const* const* OtherInfo::getRuntimePaths(int * size) "/bin/hotspot/jvm.dll" #elif UNX #ifdef MACOSX - "/../../../JavaVM", "/../../../../../Frameworks/JavaVM.framework/JavaVM" //as of 1.6.0_22 #else "/lib/" JFW_PLUGIN_ARCH "/client/libjvm.so", // for Blackdown PPC @@ -96,8 +95,7 @@ char const* const* OtherInfo::getLibraryPaths(int* size) #ifdef UNX static char const * ar[] = { #ifdef MACOSX - "/../Libraries", - "/lib" + //mac version does not have a ld library path anymore #else "/bin", "/jre/bin", diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index 1165e5080..23a380c89 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -470,10 +470,10 @@ javaPluginError jfw_plugin_startJavaVirtualMachine( { JFW_ENSURE(0, OUSTR("[Java framework]sunjavaplugin" SAL_DLLEXTENSION " could not load Java runtime library: \n") - + sRuntimeLib + OUSTR(".")); + + sRuntimeLib + OUSTR("\n")); JFW_TRACE0(OUSTR("[Java framework]sunjavaplugin" SAL_DLLEXTENSION " could not load Java runtime library: \n") - + sRuntimeLib + OUSTR(".")); + + sRuntimeLib + OUSTR("\n")); return JFW_PLUGIN_E_VM_CREATION_FAILED; } @@ -614,5 +614,63 @@ javaPluginError jfw_plugin_startJavaVirtualMachine( return errcode; } +extern "C" +javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist) +{ + javaPluginError ret = JFW_PLUGIN_E_NONE; + if (!pInfo || !exist) + return JFW_PLUGIN_E_INVALID_ARG; + ::rtl::OUString sLocation(pInfo->sLocation); + + if (sLocation.getLength() == 0) + return JFW_PLUGIN_E_INVALID_ARG; + ::osl::DirectoryItem item; + ::osl::File::RC rc_item = ::osl::DirectoryItem::get(sLocation, item); + if (::osl::File::E_None == rc_item) + { + *exist = sal_True; + } + else if (::osl::File::E_NOENT == rc_item) + { + *exist = sal_False; + } + else + { + ret = JFW_PLUGIN_E_ERROR; + } +#ifdef MACOSX + //We can have the situation that the JavaVM runtime library is not + //contained within JAVA_HOME. Then the check for JAVA_HOME would return + //true although the runtime library may not be loadable. + if (ret == JFW_PLUGIN_E_NONE && *exist == sal_True) + { + rtl::OUString sRuntimeLib = getRuntimeLib(pInfo->arVendorData); + JFW_TRACE2(OUSTR("[Java framework] Checking existence of Java runtime library.\n")); + + ::osl::DirectoryItem itemRt; + ::osl::File::RC rc_itemRt = ::osl::DirectoryItem::get(sRuntimeLib, itemRt); + if (::osl::File::E_None == rc_itemRt) + { + *exist = sal_True; + JFW_TRACE2(OUSTR("[Java framework] Java runtime library exist: ") + + sRuntimeLib + OUSTR("\n")); + + } + else if (::osl::File::E_NOENT == rc_itemRt) + { + *exist = sal_False; + JFW_TRACE2(OUSTR("[Java framework] Java runtime library does not exist: ") + + sRuntimeLib + OUSTR("\n")); + } + else + { + ret = JFW_PLUGIN_E_ERROR; + JFW_TRACE2(OUSTR("[Java framework] Error while looking for Java runtime library: ") + + sRuntimeLib + OUSTR(" \n")); + } + } +#endif + return ret; +} diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.map b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.map index db75c9611..c08817d69 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.map +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.map @@ -6,3 +6,8 @@ UDK_3_0_0 { local: *; }; + +UDK_3.1 { # OOo 3.3 + global: + jfw_plugin_existJRE; +} UDK_3_0_0; diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx index 215e1f04d..41900777e 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx @@ -418,9 +418,9 @@ SelfTest::SelfTest() break; } if (bRet) - JFW_TRACE2("[Java framework] sunjavaplugin: Testing class SunVersion succeeded."); + JFW_TRACE2("[Java framework] sunjavaplugin: Testing class SunVersion succeeded.\n"); else - OSL_ENSURE(bRet, "[Java framework] sunjavaplugin: SunVersion self test failed"); + OSL_ENSURE(bRet, "[Java framework] sunjavaplugin: SunVersion self test failed.\n"); } #endif diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index 4ae83e579..b0c94c4de 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -450,12 +450,12 @@ bool getJavaProps(const OUString & exePath, rs = stdoutReader.readLine( & aLine); if (rs != FileHandleReader::RESULT_OK) break; - JFW_TRACE2(OString("[Java framework] line:\" ") - + aLine + OString(" \".\n")); +// JFW_TRACE2(OString("[Java framework] line:\" ") +// + aLine + OString(" \".\n")); OUString sLine; if (!decodeOutput(aLine, &sLine)) continue; - JFW_TRACE2(OString("[Java framework] line:\" ") + JFW_TRACE2(OString("[Java framework]:\" ") + OString( CHAR_POINTER(sLine)) + OString(" \".\n")); sLine = sLine.trim(); if (sLine.getLength() == 0) @@ -509,7 +509,7 @@ bool decodeOutput(const rtl::OString& s, rtl::OUString* out) } while (nIndex >= 0); *out = buff.makeStringAndClear(); - JFW_TRACE2(*out); +// JFW_TRACE2(*out); return true; } diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx index 0d14a3909..c2474e5c1 100644 --- a/jvmfwk/source/elements.cxx +++ b/jvmfwk/source/elements.cxx @@ -930,6 +930,16 @@ void CNodeJavaInfo::loadFromNode(xmlDoc * pDoc, xmlNode * pJavaInfo) pDoc, cur->children, 1); rtl::OUString sRequire = xmlRequire; nRequirements = sRequire.toInt64(16); +#ifdef MACOSX + //javaldx is not used anymore in the mac build. In case the Java + //corresponding to the saved settings does not exist anymore the + //javavm services will look for an existing Java after creation of + //the JVM failed. See stoc/source/javavm/javavm.cxx. Only if + //nRequirements does not have the flag JFW_REQUIRE_NEEDRESTART the + //jvm of the new selected JRE will be started. Old settings (before + //OOo 3.3) still contain the flag which can be safely ignored. + nRequirements ^= JFW_REQUIRE_NEEDRESTART; +#endif } else if (xmlStrcmp(cur->name, (xmlChar*) "vendorData") == 0) { diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx index ee8378e78..1f9bb76db 100644 --- a/jvmfwk/source/framework.cxx +++ b/jvmfwk/source/framework.cxx @@ -1114,29 +1114,39 @@ javaFrameworkError SAL_CALL jfw_getJRELocations( javaFrameworkError jfw_existJRE(const JavaInfo *pInfo, sal_Bool *exist) { - javaFrameworkError ret = JFW_E_NONE; - if (!pInfo || !exist) - return JFW_E_INVALID_ARG; - ::rtl::OUString sLocation(pInfo->sLocation); - - if (sLocation.getLength() == 0) - return JFW_E_INVALID_ARG; + //get the function jfw_plugin_existJRE + jfw::VendorSettings aVendorSettings; + jfw::CJavaInfo aInfo; + aInfo = (const ::JavaInfo*) pInfo; //makes a copy of pInfo + rtl::OUString sLibPath = aVendorSettings.getPluginLibrary(aInfo.getVendor()); + osl::Module modulePlugin(sLibPath); + if ( ! modulePlugin) + return JFW_E_NO_PLUGIN; + rtl::OUString sFunctionName( + RTL_CONSTASCII_USTRINGPARAM("jfw_plugin_existJRE")); + jfw_plugin_existJRE_ptr pFunc = + (jfw_plugin_existJRE_ptr) + osl_getFunctionSymbol(modulePlugin, sFunctionName.pData); + if (pFunc == NULL) + return JFW_E_ERROR; + + javaPluginError plerr = (*pFunc)(pInfo, exist); - ::osl::DirectoryItem item; - ::osl::File::RC rc_item = ::osl::DirectoryItem::get(sLocation, item); - if (::osl::File::E_None == rc_item) - { - *exist = sal_True; - } - else if (::osl::File::E_NOENT == rc_item) - { - *exist = sal_False; - } - else + javaFrameworkError ret = JFW_E_NONE; + switch (plerr) { + case JFW_PLUGIN_E_NONE: + ret = JFW_E_NONE; + break; + case JFW_PLUGIN_E_INVALID_ARG: + ret = JFW_E_INVALID_ARG; + break; + case JFW_PLUGIN_E_ERROR: + ret = JFW_E_ERROR; + break; + default: ret = JFW_E_ERROR; } - return ret; } diff --git a/jvmfwk/source/framework.hxx b/jvmfwk/source/framework.hxx index 740c52391..91a3aa257 100644 --- a/jvmfwk/source/framework.hxx +++ b/jvmfwk/source/framework.hxx @@ -64,6 +64,10 @@ typedef javaPluginError (*jfw_plugin_startJavaVirtualMachine_ptr)( JavaVM ** ppVM, JNIEnv ** ppEnv); +typedef javaPluginError (*jfw_plugin_existJRE_ptr)( + const JavaInfo *info, + sal_Bool *exist); + namespace jfw { -- cgit v1.2.3 From 03a26afa7cefcc99ebfce60050581cd9adf5822f Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Wed, 27 Oct 2010 13:53:26 +0200 Subject: jl162 #i115180# fix problems with latest java 1.6.0_22 on MacOS 10.6 --- jvmfwk/source/elements.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx index c2474e5c1..1b14f9715 100644 --- a/jvmfwk/source/elements.cxx +++ b/jvmfwk/source/elements.cxx @@ -938,7 +938,8 @@ void CNodeJavaInfo::loadFromNode(xmlDoc * pDoc, xmlNode * pJavaInfo) //nRequirements does not have the flag JFW_REQUIRE_NEEDRESTART the //jvm of the new selected JRE will be started. Old settings (before //OOo 3.3) still contain the flag which can be safely ignored. - nRequirements ^= JFW_REQUIRE_NEEDRESTART; + if (nRequirements & JFW_REQUIRE_NEEDRESTART) + nRequirements ^= JFW_REQUIRE_NEEDRESTART; #endif } else if (xmlStrcmp(cur->name, (xmlChar*) "vendorData") == 0) -- cgit v1.2.3 From d3c7714e15ee5e048e24555af324381a0de6cb23 Mon Sep 17 00:00:00 2001 From: Joachim Lingner Date: Wed, 27 Oct 2010 14:33:45 +0200 Subject: jl162 #i115180# fix problems with latest java 1.6.0_22 on MacOS 10.6 --- jvmfwk/source/elements.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx index 1b14f9715..9a2d8a43d 100644 --- a/jvmfwk/source/elements.cxx +++ b/jvmfwk/source/elements.cxx @@ -938,8 +938,7 @@ void CNodeJavaInfo::loadFromNode(xmlDoc * pDoc, xmlNode * pJavaInfo) //nRequirements does not have the flag JFW_REQUIRE_NEEDRESTART the //jvm of the new selected JRE will be started. Old settings (before //OOo 3.3) still contain the flag which can be safely ignored. - if (nRequirements & JFW_REQUIRE_NEEDRESTART) - nRequirements ^= JFW_REQUIRE_NEEDRESTART; + nRequirements &= ~JFW_REQUIRE_NEEDRESTART; #endif } else if (xmlStrcmp(cur->name, (xmlChar*) "vendorData") == 0) -- cgit v1.2.3 From 36dff4041dd46301ea5a2ae4b9cc7fbfab5d351a Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 28 Oct 2010 14:20:43 +0200 Subject: sb132: #i109191# avoid early finalization of Java URP proxies --- .../sun/star/lib/uno/bridges/java_remote/ProxyFactory.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java b/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java index 631bda3a1..fd7fefdad 100644 --- a/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java +++ b/jurt/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory.java @@ -148,11 +148,22 @@ final class ProxyFactory { private Object request(String operation, Object[] args) throws Throwable { - return requestHandler.sendRequest(oid, type, operation, args); + Object res = requestHandler.sendRequest(oid, type, operation, args); + // Avoid early finalization of this object, while an invoke -> + // request call is still ongoing; as finalize also calls request, + // this should fulfil the condition from The Java Language + // Specification, 3rd ed., that "if an object's finalizer can result + // in synchronization on that object, then that object must be alive + // and considered reachable whenever a lock is held on it:" + synchronized (this) { + ++dummy; + } + return res; } private final String oid; private final Type type; + private int dummy = 0; } private static final Method METHOD_EQUALS; -- cgit v1.2.3 From 95c541411cb6dc001d7642497b6e3ee98323ea1e Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 28 Oct 2010 15:50:12 +0200 Subject: sb132: #i114840# fix inadvertent deviation of stringToDouble from C99 strtod --- sal/inc/rtl/math.h | 8 +- sal/prj/build.lst | 1 + sal/qa/rtl/math/export.exp | 1 - sal/qa/rtl/math/makefile.mk | 80 +--- sal/qa/rtl/math/rtl_math.cxx | 626 ------------------------------- sal/qa/rtl/math/rtl_old_testint64.cxx | 122 ------ sal/qa/rtl/math/test-rtl-math.cxx | 76 ++++ sal/qa/rtl/math/test_rtl_math.cxx | 674 ---------------------------------- sal/rtl/source/math.cxx | 2 +- 9 files changed, 101 insertions(+), 1489 deletions(-) delete mode 100644 sal/qa/rtl/math/export.exp delete mode 100644 sal/qa/rtl/math/rtl_math.cxx delete mode 100644 sal/qa/rtl/math/rtl_old_testint64.cxx create mode 100644 sal/qa/rtl/math/test-rtl-math.cxx delete mode 100644 sal/qa/rtl/math/test_rtl_math.cxx diff --git a/sal/inc/rtl/math.h b/sal/inc/rtl/math.h index 46efef7b1..9841d83ca 100644 --- a/sal/inc/rtl/math.h +++ b/sal/inc/rtl/math.h @@ -319,7 +319,9 @@ void SAL_CALL rtl_math_doubleToUString(rtl_uString ** pResult, @param pParsedEnd If non-null, returns one past the position of the last character parsed away. Thus if [pBegin..pEnd) only contains the numerical string to be - parsed, *pParsedEnd == pEnd on return. + parsed, *pParsedEnd == pEnd on return. If no numerical (sub-)string is + found, *pParsedEnd == pBegin on return, even if there was leading + whitespace. */ double SAL_CALL rtl_math_stringToDouble( sal_Char const * pBegin, sal_Char const * pEnd, sal_Char cDecSeparator, @@ -357,7 +359,9 @@ double SAL_CALL rtl_math_stringToDouble( @param pParsedEnd If non-null, returns one past the position of the last character parsed away. Thus if [pBegin..pEnd) only contains the numerical string to be - parsed, *pParsedEnd == pEnd on return. + parsed, *pParsedEnd == pEnd on return. If no numerical (sub-)string is + found, *pParsedEnd == pBegin on return, even if there was leading + whitespace. */ double SAL_CALL rtl_math_uStringToDouble( sal_Unicode const * pBegin, sal_Unicode const * pEnd, diff --git a/sal/prj/build.lst b/sal/prj/build.lst index c96c3977f..06e395844 100644 --- a/sal/prj/build.lst +++ b/sal/prj/build.lst @@ -20,3 +20,4 @@ sa sal\qa\OStringBuffer nmake - all sa_qa_OStringBuffer sa_cppunittester sa_util sa sal\qa\osl\mutex nmake - all sa_qa_osl_mutex sa_cppunittester sa_util NULL sa sal\qa\osl\pipe nmake - all sa_qa_osl_pipe sa_cppunittester sa_util NULL sa sal\qa\osl\profile nmake - all sa_qa_osl_profile sa_cppunittester sa_util NULL +sa sal\qa\rtl\math nmake - all sa_qa_rtl_math sa_cppunittester sa_util NULL diff --git a/sal/qa/rtl/math/export.exp b/sal/qa/rtl/math/export.exp deleted file mode 100644 index a13529da5..000000000 --- a/sal/qa/rtl/math/export.exp +++ /dev/null @@ -1 +0,0 @@ -registerAllTestFunction diff --git a/sal/qa/rtl/math/makefile.mk b/sal/qa/rtl/math/makefile.mk index deb2a7939..fc0a1004f 100644 --- a/sal/qa/rtl/math/makefile.mk +++ b/sal/qa/rtl/math/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite @@ -23,73 +23,27 @@ # # for a copy of the LGPLv3 License. # -#************************************************************************* -PRJ=..$/..$/.. -INCPRE+= $(PRJ)$/qa$/inc - -PRJNAME=sal -TARGET=rtl_math +#***********************************************************************/ -ENABLE_EXCEPTIONS=TRUE +PRJ = ../../.. +PRJNAME = sal +TARGET = qa_rtl_profile -# --- Settings ----------------------------------------------------- +ENABLE_EXCEPTIONS = TRUE -.INCLUDE : settings.mk - -CFLAGS+= $(LFS_CFLAGS) -CXXFLAGS+= $(LFS_CFLAGS) +.INCLUDE: settings.mk CFLAGSCXX += $(CPPUNIT_CFLAGS) -#----------------------------------- OStringBuffer ----------------------------------- - -SHL1OBJS= \ - $(SLO)$/test_rtl_math.obj - -SHL1TARGET= rtl_math -SHL1STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) - -SHL1IMPLIB= i$(SHL1TARGET) -# SHL1DEF= $(MISC)$/$(SHL1TARGET).def - -DEF1NAME =$(SHL1TARGET) -# DEF1EXPORTFILE= export.exp -SHL1VERSIONMAP = $(PRJ)$/qa$/export.map - -# --- BEGIN -------------------------------------------------------- -SHL2OBJS= \ - $(SLO)$/rtl_math.obj -SHL2TARGET= rtl_math2 -SHL2STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) - -SHL2IMPLIB= i$(SHL2TARGET) -DEF2NAME= $(SHL2TARGET) -SHL2VERSIONMAP = $(PRJ)$/qa$/export.map - - - -# # --- BEGIN -------------------------------------------------------- -# LLA: this is an old test, which seems not to work -# sal_setInt64() -# sal_getInt64() -# does not exist. -# -# SHL3OBJS= \ -# $(SLO)$/rtl_old_testint64.obj -# SHL3TARGET= rtl_old_testint64 -# SHL3STDLIBS= $(SALLIB) $(CPPUNITLIB) $(TESTSHL2LIB) -# -# SHL3IMPLIB= i$(SHL3TARGET) -# DEF3NAME= $(SHL3TARGET) -# SHL3VERSIONMAP = $(PRJ)$/qa$/export.map -# - -#------------------------------- All object files ------------------------------- -# do this here, so we get right dependencies -# SLOFILES=$(SHL1OBJS) - -# --- Targets ------------------------------------------------------ +SHL1IMPLIB = i$(SHL1TARGET) +SHL1OBJS = $(SLO)/test-rtl-math.obj +SHL1RPATH = NONE +SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB) +SHL1TARGET = test-rtl-math +SHL1VERSIONMAP = $(PRJ)/qa/export.map +DEF1NAME = $(SHL1TARGET) -.INCLUDE : target.mk -.INCLUDE : _cppunit.mk +SLOFILES = $(SHL1OBJS) +.INCLUDE: target.mk +.INCLUDE: _cppunit.mk diff --git a/sal/qa/rtl/math/rtl_math.cxx b/sal/qa/rtl/math/rtl_math.cxx deleted file mode 100644 index 7d04684c9..000000000 --- a/sal/qa/rtl/math/rtl_math.cxx +++ /dev/null @@ -1,626 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sal.hxx" -#ifdef WIN32 -// LLA: take a look into Microsofts math.h implementation, why this define is need -#define _USE_MATH_DEFINES -#endif - -#include -#include -#include -#include - -#include "valueequal.hxx" - -namespace rtl_math -{ - -class test : public CppUnit::TestFixture -{ -public: - // initialise your test code values here. - void setUp() - { - } - - void tearDown() - { - } - - - void equalCheck(double _nResult, double _nExpect) /* throws Exception */ - { - bool bEqualResult = is_double_equal(_nResult, _nExpect); - - rtl::OString sError = "rtl_math_round expected result is wrong should:("; - sError += rtl::OString::valueOf(_nExpect); - sError += ") but is:("; - sError += rtl::OString::valueOf(_nResult); - sError += ")"; - - CPPUNIT_ASSERT_MESSAGE(sError.getStr(), bEqualResult == true); - } - - // insert your test code here. - void round_000() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nValue = M_PI; - double nResult = 0.0; - - nResult = rtl_math_round(nValue, 0, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(3.0)); - - nResult = rtl_math_round(nValue, 2, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(3.14)); - - nResult = rtl_math_round(nValue, 3, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(3.142)); - - nResult = rtl_math_round(nValue, 10, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(3.1415926536)); - } - - // insert your test code here. - void round_001_positiv() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nResult = 0.0; - - nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(0.2)); - } - - void round_001_negativ() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nResult = 0.0; - - nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Corrected); - equalCheck(nResult, double(-0.2)); - } -// ----------------------------------------------------------------------------- - void round_002_positiv() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nResult = 0.0; - - nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(0.1)); - } - - void round_002_negativ() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nResult = 0.0; - - nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Down); - equalCheck(nResult, double(-0.1)); - } -// ----------------------------------------------------------------------------- - void round_003_positiv() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nResult = 0.0; - - nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(0.2)); - } - - void round_003_negativ() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nResult = 0.0; - - nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Up); - equalCheck(nResult, double(-0.2)); - } -// ----------------------------------------------------------------------------- - void round_004_positiv() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nResult = 0.0; - - nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(0.1)); - } - - void round_004_negativ() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nResult = 0.0; - - nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Floor); - equalCheck(nResult, double(-0.2)); - } -// ----------------------------------------------------------------------------- - void round_005_positiv() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nResult = 0.0; - - nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(0.2)); - } - - void round_005_negativ() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nResult = 0.0; - - nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_Ceiling); - equalCheck(nResult, double(-0.1)); - } -// ----------------------------------------------------------------------------- - void round_006_positiv() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nResult = 0.0; - - nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(0.2)); - } - - void round_006_negativ() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nResult = 0.0; - - nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_HalfDown); - equalCheck(nResult, double(-0.2)); - } -// ----------------------------------------------------------------------------- - void round_007_positiv() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nResult = 0.0; - - nResult = rtl_math_round(0.1, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.11, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.13, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.14, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.1499999, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(0.1)); - - nResult = rtl_math_round(0.15, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.151, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.16, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(0.2)); - - nResult = rtl_math_round(0.199999999, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(0.2)); - } - - void round_007_negativ() - { - // this is demonstration code - // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1); - - double nResult = 0.0; - - nResult = rtl_math_round(-0.1, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.11, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.13, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.14, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.1499999, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(-0.1)); - - nResult = rtl_math_round(-0.15, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.151, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.16, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(-0.2)); - - nResult = rtl_math_round(-0.19999999999, 1, rtl_math_RoundingMode_HalfUp); - equalCheck(nResult, double(-0.2)); - } - - // Change the following lines only, if you add, remove or rename - // member functions of the current class, - // because these macros are need by auto register mechanism. - - CPPUNIT_TEST_SUITE(test); - CPPUNIT_TEST(round_000); - - CPPUNIT_TEST(round_001_positiv); - CPPUNIT_TEST(round_001_negativ); - - CPPUNIT_TEST(round_002_positiv); - CPPUNIT_TEST(round_002_negativ); - - CPPUNIT_TEST(round_003_positiv); - CPPUNIT_TEST(round_003_negativ); - - CPPUNIT_TEST(round_004_positiv); - CPPUNIT_TEST(round_004_negativ); - - CPPUNIT_TEST(round_005_positiv); - CPPUNIT_TEST(round_005_negativ); - - CPPUNIT_TEST(round_006_positiv); - CPPUNIT_TEST(round_006_negativ); - - CPPUNIT_TEST(round_007_positiv); - CPPUNIT_TEST(round_007_negativ); - - CPPUNIT_TEST_SUITE_END(); -}; // class test - -// ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(rtl_math::test, "rtl_math"); -} // namespace rtl_math - - -// ----------------------------------------------------------------------------- - -// this macro creates an empty function, which will called by the RegisterAllFunctions() -// to let the user the possibility to also register some functions by hand. -NOADDITIONAL; - diff --git a/sal/qa/rtl/math/rtl_old_testint64.cxx b/sal/qa/rtl/math/rtl_old_testint64.cxx deleted file mode 100644 index bb9f7b554..000000000 --- a/sal/qa/rtl/math/rtl_old_testint64.cxx +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sal.hxx" - -// LLA: -// this file is converted to use with testshl2 -// original was placed in sal/test/textenc.cxx - -// fndef _OSL_DIAGNOSE_H_ -// nclude -// #endif - -#include - -#define TEST_ENSURE(c, m) CPPUNIT_ASSERT_MESSAGE((m), (c)) - -// #if OSL_DEBUG_LEVEL > 0 -// #define TEST_ENSURE(c, m) OSL_ENSURE(c, m) -// #else -// #define TEST_ENSURE(c, m) OSL_VERIFY(c) -// #endif - -#include - -// ----------------------------------------------------------------------------- -namespace rtl_math -{ - class int64 : public CppUnit::TestFixture - { - public: - void test_int64(); - - CPPUNIT_TEST_SUITE( int64 ); - CPPUNIT_TEST( test_int64 ); - CPPUNIT_TEST_SUITE_END( ); - }; - -void int64::test_int64() -{ -#ifndef SAL_INT64_IS_STRUCT -#ifdef UNX - sal_Int64 i1 = -3223372036854775807LL; - sal_uInt64 u1 = 5223372036854775807ULL; -#else - sal_Int64 i1 = -3223372036854775807; - sal_uInt64 u1 = 5223372036854775807; -#endif - sal_Int64 i2 = 0; - sal_uInt64 u2 = 0; -#else - sal_Int64 i1; - sal_setInt64(&i1, 3965190145L, -750499787L); - - sal_Int64 i2 = { 0, 0 }; - - sal_uInt64 u1; - sal_setUInt64(&u1, 1651507199UL, 1216161073UL); - - sal_uInt64 u2 = {0, 0 }; - -#endif - sal_uInt32 low = 0; - sal_Int32 high = 0; - - sal_getInt64(i1, &low, &high); - sal_setInt64(&i2, low, high); - - sal_uInt32 ulow = 0; - sal_uInt32 uhigh = 0; - - sal_getUInt64(u1, &ulow, &uhigh); - sal_setUInt64(&u2, ulow, uhigh); - -#ifndef SAL_INT64_IS_STRUCT - TEST_ENSURE( i1 == i2, "test_int64 error 1"); - - TEST_ENSURE( u1 == u2, "test_int64 error 2"); -#else - TEST_ENSURE( (i1.Part1 == i2.Part1) && (i1.Part2 == i2.Part2), - "test_int64 error 1"); - - TEST_ENSURE( (u1.Part1 == u2.Part1) && (u1.Part2 == u2.Part2), - "test_int64 error 2"); -#endif - return; -} - -} // namespace rtl_math - -// ----------------------------------------------------------------------------- -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( rtl_math::int64, "rtl_math" ); - -// ----------------------------------------------------------------------------- -NOADDITIONAL; - - diff --git a/sal/qa/rtl/math/test-rtl-math.cxx b/sal/qa/rtl/math/test-rtl-math.cxx new file mode 100644 index 000000000..8e9875444 --- /dev/null +++ b/sal/qa/rtl/math/test-rtl-math.cxx @@ -0,0 +1,76 @@ +/************************************************************************* +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* +* for a copy of the LGPLv3 License. +* +************************************************************************/ + +#include "precompiled_sal.hxx" +#include "sal/config.h" + +#include "cppunit/TestAssert.h" +#include "cppunit/TestFixture.h" +#include "cppunit/extensions/HelperMacros.h" +#include "cppunit/plugin/TestPlugIn.h" +#include "rtl/math.hxx" +#include "rtl/ustring.h" +#include "rtl/ustring.hxx" +#include "sal/types.h" + +namespace { + +class Test: public CppUnit::TestFixture { +public: + void test_stringToDouble_good() { + rtl_math_ConversionStatus status; + sal_Int32 end; + double res = rtl::math::stringToDouble( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" +1.E01foo")), + sal_Unicode('.'), sal_Unicode(','), &status, &end); + CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status); + CPPUNIT_ASSERT_EQUAL(sal_Int32(RTL_CONSTASCII_LENGTH(" +1.E01")), end); + CPPUNIT_ASSERT_EQUAL(10.0, res); + } + + void test_stringToDouble_bad() { + rtl_math_ConversionStatus status; + sal_Int32 end; + double res = rtl::math::stringToDouble( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" +Efoo")), + sal_Unicode('.'), sal_Unicode(','), &status, &end); + CPPUNIT_ASSERT_EQUAL(rtl_math_ConversionStatus_Ok, status); + CPPUNIT_ASSERT_EQUAL(sal_Int32(0), end); + CPPUNIT_ASSERT_EQUAL(0.0, res); + } + + CPPUNIT_TEST_SUITE(Test); + CPPUNIT_TEST(test_stringToDouble_good); + CPPUNIT_TEST(test_stringToDouble_bad); + CPPUNIT_TEST_SUITE_END(); +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(Test); + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sal/qa/rtl/math/test_rtl_math.cxx b/sal/qa/rtl/math/test_rtl_math.cxx deleted file mode 100644 index 41af2a010..000000000 --- a/sal/qa/rtl/math/test_rtl_math.cxx +++ /dev/null @@ -1,674 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sal.hxx" - -#include "rtl/math.h" -#include "rtl/math.hxx" -#include "rtl/strbuf.hxx" -#include "rtl/string.h" -#include "rtl/string.hxx" -#include "rtl/textenc.h" -// #include "rtl/tres.h" -#include -#include "rtl/ustring.hxx" -#include "sal/types.h" - -#include - -namespace { - -struct FloatTraits -{ - typedef float Number; - - static inline char const * getPrefix() { return "float"; } -}; - -struct DoubleTraits -{ - typedef double Number; - - static inline char const * getPrefix() { return "double"; } -}; - -struct StringTraits -{ - typedef rtl::OString String; - - static inline char const * getPrefix() { return "OString"; } - - static inline rtl::OString createFromAscii(char const * pString) - { return rtl::OString(pString); } - - static inline void appendBuffer(rtl::OStringBuffer & rBuffer, - rtl::OString const & rString) - { rBuffer.append(rString); } - - static inline rtl::OString doubleToString(double fValue, - rtl_math_StringFormat eFormat, - sal_Int32 nDecPlaces, - sal_Char cDecSeparator, - bool bEraseTrailingDecZeros) - { - return rtl::math::doubleToString(fValue, eFormat, nDecPlaces, - cDecSeparator, bEraseTrailingDecZeros); - } -}; - -struct UStringTraits -{ - typedef rtl::OUString String; - - static inline char const * getPrefix() { return "OUString"; } - - static inline rtl::OUString createFromAscii(char const * pString) - { return rtl::OUString::createFromAscii(pString); } - - static inline void appendBuffer(rtl::OStringBuffer & rBuffer, - rtl::OUString const & rString) - { rBuffer.append(rtl::OUStringToOString(rString, RTL_TEXTENCODING_UTF8)); } - - static inline rtl::OUString doubleToString(double fValue, - rtl_math_StringFormat eFormat, - sal_Int32 nDecPlaces, - sal_Unicode cDecSeparator, - bool bEraseTrailingDecZeros) - { - return rtl::math::doubleToUString(fValue, eFormat, nDecPlaces, - cDecSeparator, - bEraseTrailingDecZeros); - } -}; - -struct TestNumberToString -{ - double fValue; - rtl_math_StringFormat eFormat; - sal_Int32 nDecPlaces; - char cDecSeparator; - bool bEraseTrailingDecZeros; - char const * pResult; -}; - -template< typename StringT, typename NumberT > -bool testNumberToString(hTestResult pTestResult, - TestNumberToString const & rTest) -{ - typename NumberT::Number fValue = static_cast< typename NumberT::Number >(rTest.fValue); - if (fValue != rTest.fValue) - return true; - - // LLA: t_print("size: %d ", sizeof(fValue)); - typename StringT::String aResult1; - - aResult1 = StringT::doubleToString(fValue, rTest.eFormat, rTest.nDecPlaces, - rTest.cDecSeparator, - rTest.bEraseTrailingDecZeros); - - typename StringT::String aResult2(StringT::createFromAscii(rTest.pResult)); - - // LLA: rtl::OStringBuffer aBuf; - // LLA: StringT::appendBuffer(aBuf, aResult1); - // LLA: t_print("aResult1: %s ", aBuf.getStr()); - // LLA: - // LLA: rtl::OStringBuffer aBuf2; - // LLA: StringT::appendBuffer(aBuf2, aResult2); - // LLA: t_print("aResult2: %s\n", aBuf2.getStr()); - - bool bSuccess = aResult1 == aResult2; - - rtl::OStringBuffer aBuffer; - aBuffer.append(StringT::getPrefix()); - aBuffer.append(RTL_CONSTASCII_STRINGPARAM("/")); - aBuffer.append(NumberT::getPrefix()); - aBuffer.append(RTL_CONSTASCII_STRINGPARAM(" doubleToString(")); - aBuffer.append(fValue); - aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", ")); - aBuffer.append(static_cast< sal_Int32 >(rTest.eFormat)); - aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", ")); - aBuffer.append(rTest.nDecPlaces); - aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", ")); - aBuffer.append(rTest.cDecSeparator); - aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", ")); - aBuffer.append(static_cast< sal_Int32 >(rTest.bEraseTrailingDecZeros)); - aBuffer.append(RTL_CONSTASCII_STRINGPARAM("): ")); - StringT::appendBuffer(aBuffer, aResult1); - if (!bSuccess) - { - aBuffer.append(RTL_CONSTASCII_STRINGPARAM(" != ")); - StringT::appendBuffer(aBuffer, aResult2); - } - // call to the real test checker - // pTestResult->pFuncs->state_(pTestResult, bSuccess, "test_rtl_math", - // aBuffer.getStr(), false); - c_rtl_tres_state(pTestResult, bSuccess, aBuffer.getStr(), "testNumberToString"); - return bSuccess; -} - -template< typename StringT, typename NumberT > -bool testNumberToString(hTestResult pTestResult, - TestNumberToString const * pTests, size_t nCount) -{ - bool bSuccess = true; - for (size_t i = 0; i < nCount; ++i) - bSuccess &= testNumberToString< StringT, NumberT >(pTestResult, - pTests[i]); - return bSuccess; -} - -struct TestStringToNumberToString -{ - char const * pValue; - rtl_math_StringFormat eFormat; - sal_Int32 nDecPlaces; - char cDecSeparator; - bool bEraseTrailingDecZeros; - char const * pResult; -}; - -template< typename StringT > -bool testStringToNumberToString(hTestResult pTestResult, - TestStringToNumberToString const & rTest) -{ - double d = rtl::math::stringToDouble(StringT::createFromAscii(rTest.pValue), - rTest.cDecSeparator, 0, 0, 0); - typename StringT::String aResult1( - StringT::doubleToString(d, rTest.eFormat, rTest.nDecPlaces, - rTest.cDecSeparator, - rTest.bEraseTrailingDecZeros)); - typename StringT::String aResult2(StringT::createFromAscii(rTest.pResult)); - bool bSuccess = aResult1 == aResult2; - rtl::OStringBuffer aBuffer; - aBuffer.append(StringT::getPrefix()); - aBuffer.append(RTL_CONSTASCII_STRINGPARAM( - " doubleToString(stringToDouble(")); - aBuffer.append(rTest.pValue); - aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", ")); - aBuffer.append(rTest.cDecSeparator); - aBuffer.append(RTL_CONSTASCII_STRINGPARAM("), ")); - aBuffer.append(static_cast< sal_Int32 >(rTest.eFormat)); - aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", ")); - aBuffer.append(rTest.nDecPlaces); - aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", ")); - aBuffer.append(rTest.cDecSeparator); - aBuffer.append(RTL_CONSTASCII_STRINGPARAM(", ")); - aBuffer.append(static_cast< sal_Int32 >(rTest.bEraseTrailingDecZeros)); - aBuffer.append(RTL_CONSTASCII_STRINGPARAM("): ")); - StringT::appendBuffer(aBuffer, aResult1); - if (!bSuccess) - { - aBuffer.append(RTL_CONSTASCII_STRINGPARAM(" != ")); - StringT::appendBuffer(aBuffer, aResult2); - } - // call to the real test checker - // pTestResult->pFuncs->state_(pTestResult, bSuccess, "test_rtl_math", - // aBuffer.getStr(), false); - c_rtl_tres_state(pTestResult, bSuccess, aBuffer.getStr(), "testStringToNumberToString"); - - return bSuccess; -} - -template< typename StringT > -bool testStringToNumberToString(hTestResult pTestResult, - TestStringToNumberToString const * pTests, - size_t nCount) -{ - bool bSuccess = true; - for (size_t i = 0; i < nCount; ++i) - bSuccess &= testStringToNumberToString< StringT >(pTestResult, - pTests[i]); - return bSuccess; -} - -} - -extern "C" sal_Bool SAL_CALL test_rtl_math(hTestResult pTestResult) -{ - bool bReturn = true; - - { - static TestNumberToString const aTest[] - = { // 1, 1+2^-1, ..., 1+2^-52 - // Too few decimal digits are printed, so that various different - // double values lead to the same output: - { 1, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1" }, - { 1.5, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.5" }, - { 1.25, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.25" }, - { 1.125, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.125" }, - { 1.0625, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.0625" }, - { 1.03125, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.03125" }, - { 1.015625, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.015625" }, - { 1.0078125, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.0078125" }, - { 1.00390625, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00390625" }, - { 1.001953125, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.001953125" }, - { 1.0009765625, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.0009765625" }, - { 1.00048828125, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00048828125" }, - { 1.000244140625, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.000244140625" }, - { 1.0001220703125, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.0001220703125" }, - { 1.00006103515625, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00006103515625" }, - { 1.000030517578125, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00003051757813" }, - { 1.0000152587890625, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00001525878906" }, - { 1.00000762939453125, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00000762939453" }, - { 1.000003814697265625, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00000381469727" }, - { 1.0000019073486328125, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00000190734863" }, - { 1.00000095367431640625, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00000095367432" }, - { 1.000000476837158203125, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00000047683716" }, - { 1.0000002384185791015625, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00000023841858" }, - { 1.00000011920928955078125, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00000011920929" }, - { 1.000000059604644775390625, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00000005960464" }, - { 1.0000000298023223876953125, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00000002980232" }, - { 1.00000001490116119384765625, rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1.00000001490116" }, - { 1.000000007450580596923828125, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000745058" }, - { 1.0000000037252902984619140625, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000372529" }, - { 1.00000000186264514923095703125, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000186265" }, - { 1.000000000931322574615478515625, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000093132" }, - { 1.0000000004656612873077392578125, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000046566" }, - { 1.00000000023283064365386962890625, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000023283" }, - { 1.000000000116415321826934814453125, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000011642" }, - { 1.0000000000582076609134674072265625, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000005821" }, - { 1.00000000002910383045673370361328125, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.0000000000291" }, - { 1.000000000014551915228366851806640625, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000001455" }, - { 1.0000000000072759576141834259033203125, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000000728" }, - { 1.00000000000363797880709171295166015625, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000000364" }, - { 1.000000000001818989403545856475830078125, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000000182" }, - { 1.0000000000009094947017729282379150390625, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000000091" }, - { 1.00000000000045474735088646411895751953125, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000000045" }, - { 1.000000000000227373675443232059478759765625, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000000023" }, - { 1.0000000000001136868377216160297393798828125, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000000011" }, - { 1.00000000000005684341886080801486968994140625, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000000006" }, - { 1.000000000000028421709430404007434844970703125, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000000003" }, - { 1.0000000000000142108547152020037174224853515625, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000000001" }, - { 1.00000000000000710542735760100185871124267578125, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1.00000000000001" }, - { 1.000000000000003552713678800500929355621337890625, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1" }, - { 1.0000000000000017763568394002504646778106689453125, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1" }, - { 1.00000000000000088817841970012523233890533447265625, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1" }, - { 1.000000000000000444089209850062616169452667236328125, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1" }, - { 1.0000000000000002220446049250313080847263336181640625, - rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, - '.', true, "1" }, - - // 1, 1+2^-1, ..., 1+2^-52 - // Too few decimal digits are printed, so that various different - // double values lead to the same output: - { 1, rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000000000000000000000000000000000000000000000" }, - { 1.5, rtl_math_StringFormat_F, 53, '.', false, - "1.50000000000000000000000000000000000000000000000000000" }, - { 1.25, rtl_math_StringFormat_F, 53, '.', false, - "1.25000000000000000000000000000000000000000000000000000" }, - { 1.125, rtl_math_StringFormat_F, 53, '.', false, - "1.12500000000000000000000000000000000000000000000000000" }, - { 1.0625, rtl_math_StringFormat_F, 53, '.', false, - "1.06250000000000000000000000000000000000000000000000000" }, - { 1.03125, rtl_math_StringFormat_F, 53, '.', false, - "1.03125000000000000000000000000000000000000000000000000" }, - { 1.015625, rtl_math_StringFormat_F, 53, '.', false, - "1.01562500000000000000000000000000000000000000000000000" }, - { 1.0078125, rtl_math_StringFormat_F, 53, '.', false, - "1.00781250000000000000000000000000000000000000000000000" }, - { 1.00390625, rtl_math_StringFormat_F, 53, '.', false, - "1.00390625000000000000000000000000000000000000000000000" }, - { 1.001953125, rtl_math_StringFormat_F, 53, '.', false, - "1.00195312500000000000000000000000000000000000000000000" }, - { 1.0009765625, rtl_math_StringFormat_F, 53, '.', false, - "1.00097656250000000000000000000000000000000000000000000" }, - { 1.00048828125, rtl_math_StringFormat_F, 53, '.', false, - "1.00048828125000000000000000000000000000000000000000000" }, - { 1.000244140625, rtl_math_StringFormat_F, 53, '.', false, - "1.00024414062500000000000000000000000000000000000000000" }, - { 1.0001220703125, rtl_math_StringFormat_F, 53, '.', false, - "1.00012207031250000000000000000000000000000000000000000" }, - { 1.00006103515625, rtl_math_StringFormat_F, 53, '.', false, - "1.00006103515625000000000000000000000000000000000000000" }, - { 1.000030517578125, rtl_math_StringFormat_F, 53, '.', false, - "1.00003051757813000000000000000000000000000000000000000" }, - { 1.0000152587890625, rtl_math_StringFormat_F, 53, '.', false, - "1.00001525878906000000000000000000000000000000000000000" }, - { 1.00000762939453125, rtl_math_StringFormat_F, 53, '.', false, - "1.00000762939453000000000000000000000000000000000000000" }, - { 1.000003814697265625, rtl_math_StringFormat_F, 53, '.', false, - "1.00000381469727000000000000000000000000000000000000000" }, - { 1.0000019073486328125, rtl_math_StringFormat_F, 53, '.', - false, - "1.00000190734863000000000000000000000000000000000000000" }, - { 1.00000095367431640625, rtl_math_StringFormat_F, 53, '.', - false, - "1.00000095367432000000000000000000000000000000000000000" }, - { 1.000000476837158203125, rtl_math_StringFormat_F, 53, '.', - false, - "1.00000047683716000000000000000000000000000000000000000" }, - { 1.0000002384185791015625, rtl_math_StringFormat_F, 53, '.', - false, - "1.00000023841858000000000000000000000000000000000000000" }, - { 1.00000011920928955078125, rtl_math_StringFormat_F, 53, '.', - false, - "1.00000011920929000000000000000000000000000000000000000" }, - { 1.000000059604644775390625, rtl_math_StringFormat_F, 53, '.', - false, - "1.00000005960464000000000000000000000000000000000000000" }, - { 1.0000000298023223876953125, rtl_math_StringFormat_F, 53, '.', - false, - "1.00000002980232000000000000000000000000000000000000000" }, - { 1.00000001490116119384765625, rtl_math_StringFormat_F, 53, - '.', false, - "1.00000001490116000000000000000000000000000000000000000" }, - { 1.000000007450580596923828125, rtl_math_StringFormat_F, 53, - '.', false, - "1.00000000745058000000000000000000000000000000000000000" }, - { 1.0000000037252902984619140625, rtl_math_StringFormat_F, 53, - '.', false, - "1.00000000372529000000000000000000000000000000000000000" }, - { 1.00000000186264514923095703125, rtl_math_StringFormat_F, 53, - '.', false, - "1.00000000186265000000000000000000000000000000000000000" }, - { 1.000000000931322574615478515625, rtl_math_StringFormat_F, 53, - '.', false, - "1.00000000093132000000000000000000000000000000000000000" }, - { 1.0000000004656612873077392578125, rtl_math_StringFormat_F, - 53, '.', false, - "1.00000000046566000000000000000000000000000000000000000" }, - { 1.00000000023283064365386962890625, rtl_math_StringFormat_F, - 53, '.', false, - "1.00000000023283000000000000000000000000000000000000000" }, - { 1.000000000116415321826934814453125, rtl_math_StringFormat_F, - 53, '.', false, - "1.00000000011642000000000000000000000000000000000000000" }, - { 1.0000000000582076609134674072265625, rtl_math_StringFormat_F, - 53, '.', false, - "1.00000000005821000000000000000000000000000000000000000" }, - { 1.00000000002910383045673370361328125, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000002910000000000000000000000000000000000000000" }, - { 1.000000000014551915228366851806640625, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000001455000000000000000000000000000000000000000" }, - { 1.0000000000072759576141834259033203125, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000728000000000000000000000000000000000000000" }, - { 1.00000000000363797880709171295166015625, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000364000000000000000000000000000000000000000" }, - { 1.000000000001818989403545856475830078125, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000182000000000000000000000000000000000000000" }, - { 1.0000000000009094947017729282379150390625, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000091000000000000000000000000000000000000000" }, - { 1.00000000000045474735088646411895751953125, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000045000000000000000000000000000000000000000" }, - { 1.000000000000227373675443232059478759765625, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000023000000000000000000000000000000000000000" }, - { 1.0000000000001136868377216160297393798828125, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000011000000000000000000000000000000000000000" }, - { 1.00000000000005684341886080801486968994140625, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000006000000000000000000000000000000000000000" }, - { 1.000000000000028421709430404007434844970703125, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000003000000000000000000000000000000000000000" }, - { 1.0000000000000142108547152020037174224853515625, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000001000000000000000000000000000000000000000" }, - { 1.00000000000000710542735760100185871124267578125, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000001000000000000000000000000000000000000000" }, - { 1.000000000000003552713678800500929355621337890625, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000000000000000000000000000000000000000000000" }, - { 1.0000000000000017763568394002504646778106689453125, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000000000000000000000000000000000000000000000" }, - { 1.00000000000000088817841970012523233890533447265625, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000000000000000000000000000000000000000000000" }, - { 1.000000000000000444089209850062616169452667236328125, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000000000000000000000000000000000000000000000" }, - { 1.0000000000000002220446049250313080847263336181640625, - rtl_math_StringFormat_F, 53, '.', false, - "1.00000000000000000000000000000000000000000000000000000" } }; - size_t const nCount = sizeof aTest / sizeof aTest[0]; - -//LLA: the float tests are wrong here, due to the fact that -// we calculate with too less digits after the point - -// bReturn &= testNumberToString< StringTraits, FloatTraits >( -// pTestResult, aTest, nCount); - bReturn &= testNumberToString< StringTraits, DoubleTraits >( - pTestResult, aTest, nCount); -// bReturn &= testNumberToString< UStringTraits, FloatTraits >( -// pTestResult, aTest, nCount); - bReturn &= testNumberToString< UStringTraits, DoubleTraits >( - pTestResult, aTest, nCount); - } - - { - static TestStringToNumberToString const aTest[] - = { { "1", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1" }, - { " 1", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1" }, - { " 1", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1" }, - { "\t1", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1" }, - { "\t 1", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1" }, - { " \t1", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "1" }, - - { "-1", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "-1" }, - { " -1", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "-1" }, - { " -1", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "-1" }, - { "\t-1", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "-1" }, - { "\t -1", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "-1" }, - { " \t-1", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', true, "-1" }, - - { "1.#INF", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" }, - { " 1.#INF", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" }, - { " 1.#INF", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" }, - { "\t1.#INF", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" }, - { "\t 1.#INF", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" }, - { " \t1.#INF", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "1.#INF" }, - - { "-1.#INF", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" }, - { " -1.#INF", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" }, - { " -1.#INF", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" }, - { "\t-1.#INF", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" }, - { "\t -1.#INF", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" }, - { " \t-1.#INF", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "-1.#INF" }, - - { "1.#NAN", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" }, - { " 1.#NAN", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" }, - { " 1.#NAN", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" }, - { "\t1.#NAN", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" }, - { "\t 1.#NAN", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" }, - { " \t1.#NAN", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "1.#NAN" }, - - { "-1.#NAN", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" }, - { " -1.#NAN", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" }, - { " -1.#NAN", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" }, - { "\t-1.#NAN", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" }, - { "\t -1.#NAN", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" }, - { " \t-1.#NAN", rtl_math_StringFormat_Automatic, - rtl_math_DecimalPlaces_Max, '.', false, "-1.#NAN" }, - - { "3.14E-2000", rtl_math_StringFormat_E, 4, '.', false, - "0.0000E+000" }, - { "3.14E-200", rtl_math_StringFormat_E, 4, '.', false, - "3.1400E-200" }, - { "3.14E-20", rtl_math_StringFormat_E, 4, '.', false, - "3.1400E-020" }, - { "3.14E-2", rtl_math_StringFormat_E, 4, '.', false, - "3.1400E-002" }, - { "3.14E2", rtl_math_StringFormat_E, 4, '.', false, - "3.1400E+002" }, - { "3.14E20", rtl_math_StringFormat_E, 4, '.', false, - "3.1400E+020" }, - { "3.14E200", rtl_math_StringFormat_E, 4, '.', false, - "3.1400E+200" }, - { "3.14E2000", rtl_math_StringFormat_E, 4, '.', false, - "1.#INF" }, - }; - size_t const nCount = sizeof aTest / sizeof aTest[0]; - bReturn &= testStringToNumberToString< StringTraits >( - pTestResult, aTest, nCount); - bReturn &= testStringToNumberToString< UStringTraits >( - pTestResult, aTest, nCount); - } - - return bReturn; -} - -// ----------------------------------------------------------------------------- -extern "C" void /* sal_Bool */ SAL_CALL test_rtl_math2( hTestResult hRtlTestResult ) -{ - c_rtl_tres_state_start(hRtlTestResult, "rtl_math" ); - - test_rtl_math( hRtlTestResult ); - - c_rtl_tres_state_end(hRtlTestResult, "rtl_math" ); -} -// ----------------------------------------------------------------------------- -void RegisterAdditionalFunctions(FktRegFuncPtr _pFunc) -{ - if (_pFunc) - { - (_pFunc)(&test_rtl_math2, ""); - } -} diff --git a/sal/rtl/source/math.cxx b/sal/rtl/source/math.cxx index d983c5726..34b940a30 100644 --- a/sal/rtl/source/math.cxx +++ b/sal/rtl/source/math.cxx @@ -923,7 +923,7 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd, if (pStatus != 0) *pStatus = eStatus; if (pParsedEnd != 0) - *pParsedEnd = p; + *pParsedEnd = p == p0 ? pBegin : p; return fVal; } -- cgit v1.2.3 From 865d7ea17f96d43429469656d1aba702ffef9131 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 28 Oct 2010 17:10:35 +0200 Subject: sb132: #i114290# current OSL_THIS_FUNC, esp. as used in OSL_LOG_PREFIX, does not work --- sal/inc/osl/diagnose.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/sal/inc/osl/diagnose.h b/sal/inc/osl/diagnose.h index 3d9fbc6e1..9f8b519a8 100644 --- a/sal/inc/osl/diagnose.h +++ b/sal/inc/osl/diagnose.h @@ -78,15 +78,7 @@ pfunc_osl_printDetailedDebugMessage SAL_CALL osl_setDetailedDebugMessageFunc( pf #define OSL_THIS_FILE __FILE__ /* the macro OSL_THIS_FUNC is intended to be an office internal macro for now */ -#ifdef __func__ -#define OSL_THIS_FUNC __func__ -#elifdef __PRETTY_FUNCTION__ -#define OSL_THIS_FUNC __PRETTY_FUNCTION__ -#elifdef __FUNCTION__ -#define OSL_THIS_FUNC __FUNCTION__ -#else -#define OSL_THIS_FUNC " " -#endif +#define OSL_THIS_FUNC "" /* the macro OSL_TO_STRING is intended to be an office internal macro for now */ #define OSL_TO_STRING( x ) #x -- cgit v1.2.3 From 6d1943085ccf3648d5a7e7f23f91afe4f7fb09ae Mon Sep 17 00:00:00 2001 From: sb Date: Fri, 29 Oct 2010 09:52:42 +0200 Subject: sb132: #i114840# $(CPPUNITTESTER) is not yet available while building sal --- sal/qa/rtl/math/makefile.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sal/qa/rtl/math/makefile.mk b/sal/qa/rtl/math/makefile.mk index fc0a1004f..59f2ecc49 100644 --- a/sal/qa/rtl/math/makefile.mk +++ b/sal/qa/rtl/math/makefile.mk @@ -25,6 +25,10 @@ # #***********************************************************************/ +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + PRJ = ../../.. PRJNAME = sal TARGET = qa_rtl_profile @@ -47,3 +51,5 @@ SLOFILES = $(SHL1OBJS) .INCLUDE: target.mk .INCLUDE: _cppunit.mk + +.END -- cgit v1.2.3 From ac8cf22ffe3b2e18e349babc59a287f395acee13 Mon Sep 17 00:00:00 2001 From: Vladimir Glazunov Date: Thu, 11 Nov 2010 15:41:49 +0100 Subject: #i10000# added export for x64 --- cppuhelper/source/gcc3.map | 1 + 1 file changed, 1 insertion(+) diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map index f842854e2..7bc84fbab 100644 --- a/cppuhelper/source/gcc3.map +++ b/cppuhelper/source/gcc3.map @@ -386,5 +386,6 @@ UDK_3.6 { # OOo 3.3 UDK_3.7 { # OOo 3.4 global: _ZN4cppu18OPropertySetHelper29setDependentFastPropertyValueElRKN3com3sun4star3uno3AnyE; + _ZN4cppu18OPropertySetHelper29setDependentFastPropertyValueEiRKN3com3sun4star3uno3AnyE; } UDK_3.6; -- cgit v1.2.3