Assertion clean-up

Change-Id: I234c615d9d3386da2b244709add5c029b76d346c
This commit is contained in:
Stephan Bergmann 2012-07-23 15:18:02 +02:00
parent 682cb83ed5
commit a4967e4a75
2 changed files with 10 additions and 14 deletions

View File

@ -187,17 +187,14 @@ inline void ObjectEntry::append(
typelib_typedescription_acquire( (typelib_TypeDescription *) pTypeDescr ); typelib_typedescription_acquire( (typelib_TypeDescription *) pTypeDescr );
aNewEntry.pTypeDescr = pTypeDescr; aNewEntry.pTypeDescr = pTypeDescr;
::std::pair< Ptr2ObjectMap::iterator, bool > insertion( ::std::pair< Ptr2ObjectMap::iterator, bool > i(
pEnv->aPtr2ObjectMap.insert( Ptr2ObjectMap::value_type( pEnv->aPtr2ObjectMap.insert( Ptr2ObjectMap::value_type(
pInterface, this ) ) ); pInterface, this ) ) );
// No idea if the code above has side-effects and can't be just SAL_WARN_IF(
// bypassed in the no-OSL_ASSERT case, so avoid "unused variable" like this instead. !i.second && (find(pInterface, 0) == -1 || i.first->second != this),
(void) insertion; "cppu",
"map already contains " << i.first->second << " != " << this << " for "
OSL_ASSERT( insertion.second || << pInterface);
(find( pInterface, 0 ) >= 0 &&
// points to the same object entry:
insertion.first->second == this) );
aInterfaces.push_back( aNewEntry ); aInterfaces.push_back( aNewEntry );
} }

View File

@ -861,11 +861,10 @@ Reference< XInterface > FactoryImpl::createAdapter(
&adapter_set, m_receiver2adapters, xKey.get(), rTypes ); &adapter_set, m_receiver2adapters, xKey.get(), rTypes );
if (0 == that) // again no entry if (0 == that) // again no entry
{ {
pair< t_ptr_set::iterator, bool > insertion( pair< t_ptr_set::iterator, bool > i(adapter_set->insert(pNew));
adapter_set->insert( pNew ) ); SAL_WARN_IF(
// Avoid unused variable warning !i.second, "stoc",
(void) insertion; "set already contains " << *(i.first) << " != " << pNew);
OSL_ASSERT( insertion.second );
that = pNew; that = pNew;
} }
else else