[Libreoffice-commits] .: cppu/source stoc/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Mon Jul 23 06:18:18 PDT 2012


 cppu/source/uno/lbenv.cxx                           |   15 ++++++---------
 stoc/source/invocation_adapterfactory/iafactory.cxx |    9 ++++-----
 2 files changed, 10 insertions(+), 14 deletions(-)

New commits:
commit a4967e4a7563e1d1bd43d1560ed95b9f6bbf58cd
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 23 15:18:02 2012 +0200

    Assertion clean-up
    
    Change-Id: I234c615d9d3386da2b244709add5c029b76d346c

diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index ef37aee..3358fe9 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -187,17 +187,14 @@ inline void ObjectEntry::append(
     typelib_typedescription_acquire( (typelib_TypeDescription *) pTypeDescr );
     aNewEntry.pTypeDescr = pTypeDescr;
 
-    ::std::pair< Ptr2ObjectMap::iterator, bool > insertion(
+    ::std::pair< Ptr2ObjectMap::iterator, bool > i(
         pEnv->aPtr2ObjectMap.insert( Ptr2ObjectMap::value_type(
                                          pInterface, this ) ) );
-    // No idea if the code above has side-effects and can't be just
-    // bypassed in the no-OSL_ASSERT case, so avoid "unused variable" like this instead.
-    (void) insertion;
-
-    OSL_ASSERT( insertion.second ||
-                (find( pInterface, 0 ) >= 0 &&
-                 // points to the same object entry:
-                 insertion.first->second == this) );
+    SAL_WARN_IF(
+        !i.second && (find(pInterface, 0) == -1 || i.first->second != this),
+        "cppu",
+        "map already contains " << i.first->second << " != " << this << " for "
+            << pInterface);
     aInterfaces.push_back( aNewEntry );
 }
 
diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx
index 72a880a..1a1ab13 100644
--- a/stoc/source/invocation_adapterfactory/iafactory.cxx
+++ b/stoc/source/invocation_adapterfactory/iafactory.cxx
@@ -861,11 +861,10 @@ Reference< XInterface > FactoryImpl::createAdapter(
                 &adapter_set, m_receiver2adapters, xKey.get(), rTypes );
             if (0 == that) // again no entry
             {
-                pair< t_ptr_set::iterator, bool > insertion(
-                    adapter_set->insert( pNew ) );
-                // Avoid unused variable warning
-                (void) insertion;
-                OSL_ASSERT( insertion.second );
+                pair< t_ptr_set::iterator, bool > i(adapter_set->insert(pNew));
+                SAL_WARN_IF(
+                    !i.second, "stoc",
+                    "set already contains " << *(i.first) << " != " << pNew);
                 that = pNew;
             }
             else


More information about the Libreoffice-commits mailing list