Replace dynamic array with std::vector.

This commit is contained in:
Stephan Bergmann
2012-01-02 18:00:40 +01:00
parent 13a40f3041
commit 9d54084d61

View File

@@ -287,20 +287,21 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () )
if( pWeakMap )
{
sal_Int32 nSize = pWeakMap->size();
typelib_TypeDescriptionReference ** ppTDR = new typelib_TypeDescriptionReference *[ nSize ];
std::vector< typelib_TypeDescriptionReference * > ppTDR;
// save al weak references
WeakMap_Impl::const_iterator aIt = pWeakMap->begin();
sal_Int32 i = 0;
while( aIt != pWeakMap->end() )
{
typelib_typedescriptionreference_acquire( ppTDR[i++] = (*aIt).second );
ppTDR.push_back( (*aIt).second );
typelib_typedescriptionreference_acquire( ppTDR.back() );
++aIt;
}
for( i = 0; i < nSize; i++ )
for( std::vector< typelib_TypeDescriptionReference * >::iterator i(
ppTDR.begin() );
i != ppTDR.end(); ++i )
{
typelib_TypeDescriptionReference * pTDR = ppTDR[i];
typelib_TypeDescriptionReference * pTDR = *i;
OSL_ASSERT( pTDR->nRefCount > pTDR->nStaticRefCount );
pTDR->nRefCount -= pTDR->nStaticRefCount;
@@ -312,8 +313,6 @@ TypeDescriptor_Init_Impl::~TypeDescriptor_Init_Impl() SAL_THROW( () )
typelib_typedescriptionreference_release( pTDR );
}
delete [] ppTDR;
#if OSL_DEBUG_LEVEL > 1
aIt = pWeakMap->begin();
while( aIt != pWeakMap->end() )