diff options
author | Daniel Boelzle <dbo@openoffice.org> | 2001-02-20 09:16:11 +0000 |
---|---|---|
committer | Daniel Boelzle <dbo@openoffice.org> | 2001-02-20 09:16:11 +0000 |
commit | 780a743ea8892173fd06d779bc543bbbc06e655c (patch) | |
tree | 129e1ba8bc4e376f7244c4d7a408189562515217 /cppu/source/uno | |
parent | a7ccfb62b53d377c12e97241e0421e2605bba6b8 (diff) |
init of uno_Any::pData; minor modifications
Diffstat (limited to 'cppu/source/uno')
-rw-r--r-- | cppu/source/uno/data.cxx | 9 | ||||
-rw-r--r-- | cppu/source/uno/lbenv.cxx | 67 | ||||
-rw-r--r-- | cppu/source/uno/lbmap.cxx | 8 | ||||
-rw-r--r-- | cppu/source/uno/prim.hxx | 20 |
4 files changed, 61 insertions, 43 deletions
diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx index 4bcd4986763f..1e42318dcd14 100644 --- a/cppu/source/uno/data.cxx +++ b/cppu/source/uno/data.cxx @@ -2,9 +2,9 @@ * * $RCSfile: data.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dbo $ $Date: 2000-12-21 14:39:28 $ + * last change: $Author: dbo $ $Date: 2001-02-20 10:16:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,6 +73,11 @@ using namespace com::sun::star::uno; namespace cppu { +uno_Sequence * s_pSeq = 0; +uno_Sequence s_seq; +typelib_TypeDescriptionReference * s_pVoidType = 0; +typelib_TypeDescription * s_pQITD = 0; + //================================================================================================== void defaultConstructStruct( void * pMem, diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index 7e336fd8a10e..3951c42aadd9 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -2,9 +2,9 @@ * * $RCSfile: lbenv.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: dbo $ $Date: 2001-02-16 16:29:27 $ + * last change: $Author: dbo $ $Date: 2001-02-20 10:16:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -277,8 +277,8 @@ inline const InterfaceEntry * ObjectEntry::find( { // shortcut common case if (((typelib_TypeDescription *)pTypeDescr)->pTypeName->length == sizeof("com.sun.star.uno.XInterface") && - rtl_ustr_ascii_compare( ((typelib_TypeDescription *)pTypeDescr)->pTypeName->buffer, - "com.sun.star.uno.XInterface" ) == 0) + ::rtl_ustr_ascii_compare( ((typelib_TypeDescription *)pTypeDescr)->pTypeName->buffer, + "com.sun.star.uno.XInterface" ) == 0) { return &aInterfaces[0]; } @@ -431,7 +431,7 @@ static void SAL_CALL defenv_getObjectIdentifier( OSL_ENSHURE( pEnv && ppOId && pInterface, "### null ptr!" ); if (*ppOId) { - rtl_uString_release( *ppOId ); + ::rtl_uString_release( *ppOId ); *ppOId = 0; } @@ -441,7 +441,7 @@ static void SAL_CALL defenv_getObjectIdentifier( static_cast< uno_DefaultEnvironment * >( pEnv )->aPtr2ObjectMap.find( pInterface ) ); if (iFind != static_cast< uno_DefaultEnvironment * >( pEnv )->aPtr2ObjectMap.end()) { - rtl_uString_acquire( *ppOId = (*iFind).second->oid.pData ); + ::rtl_uString_acquire( *ppOId = (*iFind).second->oid.pData ); } else { @@ -502,14 +502,14 @@ static void SAL_CALL defenv_getRegisteredInterfaces( static void SAL_CALL defenv_acquire( uno_Environment * pEnv ) throw () { - osl_incrementInterlockedCount( &((uno_DefaultEnvironment *)pEnv)->nRef ); + ::osl_incrementInterlockedCount( &((uno_DefaultEnvironment *)pEnv)->nRef ); } //-------------------------------------------------------------------------------------------------- static void SAL_CALL defenv_release( uno_Environment * pEnv ) throw () { ClearableMutexGuard aGuard( getEnvironmentsData().aMutex ); - if (! osl_decrementInterlockedCount( &((uno_DefaultEnvironment *)pEnv)->nRef )) + if (! ::osl_decrementInterlockedCount( &((uno_DefaultEnvironment *)pEnv)->nRef )) { getEnvironmentsData().revokeEnvironment( pEnv ); aGuard.clear(); @@ -529,19 +529,20 @@ uno_DefaultEnvironment::uno_DefaultEnvironment( : nRef( 0 ) , hModule( hMod_ ) { - ((uno_Environment *)this)->pReserved = 0; + uno_Environment * that = (uno_Environment *)this; + that->pReserved = 0; // functions - ((uno_Environment *)this)->acquire = defenv_acquire; - ((uno_Environment *)this)->release = defenv_release; - ((uno_Environment *)this)->dispose = defenv_dispose; - ((uno_Environment *)this)->pExtEnv = this; + that->acquire = defenv_acquire; + that->release = defenv_release; + that->dispose = defenv_dispose; + that->pExtEnv = this; // identifier - rtl_uString_acquire( rTypeName_.pData ); - ((uno_Environment *)this)->pTypeName = rTypeName_.pData; - ((uno_Environment *)this)->pContext = pContext_; + ::rtl_uString_acquire( rTypeName_.pData ); + that->pTypeName = rTypeName_.pData; + that->pContext = pContext_; // will be late initialized - ((uno_Environment *)this)->environmentDisposing = 0; + that->environmentDisposing = 0; uno_ExtEnvironment::registerInterface = defenv_registerInterface; uno_ExtEnvironment::registerProxyInterface = defenv_registerProxyInterface; @@ -556,12 +557,17 @@ uno_DefaultEnvironment::~uno_DefaultEnvironment() throw () { OSL_ENSHURE( aOId2ObjectMap.empty(), "### object entries left!" ); - if (((uno_Environment *)this)->environmentDisposing) - (*((uno_Environment *)this)->environmentDisposing)( (uno_Environment *)this ); + uno_Environment * that = (uno_Environment *)this; + if (that->environmentDisposing) + { + (*that->environmentDisposing)( that ); + } if (hModule) - osl_unloadModule( hModule ); + { + ::osl_unloadModule( hModule ); + } - rtl_uString_release( ((uno_Environment *)this)->pTypeName ); + ::rtl_uString_release( that->pTypeName ); } //================================================================================================== @@ -709,13 +715,13 @@ inline static const OUString & unoenv_getStaticOIdPart() throw () // pid oslProcessInfo info; info.Size = sizeof(oslProcessInfo); - if (osl_getProcessInfo( 0, osl_Process_IDENTIFIER, &info ) == osl_Process_E_None) + if (::osl_getProcessInfo( 0, osl_Process_IDENTIFIER, &info ) == osl_Process_E_None) aRet.append( (sal_Int64)info.Ident, 16 ); else aRet.appendAscii( RTL_CONSTASCII_STRINGPARAM("unknown process id") ); // good guid sal_uInt8 ar[16]; - rtl_getGlobalProcessId( ar ); + ::rtl_getGlobalProcessId( ar ); aRet.append( (sal_Unicode)';' ); for ( sal_Int32 i = 0; i < 16; ++i ) aRet.append( (sal_Int32)ar[i], 16 ); @@ -735,7 +741,7 @@ static void SAL_CALL unoenv_computeObjectIdentifier( OSL_ENSHURE( pEnv && ppOId && pInterface, "### null ptr!" ); if (*ppOId) { - rtl_uString_release( *ppOId ); + ::rtl_uString_release( *ppOId ); *ppOId = 0; } @@ -773,7 +779,7 @@ static void SAL_CALL unoenv_computeObjectIdentifier( // process;good guid oid.append( unoenv_getStaticOIdPart() ); OUString aStr( oid.makeStringAndClear() ); - rtl_uString_acquire( *ppOId = aStr.pData ); + ::rtl_uString_acquire( *ppOId = aStr.pData ); } __destructAny( &aRet, 0 ); } @@ -809,7 +815,12 @@ EnvironmentsData::~EnvironmentsData() throw () #endif while (iPos != aName2EnvMap.end()) { - (*(*iPos).second->dispose)( (*iPos).second ); + uno_Environment * pEnv = (*iPos).second; +#ifdef CPPU_LEAK_STATIC_DATA + pEnv->environmentDisposing = 0; // set to null => wont be called in dtor +#else + (*pEnv->dispose)( pEnv ); // send explicit dispose +#endif ++iPos; } } @@ -955,7 +966,7 @@ static uno_Environment * initDefaultEnvironment( } else { - osl_unloadModule( hMod ); + ::osl_unloadModule( hMod ); } } } @@ -966,7 +977,7 @@ static uno_Environment * initDefaultEnvironment( //-------------------------------------------------------------------------------------------------- static void SAL_CALL anonymous_defenv_release( uno_Environment * pEnv ) throw () { - if (! osl_decrementInterlockedCount( &((uno_DefaultEnvironment *)pEnv)->nRef )) + if (! ::osl_decrementInterlockedCount( &((uno_DefaultEnvironment *)pEnv)->nRef )) delete (uno_DefaultEnvironment *)pEnv; } } diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx index e63affb5cfa9..6ba72bb560c8 100644 --- a/cppu/source/uno/lbmap.cxx +++ b/cppu/source/uno/lbmap.cxx @@ -2,9 +2,9 @@ * * $RCSfile: lbmap.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: pliao $ $Date: 2001-02-07 03:40:08 $ + * last change: $Author: dbo $ $Date: 2001-02-20 10:16:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -236,7 +236,7 @@ static void SAL_CALL mediate_free( uno_Mapping * pMapping ) throw () //-------------------------------------------------------------------------------------------------- static void SAL_CALL mediate_acquire( uno_Mapping * pMapping ) throw () { - if (1 == osl_incrementInterlockedCount( + if (1 == ::osl_incrementInterlockedCount( & static_cast< uno_Mediate_Mapping * >( pMapping )->nRef )) { uno_registerMapping( @@ -249,7 +249,7 @@ static void SAL_CALL mediate_acquire( uno_Mapping * pMapping ) throw () //-------------------------------------------------------------------------------------------------- static void SAL_CALL mediate_release( uno_Mapping * pMapping ) throw () { - if (! osl_decrementInterlockedCount( + if (! ::osl_decrementInterlockedCount( & static_cast< uno_Mediate_Mapping * >( pMapping )->nRef )) { uno_revokeMapping( pMapping ); diff --git a/cppu/source/uno/prim.hxx b/cppu/source/uno/prim.hxx index 69fef3ddceef..238d248f9d3f 100644 --- a/cppu/source/uno/prim.hxx +++ b/cppu/source/uno/prim.hxx @@ -2,9 +2,9 @@ * * $RCSfile: prim.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: dbo $ $Date: 2000-12-21 14:39:29 $ + * last change: $Author: dbo $ $Date: 2001-02-20 10:16:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,6 +102,11 @@ namespace cppu { +extern uno_Sequence * s_pSeq; +extern uno_Sequence s_seq; +extern typelib_TypeDescriptionReference * s_pVoidType; +extern typelib_TypeDescription * s_pQITD; + //-------------------------------------------------------------------------------------------------- inline void * __map( void * p, @@ -146,14 +151,12 @@ inline void __releaseRef( void ** pRef, uno_ReleaseFunc release ) throw () else (*((uno_Interface *)*pRef)->release)( (uno_Interface *)*pRef ); } -#ifdef DEBUG - *pRef = (void *)0xdeadbeef; +#ifdef _DEBUG + *pRef = (void *)0xdeaddead; #endif } //-------------------------------------------------------------------------------------------------- -static uno_Sequence * s_pSeq = 0; -static uno_Sequence s_seq; inline uno_Sequence * __getEmptySequence() throw () { if (! s_pSeq) @@ -170,7 +173,6 @@ inline uno_Sequence * __getEmptySequence() throw () return s_pSeq; } //-------------------------------------------------------------------------------------------------- -static typelib_TypeDescriptionReference * s_pVoidType = 0; inline typelib_TypeDescriptionReference * __getVoidType() throw () { if (! s_pVoidType) @@ -186,13 +188,14 @@ inline typelib_TypeDescriptionReference * __getVoidType() throw () } //-------------------------------------------------------------------------------------------------- -#ifdef DEBUG +#ifdef _DEBUG #define __CONSTRUCT_EMPTY_ANY( pAny ) \ (pAny)->pType = __getVoidType(); \ (pAny)->pData = (void *)0xdeadbeef; #else #define __CONSTRUCT_EMPTY_ANY( pAny ) \ (pAny)->pType = __getVoidType(); +(pAny)->pData = 0; #endif //-------------------------------------------------------------------------------------------------- @@ -200,7 +203,6 @@ inline typelib_TypeDescriptionReference * __getVoidType() throw () ::osl_incrementInterlockedCount( &(pType)->nRefCount ); //-------------------------------------------------------------------------------------------------- -static typelib_TypeDescription * s_pQITD = 0; inline typelib_TypeDescription * __getQueryInterfaceTypeDescr() throw () { if (! s_pQITD) |