init of uno_Any::pData; minor modifications

This commit is contained in:
Daniel Boelzle
2001-02-20 09:16:11 +00:00
parent a7ccfb62b5
commit 780a743ea8
4 changed files with 61 additions and 43 deletions

View File

@@ -2,9 +2,9 @@
* *
* $RCSfile: data.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@@ -73,6 +73,11 @@ using namespace com::sun::star::uno;
namespace cppu namespace cppu
{ {
uno_Sequence * s_pSeq = 0;
uno_Sequence s_seq;
typelib_TypeDescriptionReference * s_pVoidType = 0;
typelib_TypeDescription * s_pQITD = 0;
//================================================================================================== //==================================================================================================
void defaultConstructStruct( void defaultConstructStruct(
void * pMem, void * pMem,

View File

@@ -2,9 +2,9 @@
* *
* $RCSfile: lbenv.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@@ -277,7 +277,7 @@ inline const InterfaceEntry * ObjectEntry::find(
{ {
// shortcut common case // shortcut common case
if (((typelib_TypeDescription *)pTypeDescr)->pTypeName->length == sizeof("com.sun.star.uno.XInterface") && if (((typelib_TypeDescription *)pTypeDescr)->pTypeName->length == sizeof("com.sun.star.uno.XInterface") &&
rtl_ustr_ascii_compare( ((typelib_TypeDescription *)pTypeDescr)->pTypeName->buffer, ::rtl_ustr_ascii_compare( ((typelib_TypeDescription *)pTypeDescr)->pTypeName->buffer,
"com.sun.star.uno.XInterface" ) == 0) "com.sun.star.uno.XInterface" ) == 0)
{ {
return &aInterfaces[0]; return &aInterfaces[0];
@@ -431,7 +431,7 @@ static void SAL_CALL defenv_getObjectIdentifier(
OSL_ENSHURE( pEnv && ppOId && pInterface, "### null ptr!" ); OSL_ENSHURE( pEnv && ppOId && pInterface, "### null ptr!" );
if (*ppOId) if (*ppOId)
{ {
rtl_uString_release( *ppOId ); ::rtl_uString_release( *ppOId );
*ppOId = 0; *ppOId = 0;
} }
@@ -441,7 +441,7 @@ static void SAL_CALL defenv_getObjectIdentifier(
static_cast< uno_DefaultEnvironment * >( pEnv )->aPtr2ObjectMap.find( pInterface ) ); static_cast< uno_DefaultEnvironment * >( pEnv )->aPtr2ObjectMap.find( pInterface ) );
if (iFind != static_cast< uno_DefaultEnvironment * >( pEnv )->aPtr2ObjectMap.end()) 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 else
{ {
@@ -502,14 +502,14 @@ static void SAL_CALL defenv_getRegisteredInterfaces(
static void SAL_CALL defenv_acquire( uno_Environment * pEnv ) static void SAL_CALL defenv_acquire( uno_Environment * pEnv )
throw () throw ()
{ {
osl_incrementInterlockedCount( &((uno_DefaultEnvironment *)pEnv)->nRef ); ::osl_incrementInterlockedCount( &((uno_DefaultEnvironment *)pEnv)->nRef );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
static void SAL_CALL defenv_release( uno_Environment * pEnv ) static void SAL_CALL defenv_release( uno_Environment * pEnv )
throw () throw ()
{ {
ClearableMutexGuard aGuard( getEnvironmentsData().aMutex ); ClearableMutexGuard aGuard( getEnvironmentsData().aMutex );
if (! osl_decrementInterlockedCount( &((uno_DefaultEnvironment *)pEnv)->nRef )) if (! ::osl_decrementInterlockedCount( &((uno_DefaultEnvironment *)pEnv)->nRef ))
{ {
getEnvironmentsData().revokeEnvironment( pEnv ); getEnvironmentsData().revokeEnvironment( pEnv );
aGuard.clear(); aGuard.clear();
@@ -529,19 +529,20 @@ uno_DefaultEnvironment::uno_DefaultEnvironment(
: nRef( 0 ) : nRef( 0 )
, hModule( hMod_ ) , hModule( hMod_ )
{ {
((uno_Environment *)this)->pReserved = 0; uno_Environment * that = (uno_Environment *)this;
that->pReserved = 0;
// functions // functions
((uno_Environment *)this)->acquire = defenv_acquire; that->acquire = defenv_acquire;
((uno_Environment *)this)->release = defenv_release; that->release = defenv_release;
((uno_Environment *)this)->dispose = defenv_dispose; that->dispose = defenv_dispose;
((uno_Environment *)this)->pExtEnv = this; that->pExtEnv = this;
// identifier // identifier
rtl_uString_acquire( rTypeName_.pData ); ::rtl_uString_acquire( rTypeName_.pData );
((uno_Environment *)this)->pTypeName = rTypeName_.pData; that->pTypeName = rTypeName_.pData;
((uno_Environment *)this)->pContext = pContext_; that->pContext = pContext_;
// will be late initialized // will be late initialized
((uno_Environment *)this)->environmentDisposing = 0; that->environmentDisposing = 0;
uno_ExtEnvironment::registerInterface = defenv_registerInterface; uno_ExtEnvironment::registerInterface = defenv_registerInterface;
uno_ExtEnvironment::registerProxyInterface = defenv_registerProxyInterface; uno_ExtEnvironment::registerProxyInterface = defenv_registerProxyInterface;
@@ -556,12 +557,17 @@ uno_DefaultEnvironment::~uno_DefaultEnvironment() throw ()
{ {
OSL_ENSHURE( aOId2ObjectMap.empty(), "### object entries left!" ); OSL_ENSHURE( aOId2ObjectMap.empty(), "### object entries left!" );
if (((uno_Environment *)this)->environmentDisposing) uno_Environment * that = (uno_Environment *)this;
(*((uno_Environment *)this)->environmentDisposing)( (uno_Environment *)this ); if (that->environmentDisposing)
{
(*that->environmentDisposing)( that );
}
if (hModule) 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 // pid
oslProcessInfo info; oslProcessInfo info;
info.Size = sizeof(oslProcessInfo); 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 ); aRet.append( (sal_Int64)info.Ident, 16 );
else else
aRet.appendAscii( RTL_CONSTASCII_STRINGPARAM("unknown process id") ); aRet.appendAscii( RTL_CONSTASCII_STRINGPARAM("unknown process id") );
// good guid // good guid
sal_uInt8 ar[16]; sal_uInt8 ar[16];
rtl_getGlobalProcessId( ar ); ::rtl_getGlobalProcessId( ar );
aRet.append( (sal_Unicode)';' ); aRet.append( (sal_Unicode)';' );
for ( sal_Int32 i = 0; i < 16; ++i ) for ( sal_Int32 i = 0; i < 16; ++i )
aRet.append( (sal_Int32)ar[i], 16 ); aRet.append( (sal_Int32)ar[i], 16 );
@@ -735,7 +741,7 @@ static void SAL_CALL unoenv_computeObjectIdentifier(
OSL_ENSHURE( pEnv && ppOId && pInterface, "### null ptr!" ); OSL_ENSHURE( pEnv && ppOId && pInterface, "### null ptr!" );
if (*ppOId) if (*ppOId)
{ {
rtl_uString_release( *ppOId ); ::rtl_uString_release( *ppOId );
*ppOId = 0; *ppOId = 0;
} }
@@ -773,7 +779,7 @@ static void SAL_CALL unoenv_computeObjectIdentifier(
// process;good guid // process;good guid
oid.append( unoenv_getStaticOIdPart() ); oid.append( unoenv_getStaticOIdPart() );
OUString aStr( oid.makeStringAndClear() ); OUString aStr( oid.makeStringAndClear() );
rtl_uString_acquire( *ppOId = aStr.pData ); ::rtl_uString_acquire( *ppOId = aStr.pData );
} }
__destructAny( &aRet, 0 ); __destructAny( &aRet, 0 );
} }
@@ -809,7 +815,12 @@ EnvironmentsData::~EnvironmentsData() throw ()
#endif #endif
while (iPos != aName2EnvMap.end()) 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; ++iPos;
} }
} }
@@ -955,7 +966,7 @@ static uno_Environment * initDefaultEnvironment(
} }
else 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 () 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; delete (uno_DefaultEnvironment *)pEnv;
} }
} }

View File

@@ -2,9 +2,9 @@
* *
* $RCSfile: lbmap.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * 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 () 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 )) & static_cast< uno_Mediate_Mapping * >( pMapping )->nRef ))
{ {
uno_registerMapping( 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 () static void SAL_CALL mediate_release( uno_Mapping * pMapping ) throw ()
{ {
if (! osl_decrementInterlockedCount( if (! ::osl_decrementInterlockedCount(
& static_cast< uno_Mediate_Mapping * >( pMapping )->nRef )) & static_cast< uno_Mediate_Mapping * >( pMapping )->nRef ))
{ {
uno_revokeMapping( pMapping ); uno_revokeMapping( pMapping );

View File

@@ -2,9 +2,9 @@
* *
* $RCSfile: prim.hxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@@ -102,6 +102,11 @@
namespace cppu 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( inline void * __map(
void * p, void * p,
@@ -146,14 +151,12 @@ inline void __releaseRef( void ** pRef, uno_ReleaseFunc release ) throw ()
else else
(*((uno_Interface *)*pRef)->release)( (uno_Interface *)*pRef ); (*((uno_Interface *)*pRef)->release)( (uno_Interface *)*pRef );
} }
#ifdef DEBUG #ifdef _DEBUG
*pRef = (void *)0xdeadbeef; *pRef = (void *)0xdeaddead;
#endif #endif
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
static uno_Sequence * s_pSeq = 0;
static uno_Sequence s_seq;
inline uno_Sequence * __getEmptySequence() throw () inline uno_Sequence * __getEmptySequence() throw ()
{ {
if (! s_pSeq) if (! s_pSeq)
@@ -170,7 +173,6 @@ inline uno_Sequence * __getEmptySequence() throw ()
return s_pSeq; return s_pSeq;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
static typelib_TypeDescriptionReference * s_pVoidType = 0;
inline typelib_TypeDescriptionReference * __getVoidType() throw () inline typelib_TypeDescriptionReference * __getVoidType() throw ()
{ {
if (! s_pVoidType) if (! s_pVoidType)
@@ -186,13 +188,14 @@ inline typelib_TypeDescriptionReference * __getVoidType() throw ()
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
#ifdef DEBUG #ifdef _DEBUG
#define __CONSTRUCT_EMPTY_ANY( pAny ) \ #define __CONSTRUCT_EMPTY_ANY( pAny ) \
(pAny)->pType = __getVoidType(); \ (pAny)->pType = __getVoidType(); \
(pAny)->pData = (void *)0xdeadbeef; (pAny)->pData = (void *)0xdeadbeef;
#else #else
#define __CONSTRUCT_EMPTY_ANY( pAny ) \ #define __CONSTRUCT_EMPTY_ANY( pAny ) \
(pAny)->pType = __getVoidType(); (pAny)->pType = __getVoidType();
(pAny)->pData = 0;
#endif #endif
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -200,7 +203,6 @@ inline typelib_TypeDescriptionReference * __getVoidType() throw ()
::osl_incrementInterlockedCount( &(pType)->nRefCount ); ::osl_incrementInterlockedCount( &(pType)->nRefCount );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
static typelib_TypeDescription * s_pQITD = 0;
inline typelib_TypeDescription * __getQueryInterfaceTypeDescr() throw () inline typelib_TypeDescription * __getQueryInterfaceTypeDescr() throw ()
{ {
if (! s_pQITD) if (! s_pQITD)