cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx |    4 ---
 cppu/source/threadpool/threadpool.cxx                 |    6 ++---
 cppu/source/typelib/typelib.cxx                       |    3 +-
 cppu/source/uno/cascade_mapping.cxx                   |    2 -
 cppu/source/uno/lbenv.cxx                             |   21 ++++++------------
 cppu/source/uno/sequence.cxx                          |    6 ++---
 6 files changed, 17 insertions(+), 25 deletions(-)

New commits:
commit 8dbf87595ece3db6c98d34b97e10276bf588fd73
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue Apr 30 10:42:27 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Apr 30 18:51:12 2024 +0200

    WaE: C6011 Dereferencing NULL pointer warnings
    
    convert OSL_ASSERT to assert, etc.
    
    Change-Id: Idb920aab41e5d63ee07d0a8ef4c4cba1a220fc14
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166850
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx 
b/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx
index f68a47390cdb..e5d96658dcf5 100644
--- a/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx
+++ b/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx
@@ -128,13 +128,12 @@ Mapping::~Mapping()
     SAL_INFO("cppu.purpenv", "LIFE: Mapping:~Mapping() -> " << this);
 }
 
-
 void Mapping::mapInterface(
     uno_Interface                    ** ppOut,
     uno_Interface                     * pUnoI,
     typelib_InterfaceTypeDescription  * pTypeDescr)
 {
-    OSL_ASSERT(ppOut && pTypeDescr);
+    assert(ppOut && pTypeDescr);
     if (*ppOut)
     {
         (*ppOut)->release(*ppOut);
@@ -178,7 +177,6 @@ void Mapping::mapInterface(
     rtl_uString_release(pOId);
 }
 
-
 void Mapping::acquire()
 {
     if (osl_atomic_increment(&m_nCount) == 1)
diff --git a/cppu/source/threadpool/threadpool.cxx 
b/cppu/source/threadpool/threadpool.cxx
index a74d8678d986..5a6127dabcf7 100644
--- a/cppu/source/threadpool/threadpool.cxx
+++ b/cppu/source/threadpool/threadpool.cxx
@@ -295,11 +295,11 @@ namespace cppu_threadpool
 
             ThreadIdHashMap::iterator ii = m_mapQueue.find( aThreadId );
 
-            OSL_ASSERT( ii != m_mapQueue.end() );
+            assert(ii != m_mapQueue.end());
             pQueue = (*ii).second.first;
         }
 
-        OSL_ASSERT( pQueue );
+        assert(pQueue);
         void *pReturn = pQueue->enter( nDisposeId );
 
         if( pQueue->isCallstackEmpty() )
@@ -449,7 +449,7 @@ uno_threadpool_destroy( uno_ThreadPool hPool ) 
SAL_THROW_EXTERN_C()
 
     bool empty;
     {
-        OSL_ASSERT( g_pThreadpoolHashSet );
+        assert(g_pThreadpoolHashSet);
 
         MutexGuard guard( Mutex::getGlobalMutex() );
 
diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx
index 2b646a6dbf74..c482b725f80e 100644
--- a/cppu/source/typelib/typelib.cxx
+++ b/cppu/source/typelib/typelib.cxx
@@ -689,7 +689,7 @@ void newTypeDescription(
                 pTmp->ppMemberNames = new rtl_uString *[ nMembers ];
                 bool polymorphic = eTypeClass == typelib_TypeClass_STRUCT
                     && OUString::unacquired(&pTypeName).indexOf('<') >= 0;
-                OSL_ASSERT(!polymorphic || pStructMembers != nullptr);
+                assert(!polymorphic || pStructMembers != nullptr);
                 if (polymorphic) {
                     reinterpret_cast< typelib_StructTypeDescription * >(pTmp)->
                         pParameterizedTypes = new sal_Bool[nMembers];
@@ -714,6 +714,7 @@ void newTypeDescription(
                             = pStructMembers[i].aBase.pMemberName;
                         rtl_uString_acquire(pTmp->ppMemberNames[i]);
                     }
+                    assert(pTmp->ppTypeRefs[i]);
                     // write offset
                     sal_Int32 size;
                     sal_Int32 alignment;
diff --git a/cppu/source/uno/cascade_mapping.cxx 
b/cppu/source/uno/cascade_mapping.cxx
index 17b190032e52..97aaa16ca09a 100644
--- a/cppu/source/uno/cascade_mapping.cxx
+++ b/cppu/source/uno/cascade_mapping.cxx
@@ -131,7 +131,7 @@ void MediatorMapping::mapInterface(
     if (*ppOut != nullptr)
     {
         uno_ExtEnvironment * env = m_to.get()->pExtEnv;
-        OSL_ASSERT( env != nullptr );
+        assert(env != nullptr);
         env->releaseInterface( env, *ppOut );
         *ppOut = nullptr;
     }
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index d9b37b083e02..ef1509f37d04 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -233,7 +233,7 @@ static void defenv_registerInterface(
     uno_ExtEnvironment * pEnv, void ** ppInterface,
     rtl_uString * pOId, typelib_InterfaceTypeDescription * pTypeDescr )
 {
-    OSL_ENSURE( pEnv && ppInterface && pOId && pTypeDescr, "### null ptr!" );
+    assert(pEnv && ppInterface && pOId && pTypeDescr && "### null ptr!");
     OUString const & rOId = OUString::unacquired( &pOId );
 
     uno_DefaultEnvironment * that =
@@ -275,13 +275,11 @@ static void defenv_registerInterface(
     }
 }
 
-
 static void defenv_registerProxyInterface(
     uno_ExtEnvironment * pEnv, void ** ppInterface, uno_freeProxyFunc 
freeProxy,
     rtl_uString * pOId, typelib_InterfaceTypeDescription * pTypeDescr )
 {
-    OSL_ENSURE( pEnv && ppInterface && pOId && pTypeDescr && freeProxy,
-                "### null ptr!" );
+    assert(pEnv && ppInterface && pOId && pTypeDescr && freeProxy && "### null 
ptr!");
     OUString const & rOId = OUString::unacquired( &pOId );
 
     uno_DefaultEnvironment * that =
@@ -333,13 +331,12 @@ static void defenv_registerProxyInterface(
     }
 }
 
-
 static void s_stub_defenv_revokeInterface(va_list * pParam)
 {
     uno_ExtEnvironment * pEnv       = va_arg(*pParam, uno_ExtEnvironment *);
     void               * pInterface = va_arg(*pParam, void *);
 
-    OSL_ENSURE( pEnv && pInterface, "### null ptr!" );
+    assert(pEnv && pInterface && "### null ptr!");
     uno_DefaultEnvironment * that =
         static_cast< uno_DefaultEnvironment * >( pEnv );
     ::osl::ClearableMutexGuard guard( that->mutex );
@@ -430,7 +427,7 @@ static void defenv_revokeInterface(uno_ExtEnvironment * 
pEnv, void * pInterface)
 static void defenv_getObjectIdentifier(
     uno_ExtEnvironment * pEnv, rtl_uString ** ppOId, void * pInterface )
 {
-    OSL_ENSURE( pEnv && ppOId && pInterface, "### null ptr!" );
+    assert(pEnv && ppOId && pInterface && "### null ptr!");
     if (*ppOId)
     {
         ::rtl_uString_release( *ppOId );
@@ -456,12 +453,11 @@ static void defenv_getObjectIdentifier(
     }
 }
 
-
 static void defenv_getRegisteredInterface(
     uno_ExtEnvironment * pEnv, void ** ppInterface,
     rtl_uString * pOId, typelib_InterfaceTypeDescription * pTypeDescr )
 {
-    OSL_ENSURE( pEnv && ppInterface && pOId && pTypeDescr, "### null ptr!" );
+    assert(pEnv && ppInterface && pOId && pTypeDescr && "### null ptr!");
     if (*ppInterface)
     {
         (*pEnv->releaseInterface)( pEnv, *ppInterface );
@@ -486,7 +482,6 @@ static void defenv_getRegisteredInterface(
     }
 }
 
-
 static void defenv_getRegisteredInterfaces(
     uno_ExtEnvironment * pEnv, void *** pppInterfaces, sal_Int32 * pnLen,
     uno_memAlloc memAlloc )
@@ -690,7 +685,7 @@ extern "C" void SAL_CALL uno_dumpEnvironment(
     void * stream, uno_Environment * pEnv, const char * pFilter )
     SAL_THROW_EXTERN_C()
 {
-    OSL_ENSURE( pEnv, "### null ptr!" );
+    assert(pEnv && "### null ptr!");
     OUStringBuffer buf;
 
     if (! pEnv->pExtEnv)
@@ -919,10 +914,9 @@ void EnvironmentsData::getEnvironment(
     }
 }
 
-
 void EnvironmentsData::registerEnvironment( uno_Environment ** ppEnv )
 {
-    OSL_ENSURE( ppEnv, "### null ptr!" );
+    assert(ppEnv && "### null ptr!");
     uno_Environment * pEnv =  *ppEnv;
 
     OUString aKey =
@@ -958,7 +952,6 @@ void EnvironmentsData::registerEnvironment( uno_Environment 
** ppEnv )
     }
 }
 
-
 void EnvironmentsData::getRegisteredEnvironments(
     uno_Environment *** pppEnvs, sal_Int32 * pnLen, uno_memAlloc memAlloc,
     std::u16string_view rEnvDcp )
diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx
index 2d8b1da19f84..1a8da6d53c96 100644
--- a/cppu/source/uno/sequence.cxx
+++ b/cppu/source/uno/sequence.cxx
@@ -779,7 +779,7 @@ sal_Bool SAL_CALL uno_sequence_realloc(
     sal_Int32 nSize, uno_AcquireFunc acquire, uno_ReleaseFunc release )
     SAL_THROW_EXTERN_C()
 {
-    OSL_ENSURE( ppSequence, "### null ptr!" );
+    assert(ppSequence && "### null ptr!");
     OSL_ENSURE( nSize >= 0, "### new size must be at least 0!" );
 
     bool ret = true;
@@ -799,7 +799,7 @@ sal_Bool SAL_CALL uno_type_sequence_reference2One(
     uno_AcquireFunc acquire, uno_ReleaseFunc release )
     SAL_THROW_EXTERN_C()
 {
-    OSL_ENSURE( ppSequence, "### null ptr!" );
+    assert(ppSequence && "### null ptr!");
     bool ret = true;
     uno_Sequence * pSequence = *ppSequence;
     if (pSequence->nRefCount > 1)
@@ -846,7 +846,7 @@ sal_Bool SAL_CALL uno_sequence_reference2One(
     uno_AcquireFunc acquire, uno_ReleaseFunc release )
     SAL_THROW_EXTERN_C()
 {
-    OSL_ENSURE( ppSequence, "### null ptr!" );
+    assert(ppSequence && "### null ptr!");
     bool ret = true;
     uno_Sequence * pSequence = *ppSequence;
     if (pSequence->nRefCount > 1)
  • core.git: cppu/source Caolán McNamara (via logerrit)
    • core.git: cppu/source Caolán McNamara (via logerrit)

Reply via email to