diff options
author | Armin Le Grand <alg@apache.org> | 2013-07-27 11:40:32 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2013-07-27 11:40:32 +0000 |
commit | 8a6f84ce896f41a7a1f97b06d1e053c51cbba95e (patch) | |
tree | 0865afbfa9eb147e0a5be9759f932954cfb59e32 /cppu | |
parent | 59ee09f905e86724a2ba5cdccab9210d16686820 (diff) |
resync to trunk (close to AOO400)
Diffstat (limited to 'cppu')
-rw-r--r-- | cppu/inc/com/sun/star/uno/Reference.hxx | 5 | ||||
-rw-r--r-- | cppu/inc/cppu/Enterable.hxx | 18 | ||||
-rw-r--r-- | cppu/inc/typelib/typedescription.h | 91 | ||||
-rw-r--r-- | cppu/source/uno/EnvStack.cxx | 4 | ||||
-rw-r--r-- | cppu/source/uno/data.cxx | 14 |
5 files changed, 63 insertions, 69 deletions
diff --git a/cppu/inc/com/sun/star/uno/Reference.hxx b/cppu/inc/com/sun/star/uno/Reference.hxx index 24ec8ca4f053..d1df31156455 100644 --- a/cppu/inc/com/sun/star/uno/Reference.hxx +++ b/cppu/inc/com/sun/star/uno/Reference.hxx @@ -171,18 +171,21 @@ inline Reference< interface_type >::Reference( const Any & rAny, UnoReference_Qu template< class interface_type > inline Reference< interface_type >::Reference( const BaseReference & rRef, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ) { + _pInterface = NULL; _pInterface = iquery_throw( rRef.get() ); } //__________________________________________________________________________________________________ template< class interface_type > inline Reference< interface_type >::Reference( XInterface * pInterface, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ) { + _pInterface = NULL; _pInterface = iquery_throw( pInterface ); } //__________________________________________________________________________________________________ template< class interface_type > inline Reference< interface_type >::Reference( const Any & rAny, UnoReference_QueryThrow ) SAL_THROW( (RuntimeException) ) { + _pInterface = NULL; _pInterface = iquery_throw( typelib_TypeClass_INTERFACE == rAny.pType->eTypeClass ? static_cast< XInterface * >( rAny.pReserved ) : 0 ); } @@ -190,12 +193,14 @@ inline Reference< interface_type >::Reference( const Any & rAny, UnoReference_Qu template< class interface_type > inline Reference< interface_type >::Reference( const Reference< interface_type > & rRef, UnoReference_SetThrow ) SAL_THROW( (RuntimeException) ) { + _pInterface = NULL; _pInterface = iset_throw( rRef.get() ); } //__________________________________________________________________________________________________ template< class interface_type > inline Reference< interface_type >::Reference( interface_type * pInterface, UnoReference_SetThrow ) SAL_THROW( (RuntimeException) ) { + _pInterface = NULL; _pInterface = iset_throw( pInterface ); } #endif diff --git a/cppu/inc/cppu/Enterable.hxx b/cppu/inc/cppu/Enterable.hxx index e29cbb5887a3..58edf3f56783 100644 --- a/cppu/inc/cppu/Enterable.hxx +++ b/cppu/inc/cppu/Enterable.hxx @@ -46,16 +46,16 @@ public: virtual void v_callOut_v (uno_EnvCallee * pCallee, va_list * pParam) = 0; virtual int v_isValid (rtl::OUString * pReason) = 0; - virtual ~Enterable() {}; + virtual ~Enterable() {} public: inline explicit Enterable(void); - inline void enter(void) {m_enter(this);}; - inline void leave(void) {m_leave(this);}; + inline void enter(void) {m_enter(this);} + inline void leave(void) {m_leave(this);} - inline void callInto_v(uno_EnvCallee * pCallee, va_list * pParam) {m_callInto_v(this, pCallee, pParam);}; - inline void callOut_v (uno_EnvCallee * pCallee, va_list * pParam) {m_callOut_v (this, pCallee, pParam);}; + inline void callInto_v(uno_EnvCallee * pCallee, va_list * pParam) {m_callInto_v(this, pCallee, pParam);} + inline void callOut_v (uno_EnvCallee * pCallee, va_list * pParam) {m_callOut_v (this, pCallee, pParam);} inline void callInto(uno_EnvCallee * pCallee, ...); inline void callOut (uno_EnvCallee * pCallee, ...); @@ -67,12 +67,12 @@ private: Enterable & operator = (Enterable const &); }; -extern "C" inline void Enterable_call_enter (void * context) { ((Enterable *)context)->v_enter(); }; -extern "C" inline void Enterable_call_leave (void * context) { ((Enterable *)context)->v_leave(); }; +extern "C" inline void Enterable_call_enter (void * context) { ((Enterable *)context)->v_enter(); } +extern "C" inline void Enterable_call_leave (void * context) { ((Enterable *)context)->v_leave(); } extern "C" inline void Enterable_call_callInto_v(void * context, uno_EnvCallee * pCallee, va_list * pParam) - { ((Enterable *)context)->v_callInto_v(pCallee, pParam); }; + { ((Enterable *)context)->v_callInto_v(pCallee, pParam); } extern "C" inline void Enterable_call_callOut_v (void * context, uno_EnvCallee * pCallee, va_list * pParam) - { ((Enterable *)context)->v_callOut_v(pCallee, pParam); }; + { ((Enterable *)context)->v_callOut_v(pCallee, pParam); } extern "C" inline int Enterable_call_isValid (void * context, rtl_uString ** pReason) {return ((Enterable *)context)->v_isValid((rtl::OUString *)pReason);} diff --git a/cppu/inc/typelib/typedescription.h b/cppu/inc/typelib/typedescription.h index b7913f2d9b1e..8e0e7e75750d 100644 --- a/cppu/inc/typelib/typedescription.h +++ b/cppu/inc/typelib/typedescription.h @@ -868,51 +868,6 @@ void SAL_CALL typelib_typedescription_revokeCallback( /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ -/** Returns true, if the type description reference may lose the type description. Otherwise - pType is a valid pointer and cannot be discarded through the lifetime of this reference. - Remark: If the pWeakObj of the type is set too, you can avoid the call of - ...getDescription(...) and use the description directly. pWeakObj == 0 means, that the - description is not initialized. - @internal -*/ -#define TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( eTypeClass ) \ - ((eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || \ - (eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE) - -/** Gets a description from the reference. The description may not be locked by this call. - You must use the TYPELIB_DANGER_RELEASE macro to release the description fetched with - this macro. - @internal -*/ -#define TYPELIB_DANGER_GET( ppDescription, pTypeRef ) \ -{ \ - typelib_TypeDescriptionReference * pMacroTypeRef = (pTypeRef); \ - typelib_TypeDescription ** ppMacroTypeDescr = (ppDescription); \ - if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pMacroTypeRef->eTypeClass )) \ - { \ - typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef ); \ - } \ - else if (!pMacroTypeRef->pType || !pMacroTypeRef->pType->pWeakRef) \ - { \ - typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef ); \ - if (*ppMacroTypeDescr) \ - typelib_typedescription_release( *ppMacroTypeDescr ); \ - } \ - else \ - { \ - *ppMacroTypeDescr = pMacroTypeRef->pType; \ - } \ -} - -/** Releases the description previouse fetched by TYPELIB_DANGER_GET. - @internal -*/ -#define TYPELIB_DANGER_RELEASE( pDescription ) \ -{ \ - if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( (pDescription)->eTypeClass )) \ - typelib_typedescription_release( pDescription ); \ -} - /** Creates a type description reference. This is a weak reference not holding the description. If the description is already registered, the previous one is returned. @@ -1149,6 +1104,52 @@ sal_Bool SAL_CALL typelib_typedescription_complete( typelib_TypeDescription ** ppTypeDescr ) SAL_THROW_EXTERN_C(); +/** Returns true, if the type description reference may lose the type description. Otherwise + pType is a valid pointer and cannot be discarded through the lifetime of this reference. + Remark: If the pWeakObj of the type is set too, you can avoid the call of + ...getDescription(...) and use the description directly. pWeakObj == 0 means, that the + description is not initialized. + @internal +*/ +inline bool TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( _typelib_TypeClass eTypeClass ) +{ + return (eTypeClass == typelib_TypeClass_INTERFACE_METHOD) || + (eTypeClass == typelib_TypeClass_INTERFACE_ATTRIBUTE); +} + +/** Gets a description from the reference. The description may not be locked by this call. + You must use the TYPELIB_DANGER_RELEASE macro to release the description fetched with + this macro. + @internal +*/ +inline void TYPELIB_DANGER_GET( typelib_TypeDescription** ppMacroTypeDescr, + typelib_TypeDescriptionReference* pMacroTypeRef ) +{ + if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pMacroTypeRef->eTypeClass )) + { + typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef ); + } + else if (!pMacroTypeRef->pType || !pMacroTypeRef->pType->pWeakRef) + { + typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef ); + if (*ppMacroTypeDescr) + typelib_typedescription_release( *ppMacroTypeDescr ); + } + else + { + *ppMacroTypeDescr = pMacroTypeRef->pType; + } +} + +/** Releases the description previouse fetched by TYPELIB_DANGER_GET. + @internal +*/ +inline void TYPELIB_DANGER_RELEASE( typelib_TypeDescription* pDescription ) +{ + if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pDescription->eTypeClass )) + typelib_typedescription_release( pDescription ); +} + #ifdef __cplusplus } #endif diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx index 46865115d97f..6fce75c5ae5b 100644 --- a/cppu/source/uno/EnvStack.cxx +++ b/cppu/source/uno/EnvStack.cxx @@ -76,11 +76,11 @@ static void s_setCurrent(uno_Environment * pEnv) osl::MutexGuard guard(s_threadMap_mutex); if (pEnv) s_threadMap[threadId] = pEnv; - else { ThreadMap::iterator iEnv = s_threadMap.find(threadId); - s_threadMap.erase(iEnv); + if( iEnv != s_threadMap.end()) + s_threadMap.erase(iEnv); } } diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx index ee4169b3d333..d23f61e7901d 100644 --- a/cppu/source/uno/data.cxx +++ b/cppu/source/uno/data.cxx @@ -368,20 +368,8 @@ sal_Bool SAL_CALL uno_type_isAssignableFromData( #define BINTEST_VERIFYOFFSET( s, m, n ) \ if (OFFSET_OF(s, m) != n) { fprintf( stderr, "### OFFSET_OF(" #s ", " #m ") = %" SAL_PRI_SIZET "u instead of expected %d!!!\n", OFFSET_OF(s, m), static_cast<int>(n) ); abort(); } -#if OSL_DEBUG_LEVEL > 1 -#if defined(__GNUC__) && (defined(LINUX) || defined(FREEBSD)) && (defined(INTEL) || defined(POWERPC) || defined(X86_64) || defined(S390)) -#define BINTEST_VERIFYSIZE( s, n ) \ - fprintf( stderr, "> sizeof(" #s ") = %d; __alignof__ (" #s ") = %d\n", sizeof(s), __alignof__ (s) ); \ - if (sizeof(s) != n) { fprintf( stderr, "### sizeof(" #s ") = %d instead of expected %d!!!\n", sizeof(s), n ); abort(); } -#else // ! GNUC #define BINTEST_VERIFYSIZE( s, n ) \ - fprintf( stderr, "> sizeof(" #s ") = %" SAL_PRI_SIZET "d\n", sizeof(s) ); \ - if (sizeof(s) != n) { fprintf( stderr, "### sizeof(" #s ") = %" SAL_PRI_SIZET "d instead of expected %d!!!\n", sizeof(s), n ); abort(); } -#endif -#else // ! OSL_DEBUG_LEVEL -#define BINTEST_VERIFYSIZE( s, n ) \ - if (sizeof(s) != n) { fprintf( stderr, "### sizeof(" #s ") = %d instead of expected %d!!!\n", sizeof(s), n ); abort(); } -#endif + if (sizeof(s) != n) { fprintf( stderr, "### sizeof(" #s ") = %d instead of expected %d!!!\n", (int)sizeof(s), n ); abort(); } struct C1 { |