diff options
Diffstat (limited to 'cppu/source/uno')
-rw-r--r-- | cppu/source/uno/EnvStack.cxx | 16 | ||||
-rw-r--r-- | cppu/source/uno/any.cxx | 12 | ||||
-rw-r--r-- | cppu/source/uno/assign.hxx | 14 | ||||
-rw-r--r-- | cppu/source/uno/cascade_mapping.cxx | 20 | ||||
-rw-r--r-- | cppu/source/uno/constr.hxx | 4 | ||||
-rw-r--r-- | cppu/source/uno/copy.hxx | 34 | ||||
-rw-r--r-- | cppu/source/uno/data.cxx | 44 | ||||
-rw-r--r-- | cppu/source/uno/destr.hxx | 8 | ||||
-rw-r--r-- | cppu/source/uno/eq.hxx | 14 | ||||
-rw-r--r-- | cppu/source/uno/lbenv.cxx | 48 | ||||
-rw-r--r-- | cppu/source/uno/lbmap.cxx | 40 | ||||
-rw-r--r-- | cppu/source/uno/prim.hxx | 2 | ||||
-rw-r--r-- | cppu/source/uno/sequence.cxx | 128 |
13 files changed, 192 insertions, 192 deletions
diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx index 5fefaa85640a..2c1100a62499 100644 --- a/cppu/source/uno/EnvStack.cxx +++ b/cppu/source/uno/EnvStack.cxx @@ -88,7 +88,7 @@ static void s_setCurrent(uno_Environment * pEnv) static uno_Environment * s_getCurrent() { - uno_Environment * pEnv = NULL; + uno_Environment * pEnv = nullptr; oslThreadIdentifier threadId = osl::Thread::getCurrentIdentifier(); @@ -108,7 +108,7 @@ extern "C" void SAL_CALL uno_getCurrentEnvironment(uno_Environment ** ppEnv, rtl if (*ppEnv) { (*ppEnv)->release(*ppEnv); - *ppEnv = NULL; + *ppEnv = nullptr; } rtl::OUString currPurpose; @@ -122,7 +122,7 @@ extern "C" void SAL_CALL uno_getCurrentEnvironment(uno_Environment ** ppEnv, rtl rtl::OUString envDcp(pTypeName); envDcp += currPurpose; - uno_getEnvironment(ppEnv, envDcp.pData, NULL); + uno_getEnvironment(ppEnv, envDcp.pData, nullptr); } else { @@ -134,7 +134,7 @@ extern "C" void SAL_CALL uno_getCurrentEnvironment(uno_Environment ** ppEnv, rtl else { rtl::OUString uno_envDcp(UNO_LB_UNO); - uno_getEnvironment(ppEnv, uno_envDcp.pData, NULL); + uno_getEnvironment(ppEnv, uno_envDcp.pData, nullptr); } } } @@ -205,14 +205,14 @@ static int s_getNextEnv(uno_Environment ** ppEnv, uno_Environment * pCurrEnv, un rtl::OUString next_envDcp(UNO_LB_UNO); next_envDcp += nextPurpose; - uno_getEnvironment(ppEnv, next_envDcp.pData, NULL); + uno_getEnvironment(ppEnv, next_envDcp.pData, nullptr); } else { if (*ppEnv) (*ppEnv)->release(*ppEnv); - *ppEnv = NULL; + *ppEnv = nullptr; } return res; @@ -278,7 +278,7 @@ extern "C" { static void s_environment_invoke_vv(va_list * pParam) static void s_environment_invoke_v(uno_Environment * pCurrEnv, uno_Environment * pTargetEnv, uno_EnvCallee * pCallee, va_list * pParam) { - uno_Environment * pNextEnv = NULL; + uno_Environment * pNextEnv = nullptr; switch(s_getNextEnv(&pNextEnv, pCurrEnv, pTargetEnv)) { case -1: @@ -325,7 +325,7 @@ extern "C" void SAL_CALL uno_Environment_invoke(uno_Environment * pEnv, uno_EnvC extern "C" void SAL_CALL uno_Environment_enter(uno_Environment * pTargetEnv) SAL_THROW_EXTERN_C() { - uno_Environment * pNextEnv = NULL; + uno_Environment * pNextEnv = nullptr; uno_Environment * pCurrEnv = s_getCurrent(); int res; diff --git a/cppu/source/uno/any.cxx b/cppu/source/uno/any.cxx index 891518422a51..e26b97286d01 100644 --- a/cppu/source/uno/any.cxx +++ b/cppu/source/uno/any.cxx @@ -36,7 +36,7 @@ void SAL_CALL uno_type_any_assign( _destructAny( pDest, release ); if (pType) { - _copyConstructAny( pDest, pSource, pType, 0, acquire, 0 ); + _copyConstructAny( pDest, pSource, pType, nullptr, acquire, nullptr ); } else { @@ -53,7 +53,7 @@ void SAL_CALL uno_any_assign( _destructAny( pDest, release ); if (pTypeDescr) { - _copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, acquire, 0 ); + _copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, acquire, nullptr ); } else { @@ -69,7 +69,7 @@ void SAL_CALL uno_type_any_construct( { if (pType) { - _copyConstructAny( pDest, pSource, pType, 0, acquire, 0 ); + _copyConstructAny( pDest, pSource, pType, nullptr, acquire, nullptr ); } else { @@ -85,7 +85,7 @@ void SAL_CALL uno_any_construct( { if (pTypeDescr) { - _copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, acquire, 0 ); + _copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, acquire, nullptr ); } else { @@ -101,7 +101,7 @@ void SAL_CALL uno_type_any_constructAndConvert( { if (pType) { - _copyConstructAny( pDest, pSource, pType, 0, 0, mapping ); + _copyConstructAny( pDest, pSource, pType, nullptr, nullptr, mapping ); } else { @@ -117,7 +117,7 @@ void SAL_CALL uno_any_constructAndConvert( { if (pTypeDescr) { - _copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, 0, mapping ); + _copyConstructAny( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, nullptr, mapping ); } else { diff --git a/cppu/source/uno/assign.hxx b/cppu/source/uno/assign.hxx index cd4b21b00414..e016565aa7c9 100644 --- a/cppu/source/uno/assign.hxx +++ b/cppu/source/uno/assign.hxx @@ -54,7 +54,7 @@ inline void * _queryInterface( { if (pSource) { - if (0 == queryInterface) + if (nullptr == queryInterface) queryInterface = binuno_queryInterface; pSource = (*queryInterface)( pSource, pDestType ); } @@ -116,7 +116,7 @@ inline bool _assignData( } while (typelib_TypeClass_ANY == pSourceType->eTypeClass) { - pSourceTypeDescr = 0; + pSourceTypeDescr = nullptr; pSourceType = static_cast<uno_Any *>(pSource)->pType; pSource = static_cast<uno_Any *>(pSource)->pData; if (pDest == pSource) @@ -338,7 +338,7 @@ inline bool _assignData( } case typelib_TypeClass_ANY: _destructAny( static_cast<uno_Any *>(pDest), release ); - _copyConstructAny( static_cast<uno_Any *>(pDest), pSource, pSourceType, pSourceTypeDescr, acquire, 0 ); + _copyConstructAny( static_cast<uno_Any *>(pDest), pSource, pSourceType, pSourceTypeDescr, acquire, nullptr ); return true; case typelib_TypeClass_ENUM: if (_type_equals( pDestType, pSourceType )) @@ -411,12 +411,12 @@ inline bool _assignData( _assignInterface( static_cast<void **>(pDest), *static_cast<void **>(pSource), acquire, release ); return true; } - else if (*static_cast< void ** >(pSource) == 0) + else if (*static_cast< void ** >(pSource) == nullptr) { // A null reference of any interface type can be converted to a null // reference of any other interface type: void * const pToBeReleased = *static_cast< void ** >(pDest); - *static_cast< void ** >(pDest) = 0; + *static_cast< void ** >(pDest) = nullptr; _release( pToBeReleased, release ); return true; } @@ -439,12 +439,12 @@ inline bool _assignData( // query for interface: void * pQueried = _queryInterface( *static_cast<void **>(pSource), pDestType, queryInterface ); - if (pQueried != 0) { + if (pQueried != nullptr) { void * const pToBeReleased = *static_cast<void **>(pDest); *static_cast<void **>(pDest) = pQueried; _release( pToBeReleased, release ); } - return (pQueried != 0); + return (pQueried != nullptr); } default: OSL_ASSERT(false); diff --git a/cppu/source/uno/cascade_mapping.cxx b/cppu/source/uno/cascade_mapping.cxx index a5295bce9d6b..3033545637fb 100644 --- a/cppu/source/uno/cascade_mapping.cxx +++ b/cppu/source/uno/cascade_mapping.cxx @@ -145,16 +145,16 @@ void MediatorMapping::mapInterface( void * pInterface, typelib_InterfaceTypeDescription * pInterfaceTypeDescr) { - if (*ppOut != 0) + if (*ppOut != nullptr) { uno_ExtEnvironment * env = m_to.get()->pExtEnv; - OSL_ASSERT( env != 0 ); + OSL_ASSERT( env != nullptr ); env->releaseInterface( env, *ppOut ); - *ppOut = NULL; + *ppOut = nullptr; } - void * ret = 0; - uno_Interface * pUnoI = 0; + void * ret = nullptr; + uno_Interface * pUnoI = nullptr; m_from.invoke(s_mapInterface_v, &pUnoI, pInterface, pInterfaceTypeDescr, m_from2uno.get()); @@ -247,7 +247,7 @@ void getCascadeMapping(uno_Mapping ** ppMapping, // reaching this point means, we need a mediated mapping!!! // we generally mediate via uno[:free] - uno_Environment * pInterm = NULL; + uno_Environment * pInterm = nullptr; // chained uno -> uno if (from_envType == uno_envType && to_envType == uno_envType) @@ -286,7 +286,7 @@ void getCascadeMapping(uno_Mapping ** ppMapping, uno_envDcp += rest.copy(0, index); } - uno_getEnvironment(&pInterm, uno_envDcp.pData, NULL); + uno_getEnvironment(&pInterm, uno_envDcp.pData, nullptr); } else if (from_envType != uno_envType && to_envType == uno_envType) // <ANY> -> UNO ? // mediate via uno:purpose(fromEnv) @@ -294,7 +294,7 @@ void getCascadeMapping(uno_Mapping ** ppMapping, rtl::OUString envDcp = uno_envType; envDcp += from_envPurpose; - uno_getEnvironment(&pInterm, envDcp.pData, NULL); + uno_getEnvironment(&pInterm, envDcp.pData, nullptr); } else if (from_envType == uno_envType && to_envType != uno_envType) // UNO -> <ANY>? // mediate via uno(context) @@ -302,7 +302,7 @@ void getCascadeMapping(uno_Mapping ** ppMapping, rtl::OUString envDcp = uno_envType; envDcp += to_envPurpose; - uno_getEnvironment(&pInterm, envDcp.pData, NULL); + uno_getEnvironment(&pInterm, envDcp.pData, nullptr); } else // everything else // mediate via uno:purpose @@ -312,7 +312,7 @@ void getCascadeMapping(uno_Mapping ** ppMapping, rtl::OUString uno_envDcp = uno_envType; uno_envDcp += purpose; - uno_getEnvironment(&pInterm, uno_envDcp.pData, NULL); + uno_getEnvironment(&pInterm, uno_envDcp.pData, nullptr); } uno_Mapping * pMapping = new MediatorMapping(pFrom, pInterm, pTo); diff --git a/cppu/source/uno/constr.hxx b/cppu/source/uno/constr.hxx index a1242da507ce..e6fd9abbcb66 100644 --- a/cppu/source/uno/constr.hxx +++ b/cppu/source/uno/constr.hxx @@ -89,7 +89,7 @@ inline void _defaultConstructData( *static_cast<double *>(pMem) = 0.0; break; case typelib_TypeClass_STRING: - *static_cast<rtl_uString **>(pMem) = 0; + *static_cast<rtl_uString **>(pMem) = nullptr; ::rtl_uString_new( static_cast<rtl_uString **>(pMem) ); break; case typelib_TypeClass_TYPE: @@ -127,7 +127,7 @@ inline void _defaultConstructData( *static_cast<uno_Sequence **>(pMem) = createEmptySequence(); break; case typelib_TypeClass_INTERFACE: - *static_cast<void **>(pMem) = 0; // either cpp or c-uno interface + *static_cast<void **>(pMem) = nullptr; // either cpp or c-uno interface break; default: OSL_ASSERT(false); diff --git a/cppu/source/uno/copy.hxx b/cppu/source/uno/copy.hxx index f082803d66a2..ab25e062b984 100644 --- a/cppu/source/uno/copy.hxx +++ b/cppu/source/uno/copy.hxx @@ -35,12 +35,12 @@ inline uno_Sequence * allocSeq( sal_Int32 nElementSize, sal_Int32 nElements ) { OSL_ASSERT( nElements >= 0 && nElementSize >= 0 ); - uno_Sequence * pSeq = 0; + uno_Sequence * pSeq = nullptr; sal_uInt32 nSize = calcSeqMemSize( nElementSize, nElements ); if (nSize > 0) { pSeq = static_cast<uno_Sequence *>(rtl_allocateMemory( nSize )); - if (pSeq != 0) + if (pSeq != nullptr) { // header init pSeq->nRefCount = 1; @@ -251,7 +251,7 @@ inline void _copyConstructAny( CONSTRUCT_EMPTY_ANY( pDestAny ); return; } - pTypeDescr = 0; + pTypeDescr = nullptr; pSource = static_cast<uno_Any *>(pSource)->pData; } else @@ -316,7 +316,7 @@ inline void _copyConstructAny( break; case typelib_TypeClass_STRING: pDestAny->pData = &pDestAny->pReserved; - *static_cast<rtl_uString **>(pDestAny->pData) = 0; + *static_cast<rtl_uString **>(pDestAny->pData) = nullptr; ::rtl_uString_new( static_cast<rtl_uString **>(pDestAny->pData) ); break; case typelib_TypeClass_TYPE: @@ -359,7 +359,7 @@ inline void _copyConstructAny( break; case typelib_TypeClass_INTERFACE: pDestAny->pData = &pDestAny->pReserved; - pDestAny->pReserved = 0; // either cpp or c-uno interface + pDestAny->pReserved = nullptr; // either cpp or c-uno interface break; default: OSL_ASSERT(false); @@ -393,7 +393,7 @@ inline uno_Sequence * icopyConstructSequence( case typelib_TypeClass_ANY: { pDest = allocSeq( sizeof (uno_Any), nElements ); - if (pDest != 0) + if (pDest != nullptr) { uno_Any * pDestElements = reinterpret_cast<uno_Any *>(pDest->elements); uno_Any * pSourceElements = reinterpret_cast<uno_Any *>(pSource->elements); @@ -410,7 +410,7 @@ inline uno_Sequence * icopyConstructSequence( _copyConstructAnyFromData( &pDestElements[nPos], pSourceElements[nPos].pData, - pType, 0, + pType, nullptr, acquire, mapping ); } } @@ -420,12 +420,12 @@ inline uno_Sequence * icopyConstructSequence( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 nElementSize = pElementTypeDescr->nSize; char * pSourceElements = pSource->elements; pDest = allocSeq( nElementSize, nElements ); - if (pDest != 0) + if (pDest != nullptr) { char * pElements = pDest->elements; for ( sal_Int32 nPos = nElements; nPos--; ) @@ -445,9 +445,9 @@ inline uno_Sequence * icopyConstructSequence( { // coverity[suspicious_sizeof] - sizeof(uno_Sequence*) is correct here pDest = allocSeq( sizeof (uno_Sequence *), nElements ); - if (pDest != 0) + if (pDest != nullptr) { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); typelib_TypeDescriptionReference * pSeqElementType = reinterpret_cast<typelib_IndirectTypeDescription *>( @@ -463,7 +463,7 @@ inline uno_Sequence * icopyConstructSequence( pSourceElements[nPos], pSeqElementType, acquire, mapping ); - OSL_ASSERT( pNew != 0 ); + OSL_ASSERT( pNew != nullptr ); // ought never be a memory allocation problem, // because of reference counted sequence handles pDestElements[ nPos ] = pNew; @@ -476,15 +476,15 @@ inline uno_Sequence * icopyConstructSequence( case typelib_TypeClass_INTERFACE: { pDest = allocSeq( sizeof (void *), nElements ); - if (pDest != 0) + if (pDest != nullptr) { char * pElements = pDest->elements; void ** pSourceElements = reinterpret_cast<void **>(pSource->elements); - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); for ( sal_Int32 nPos = nElements; nPos--; ) { - reinterpret_cast<void **>(pElements)[nPos] = 0; + reinterpret_cast<void **>(pElements)[nPos] = nullptr; if (pSourceElements[nPos]) { (*mapping->mapInterface)( @@ -500,7 +500,7 @@ inline uno_Sequence * icopyConstructSequence( } default: OSL_FAIL( "### unexepcted sequence element type!" ); - pDest = 0; + pDest = nullptr; break; } } @@ -559,7 +559,7 @@ inline void _copyConstructData( case typelib_TypeClass_ANY: _copyConstructAny( static_cast<uno_Any *>(pDest), static_cast<uno_Any *>(pSource)->pData, - static_cast<uno_Any *>(pSource)->pType, 0, + static_cast<uno_Any *>(pSource)->pType, nullptr, acquire, mapping ); break; case typelib_TypeClass_ENUM: diff --git a/cppu/source/uno/data.cxx b/cppu/source/uno/data.cxx index 9ae11151a006..ed0ebdd292c2 100644 --- a/cppu/source/uno/data.cxx +++ b/cppu/source/uno/data.cxx @@ -40,21 +40,21 @@ namespace cppu // Sequence<>() (default ctor) relies on this being static: uno_Sequence g_emptySeq = { 1, 0, { 0 } }; -typelib_TypeDescriptionReference * g_pVoidType = 0; +typelib_TypeDescriptionReference * g_pVoidType = nullptr; void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * pDestType ) { // init queryInterface() td - static typelib_TypeDescription * g_pQITD = 0; - if (0 == g_pQITD) + static typelib_TypeDescription * g_pQITD = nullptr; + if (nullptr == g_pQITD) { MutexGuard aGuard( Mutex::getGlobalMutex() ); - if (0 == g_pQITD) + if (nullptr == g_pQITD) { typelib_TypeDescriptionReference * type_XInterface = * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - typelib_InterfaceTypeDescription * pTXInterfaceDescr = 0; + typelib_InterfaceTypeDescription * pTXInterfaceDescr = nullptr; TYPELIB_DANGER_GET( reinterpret_cast<typelib_TypeDescription **>(&pTXInterfaceDescr), type_XInterface ); assert(pTXInterfaceDescr->ppAllMembers); typelib_typedescriptionreference_getDescription( @@ -70,8 +70,8 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p (*static_cast<uno_Interface *>(pUnoI)->pDispatcher)( static_cast<uno_Interface *>(pUnoI), g_pQITD, &aRet, aArgs, &pExc ); - uno_Interface * ret = 0; - if (0 == pExc) + uno_Interface * ret = nullptr; + if (nullptr == pExc) { typelib_TypeDescriptionReference * ret_type = aRet.pType; switch (ret_type->eTypeClass) @@ -85,7 +85,7 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p ret = static_cast<uno_Interface *>(aRet.pReserved); // serving acquired interface break; default: - _destructAny( &aRet, 0 ); + _destructAny( &aRet, nullptr ); break; } } @@ -98,7 +98,7 @@ void * binuno_queryInterface( void * pUnoI, typelib_TypeDescriptionReference * p << OUString(pExc->pType->pTypeName) << "] " << *static_cast<OUString const *>(pExc->pData)); // Message is very first member - uno_any_destruct( pExc, 0 ); + uno_any_destruct( pExc, nullptr ); } return ret; } @@ -180,7 +180,7 @@ void SAL_CALL uno_type_constructData( void * pMem, typelib_TypeDescriptionReference * pType ) SAL_THROW_EXTERN_C() { - _defaultConstructData( pMem, pType, 0 ); + _defaultConstructData( pMem, pType, nullptr ); } void SAL_CALL uno_constructData( @@ -195,7 +195,7 @@ void SAL_CALL uno_type_destructData( uno_ReleaseFunc release ) SAL_THROW_EXTERN_C() { - _destructData( pValue, pType, 0, release ); + _destructData( pValue, pType, nullptr, release ); } void SAL_CALL uno_destructData( @@ -213,7 +213,7 @@ void SAL_CALL uno_type_copyData( uno_AcquireFunc acquire ) SAL_THROW_EXTERN_C() { - _copyConstructData( pDest, pSource, pType, 0, acquire, 0 ); + _copyConstructData( pDest, pSource, pType, nullptr, acquire, nullptr ); } void SAL_CALL uno_copyData( @@ -222,7 +222,7 @@ void SAL_CALL uno_copyData( uno_AcquireFunc acquire ) SAL_THROW_EXTERN_C() { - _copyConstructData( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, acquire, 0 ); + _copyConstructData( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, acquire, nullptr ); } void SAL_CALL uno_type_copyAndConvertData( @@ -231,7 +231,7 @@ void SAL_CALL uno_type_copyAndConvertData( uno_Mapping * mapping ) SAL_THROW_EXTERN_C() { - _copyConstructData( pDest, pSource, pType, 0, 0, mapping ); + _copyConstructData( pDest, pSource, pType, nullptr, nullptr, mapping ); } void SAL_CALL uno_copyAndConvertData( @@ -240,7 +240,7 @@ void SAL_CALL uno_copyAndConvertData( uno_Mapping * mapping ) SAL_THROW_EXTERN_C() { - _copyConstructData( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, 0, mapping ); + _copyConstructData( pDest, pSource, pTypeDescr->pWeakRef, pTypeDescr, nullptr, mapping ); } sal_Bool SAL_CALL uno_type_equalData( @@ -250,7 +250,7 @@ sal_Bool SAL_CALL uno_type_equalData( SAL_THROW_EXTERN_C() { return _equalData( - pVal1, pVal1Type, 0, + pVal1, pVal1Type, nullptr, pVal2, pVal2Type, queryInterface, release ); } @@ -274,8 +274,8 @@ sal_Bool SAL_CALL uno_type_assignData( SAL_THROW_EXTERN_C() { return _assignData( - pDest, pDestType, 0, - pSource, pSourceType, 0, + pDest, pDestType, nullptr, + pSource, pSourceType, nullptr, queryInterface, acquire, release ); } @@ -306,17 +306,17 @@ sal_Bool SAL_CALL uno_type_isAssignableFromData( } // query - if (0 == pFrom) + if (nullptr == pFrom) return sal_False; void * pInterface = *static_cast<void **>(pFrom); - if (0 == pInterface) + if (nullptr == pInterface) return sal_False; - if (0 == queryInterface) + if (nullptr == queryInterface) queryInterface = binuno_queryInterface; void * p = (*queryInterface)( pInterface, pAssignable ); _release( p, release ); - return (0 != p); + return (nullptr != p); } } diff --git a/cppu/source/uno/destr.hxx b/cppu/source/uno/destr.hxx index 1f0cc3213bb3..1bf9313801d0 100644 --- a/cppu/source/uno/destr.hxx +++ b/cppu/source/uno/destr.hxx @@ -113,7 +113,7 @@ inline void _destructAny( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pTypeDescr = 0; + typelib_TypeDescription * pTypeDescr = nullptr; TYPELIB_DANGER_GET( &pTypeDescr, pType ); _destructStruct( pAny->pData, reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr), release ); TYPELIB_DANGER_RELEASE( pTypeDescr ); @@ -123,7 +123,7 @@ inline void _destructAny( case typelib_TypeClass_SEQUENCE: { destructSequence( - static_cast<uno_Sequence *>(pAny->pReserved), pType, 0, release ); + static_cast<uno_Sequence *>(pAny->pReserved), pType, nullptr, release ); break; } case typelib_TypeClass_INTERFACE: @@ -198,7 +198,7 @@ inline sal_Int32 idestructElements( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 nElementSize = pElementTypeDescr->nSize; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -214,7 +214,7 @@ inline sal_Int32 idestructElements( } case typelib_TypeClass_SEQUENCE: { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); uno_Sequence ** pDest = static_cast<uno_Sequence **>(pElements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) diff --git a/cppu/source/uno/eq.hxx b/cppu/source/uno/eq.hxx index cd734ed2e215..92acdcded26f 100644 --- a/cppu/source/uno/eq.hxx +++ b/cppu/source/uno/eq.hxx @@ -39,19 +39,19 @@ inline bool _equalObject( { if (pI1 == pI2) return true; - if ((0 == pI1) || (0 == pI2)) + if ((nullptr == pI1) || (nullptr == pI2)) return false; bool bRet = false; typelib_TypeDescriptionReference * type_XInterface = * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ); - if (0 == queryInterface) + if (nullptr == queryInterface) queryInterface = binuno_queryInterface; pI1 = (*queryInterface)( pI1, type_XInterface ); - if (0 != pI1) + if (nullptr != pI1) { pI2 = (*queryInterface)( pI2, type_XInterface ); - if (0 != pI2) + if (nullptr != pI2) { bRet = (pI1 == pI2); _release( pI2, release ); @@ -204,7 +204,7 @@ inline bool _equalSequence( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 nElementSize = pElementTypeDescr->nSize; for ( sal_Int32 nPos = nElements; nPos--; ) @@ -223,7 +223,7 @@ inline bool _equalSequence( } case typelib_TypeClass_SEQUENCE: // sequence of sequence { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); typelib_TypeDescriptionReference * pSeqElementType = reinterpret_cast<typelib_IndirectTypeDescription *>(pElementTypeDescr)->pType; @@ -268,7 +268,7 @@ inline bool _equalData( typelib_TypeClass eSourceTypeClass, eDestTypeClass; while (typelib_TypeClass_ANY == (eDestTypeClass = pDestType->eTypeClass)) { - pDestTypeDescr = 0; + pDestTypeDescr = nullptr; pDestType = static_cast<uno_Any *>(pDest)->pType; pDest = static_cast<uno_Any *>(pDest)->pData; } diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx index e1d294f53682..07ca0659bdad 100644 --- a/cppu/source/uno/lbenv.cxx +++ b/cppu/source/uno/lbenv.cxx @@ -189,7 +189,7 @@ inline InterfaceEntry * ObjectEntry::find( { OSL_ASSERT( ! aInterfaces.empty() ); if (aInterfaces.empty()) - return 0; + return nullptr; // shortcut common case: OUString const & type_name = @@ -211,7 +211,7 @@ inline InterfaceEntry * ObjectEntry::find( pITD = pITD->pBaseTypeDescription; } } - return 0; + return nullptr; } @@ -250,7 +250,7 @@ static void SAL_CALL defenv_registerInterface( ObjectEntry * pOEntry = new ObjectEntry( rOId ); insertion.first->second = pOEntry; ++pOEntry->nRef; // another register call on object - pOEntry->append( that, *ppInterface, pTypeDescr, 0 ); + pOEntry->append( that, *ppInterface, pTypeDescr, nullptr ); } else // object entry exists { @@ -272,7 +272,7 @@ static void SAL_CALL defenv_registerInterface( } else { - pOEntry->append( that, *ppInterface, pTypeDescr, 0 ); + pOEntry->append( that, *ppInterface, pTypeDescr, nullptr ); } } } @@ -307,7 +307,7 @@ static void SAL_CALL defenv_registerProxyInterface( // first registration was an original, then registerProxyInterface(): pOEntry->mixedObject |= (!pOEntry->aInterfaces.empty() && - pOEntry->aInterfaces[ 0 ].fpFreeProxy == 0); + pOEntry->aInterfaces[ 0 ].fpFreeProxy == nullptr); ++pOEntry->nRef; // another register call on object InterfaceEntry * pIEntry = pOEntry->find( pTypeDescr ); @@ -384,7 +384,7 @@ static void SAL_CALL s_stub_defenv_revokeInterface(va_list * pParam) else if (pOEntry->mixedObject) { OSL_ASSERT( !pOEntry->aInterfaces.empty() && - pOEntry->aInterfaces[ 0 ].fpFreeProxy == 0 ); + pOEntry->aInterfaces[ 0 ].fpFreeProxy == nullptr ); sal_Int32 index = pOEntry->find( pInterface, 1 ); OSL_ASSERT( index > 0 ); @@ -392,7 +392,7 @@ static void SAL_CALL s_stub_defenv_revokeInterface(va_list * pParam) { InterfaceEntry & entry = pOEntry->aInterfaces[ index ]; OSL_ASSERT( entry.pInterface == pInterface ); - if (entry.fpFreeProxy != 0) + if (entry.fpFreeProxy != nullptr) { --entry.refCount; if (entry.refCount == 0) @@ -436,7 +436,7 @@ static void SAL_CALL defenv_getObjectIdentifier( if (*ppOId) { ::rtl_uString_release( *ppOId ); - *ppOId = 0; + *ppOId = nullptr; } uno_DefaultEnvironment * that = @@ -467,7 +467,7 @@ static void SAL_CALL defenv_getRegisteredInterface( if (*ppInterface) { (*pEnv->releaseInterface)( pEnv, *ppInterface ); - *ppInterface = 0; + *ppInterface = nullptr; } OUString const & rOId = OUString::unacquired( &pOId ); @@ -567,7 +567,7 @@ static void SAL_CALL defenv_harden( if (*ppHardEnv) { (*(*ppHardEnv)->release)( *ppHardEnv ); - *ppHardEnv = 0; + *ppHardEnv = nullptr; } EnvironmentsData & rData = theEnvironmentsData::get(); @@ -601,7 +601,7 @@ uno_DefaultEnvironment::uno_DefaultEnvironment( nWeakRef( 0 ) { uno_Environment * that = reinterpret_cast< uno_Environment * >(this); - that->pReserved = 0; + that->pReserved = nullptr; // functions that->acquire = defenv_acquire; that->release = defenv_release; @@ -616,7 +616,7 @@ uno_DefaultEnvironment::uno_DefaultEnvironment( that->pContext = pContext_; // will be late initialized - that->environmentDisposing = 0; + that->environmentDisposing = nullptr; uno_ExtEnvironment::registerInterface = defenv_registerInterface; uno_ExtEnvironment::registerProxyInterface = defenv_registerProxyInterface; @@ -777,8 +777,8 @@ extern "C" void SAL_CALL uno_dumpEnvironmentByName( void * stream, rtl_uString * pEnvDcp, const sal_Char * pFilter ) SAL_THROW_EXTERN_C() { - uno_Environment * pEnv = 0; - uno_getEnvironment( &pEnv, pEnvDcp, 0 ); + uno_Environment * pEnv = nullptr; + uno_getEnvironment( &pEnv, pEnvDcp, nullptr ); if (pEnv) { ::uno_dumpEnvironment( stream, pEnv, pFilter ); @@ -808,7 +808,7 @@ namespace // pid oslProcessInfo info; info.Size = sizeof(oslProcessInfo); - if (::osl_getProcessInfo( 0, osl_Process_IDENTIFIER, &info ) == + if (::osl_getProcessInfo( nullptr, osl_Process_IDENTIFIER, &info ) == osl_Process_E_None) { aRet.append( (sal_Int64)info.Ident, 16 ); @@ -849,14 +849,14 @@ static void SAL_CALL unoenv_computeObjectIdentifier( if (*ppOId) { ::rtl_uString_release( *ppOId ); - *ppOId = 0; + *ppOId = nullptr; } uno_Interface * pUnoI = static_cast<uno_Interface *>( ::cppu::binuno_queryInterface( pInterface, *typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ) )); - if (0 != pUnoI) + if (nullptr != pUnoI) { (*pUnoI->release)( pUnoI ); // interface @@ -904,7 +904,7 @@ EnvironmentsData::~EnvironmentsData() iPos != aName2EnvMap.end(); ++iPos ) { uno_Environment * pWeak = iPos->second; - uno_Environment * pHard = 0; + uno_Environment * pHard = nullptr; (*pWeak->harden)( &pHard, pWeak ); (*pWeak->releaseWeak)( pWeak ); @@ -926,7 +926,7 @@ inline void EnvironmentsData::getEnvironment( if (*ppEnv) { (*(*ppEnv)->release)( *ppEnv ); - *ppEnv = 0; + *ppEnv = nullptr; } OUString aKey( @@ -966,7 +966,7 @@ inline void EnvironmentsData::registerEnvironment( uno_Environment ** ppEnv ) } else { - uno_Environment * pHard = 0; + uno_Environment * pHard = nullptr; uno_Environment * pWeak = iFind->second; (*pWeak->harden)( &pHard, pWeak ); if (pHard) @@ -1003,7 +1003,7 @@ inline void EnvironmentsData::getRegisteredEnvironments( if (rEnvDcp.isEmpty() || rEnvDcp.equals( pWeak->pTypeName )) { - ppFound[nSize] = 0; + ppFound[nSize] = nullptr; (*pWeak->harden)( &ppFound[nSize], pWeak ); if (ppFound[nSize]) ++nSize; @@ -1023,7 +1023,7 @@ inline void EnvironmentsData::getRegisteredEnvironments( } else { - *pppEnvs = 0; + *pppEnvs = nullptr; } } @@ -1103,7 +1103,7 @@ static uno_Environment * initDefaultEnvironment( if(!loadEnv(libStem, pEnv)) { pEnv->release(pEnv); - return NULL; + return nullptr; } } } @@ -1118,7 +1118,7 @@ static uno_Environment * initDefaultEnvironment( if (!loadEnv(aStr, pEnv)) { pEnv->release(pEnv); - return NULL; + return nullptr; } } diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx index 82060fd72b01..442c34172212 100644 --- a/cppu/source/uno/lbmap.cxx +++ b/cppu/source/uno/lbmap.cxx @@ -62,7 +62,7 @@ class Mapping uno_Mapping * _pMapping; public: - inline explicit Mapping( uno_Mapping * pMapping = 0 ); + inline explicit Mapping( uno_Mapping * pMapping = nullptr ); inline Mapping( const Mapping & rMapping ); inline ~Mapping(); inline Mapping & SAL_CALL operator = ( uno_Mapping * pMapping ); @@ -71,7 +71,7 @@ public: inline uno_Mapping * SAL_CALL get() const { return _pMapping; } inline bool SAL_CALL is() const - { return (_pMapping != 0); } + { return (_pMapping != nullptr); } }; inline Mapping::Mapping( uno_Mapping * pMapping ) @@ -152,7 +152,7 @@ struct MappingsData static MappingsData & getMappingsData() { - static MappingsData * s_p = 0; + static MappingsData * s_p = nullptr; if (! s_p) { MutexGuard aGuard( Mutex::getGlobalMutex() ); @@ -228,18 +228,18 @@ static void SAL_CALL mediate_mapInterface( uno_Mediate_Mapping * that = static_cast< uno_Mediate_Mapping * >( pMapping ); uno_Mapping * pFrom2Uno = that->aFrom2Uno.get(); - uno_Interface * pUnoI = 0; + uno_Interface * pUnoI = nullptr; (*pFrom2Uno->mapInterface)( pFrom2Uno, reinterpret_cast<void **>(&pUnoI), pInterface, pInterfaceTypeDescr ); - if (0 == pUnoI) + if (nullptr == pUnoI) { void * pOut = *ppOut; - if (0 != pOut) + if (nullptr != pOut) { uno_ExtEnvironment * pTo = that->aTo.get()->pExtEnv; - OSL_ENSURE( 0 != pTo, "### cannot release out interface: leaking!" ); - if (0 != pTo) + OSL_ENSURE( nullptr != pTo, "### cannot release out interface: leaking!" ); + if (nullptr != pTo) (*pTo->releaseInterface)( pTo, pOut ); - *ppOut = 0; // set to 0 anyway, because mapping was not successful! + *ppOut = nullptr; // set to 0 anyway, because mapping was not successful! } } else @@ -508,7 +508,7 @@ static Mapping getMediateMapping( else { // get registered uno env - ::uno_getEnvironment( reinterpret_cast<uno_Environment **>(&aUno), aUnoEnvTypeName.pData, 0 ); + ::uno_getEnvironment( reinterpret_cast<uno_Environment **>(&aUno), aUnoEnvTypeName.pData, nullptr ); aUno2To = getDirectMapping( aUno, rTo ); // : uno <-> to @@ -521,7 +521,7 @@ static Mapping getMediateMapping( { // create anonymous uno env Environment aAnUno; - ::uno_createEnvironment( reinterpret_cast<uno_Environment **>(&aAnUno), aUnoEnvTypeName.pData, 0 ); + ::uno_createEnvironment( reinterpret_cast<uno_Environment **>(&aAnUno), aUnoEnvTypeName.pData, nullptr ); Mapping aAnUno2Uno( getDirectMapping( aAnUno, aUno, rAddPurpose ) ); if (! aAnUno2Uno.is()) @@ -562,13 +562,13 @@ void SAL_CALL uno_getMapping( rtl_uString * pAddPurpose ) SAL_THROW_EXTERN_C() { - assert(ppMapping != 0); - assert(pFrom != 0); - assert(pTo != 0); + assert(ppMapping != nullptr); + assert(pFrom != nullptr); + assert(pTo != nullptr); if (*ppMapping) { (*(*ppMapping)->release)( *ppMapping ); - *ppMapping = 0; + *ppMapping = nullptr; } Mapping aRet; @@ -636,16 +636,16 @@ void SAL_CALL uno_getMappingByName( if (*ppMapping) { (*(*ppMapping)->release)( *ppMapping ); - *ppMapping = 0; + *ppMapping = nullptr; } - uno_Environment * pEFrom = 0; - uno_getEnvironment( &pEFrom, pFrom, 0 ); + uno_Environment * pEFrom = nullptr; + uno_getEnvironment( &pEFrom, pFrom, nullptr ); OSL_ENSURE( pEFrom, "### cannot get source environment!" ); if (pEFrom) { - uno_Environment * pETo = 0; - uno_getEnvironment( &pETo, pTo, 0 ); + uno_Environment * pETo = nullptr; + uno_getEnvironment( &pETo, pTo, nullptr ); OSL_ENSURE( pETo, "### cannot get target environment!" ); if (pETo) { diff --git a/cppu/source/uno/prim.hxx b/cppu/source/uno/prim.hxx index 3fcdb132d888..cf66016353cd 100644 --- a/cppu/source/uno/prim.hxx +++ b/cppu/source/uno/prim.hxx @@ -51,7 +51,7 @@ inline void * _map( uno_Mapping * mapping ) { - void * pRet = 0; + void * pRet = nullptr; if (p) { if (pTypeDescr) diff --git a/cppu/source/uno/sequence.cxx b/cppu/source/uno/sequence.cxx index cd536a853614..3b5f01fdacee 100644 --- a/cppu/source/uno/sequence.cxx +++ b/cppu/source/uno/sequence.cxx @@ -45,11 +45,11 @@ static inline uno_Sequence * reallocSeq( uno_Sequence * pReallocate, sal_Size nElementSize, sal_Int32 nElements ) { OSL_ASSERT( nElements >= 0 ); - uno_Sequence * pNew = 0; + uno_Sequence * pNew = nullptr; sal_uInt32 nSize = calcSeqMemSize( nElementSize, nElements ); if (nSize > 0) { - if (pReallocate == 0) + if (pReallocate == nullptr) { pNew = static_cast<uno_Sequence *>(rtl_allocateMemory( nSize )); } @@ -57,7 +57,7 @@ static inline uno_Sequence * reallocSeq( { pNew = static_cast<uno_Sequence *>(rtl_reallocateMemory( pReallocate, nSize )); } - if (pNew != 0) + if (pNew != nullptr) { // header init pNew->nRefCount = 1; @@ -80,7 +80,7 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_CHAR: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Unicode), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memset( pSeq->elements + (sizeof(sal_Unicode) * nStartIndex), @@ -91,7 +91,7 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_BOOLEAN: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Bool), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memset( pSeq->elements + (sizeof(sal_Bool) * nStartIndex), @@ -102,7 +102,7 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_BYTE: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int8), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memset( pSeq->elements + (sizeof(sal_Int8) * nStartIndex), @@ -114,7 +114,7 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_UNSIGNED_SHORT: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int16), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memset( pSeq->elements + (sizeof(sal_Int16) * nStartIndex), @@ -126,7 +126,7 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_UNSIGNED_LONG: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memset( pSeq->elements + (sizeof(sal_Int32) * nStartIndex), @@ -138,7 +138,7 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_UNSIGNED_HYPER: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int64), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memset( pSeq->elements + (sizeof(sal_Int64) * nStartIndex), @@ -150,7 +150,7 @@ static inline bool idefaultConstructElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(float), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { float * pElements = reinterpret_cast<float *>(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -164,7 +164,7 @@ static inline bool idefaultConstructElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(double), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { double * pElements = reinterpret_cast<double *>(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -178,12 +178,12 @@ static inline bool idefaultConstructElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(rtl_uString *), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { rtl_uString ** pElements = reinterpret_cast<rtl_uString **>(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) { - pElements[nPos] = 0; + pElements[nPos] = nullptr; rtl_uString_new( &pElements[nPos] ); } } @@ -196,7 +196,7 @@ static inline bool idefaultConstructElements( pSeq = reallocSeq( pSeq, sizeof(typelib_TypeDescriptionReference *), nAlloc ); } - if (pSeq != 0) + if (pSeq != nullptr) { typelib_TypeDescriptionReference ** pElements = reinterpret_cast<typelib_TypeDescriptionReference **>(pSeq->elements); @@ -211,7 +211,7 @@ static inline bool idefaultConstructElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(uno_Any), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { uno_Any * pElements = reinterpret_cast<uno_Any *>(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -225,9 +225,9 @@ static inline bool idefaultConstructElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 eEnum = reinterpret_cast<typelib_EnumTypeDescription *>( @@ -245,13 +245,13 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 nElementSize = pElementTypeDescr->nSize; if (nAlloc >= 0) pSeq = reallocSeq( pSeq, nElementSize, nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { char * pElements = pSeq->elements; for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -272,7 +272,7 @@ static inline bool idefaultConstructElements( // coverity[suspicious_sizeof] - sizeof(uno_Sequence*) is correct here pSeq = reallocSeq(pSeq, sizeof(uno_Sequence*), nAlloc); } - if (pSeq != 0) + if (pSeq != nullptr) { uno_Sequence ** pElements = reinterpret_cast<uno_Sequence **>(pSeq->elements); @@ -286,7 +286,7 @@ static inline bool idefaultConstructElements( case typelib_TypeClass_INTERFACE: // either C++ or C-UNO interface if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(void *), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memset( pSeq->elements + (sizeof(void *) * nStartIndex), @@ -296,11 +296,11 @@ static inline bool idefaultConstructElements( break; default: OSL_FAIL( "### unexpected element type!" ); - pSeq = 0; + pSeq = nullptr; break; } - if (pSeq == 0) + if (pSeq == nullptr) { OSL_ASSERT( nAlloc >= 0 ); // must have been an allocation failure return false; @@ -326,7 +326,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_CHAR: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Unicode), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(sal_Unicode) * nStartIndex), @@ -337,7 +337,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_BOOLEAN: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Bool), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(sal_Bool) * nStartIndex), @@ -348,7 +348,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_BYTE: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int8), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(sal_Int8) * nStartIndex), @@ -360,7 +360,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_UNSIGNED_SHORT: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int16), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(sal_Int16) * nStartIndex), @@ -372,7 +372,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_UNSIGNED_LONG: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(sal_Int32) * nStartIndex), @@ -384,7 +384,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_UNSIGNED_HYPER: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int64), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(sal_Int64) * nStartIndex), @@ -395,7 +395,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_FLOAT: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(float), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(float) * nStartIndex), @@ -406,7 +406,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_DOUBLE: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(double), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(double) * nStartIndex), @@ -417,7 +417,7 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_ENUM: if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(sal_Int32), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { memcpy( pSeq->elements + (sizeof(sal_Int32) * nStartIndex), @@ -429,7 +429,7 @@ static inline bool icopyConstructFromElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(rtl_uString *), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { rtl_uString ** pDestElements = reinterpret_cast<rtl_uString **>(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -450,7 +450,7 @@ static inline bool icopyConstructFromElements( pSeq = reallocSeq( pSeq, sizeof(typelib_TypeDescriptionReference *), nAlloc ); } - if (pSeq != 0) + if (pSeq != nullptr) { typelib_TypeDescriptionReference ** pDestElements = reinterpret_cast<typelib_TypeDescriptionReference **>(pSeq->elements); @@ -470,7 +470,7 @@ static inline bool icopyConstructFromElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(uno_Any), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { uno_Any * pDestElements = reinterpret_cast<uno_Any *>(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -479,8 +479,8 @@ static inline bool icopyConstructFromElements( _copyConstructAny( &pDestElements[nPos], pSource->pData, - pSource->pType, 0, - acquire, 0 ); + pSource->pType, nullptr, + acquire, nullptr ); } } break; @@ -488,13 +488,13 @@ static inline bool icopyConstructFromElements( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); sal_Int32 nElementSize = pElementTypeDescr->nSize; if (nAlloc >= 0) pSeq = reallocSeq( pSeq, nElementSize, nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { char * pDestElements = pSeq->elements; @@ -512,7 +512,7 @@ static inline bool icopyConstructFromElements( // copy base value _copyConstructStruct( pDest, pSource, - pTypeDescr->pBaseTypeDescription, acquire, 0 ); + pTypeDescr->pBaseTypeDescription, acquire, nullptr ); } // then copy members @@ -541,9 +541,9 @@ static inline bool icopyConstructFromElements( // coverity[suspicious_sizeof] - sizeof(uno_Sequence*) is correct here pSeq = reallocSeq(pSeq, sizeof(uno_Sequence*), nAlloc); } - if (pSeq != 0) + if (pSeq != nullptr) { - typelib_TypeDescription * pElementTypeDescr = 0; + typelib_TypeDescription * pElementTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElementTypeDescr, pElementType ); typelib_TypeDescriptionReference * pSeqElementType = reinterpret_cast<typelib_IndirectTypeDescription *>(pElementTypeDescr)->pType; @@ -552,8 +552,8 @@ static inline bool icopyConstructFromElements( { uno_Sequence * pNew = icopyConstructSequence( static_cast<uno_Sequence **>(pSourceElements)[nPos], - pSeqElementType, acquire, 0 ); - OSL_ASSERT( pNew != 0 ); + pSeqElementType, acquire, nullptr ); + OSL_ASSERT( pNew != nullptr ); // ought never be a memory allocation problem, // because of reference counted sequence handles pDestElements[ nPos ] = pNew; @@ -566,7 +566,7 @@ static inline bool icopyConstructFromElements( { if (nAlloc >= 0) pSeq = reallocSeq( pSeq, sizeof(void *), nAlloc ); - if (pSeq != 0) + if (pSeq != nullptr) { void ** pDestElements = reinterpret_cast<void **>(pSeq->elements); for ( sal_Int32 nPos = nStartIndex; nPos < nStopIndex; ++nPos ) @@ -579,11 +579,11 @@ static inline bool icopyConstructFromElements( } default: OSL_FAIL( "### unexpected element type!" ); - pSeq = 0; + pSeq = nullptr; break; } - if (pSeq == 0) + if (pSeq == nullptr) { OSL_ASSERT( nAlloc >= 0 ); // must have been an allocation failure return false; @@ -613,7 +613,7 @@ static inline bool ireallocSequence( typelib_TypeClass_EXCEPTION == pElementType->eTypeClass) { // split sequence and construct new one from scratch - uno_Sequence * pNew = 0; + uno_Sequence * pNew = nullptr; sal_Int32 nRest = nSize - nElements; sal_Int32 nCopy = (nRest > 0 ? nElements : nSize); @@ -667,8 +667,8 @@ static inline bool ireallocSequence( // warning: it is assumed that the following will never fail, // else this leads to a sequence null handle *ppSequence = reallocSeq( pSeq, nElementSize, nSize ); - OSL_ASSERT( *ppSequence != 0 ); - ret = (*ppSequence != 0); + OSL_ASSERT( *ppSequence != nullptr ); + ret = (*ppSequence != nullptr); } } @@ -691,14 +691,14 @@ sal_Bool SAL_CALL uno_type_sequence_construct( bool ret; if (len) { - typelib_TypeDescription * pTypeDescr = 0; + typelib_TypeDescription * pTypeDescr = nullptr; TYPELIB_DANGER_GET( &pTypeDescr, pType ); typelib_TypeDescriptionReference * pElementType = reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType; - *ppSequence = 0; - if (pElements == 0) + *ppSequence = nullptr; + if (pElements == nullptr) { ret = idefaultConstructElements( ppSequence, pElementType, @@ -721,7 +721,7 @@ sal_Bool SAL_CALL uno_type_sequence_construct( ret = true; } - OSL_ASSERT( (*ppSequence != 0) == ret ); + OSL_ASSERT( (*ppSequence != nullptr) == ret ); return ret; } @@ -738,8 +738,8 @@ sal_Bool SAL_CALL uno_sequence_construct( typelib_TypeDescriptionReference * pElementType = reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType; - *ppSequence = 0; - if (pElements == 0) + *ppSequence = nullptr; + if (pElements == nullptr) { ret = idefaultConstructElements( ppSequence, pElementType, @@ -760,7 +760,7 @@ sal_Bool SAL_CALL uno_sequence_construct( ret = true; } - OSL_ASSERT( (*ppSequence != 0) == ret ); + OSL_ASSERT( (*ppSequence != nullptr) == ret ); return ret; } @@ -776,7 +776,7 @@ sal_Bool SAL_CALL uno_type_sequence_realloc( bool ret = true; if (nSize != (*ppSequence)->nElements) { - typelib_TypeDescription * pTypeDescr = 0; + typelib_TypeDescription * pTypeDescr = nullptr; TYPELIB_DANGER_GET( &pTypeDescr, pType ); ret = ireallocSequence( ppSequence, reinterpret_cast<typelib_IndirectTypeDescription *>(pTypeDescr)->pType, @@ -817,10 +817,10 @@ sal_Bool SAL_CALL uno_type_sequence_reference2One( uno_Sequence * pSequence = *ppSequence; if (pSequence->nRefCount > 1) { - uno_Sequence * pNew = 0; + uno_Sequence * pNew = nullptr; if (pSequence->nElements > 0) { - typelib_TypeDescription * pTypeDescr = 0; + typelib_TypeDescription * pTypeDescr = nullptr; TYPELIB_DANGER_GET( &pTypeDescr, pType ); ret = icopyConstructFromElements( @@ -839,7 +839,7 @@ sal_Bool SAL_CALL uno_type_sequence_reference2One( else { pNew = allocSeq( 0, 0 ); - ret = (pNew != 0); + ret = (pNew != nullptr); if (ret) { // easy destruction of empty sequence: @@ -864,7 +864,7 @@ sal_Bool SAL_CALL uno_sequence_reference2One( uno_Sequence * pSequence = *ppSequence; if (pSequence->nRefCount > 1) { - uno_Sequence * pNew = 0; + uno_Sequence * pNew = nullptr; if (pSequence->nElements > 0) { ret = icopyConstructFromElements( @@ -882,7 +882,7 @@ sal_Bool SAL_CALL uno_sequence_reference2One( else { pNew = allocSeq( 0, 0 ); - ret = (pNew != 0); + ret = (pNew != nullptr); if (ret) { // easy destruction of empty sequence: @@ -923,7 +923,7 @@ void SAL_CALL uno_type_sequence_assign( if (*ppDest != pSource) { osl_atomic_increment( &pSource->nRefCount ); - idestructSequence( *ppDest, pType, 0, release ); + idestructSequence( *ppDest, pType, nullptr, release ); *ppDest = pSource; } } |