diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:11:03 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-11-10 10:31:17 +0100 |
commit | 655c2d5193a8f04d8d0e34c18c8d887589f0e6a9 (patch) | |
tree | 1d5370d488bf25e366bdf95b27b616315dcd61dd /bridges | |
parent | e68121b3c1d973d149adad4d8e1bcbe042107506 (diff) |
loplugin:nullptr (automatic rewrite)
Change-Id: Ib05cdd5a0f2a2e0f4c08504d89d0b6201cbcb429
Diffstat (limited to 'bridges')
21 files changed, 390 insertions, 390 deletions
diff --git a/bridges/inc/bridges/cpp_uno/shared/vtablefactory.hxx b/bridges/inc/bridges/cpp_uno/shared/vtablefactory.hxx index b5d7aaa4f345..19fe4e7a0fa5 100644 --- a/bridges/inc/bridges/cpp_uno/shared/vtablefactory.hxx +++ b/bridges/inc/bridges/cpp_uno/shared/vtablefactory.hxx @@ -94,7 +94,7 @@ public: Block * blocks; Vtables() : count(0) - , blocks(NULL) + , blocks(nullptr) { } }; diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx index 36de6daa6f14..6e7e18579af8 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx @@ -179,7 +179,7 @@ classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_c case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - typelib_TypeDescription * pTypeDescr = 0; + typelib_TypeDescription * pTypeDescr = nullptr; TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef ); const int UNITS_PER_WORD = 8; diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx index 735bb976cf9b..d229de63f476 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx @@ -68,12 +68,12 @@ static typelib_TypeClass cpp2uno_call( unsigned int nr_fpr = 0; //number of fpr registers used // return - typelib_TypeDescription * pReturnTypeDescr = 0; + typelib_TypeDescription * pReturnTypeDescr = nullptr; if (pReturnTypeRef) TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); - void * pUnoReturn = 0; - void * pCppReturn = 0; // complex return ptr: if != 0 && != pUnoReturn, reconversion need + void * pUnoReturn = nullptr; + void * pCppReturn = nullptr; // complex return ptr: if != 0 && != pUnoReturn, reconversion need if ( pReturnTypeDescr ) { @@ -140,7 +140,7 @@ static typelib_TypeClass cpp2uno_call( } else // struct <= 16 bytes || ptr to complex value || ref { - typelib_TypeDescription * pParamTypeDescr = 0; + typelib_TypeDescription * pParamTypeDescr = nullptr; TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef ); void *pCppStack; @@ -194,7 +194,7 @@ static typelib_TypeClass cpp2uno_call( sal_Int32 nIndex = pTempIndices[nTempIndices]; if (pParams[nIndex].bIn) // is in/inout => was constructed - uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndices], 0 ); + uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndices], nullptr ); TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] ); } if (pReturnTypeDescr) @@ -220,7 +220,7 @@ static typelib_TypeClass cpp2uno_call( pThis->getBridge()->getUno2Cpp() ); } // destroy temp uno param - uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); + uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, nullptr ); TYPELIB_DANGER_RELEASE( pParamTypeDescr ); } @@ -232,7 +232,7 @@ static typelib_TypeClass cpp2uno_call( uno_copyAndConvertData( pCppReturn, pUnoReturn, pReturnTypeDescr, pThis->getBridge()->getUno2Cpp() ); // destroy temp uno return - uno_destructData( pUnoReturn, pReturnTypeDescr, 0 ); + uno_destructData( pUnoReturn, pReturnTypeDescr, nullptr ); } // complex return ptr is set to return reg *reinterpret_cast<void **>(pRegisterReturn) = pCppReturn; @@ -306,7 +306,7 @@ typelib_TypeClass cpp_vtable_call( { // is GET method eRet = cpp2uno_call( pCppI, aMemberDescr.get(), pAttrTypeRef, - 0, 0, // no params + 0, nullptr, // no params gpreg, fpreg, ovrflw, pRegisterReturn ); } else @@ -318,7 +318,7 @@ typelib_TypeClass cpp_vtable_call( aParam.bOut = sal_False; eRet = cpp2uno_call( pCppI, aMemberDescr.get(), - 0, // indicates void return + nullptr, // indicates void return 1, &aParam, gpreg, fpreg, ovrflw, pRegisterReturn ); } @@ -339,11 +339,11 @@ typelib_TypeClass cpp_vtable_call( break; case 0: // queryInterface() opt { - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; TYPELIB_DANGER_GET( &pTD, static_cast<Type *>( gpreg[2] )->getTypeLibType() ); if ( pTD ) { - XInterface * pInterface = 0; + XInterface * pInterface = nullptr; (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface) ( pCppI->getBridge()->getCppEnv(), reinterpret_cast<void **>(&pInterface), @@ -457,7 +457,7 @@ bridges::cpp_uno::shared::VtableFactory::initializeBlock( Slot * slots = mapBlockToVtable(block); slots[-2].fn = reinterpret_cast<void *>(-(vtableNumber * sizeof (void *))); #if ENABLE_RUNTIME_OPTIMIZATIONS - slots[-1].fn = 0; + slots[-1].fn = nullptr; (void)type; #else slots[-1].fn = x86_64::getRtti(type->aBase); @@ -476,7 +476,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( Slot * s = *slots; for ( sal_Int32 nPos = 0; nPos < type->nMembers; ++nPos ) { - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; TYPELIB_DANGER_GET( &pTD, type->ppMembers[ nPos ] ); assert(pTD); diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx index d03a6abf915e..5efd7cb752e8 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx @@ -82,7 +82,7 @@ extern "C" { static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc ) { __cxa_exception const * header = (static_cast<__cxa_exception const *>(pExc) - 1); - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; OUString unoName( toUNOname( header->exceptionType->name() ) ); ::typelib_typedescription_getByName( &pTD, unoName.pData ); assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!"); @@ -108,7 +108,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) { // construct cpp exception object - typelib_TypeDescription * pTypeDescr = 0; + typelib_TypeDescription * pTypeDescr = nullptr; TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType ); assert(pTypeDescr); if (! pTypeDescr) @@ -122,7 +122,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) ::uno_copyAndConvertData( pCppExc, pUnoExc->pData, pTypeDescr, pUno2Cpp ); // destruct uno exception - ::uno_any_destruct( pUnoExc, 0 ); + ::uno_any_destruct( pUnoExc, nullptr ); // avoiding locked counts rtti = x86_64::getRtti(*pTypeDescr); TYPELIB_DANGER_RELEASE( pTypeDescr ); @@ -149,14 +149,14 @@ void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping return; } - typelib_TypeDescription * pExcTypeDescr = 0; + typelib_TypeDescription * pExcTypeDescr = nullptr; OUString unoName( toUNOname( header->exceptionType->name() ) ); #if OSL_DEBUG_LEVEL > 1 OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); #endif typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); - if (0 == pExcTypeDescr) + if (nullptr == pExcTypeDescr) { RuntimeException aRE( "exception type not found: " + unoName ); Type const & rType = cppu::UnoType<decltype(aRE)>::get(); diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx index 575e43251bbb..47a50040ab28 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx @@ -60,7 +60,7 @@ RTTI::RTTI() #if defined(FREEBSD) && __FreeBSD_version < 702104 : m_hApp( dlopen( 0, RTLD_NOW | RTLD_GLOBAL ) ) #else - : m_hApp( dlopen( 0, RTLD_LAZY ) ) + : m_hApp( dlopen( nullptr, RTLD_LAZY ) ) #endif { } @@ -195,7 +195,7 @@ std::type_info * RTTI::getRTTI(typelib_TypeDescription const & pTypeDescr) default: assert(false); // cannot happen } - if (rtti != 0) { + if (rtti != nullptr) { std::pair< t_rtti_map::iterator, bool > insertion ( m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); SAL_WARN_IF( !insertion.second, "bridges", "key " << unoName << " already in generated rtti map" ); diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx index b286d17a56d8..a4686916ca1e 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx @@ -96,7 +96,7 @@ void INSERT_INT8( } void appendCString(OUStringBuffer & buffer, char const * text) { - if (text != 0) { + if (text != nullptr) { buffer.append( OStringToOUString(OString(text), RTL_TEXTENCODING_ISO_8859_1)); // use 8859-1 to avoid conversion failure @@ -124,11 +124,11 @@ static void cpp_call( sal_uInt32 nFPR = 0; // Return - typelib_TypeDescription * pReturnTypeDescr = 0; + typelib_TypeDescription * pReturnTypeDescr = nullptr; TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); assert(pReturnTypeDescr); - void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion (see below) + void * pCppReturn = nullptr; // if != 0 && != pUnoReturn, needs reconversion (see below) bool bSimpleReturn = true; if ( pReturnTypeDescr ) @@ -163,7 +163,7 @@ static void cpp_call( for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) { const typelib_MethodParameter & rParam = pParams[nPos]; - typelib_TypeDescription * pParamTypeDescr = 0; + typelib_TypeDescription * pParamTypeDescr = nullptr; TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef ); if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr )) @@ -256,7 +256,7 @@ static void cpp_call( throw RuntimeException("C++ code threw unknown exception"); } - *ppUnoExc = 0; + *ppUnoExc = nullptr; // reconvert temporary params for ( ; nTempIndices--; ) @@ -268,7 +268,7 @@ static void cpp_call( { if (pParams[nIndex].bOut) // inout { - uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value + uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, nullptr ); // destroy uno value uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr, pThis->getBridge()->getCpp2Uno() ); } @@ -355,7 +355,7 @@ void unoInterfaceProxyDispatch( cpp_call( pThis, aVtableSlot, reinterpret_cast<typelib_InterfaceAttributeTypeDescription const *>(pMemberDescr)->pAttributeTypeRef, - 0, 0, // no params + 0, nullptr, // no params pReturn, pArgs, ppException ); } else @@ -367,7 +367,7 @@ void unoInterfaceProxyDispatch( aParam.bIn = sal_True; aParam.bOut = sal_False; - typelib_TypeDescriptionReference * pReturnTypeRef = 0; + typelib_TypeDescriptionReference * pReturnTypeRef = nullptr; OUString aVoidName("void"); typelib_typedescriptionreference_new( &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData ); @@ -403,19 +403,19 @@ void unoInterfaceProxyDispatch( // standard calls case 1: // acquire uno interface (*pUnoI->acquire)( pUnoI ); - *ppException = 0; + *ppException = nullptr; break; case 2: // release uno interface (*pUnoI->release)( pUnoI ); - *ppException = 0; + *ppException = nullptr; break; case 0: // queryInterface() opt { - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; TYPELIB_DANGER_GET( &pTD, static_cast< Type * >( pArgs[0] )->getTypeLibType() ); if (pTD) { - uno_Interface * pInterface = 0; + uno_Interface * pInterface = nullptr; (*pThis->getBridge()->getUnoEnv()->getRegisteredInterface)( pThis->getBridge()->getUnoEnv(), reinterpret_cast<void **>(&pInterface), pThis->oid.pData, reinterpret_cast<typelib_InterfaceTypeDescription *>(pTD) ); @@ -424,10 +424,10 @@ void unoInterfaceProxyDispatch( { ::uno_any_construct( static_cast< uno_Any * >( pReturn ), - &pInterface, pTD, 0 ); + &pInterface, pTD, nullptr ); (*pInterface->release)( pInterface ); TYPELIB_DANGER_RELEASE( pTD ); - *ppException = 0; + *ppException = nullptr; break; } TYPELIB_DANGER_RELEASE( pTD ); @@ -452,7 +452,7 @@ void unoInterfaceProxyDispatch( Type const & rExcType = cppu::UnoType<decltype(aExc)>::get(); // binary identical null reference - ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 ); + ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), nullptr ); } } } diff --git a/bridges/source/cpp_uno/shared/bridge.cxx b/bridges/source/cpp_uno/shared/bridge.cxx index 43a4c3f307db..42b83f8a9f79 100644 --- a/bridges/source/cpp_uno/shared/bridge.cxx +++ b/bridges/source/cpp_uno/shared/bridge.cxx @@ -58,14 +58,14 @@ void cpp2unoMapping( { (*static_cast< uno_Interface * >( *ppUnoI )->release)( static_cast< uno_Interface * >( *ppUnoI ) ); - *ppUnoI = 0; + *ppUnoI = nullptr; } if (pCppI) { Bridge * pBridge = static_cast< Bridge::Mapping * >( pMapping )->pBridge; // get object id of interface to be wrapped - rtl_uString * pOId = 0; + rtl_uString * pOId = nullptr; (*pBridge->pCppEnv->getObjectIdentifier)( pBridge->pCppEnv, &pOId, pCppI ); assert(pOId); @@ -104,14 +104,14 @@ void uno2cppMapping( { static_cast< ::com::sun::star::uno::XInterface * >( *ppCppI )-> release(); - *ppCppI = 0; + *ppCppI = nullptr; } if (pUnoI) { Bridge * pBridge = static_cast< Bridge::Mapping * >( pMapping )->pBridge; // get object id of uno interface to be wrapped - rtl_uString * pOId = 0; + rtl_uString * pOId = nullptr; (*pBridge->pUnoEnv->getObjectIdentifier)( pBridge->pUnoEnv, &pOId, pUnoI ); assert(pOId); @@ -158,14 +158,14 @@ void Bridge::acquire() uno_Mapping * pMapping = &aCpp2Uno; ::uno_registerMapping( &pMapping, freeMapping, &pCppEnv->aBase, - &pUnoEnv->aBase, 0 ); + &pUnoEnv->aBase, nullptr ); } else { uno_Mapping * pMapping = &aUno2Cpp; ::uno_registerMapping( &pMapping, freeMapping, &pUnoEnv->aBase, - &pCppEnv->aBase, 0 ); + &pCppEnv->aBase, nullptr ); } } } diff --git a/bridges/source/cpp_uno/shared/component.cxx b/bridges/source/cpp_uno/shared/component.cxx index 0dc2c0856270..f27c6ec10b9e 100644 --- a/bridges/source/cpp_uno/shared/component.cxx +++ b/bridges/source/cpp_uno/shared/component.cxx @@ -48,7 +48,7 @@ static OUString * s_pStaticOidPart = 0; const OUString & SAL_CALL cppu_cppenv_getStaticOIdPart() { #if ! (defined(__GNUC__) && defined(__APPLE__)) - static OUString * s_pStaticOidPart = 0; + static OUString * s_pStaticOidPart = nullptr; #endif if (! s_pStaticOidPart) { @@ -93,7 +93,7 @@ static void s_stub_computeObjectIdentifier(va_list * pParam) if (*ppOId) { rtl_uString_release( *ppOId ); - *ppOId = 0; + *ppOId = nullptr; } try @@ -199,7 +199,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( assert(ppMapping && pFrom && pTo); if (ppMapping && pFrom && pTo && pFrom->pExtEnv && pTo->pExtEnv) { - uno_Mapping * pMapping = 0; + uno_Mapping * pMapping = nullptr; OUString from_envTypeName(cppu::EnvDcp::getTypeName(pFrom->pTypeName)); OUString to_envTypeName(cppu::EnvDcp::getTypeName(pTo->pTypeName)); @@ -216,7 +216,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( ::uno_registerMapping( &pMapping, bridges::cpp_uno::shared::freeMapping, &pFrom->pExtEnv->aBase, - &pTo->pExtEnv->aBase, 0 ); + &pTo->pExtEnv->aBase, nullptr ); } else if (0 == rtl_ustr_ascii_compare( to_envTypeName.pData->buffer, @@ -230,7 +230,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( ::uno_registerMapping( &pMapping, bridges::cpp_uno::shared::freeMapping, &pFrom->pExtEnv->aBase, - &pTo->pExtEnv->aBase, 0 ); + &pTo->pExtEnv->aBase, nullptr ); } if (*ppMapping) diff --git a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx index 3d583235b0c9..ec8c33a7f42e 100644 --- a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx +++ b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx @@ -51,7 +51,7 @@ void dso_exit() { if (pInstance) { delete pInstance; - pInstance = NULL; + pInstance = nullptr; } } diff --git a/bridges/source/cpp_uno/shared/types.cxx b/bridges/source/cpp_uno/shared/types.cxx index 40adaa012e8a..07b048dda239 100644 --- a/bridges/source/cpp_uno/shared/types.cxx +++ b/bridges/source/cpp_uno/shared/types.cxx @@ -60,7 +60,7 @@ bool relatesToInterfaceType(typelib_TypeDescription const * type) { case typelib_TypeClass_EXCEPTION: case typelib_TypeClass_SEQUENCE: { - typelib_TypeDescription * t = 0; + typelib_TypeDescription * t = nullptr; TYPELIB_DANGER_GET(&t, p->ppTypeRefs[i]); bool b = relatesToInterfaceType(t); TYPELIB_DANGER_RELEASE(t); @@ -74,7 +74,7 @@ bool relatesToInterfaceType(typelib_TypeDescription const * type) { break; } } - if (p->pBaseTypeDescription != 0) { + if (p->pBaseTypeDescription != nullptr) { return relatesToInterfaceType(&p->pBaseTypeDescription->aBase); } } @@ -91,7 +91,7 @@ bool relatesToInterfaceType(typelib_TypeDescription const * type) { case typelib_TypeClass_EXCEPTION: case typelib_TypeClass_SEQUENCE: { - typelib_TypeDescription * t = 0; + typelib_TypeDescription * t = nullptr; TYPELIB_DANGER_GET( &t, reinterpret_cast< typelib_IndirectTypeDescription const * >( diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx index c81bcaea3121..893cbfe8878e 100644 --- a/bridges/source/cpp_uno/shared/vtablefactory.cxx +++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx @@ -86,20 +86,20 @@ extern "C" void * SAL_CALL allocExec( void * p; #if defined SAL_UNX p = mmap( - 0, n, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, + nullptr, n, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); if (p == MAP_FAILED) { - p = 0; + p = nullptr; } else if (mprotect (p, n, PROT_READ | PROT_WRITE | PROT_EXEC) == -1) { munmap (p, n); - p = 0; + p = nullptr; } #elif defined SAL_W32 p = VirtualAlloc(0, n, MEM_COMMIT, PAGE_EXECUTE_READWRITE); #endif - if (p != 0) { + if (p != nullptr) { *size = n; } return p; @@ -180,7 +180,7 @@ VtableFactory::VtableFactory(): m_arena( sizeof (void *), // to satisfy alignment requirements 0, nullptr, allocExec, freeExec, 0)) { - if (m_arena == 0) { + if (m_arena == nullptr) { throw std::bad_alloc(); } } @@ -278,13 +278,13 @@ bool VtableFactory::createBlock(Block &block, sal_Int32 slotCount) const block.fd = -1; break; } - block.start = mmap(NULL, block.size, PROT_READ | PROT_WRITE, MAP_SHARED, block.fd, 0); + block.start = mmap(nullptr, block.size, PROT_READ | PROT_WRITE, MAP_SHARED, block.fd, 0); if (block.start== MAP_FAILED) { - block.start = 0; + block.start = nullptr; } - block.exec = mmap(NULL, block.size, PROT_READ | PROT_EXEC, MAP_SHARED, block.fd, 0); + block.exec = mmap(nullptr, block.size, PROT_READ | PROT_EXEC, MAP_SHARED, block.fd, 0); if (block.exec == MAP_FAILED) { - block.exec = 0; + block.exec = nullptr; } //All good @@ -295,12 +295,12 @@ bool VtableFactory::createBlock(Block &block, sal_Int32 slotCount) const strDirectory.clear(); } - return (block.start != 0 && block.exec != 0); + return (block.start != nullptr && block.exec != nullptr); } void VtableFactory::freeBlock(Block const & block) const { //if the double-map failed we were allocated on the arena - if (block.fd == -1 && block.start == block.exec && block.start != NULL) + if (block.fd == -1 && block.start == block.exec && block.start != nullptr) rtl_arena_free(m_arena, block.start, block.size); else { @@ -342,7 +342,7 @@ sal_Int32 VtableFactory::createVtables( unsigned char * code = codeBegin; sal_Int32 vtableOffset = blocks.size() * sizeof (Slot *); for (typelib_InterfaceTypeDescription const * type2 = type; - type2 != 0; type2 = type2->pBaseTypeDescription) + type2 != nullptr; type2 = type2->pBaseTypeDescription) { code = addLocalFunctions( &slots, code, diff --git a/bridges/source/cpp_uno/shared/vtables.cxx b/bridges/source/cpp_uno/shared/vtables.cxx index 54fdb6a7d2c8..2571cc80d5b5 100644 --- a/bridges/source/cpp_uno/shared/vtables.cxx +++ b/bridges/source/cpp_uno/shared/vtables.cxx @@ -87,11 +87,11 @@ template< typename T > bridges::cpp_uno::shared::VtableSlot doGetVtableSlot( for (sal_Int32 i = 0; i < member->nIndex; ++i) { slot.offset += getVtableCount(member->pInterface->ppBaseTypes[i]); } - typelib_TypeDescription * desc = 0; + typelib_TypeDescription * desc = nullptr; typelib_typedescriptionreference_getDescription( &desc, member->pBaseRef); assert( - desc != 0 && desc->eTypeClass == member->aBase.aBase.eTypeClass); + desc != nullptr && desc->eTypeClass == member->aBase.aBase.eTypeClass); if (member != ifcMember) { typelib_typedescription_release(&member->aBase.aBase); } @@ -121,7 +121,7 @@ sal_Int32 getLocalFunctions(typelib_InterfaceTypeDescription const * type) { sal_Int32 getPrimaryFunctions(typelib_InterfaceTypeDescription * type) { sal_Int32 n = 0; - for (; type != 0; type = type->pBaseTypeDescription) { + for (; type != nullptr; type = type->pBaseTypeDescription) { typelib_typedescription_complete( reinterpret_cast< typelib_TypeDescription ** >(&type)); n += getLocalFunctions(type); diff --git a/bridges/source/jni_uno/jni_base.h b/bridges/source/jni_uno/jni_base.h index 0855f8b3daed..f5b53429b705 100644 --- a/bridges/source/jni_uno/jni_base.h +++ b/bridges/source/jni_uno/jni_base.h @@ -91,7 +91,7 @@ public: inline void ensure_no_exception() const; // throws BridgeRuntimeError inline bool assert_no_exception() const; // asserts and clears exception - OUString get_stack_trace( jobject jo_exc = 0 ) const; + OUString get_stack_trace( jobject jo_exc = NULL ) const; }; inline void JNI_context::ensure_no_exception() const @@ -144,7 +144,7 @@ class JLocalAutoRef public: explicit JLocalAutoRef( JNI_context const & jni ) : m_jni( jni ), - m_jo( 0 ) + m_jo( NULL ) {} explicit JLocalAutoRef( JNI_context const & jni, jobject jo ) : m_jni( jni ), @@ -156,7 +156,7 @@ public: jobject get() const { return m_jo; } bool is() const - { return (0 != m_jo); } + { return (NULL != m_jo); } inline jobject release(); inline void reset( jobject jo ); inline JLocalAutoRef & operator = ( JLocalAutoRef & auto_ref ); @@ -164,7 +164,7 @@ public: inline JLocalAutoRef::~JLocalAutoRef() { - if (0 != m_jo) + if (NULL != m_jo) m_jni->DeleteLocalRef( m_jo ); } @@ -172,13 +172,13 @@ inline JLocalAutoRef::JLocalAutoRef( JLocalAutoRef & auto_ref ) : m_jni( auto_ref.m_jni ), m_jo( auto_ref.m_jo ) { - auto_ref.m_jo = 0; + auto_ref.m_jo = NULL; } inline jobject JLocalAutoRef::release() { jobject jo = m_jo; - m_jo = 0; + m_jo = NULL; return jo; } @@ -186,7 +186,7 @@ inline void JLocalAutoRef::reset( jobject jo ) { if (jo != m_jo) { - if (0 != m_jo) + if (NULL != m_jo) m_jni->DeleteLocalRef( m_jo ); m_jo = jo; } @@ -196,7 +196,7 @@ inline JLocalAutoRef & JLocalAutoRef::operator = ( JLocalAutoRef & auto_ref ) { assert( m_jni.get_jni_env() == auto_ref.m_jni.get_jni_env() ); reset( auto_ref.m_jo ); - auto_ref.m_jo = 0; + auto_ref.m_jo = NULL; return *this; } @@ -219,7 +219,7 @@ struct rtl_mem inline rtl_mem * rtl_mem::allocate( ::std::size_t bytes ) { void * p = rtl_allocateMemory( bytes ); - if (0 == p) + if (NULL == p) throw BridgeRuntimeError( "out of memory!" ); return static_cast<rtl_mem *>(p); } @@ -242,10 +242,10 @@ public: }; inline TypeDescr::TypeDescr( typelib_TypeDescriptionReference * td_ref ) - : m_td( 0 ) + : m_td( NULL ) { TYPELIB_DANGER_GET( &m_td, td_ref ); - if (0 == m_td) + if (NULL == m_td) { throw BridgeRuntimeError( "cannot get comprehensive type description for " + diff --git a/bridges/source/jni_uno/jni_bridge.cxx b/bridges/source/jni_uno/jni_bridge.cxx index 75483733f6cc..cff6edc99129 100644 --- a/bridges/source/jni_uno/jni_bridge.cxx +++ b/bridges/source/jni_uno/jni_bridge.cxx @@ -64,16 +64,16 @@ void SAL_CALL Mapping_map_to_uno( jobject javaI = static_cast<jobject>(pIn); static_assert(sizeof (void *) == sizeof (jobject), "must be the same size"); - assert(ppUnoI != 0); - assert(td != 0); + assert(ppUnoI != nullptr); + assert(td != nullptr); - if (0 == javaI) + if (nullptr == javaI) { - if (0 != *ppUnoI) + if (nullptr != *ppUnoI) { uno_Interface * p = *ppUnoI; (*p->release)( p ); - *ppUnoI = 0; + *ppUnoI = nullptr; } } else @@ -93,7 +93,7 @@ void SAL_CALL Mapping_map_to_uno( bridge->getJniInfo()->get_type_info( jni, &td->aBase ) ); uno_Interface * pUnoI = bridge->map_to_uno( jni, javaI, info ); - if (0 != *ppUnoI) + if (nullptr != *ppUnoI) { uno_Interface * p = *ppUnoI; (*p->release)( p ); @@ -123,14 +123,14 @@ void SAL_CALL Mapping_map_to_java( uno_Interface * pUnoI = static_cast<uno_Interface *>(pIn); static_assert(sizeof (void *) == sizeof (jobject), "must be the same size"); - assert(ppJavaI != 0); - assert(td != 0); + assert(ppJavaI != nullptr); + assert(td != nullptr); try { - if (0 == pUnoI) + if (nullptr == pUnoI) { - if (0 != *ppJavaI) + if (nullptr != *ppJavaI) { Bridge const * bridge = static_cast< Mapping const * >( mapping )->m_bridge; @@ -140,7 +140,7 @@ void SAL_CALL Mapping_map_to_java( bridge->m_java_env->pContext) ->machine)); jni->DeleteGlobalRef( *ppJavaI ); - *ppJavaI = 0; + *ppJavaI = nullptr; } } else @@ -158,7 +158,7 @@ void SAL_CALL Mapping_map_to_java( bridge->getJniInfo()->get_type_info( jni, &td->aBase ) ); jobject jlocal = bridge->map_to_java( jni, pUnoI, info ); - if (0 != *ppJavaI) + if (nullptr != *ppJavaI) jni->DeleteGlobalRef( *ppJavaI ); *ppJavaI = jni->NewGlobalRef( jlocal ); jni->DeleteLocalRef( jlocal ); @@ -201,14 +201,14 @@ void Bridge::acquire() const uno_Mapping * mapping = const_cast< Mapping * >( &m_java2uno ); uno_registerMapping( &mapping, Bridge_free, - m_java_env, &m_uno_env->aBase, 0 ); + m_java_env, &m_uno_env->aBase, nullptr ); } else { uno_Mapping * mapping = const_cast< Mapping * >( &m_uno2java ); uno_registerMapping( &mapping, Bridge_free, - &m_uno_env->aBase, m_java_env, 0 ); + &m_uno_env->aBase, m_java_env, nullptr ); } } } @@ -234,8 +234,8 @@ Bridge::Bridge( m_java_env( java_env ), m_registered_java2uno( registered_java2uno ) { - assert(m_java_env != 0); - assert(m_uno_env != 0); + assert(m_java_env != nullptr); + assert(m_uno_env != nullptr); // uno_initEnvironment (below) cannot report errors directly, so it clears // its pContext upon error to indirectly report errors from here: @@ -305,11 +305,11 @@ void JNI_context::java_exc_occurred() const "cannot get method id of java.lang.Object.toString()!" + get_stack_trace() ); } - assert(method_Object_toString != 0); + assert(method_Object_toString != nullptr); JLocalAutoRef jo_descr( *this, m_env->CallObjectMethodA( - jo_exc.get(), method_Object_toString, 0 ) ); + jo_exc.get(), method_Object_toString, nullptr ) ); if (m_env->ExceptionCheck()) // no chance at all { m_env->ExceptionClear(); @@ -343,7 +343,7 @@ void JNI_context::getClassForName( jclass * classClass, jmethodID * methodForName) const { jclass c = m_env->FindClass("java/lang/Class"); - if (c != 0) { + if (c != nullptr) { *methodForName = m_env->GetStaticMethodID( c, "forName", "(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;"); @@ -356,7 +356,7 @@ jclass JNI_context::findClass( char const * name, jclass classClass, jmethodID methodForName, bool inException) const { - jclass c = 0; + jclass c = nullptr; JLocalAutoRef s(*this, m_env->NewStringUTF(name)); if (s.is()) { jvalue a[3]; @@ -384,7 +384,7 @@ OUString JNI_context::get_stack_trace( jobject jo_exc ) const jmethodID method = m_env->GetStaticMethodID( static_cast<jclass>(jo_JNI_proxy.get()), "get_stack_trace", "(Ljava/lang/Throwable;)Ljava/lang/String;" ); - if (assert_no_exception() && (0 != method)) + if (assert_no_exception() && (nullptr != method)) { jvalue arg; arg.l = jo_exc; @@ -481,7 +481,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_initEnvironment( uno_Environment * java_e java_env->pContext = nullptr; java_env->dispose = java_env_dispose; java_env->environmentDisposing = java_env_disposing; - java_env->pExtEnv = 0; // no extended support + java_env->pExtEnv = nullptr; // no extended support std::unique_ptr<jni_uno::JniUnoEnvironmentData> envData( new jni_uno::JniUnoEnvironmentData(vm)); { @@ -514,13 +514,13 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( uno_Mapping ** ppMapping, uno_Environment * pFrom, uno_Environment * pTo ) SAL_THROW_EXTERN_C() { - assert(ppMapping != 0); - assert(pFrom != 0); - assert(pTo != 0); - if (0 != *ppMapping) + assert(ppMapping != nullptr); + assert(pFrom != nullptr); + assert(pTo != nullptr); + if (nullptr != *ppMapping) { (*(*ppMapping)->release)( *ppMapping ); - *ppMapping = 0; + *ppMapping = nullptr; } static_assert(int(JNI_FALSE) == int(sal_False), "must be equal"); @@ -539,7 +539,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( OUString const & to_env_typename = OUString::unacquired( &pTo->pTypeName ); - uno_Mapping * mapping = 0; + uno_Mapping * mapping = nullptr; try { @@ -550,7 +550,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( mapping = &bridge->m_java2uno; uno_registerMapping( &mapping, Bridge_free, - pFrom, &pTo->pExtEnv->aBase, 0 ); + pFrom, &pTo->pExtEnv->aBase, nullptr ); // coverity[leaked_storage] } else if ( from_env_typename == UNO_LB_UNO && to_env_typename == UNO_LB_JAVA ) @@ -560,7 +560,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( mapping = &bridge->m_uno2java; uno_registerMapping( &mapping, Bridge_free, - &pFrom->pExtEnv->aBase, pTo, 0 ); + &pFrom->pExtEnv->aBase, pTo, nullptr ); // coverity[leaked_storage] } } diff --git a/bridges/source/jni_uno/jni_data.cxx b/bridges/source/jni_uno/jni_data.cxx index af507e608b7a..08c198cec631 100644 --- a/bridges/source/jni_uno/jni_data.cxx +++ b/bridges/source/jni_uno/jni_data.cxx @@ -97,7 +97,7 @@ void createDefaultUnoValue( case typelib_TypeClass_STRING: if (!assign) { - *static_cast< rtl_uString ** >(uno_data) = 0; + *static_cast< rtl_uString ** >(uno_data) = nullptr; } rtl_uString_new(static_cast< rtl_uString ** >(uno_data)); break; @@ -110,25 +110,25 @@ void createDefaultUnoValue( *static_cast< typelib_TypeDescriptionReference ** >(uno_data) = *typelib_static_type_getByTypeClass(typelib_TypeClass_VOID); assert( - *static_cast< typelib_TypeDescriptionReference ** >(uno_data) != 0); + *static_cast< typelib_TypeDescriptionReference ** >(uno_data) != nullptr); typelib_typedescriptionreference_acquire( *static_cast< typelib_TypeDescriptionReference ** >(uno_data)); break; case typelib_TypeClass_ANY: if (assign) { - uno_any_destruct(static_cast< uno_Any * >(uno_data), 0); + uno_any_destruct(static_cast< uno_Any * >(uno_data), nullptr); } uno_any_construct( - static_cast< uno_Any * >(uno_data), 0, - jni.get_info()->m_XInterface_type_info->m_td.get(), 0); + static_cast< uno_Any * >(uno_data), nullptr, + jni.get_info()->m_XInterface_type_info->m_td.get(), nullptr); break; case typelib_TypeClass_SEQUENCE: { std::unique_ptr< rtl_mem > seq(seq_allocate(0, 0)); if (assign) { - uno_type_destructData(uno_data, type, 0); + uno_type_destructData(uno_data, type, nullptr); } *static_cast< uno_Sequence ** >(uno_data) = reinterpret_cast< uno_Sequence * >(seq.release()); @@ -137,7 +137,7 @@ void createDefaultUnoValue( case typelib_TypeClass_ENUM: { - typelib_TypeDescription * td = 0; + typelib_TypeDescription * td = nullptr; TYPELIB_DANGER_GET(&td, type); *static_cast< sal_Int32 * >(uno_data) = (reinterpret_cast< typelib_EnumTypeDescription * >(td)-> @@ -148,7 +148,7 @@ void createDefaultUnoValue( case typelib_TypeClass_STRUCT: { - if (info == 0) { + if (info == nullptr) { info = jni.get_info()->get_type_info(jni, type); } JNI_compound_type_info const * comp_info @@ -159,7 +159,7 @@ void createDefaultUnoValue( sal_Int32 nPos = 0; sal_Int32 nMembers = comp_td->nMembers; try { - if (comp_td->pBaseTypeDescription != 0) { + if (comp_td->pBaseTypeDescription != nullptr) { createDefaultUnoValue( jni, uno_data, comp_td->pBaseTypeDescription->aBase.pWeakRef, @@ -170,7 +170,7 @@ void createDefaultUnoValue( jni, (static_cast< char * >(uno_data) + comp_td->pMemberOffsets[nPos]), - comp_td->ppTypeRefs[nPos], 0, assign); + comp_td->ppTypeRefs[nPos], nullptr, assign); } } catch (...) { if (!assign) { @@ -178,11 +178,11 @@ void createDefaultUnoValue( uno_type_destructData( (static_cast< char * >(uno_data) + comp_td->pMemberOffsets[i]), - comp_td->ppTypeRefs[i], 0); + comp_td->ppTypeRefs[i], nullptr); } - if (comp_td->pBaseTypeDescription != 0) { + if (comp_td->pBaseTypeDescription != nullptr) { uno_destructData( - uno_data, &comp_td->pBaseTypeDescription->aBase, 0); + uno_data, &comp_td->pBaseTypeDescription->aBase, nullptr); } } throw; @@ -193,11 +193,11 @@ void createDefaultUnoValue( case typelib_TypeClass_INTERFACE: if (assign) { uno_Interface * p = *static_cast< uno_Interface ** >(uno_data); - if (p != 0) { + if (p != nullptr) { (*p->release)(p); } } - *static_cast< uno_Interface ** >(uno_data) = 0; + *static_cast< uno_Interface ** >(uno_data) = nullptr; break; default: @@ -232,7 +232,7 @@ void Bridge::map_to_uno( else if (special_wrapped_integral_types) { *static_cast<jchar *>(uno_data) = jni->CallCharMethodA( - java_data.l, getJniInfo()->m_method_Character_charValue, 0 ); + java_data.l, getJniInfo()->m_method_Character_charValue, nullptr ); jni.ensure_no_exception(); } else @@ -250,7 +250,7 @@ void Bridge::map_to_uno( else if (special_wrapped_integral_types) { *static_cast<jboolean *>(uno_data) = jni->CallBooleanMethodA( - java_data.l, getJniInfo()->m_method_Boolean_booleanValue, 0 ); + java_data.l, getJniInfo()->m_method_Boolean_booleanValue, nullptr ); jni.ensure_no_exception(); } else @@ -268,7 +268,7 @@ void Bridge::map_to_uno( else if (special_wrapped_integral_types) { *static_cast<jbyte *>(uno_data) = jni->CallByteMethodA( - java_data.l, getJniInfo()->m_method_Byte_byteValue, 0 ); + java_data.l, getJniInfo()->m_method_Byte_byteValue, nullptr ); jni.ensure_no_exception(); } else @@ -287,7 +287,7 @@ void Bridge::map_to_uno( else if (special_wrapped_integral_types) { *static_cast<jshort *>(uno_data) = jni->CallShortMethodA( - java_data.l, getJniInfo()->m_method_Short_shortValue, 0 ); + java_data.l, getJniInfo()->m_method_Short_shortValue, nullptr ); jni.ensure_no_exception(); } else @@ -306,7 +306,7 @@ void Bridge::map_to_uno( else if (special_wrapped_integral_types) { *static_cast<jint *>(uno_data) = jni->CallIntMethodA( - java_data.l, getJniInfo()->m_method_Integer_intValue, 0 ); + java_data.l, getJniInfo()->m_method_Integer_intValue, nullptr ); jni.ensure_no_exception(); } else @@ -325,7 +325,7 @@ void Bridge::map_to_uno( else if (special_wrapped_integral_types) { *static_cast<jlong *>(uno_data) = jni->CallLongMethodA( - java_data.l, getJniInfo()->m_method_Long_longValue, 0 ); + java_data.l, getJniInfo()->m_method_Long_longValue, nullptr ); jni.ensure_no_exception(); } else @@ -343,7 +343,7 @@ void Bridge::map_to_uno( else if (special_wrapped_integral_types) { *static_cast<jfloat *>(uno_data) = jni->CallFloatMethodA( - java_data.l, getJniInfo()->m_method_Float_floatValue, 0 ); + java_data.l, getJniInfo()->m_method_Float_floatValue, nullptr ); jni.ensure_no_exception(); } else @@ -361,7 +361,7 @@ void Bridge::map_to_uno( else if (special_wrapped_integral_types) { *static_cast<jdouble *>(uno_data) = jni->CallDoubleMethodA( - java_data.l, getJniInfo()->m_method_Double_doubleValue, 0 ); + java_data.l, getJniInfo()->m_method_Double_doubleValue, nullptr ); jni.ensure_no_exception(); } else @@ -379,14 +379,14 @@ void Bridge::map_to_uno( jni.ensure_no_exception(); java_data.l = jo_out_holder.get(); } - if (0 == java_data.l) + if (nullptr == java_data.l) { throw BridgeRuntimeError( "[map_to_uno():" + OUString::unacquired( &type->pTypeName ) + "] null-ref given!" + jni.get_stack_trace() ); } if (! assign) - *static_cast<rtl_uString **>(uno_data) = 0; + *static_cast<rtl_uString **>(uno_data) = nullptr; jstring_to_ustring( jni, static_cast<rtl_uString **>(uno_data), static_cast<jstring>(java_data.l) ); break; @@ -401,7 +401,7 @@ void Bridge::map_to_uno( jni.ensure_no_exception(); java_data.l = jo_out_holder.get(); } - if (0 == java_data.l) + if (nullptr == java_data.l) { throw BridgeRuntimeError( "[map_to_uno():" + OUString::unacquired( &type->pTypeName ) @@ -450,12 +450,12 @@ void Bridge::map_to_uno( } uno_Any * pAny = static_cast<uno_Any *>(uno_data); - if (0 == java_data.l) // null-ref maps to XInterface null-ref + if (nullptr == java_data.l) // null-ref maps to XInterface null-ref { if (assign) - uno_any_destruct( pAny, 0 ); + uno_any_destruct( pAny, nullptr ); uno_any_construct( - pAny, 0, getJniInfo()->m_XInterface_type_info->m_td.get(), 0 ); + pAny, nullptr, getJniInfo()->m_XInterface_type_info->m_td.get(), nullptr ); break; } @@ -507,7 +507,7 @@ void Bridge::map_to_uno( if (assign) { - uno_any_destruct( pAny, 0 ); + uno_any_destruct( pAny, nullptr ); } try { @@ -519,33 +519,33 @@ void Bridge::map_to_uno( case typelib_TypeClass_CHAR: pAny->pData = &pAny->pReserved; *static_cast<jchar *>(pAny->pData) = jni->CallCharMethodA( - java_data.l, getJniInfo()->m_method_Character_charValue, 0 ); + java_data.l, getJniInfo()->m_method_Character_charValue, nullptr ); jni.ensure_no_exception(); break; case typelib_TypeClass_BOOLEAN: pAny->pData = &pAny->pReserved; *static_cast<jboolean *>(pAny->pData) = jni->CallBooleanMethodA( - java_data.l, getJniInfo()->m_method_Boolean_booleanValue, 0 ); + java_data.l, getJniInfo()->m_method_Boolean_booleanValue, nullptr ); jni.ensure_no_exception(); break; case typelib_TypeClass_BYTE: pAny->pData = &pAny->pReserved; *static_cast<jbyte *>(pAny->pData) = jni->CallByteMethodA( - java_data.l, getJniInfo()->m_method_Byte_byteValue, 0 ); + java_data.l, getJniInfo()->m_method_Byte_byteValue, nullptr ); jni.ensure_no_exception(); break; case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: pAny->pData = &pAny->pReserved; *static_cast<jshort *>(pAny->pData) = jni->CallShortMethodA( - java_data.l, getJniInfo()->m_method_Short_shortValue, 0 ); + java_data.l, getJniInfo()->m_method_Short_shortValue, nullptr ); jni.ensure_no_exception(); break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: pAny->pData = &pAny->pReserved; *static_cast<jint *>(pAny->pData) = jni->CallIntMethodA( - java_data.l, getJniInfo()->m_method_Integer_intValue, 0 ); + java_data.l, getJniInfo()->m_method_Integer_intValue, nullptr ); jni.ensure_no_exception(); break; case typelib_TypeClass_HYPER: @@ -554,7 +554,7 @@ void Bridge::map_to_uno( { pAny->pData = &pAny->pReserved; *static_cast<jlong *>(pAny->pData) = jni->CallLongMethodA( - java_data.l, getJniInfo()->m_method_Long_longValue, 0 ); + java_data.l, getJniInfo()->m_method_Long_longValue, nullptr ); jni.ensure_no_exception(); } else @@ -562,7 +562,7 @@ void Bridge::map_to_uno( std::unique_ptr< rtl_mem > mem( rtl_mem::allocate( sizeof (sal_Int64) ) ); *reinterpret_cast<jlong *>(mem.get()) = jni->CallLongMethodA( - java_data.l, getJniInfo()->m_method_Long_longValue, 0 ); + java_data.l, getJniInfo()->m_method_Long_longValue, nullptr ); jni.ensure_no_exception(); pAny->pData = mem.release(); } @@ -572,7 +572,7 @@ void Bridge::map_to_uno( { pAny->pData = &pAny->pReserved; *static_cast<jfloat *>(pAny->pData) = jni->CallFloatMethodA( - java_data.l, getJniInfo()->m_method_Float_floatValue, 0 ); + java_data.l, getJniInfo()->m_method_Float_floatValue, nullptr ); jni.ensure_no_exception(); } else @@ -580,7 +580,7 @@ void Bridge::map_to_uno( std::unique_ptr< rtl_mem > mem( rtl_mem::allocate( sizeof (float) ) ); *reinterpret_cast<jfloat *>(mem.get()) = jni->CallFloatMethodA( - java_data.l, getJniInfo()->m_method_Float_floatValue, 0 ); + java_data.l, getJniInfo()->m_method_Float_floatValue, nullptr ); jni.ensure_no_exception(); pAny->pData = mem.release(); } @@ -592,7 +592,7 @@ void Bridge::map_to_uno( *static_cast<jdouble *>(pAny->pData) = jni->CallDoubleMethodA( java_data.l, - getJniInfo()->m_method_Double_doubleValue, 0 ); + getJniInfo()->m_method_Double_doubleValue, nullptr ); jni.ensure_no_exception(); } else @@ -602,14 +602,14 @@ void Bridge::map_to_uno( *reinterpret_cast<jdouble *>(mem.get()) = jni->CallDoubleMethodA( java_data.l, - getJniInfo()->m_method_Double_doubleValue, 0 ); + getJniInfo()->m_method_Double_doubleValue, nullptr ); jni.ensure_no_exception(); pAny->pData = mem.release(); } break; case typelib_TypeClass_STRING: // opt: anies often contain strings; copy string directly - pAny->pReserved = 0; + pAny->pReserved = nullptr; pAny->pData = &pAny->pReserved; jstring_to_ustring( jni, static_cast<rtl_uString **>(pAny->pData), @@ -622,7 +622,7 @@ void Bridge::map_to_uno( pAny->pData = &pAny->pReserved; map_to_uno( jni, pAny->pData, java_data, - value_td.get()->pWeakRef, 0, + value_td.get()->pWeakRef, nullptr, false /* no assign */, false /* no out param */ ); break; case typelib_TypeClass_STRUCT: @@ -631,7 +631,7 @@ void Bridge::map_to_uno( std::unique_ptr< rtl_mem > mem( rtl_mem::allocate( value_td.get()->nSize ) ); map_to_uno( - jni, mem.get(), java_data, value_td.get()->pWeakRef, 0, + jni, mem.get(), java_data, value_td.get()->pWeakRef, nullptr, false /* no assign */, false /* no out param */ ); pAny->pData = mem.release(); break; @@ -650,7 +650,7 @@ void Bridge::map_to_uno( if (assign) { // restore to valid any - uno_any_construct( pAny, 0, 0, 0 ); + uno_any_construct( pAny, nullptr, nullptr, nullptr ); } throw; } @@ -668,7 +668,7 @@ void Bridge::map_to_uno( jni.ensure_no_exception(); java_data.l = jo_out_holder.get(); } - if (0 == java_data.l) + if (nullptr == java_data.l) { throw BridgeRuntimeError( "[map_to_uno():" + OUString::unacquired( &type->pTypeName ) @@ -690,14 +690,14 @@ void Bridge::map_to_uno( jni.ensure_no_exception(); java_data.l = jo_out_holder.get(); } - if (0 == java_data.l) + if (nullptr == java_data.l) { throw BridgeRuntimeError( "[map_to_uno():" + OUString::unacquired( &type->pTypeName ) + "] null-ref given!" + jni.get_stack_trace() ); } - if (0 == info) + if (nullptr == info) info = getJniInfo()->get_type_info( jni, type ); JNI_compound_type_info const * comp_info = static_cast< JNI_compound_type_info const * >( info ); @@ -707,13 +707,13 @@ void Bridge::map_to_uno( bool polymorphic = comp_td->aBase.eTypeClass == typelib_TypeClass_STRUCT && reinterpret_cast< typelib_StructTypeDescription * >( - comp_td)->pParameterizedTypes != 0; + comp_td)->pParameterizedTypes != nullptr; sal_Int32 nPos = 0; sal_Int32 nMembers = comp_td->nMembers; try { - if (0 != comp_td->pBaseTypeDescription) + if (nullptr != comp_td->pBaseTypeDescription) { map_to_uno( jni, uno_data, java_data, @@ -737,13 +737,13 @@ void Bridge::map_to_uno( if (parameterizedType) { JLocalAutoRef jo( jni, jni->GetObjectField( java_data.l, field_id ) ); - if ( jo.get() == 0 ) { + if ( jo.get() == nullptr ) { *static_cast<jchar *>(p) = 0; } else { jvalue val; val.l = jo.get(); map_to_uno( - jni, p, val, member_type, 0, assign, false, + jni, p, val, member_type, nullptr, assign, false, true ); } } else { @@ -755,13 +755,13 @@ void Bridge::map_to_uno( if (parameterizedType) { JLocalAutoRef jo( jni, jni->GetObjectField( java_data.l, field_id ) ); - if ( jo.get() == 0 ) { + if ( jo.get() == nullptr ) { *static_cast<jboolean *>(p) = false; } else { jvalue val; val.l = jo.get(); map_to_uno( - jni, p, val, member_type, 0, assign, false, + jni, p, val, member_type, nullptr, assign, false, true ); } } else { @@ -773,13 +773,13 @@ void Bridge::map_to_uno( if (parameterizedType) { JLocalAutoRef jo( jni, jni->GetObjectField( java_data.l, field_id ) ); - if ( jo.get() == 0 ) { + if ( jo.get() == nullptr ) { *static_cast<jbyte *>(p) = 0; } else { jvalue val; val.l = jo.get(); map_to_uno( - jni, p, val, member_type, 0, assign, false, + jni, p, val, member_type, nullptr, assign, false, true ); } } else { @@ -792,13 +792,13 @@ void Bridge::map_to_uno( if (parameterizedType) { JLocalAutoRef jo( jni, jni->GetObjectField( java_data.l, field_id ) ); - if ( jo.get() == 0 ) { + if ( jo.get() == nullptr ) { *static_cast<jshort *>(p) = 0; } else { jvalue val; val.l = jo.get(); map_to_uno( - jni, p, val, member_type, 0, assign, false, + jni, p, val, member_type, nullptr, assign, false, true ); } } else { @@ -811,13 +811,13 @@ void Bridge::map_to_uno( if (parameterizedType) { JLocalAutoRef jo( jni, jni->GetObjectField( java_data.l, field_id ) ); - if ( jo.get() == 0 ) { + if ( jo.get() == nullptr ) { *static_cast<jint *>(p) = 0; } else { jvalue val; val.l = jo.get(); map_to_uno( - jni, p, val, member_type, 0, assign, false, + jni, p, val, member_type, nullptr, assign, false, true ); } } else { @@ -829,13 +829,13 @@ void Bridge::map_to_uno( if (parameterizedType) { JLocalAutoRef jo( jni, jni->GetObjectField( java_data.l, field_id ) ); - if ( jo.get() == 0 ) { + if ( jo.get() == nullptr ) { *static_cast<jlong *>(p) = 0; } else { jvalue val; val.l = jo.get(); map_to_uno( - jni, p, val, member_type, 0, assign, false, + jni, p, val, member_type, nullptr, assign, false, true ); } } else { @@ -847,13 +847,13 @@ void Bridge::map_to_uno( if (parameterizedType) { JLocalAutoRef jo( jni, jni->GetObjectField( java_data.l, field_id ) ); - if ( jo.get() == 0 ) { + if ( jo.get() == nullptr ) { *static_cast<jfloat *>(p) = 0; } else { jvalue val; val.l = jo.get(); map_to_uno( - jni, p, val, member_type, 0, assign, false, + jni, p, val, member_type, nullptr, assign, false, true ); } } else { @@ -865,13 +865,13 @@ void Bridge::map_to_uno( if (parameterizedType) { JLocalAutoRef jo( jni, jni->GetObjectField( java_data.l, field_id ) ); - if ( jo.get() == 0 ) { + if ( jo.get() == nullptr ) { *static_cast<jdouble *>(p) = 0; } else { jvalue val; val.l = jo.get(); map_to_uno( - jni, p, val, member_type, 0, assign, false, + jni, p, val, member_type, nullptr, assign, false, true ); } } else { @@ -883,7 +883,7 @@ void Bridge::map_to_uno( { JLocalAutoRef jo_field( jni ); bool checkNull; - if (0 == field_id) + if (nullptr == field_id) { // special for Message: call Throwable.getMessage() assert( @@ -899,7 +899,7 @@ void Bridge::map_to_uno( jo_field.reset( jni->CallObjectMethodA( java_data.l, - getJniInfo()->m_method_Throwable_getMessage, 0 ) + getJniInfo()->m_method_Throwable_getMessage, nullptr ) ); jni.ensure_no_exception(); checkNull = true; @@ -911,12 +911,12 @@ void Bridge::map_to_uno( checkNull = parameterizedType; } if (checkNull && !jo_field.is()) { - createDefaultUnoValue(jni, p, member_type, 0, assign); + createDefaultUnoValue(jni, p, member_type, nullptr, assign); } else { jvalue val; val.l = jo_field.get(); map_to_uno( - jni, p, val, member_type, 0, + jni, p, val, member_type, nullptr, assign, false /* no out param */ ); } break; @@ -934,12 +934,12 @@ void Bridge::map_to_uno( void * p = static_cast<char *>(uno_data) + comp_td->pMemberOffsets[ nCleanup ]; uno_type_destructData( - p, comp_td->ppTypeRefs[ nCleanup ], 0 ); + p, comp_td->ppTypeRefs[ nCleanup ], nullptr ); } - if (0 != comp_td->pBaseTypeDescription) + if (nullptr != comp_td->pBaseTypeDescription) { uno_destructData( - uno_data, &comp_td->pBaseTypeDescription->aBase, 0 ); + uno_data, &comp_td->pBaseTypeDescription->aBase, nullptr ); } } throw; @@ -956,7 +956,7 @@ void Bridge::map_to_uno( jni.ensure_no_exception(); java_data.l = jo_out_holder.get(); } - if (0 == java_data.l) + if (nullptr == java_data.l) { throw BridgeRuntimeError( "[map_to_uno():" + OUString::unacquired( &type->pTypeName ) @@ -1053,7 +1053,7 @@ void Bridge::map_to_uno( } else { - element_info = 0; + element_info = nullptr; } for ( sal_Int32 nPos = 0; nPos < nElements; ++nPos ) @@ -1082,7 +1082,7 @@ void Bridge::map_to_uno( void * p = reinterpret_cast<uno_Sequence *>(seq.get())->elements + (nCleanPos * element_td.get()->nSize); - uno_destructData( p, element_td.get(), 0 ); + uno_destructData( p, element_td.get(), nullptr ); } throw; } @@ -1100,7 +1100,7 @@ void Bridge::map_to_uno( } if (assign) - uno_destructData( uno_data, td.get(), 0 ); + uno_destructData( uno_data, td.get(), nullptr ); *static_cast<uno_Sequence **>(uno_data) = reinterpret_cast<uno_Sequence *>(seq.release()); break; } @@ -1115,19 +1115,19 @@ void Bridge::map_to_uno( java_data.l = jo_out_holder.get(); } - if (0 == java_data.l) // null-ref + if (nullptr == java_data.l) // null-ref { if (assign) { uno_Interface * p = *static_cast<uno_Interface **>(uno_data); - if (0 != p) + if (nullptr != p) (*p->release)( p ); } - *static_cast<uno_Interface **>(uno_data) = 0; + *static_cast<uno_Interface **>(uno_data) = nullptr; } else { - if (0 == info) + if (nullptr == info) info = getJniInfo()->get_type_info( jni, type ); JNI_interface_type_info const * iface_info = static_cast< JNI_interface_type_info const * >( info ); @@ -1135,7 +1135,7 @@ void Bridge::map_to_uno( if (assign) { uno_Interface * p = *static_cast<uno_Interface **>(uno_data); - if (0 != p) + if (nullptr != p) (*p->release)( p ); } *static_cast<uno_Interface **>(uno_data) = pUnoI; @@ -1173,7 +1173,7 @@ void Bridge::map_to_java( case typelib_TypeClass_CHAR: if (out_param) { - if (0 == java_data->l) + if (nullptr == java_data->l) { JLocalAutoRef jo_ar( jni, jni->NewCharArray( 1 ) ); jni.ensure_no_exception(); @@ -1212,7 +1212,7 @@ void Bridge::map_to_java( case typelib_TypeClass_BOOLEAN: if (out_param) { - if (0 == java_data->l) + if (nullptr == java_data->l) { JLocalAutoRef jo_ar( jni, jni->NewBooleanArray( 1 ) ); jni.ensure_no_exception(); @@ -1253,7 +1253,7 @@ void Bridge::map_to_java( case typelib_TypeClass_BYTE: if (out_param) { - if (0 == java_data->l) + if (nullptr == java_data->l) { JLocalAutoRef jo_ar( jni, jni->NewByteArray( 1 ) ); jni.ensure_no_exception(); @@ -1293,7 +1293,7 @@ void Bridge::map_to_java( case typelib_TypeClass_UNSIGNED_SHORT: if (out_param) { - if (0 == java_data->l) + if (nullptr == java_data->l) { JLocalAutoRef jo_ar( jni, jni->NewShortArray( 1 ) ); jni.ensure_no_exception(); @@ -1333,7 +1333,7 @@ void Bridge::map_to_java( case typelib_TypeClass_UNSIGNED_LONG: if (out_param) { - if (0 == java_data->l) + if (nullptr == java_data->l) { JLocalAutoRef jo_ar( jni, jni->NewIntArray( 1 ) ); jni.ensure_no_exception(); @@ -1373,7 +1373,7 @@ void Bridge::map_to_java( case typelib_TypeClass_UNSIGNED_HYPER: if (out_param) { - if (0 == java_data->l) + if (nullptr == java_data->l) { JLocalAutoRef jo_ar( jni, jni->NewLongArray( 1 ) ); jni.ensure_no_exception(); @@ -1412,7 +1412,7 @@ void Bridge::map_to_java( case typelib_TypeClass_FLOAT: if (out_param) { - if (0 == java_data->l) + if (nullptr == java_data->l) { JLocalAutoRef jo_ar( jni, jni->NewFloatArray( 1 ) ); jni.ensure_no_exception(); @@ -1451,7 +1451,7 @@ void Bridge::map_to_java( case typelib_TypeClass_DOUBLE: if (out_param) { - if (0 == java_data->l) + if (nullptr == java_data->l) { JLocalAutoRef jo_ar( jni, jni->NewDoubleArray( 1 ) ); jni.ensure_no_exception(); @@ -1500,7 +1500,7 @@ void Bridge::map_to_java( ustring_to_jstring( jni, *static_cast<rtl_uString * const *>(uno_data) ) ); } - if (0 == java_data->l) + if (nullptr == java_data->l) { java_data->l = jni->NewObjectArray( 1, getJniInfo()->m_class_String, jo_in.get() ); @@ -1534,7 +1534,7 @@ void Bridge::map_to_java( *static_cast<typelib_TypeDescriptionReference * const *>(uno_data) ) ); } - if (0 == java_data->l) + if (nullptr == java_data->l) { java_data->l = jni->NewObjectArray( 1, getJniInfo()->m_class_Type, jo_in.get() ); @@ -1636,7 +1636,7 @@ void Bridge::map_to_java( // prefetch sequence td TypeDescr seq_td( pAny->pType ); map_to_java( - jni, &java_data2, pAny->pData, seq_td.get()->pWeakRef, 0, + jni, &java_data2, pAny->pData, seq_td.get()->pWeakRef, nullptr, true /* in */, false /* no out */, true /* create integral wrappers */ ); jo_any.reset( java_data2.l ); @@ -1683,7 +1683,7 @@ void Bridge::map_to_java( uno_Interface * pUnoI = static_cast<uno_Interface *>(pAny->pReserved); if (is_XInterface( pAny->pType )) { - if (0 != pUnoI) + if (nullptr != pUnoI) { jo_any.reset( map_to_java( @@ -1697,7 +1697,7 @@ void Bridge::map_to_java( JNI_interface_type_info const * iface_info = static_cast< JNI_interface_type_info const * >( getJniInfo()->get_type_info( jni, pAny->pType ) ); - if (0 != pUnoI) + if (nullptr != pUnoI) { jo_any.reset( map_to_java( jni, pUnoI, iface_info ) ); } @@ -1726,7 +1726,7 @@ void Bridge::map_to_java( JLocalAutoRef jo_type(jni, create_type(jni, pAny->pType)); jvalue java_data2; map_to_java( - jni, &java_data2, pAny->pData, pAny->pType, 0, true, + jni, &java_data2, pAny->pData, pAny->pType, nullptr, true, false); jo_any.reset(java_data2.l); jvalue args[2]; @@ -1745,7 +1745,7 @@ void Bridge::map_to_java( { jvalue java_data2; map_to_java( - jni, &java_data2, pAny->pData, pAny->pType, 0, + jni, &java_data2, pAny->pData, pAny->pType, nullptr, true /* in */, false /* no out */, true /* create integral wrappers */ ); jo_any.reset( java_data2.l ); @@ -1756,7 +1756,7 @@ void Bridge::map_to_java( if (out_param) { - if (0 == java_data->l) + if (nullptr == java_data->l) { java_data->l = jni->NewObjectArray( 1, getJniInfo()->m_class_Object, jo_any.get() ); @@ -1795,7 +1795,7 @@ void Bridge::map_to_java( jmethodID method_id = jni->GetStaticMethodID( static_cast<jclass>(jo_enum_class.get()), "fromInt", sig.getStr() ); jni.ensure_no_exception(); - assert( 0 != method_id ); + assert( nullptr != method_id ); jvalue arg; arg.i = *static_cast<jint const *>(uno_data); @@ -1806,7 +1806,7 @@ void Bridge::map_to_java( } if (out_param) { - if (0 == java_data->l) + if (nullptr == java_data->l) { java_data->l = jni->NewObjectArray( 1, static_cast<jclass>(jo_enum_class.get()), jo_enum.get() ); @@ -1828,7 +1828,7 @@ void Bridge::map_to_java( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - if (0 == info) + if (nullptr == info) info = getJniInfo()->get_type_info( jni, type ); JNI_compound_type_info const * comp_info = static_cast< JNI_compound_type_info const * >( info ); @@ -1854,7 +1854,7 @@ void Bridge::map_to_java( } for ( JNI_compound_type_info const * linfo = comp_info; - 0 != linfo; + nullptr != linfo; linfo = static_cast< JNI_compound_type_info const * >( linfo->m_base ) ) { @@ -1866,11 +1866,11 @@ void Bridge::map_to_java( bool polymorphic = comp_td->aBase.eTypeClass == typelib_TypeClass_STRUCT && reinterpret_cast< typelib_StructTypeDescription * >( - comp_td)->pParameterizedTypes != 0; + comp_td)->pParameterizedTypes != nullptr; for ( sal_Int32 nPos = comp_td->nMembers; nPos--; ) { jfieldID field_id = linfo->m_fields[ nPos ]; - if (0 != field_id) + if (nullptr != field_id) { void const * p = static_cast<char const *>(uno_data) + pMemberOffsets[ nPos ]; @@ -2050,7 +2050,7 @@ void Bridge::map_to_java( { jvalue java_data2; map_to_java( - jni, &java_data2, p, member_type, 0, + jni, &java_data2, p, member_type, nullptr, true /* in */, false /* no out */ ); JLocalAutoRef jo_obj( jni, java_data2.l ); jni->SetObjectField( @@ -2064,7 +2064,7 @@ void Bridge::map_to_java( } if (out_param) { - if (0 == java_data->l) + if (nullptr == java_data->l) { java_data->l = jni->NewObjectArray( 1, comp_info->m_class, jo_comp.get() ); @@ -2089,7 +2089,7 @@ void Bridge::map_to_java( JLocalAutoRef jo_ar( jni ); sal_Int32 nElements; - uno_Sequence * seq = 0; + uno_Sequence * seq = nullptr; if (in_param) { seq = *static_cast<uno_Sequence * const *>(uno_data); @@ -2200,7 +2200,7 @@ void Bridge::map_to_java( case typelib_TypeClass_STRING: jo_ar.reset( jni->NewObjectArray( - nElements, getJniInfo()->m_class_String, 0 ) ); + nElements, getJniInfo()->m_class_String, nullptr ) ); jni.ensure_no_exception(); if (in_param) { @@ -2218,7 +2218,7 @@ void Bridge::map_to_java( break; case typelib_TypeClass_TYPE: jo_ar.reset( - jni->NewObjectArray( nElements, getJniInfo()->m_class_Type, 0 ) ); + jni->NewObjectArray( nElements, getJniInfo()->m_class_Type, nullptr ) ); jni.ensure_no_exception(); if (in_param) { @@ -2228,7 +2228,7 @@ void Bridge::map_to_java( { jvalue val; map_to_java( - jni, &val, &pp[ nPos ], element_type, 0, + jni, &val, &pp[ nPos ], element_type, nullptr, true /* in */, false /* no out */ ); JLocalAutoRef jo_element( jni, val.l ); jni->SetObjectArrayElement( @@ -2240,7 +2240,7 @@ void Bridge::map_to_java( case typelib_TypeClass_ANY: jo_ar.reset( jni->NewObjectArray( - nElements, getJniInfo()->m_class_Object, 0 ) ); + nElements, getJniInfo()->m_class_Object, nullptr ) ); jni.ensure_no_exception(); if (in_param) { @@ -2249,7 +2249,7 @@ void Bridge::map_to_java( { jvalue val; map_to_java( - jni, &val, &p[ nPos ], element_type, 0, + jni, &val, &p[ nPos ], element_type, nullptr, true /* in */, false /* no out */ ); JLocalAutoRef jo_element( jni, val.l ); jni->SetObjectArrayElement( @@ -2270,7 +2270,7 @@ void Bridge::map_to_java( jo_ar.reset( jni->NewObjectArray( - nElements, static_cast<jclass>(jo_enum_class.get()), 0 ) ); + nElements, static_cast<jclass>(jo_enum_class.get()), nullptr ) ); jni.ensure_no_exception(); if (0 < nElements) @@ -2284,7 +2284,7 @@ void Bridge::map_to_java( jmethodID method_id = jni->GetStaticMethodID( static_cast<jclass>(jo_enum_class.get()), "fromInt", sig.getStr() ); jni.ensure_no_exception(); - assert( 0 != method_id ); + assert( nullptr != method_id ); sal_Int32 const * p = reinterpret_cast<sal_Int32 const *>(seq->elements); for ( sal_Int32 nPos = 0; nPos < nElements; ++nPos ) @@ -2309,7 +2309,7 @@ void Bridge::map_to_java( getJniInfo()->get_type_info( jni, element_type ); jo_ar.reset( - jni->NewObjectArray( nElements, element_info->m_class, 0 ) ); + jni->NewObjectArray( nElements, element_info->m_class, nullptr ) ); jni.ensure_no_exception(); if (0 < nElements) @@ -2343,7 +2343,7 @@ void Bridge::map_to_java( jo_ar.reset( jni->NewObjectArray( - nElements, static_cast<jclass>(jo_seq_class.get()), 0 ) ); + nElements, static_cast<jclass>(jo_seq_class.get()), nullptr ) ); jni.ensure_no_exception(); if (0 < nElements) @@ -2354,7 +2354,7 @@ void Bridge::map_to_java( { jvalue java_data2; map_to_java( - jni, &java_data2, elements + nPos, element_type, 0, + jni, &java_data2, elements + nPos, element_type, nullptr, true /* in */, false /* no out */ ); JLocalAutoRef jo_seq( jni, java_data2.l ); jni->SetObjectArrayElement( @@ -2371,7 +2371,7 @@ void Bridge::map_to_java( getJniInfo()->get_type_info( jni, element_type ) ); jo_ar.reset( - jni->NewObjectArray( nElements, iface_info->m_class, 0 ) ); + jni->NewObjectArray( nElements, iface_info->m_class, nullptr ) ); jni.ensure_no_exception(); if (0 < nElements) @@ -2380,7 +2380,7 @@ void Bridge::map_to_java( for ( sal_Int32 nPos = 0; nPos < nElements; ++nPos ) { uno_Interface * pUnoI = pp[ nPos ]; - if (0 != pUnoI) + if (nullptr != pUnoI) { JLocalAutoRef jo_element( jni, map_to_java( jni, pUnoI, iface_info ) ); @@ -2405,7 +2405,7 @@ void Bridge::map_to_java( if (out_param) { - if (0 == java_data->l) + if (nullptr == java_data->l) { JLocalAutoRef jo_element_class( jni, jni->GetObjectClass( jo_ar.get() ) ); @@ -2417,7 +2417,7 @@ void Bridge::map_to_java( else { java_data->l = jni->NewObjectArray( - 1, static_cast<jclass>(jo_element_class.get()), 0 ); + 1, static_cast<jclass>(jo_element_class.get()), nullptr ); } jni.ensure_no_exception(); } @@ -2440,9 +2440,9 @@ void Bridge::map_to_java( if (in_param) { uno_Interface * pUnoI = *static_cast<uno_Interface * const *>(uno_data); - if (0 != pUnoI) + if (nullptr != pUnoI) { - if (0 == info) + if (nullptr == info) info = getJniInfo()->get_type_info( jni, type ); JNI_interface_type_info const * iface_info = static_cast< JNI_interface_type_info const * >( info ); @@ -2451,9 +2451,9 @@ void Bridge::map_to_java( } if (out_param) { - if (0 == java_data->l) + if (nullptr == java_data->l) { - if (0 == info) + if (nullptr == info) info = getJniInfo()->get_type_info( jni, type ); java_data->l = jni->NewObjectArray( 1, info->m_class, jo_iface.get() ); diff --git a/bridges/source/jni_uno/jni_helper.h b/bridges/source/jni_uno/jni_helper.h index bfbfd7741cf7..43b0c9633b76 100644 --- a/bridges/source/jni_uno/jni_helper.h +++ b/bridges/source/jni_uno/jni_helper.h @@ -34,7 +34,7 @@ namespace jni_uno inline void jstring_to_ustring( JNI_context const & jni, rtl_uString ** out_ustr, jstring jstr ) { - if (0 == jstr) + if (NULL == jstr) { rtl_uString_new( out_ustr ); } @@ -51,7 +51,7 @@ inline void jstring_to_ustring( ustr->length = len; ustr->buffer[ len ] = '\0'; mem.release(); - if (0 != *out_ustr) + if (NULL != *out_ustr) rtl_uString_release( *out_ustr ); *out_ustr = ustr; } @@ -60,7 +60,7 @@ inline void jstring_to_ustring( inline OUString jstring_to_oustring( JNI_context const & jni, jstring jstr ) { - rtl_uString * ustr = 0; + rtl_uString * ustr = NULL; jstring_to_ustring( jni, &ustr, jstr ); return OUString( ustr, SAL_NO_ACQUIRE ); } @@ -80,14 +80,14 @@ inline jclass find_class( JNI_context const & jni, char const * class_name, bool inException = false ) { // find_class may be called before the JNI_info is set: - jclass c=0; + jclass c=NULL; jmethodID m; JNI_info const * info = jni.get_info(); - if (info == 0) { + if (info == NULL) { jni.getClassForName(&c, &m); - if (c == 0) { + if (c == NULL) { if (inException) { - return 0; + return NULL; } jni.ensure_no_exception(); } diff --git a/bridges/source/jni_uno/jni_info.cxx b/bridges/source/jni_uno/jni_info.cxx index fc49ea4a1855..89e4b0bb5564 100644 --- a/bridges/source/jni_uno/jni_info.cxx +++ b/bridges/source/jni_uno/jni_info.cxx @@ -43,7 +43,7 @@ namespace jni_uno JNI_type_info::JNI_type_info( JNI_context const & jni, typelib_TypeDescription * td ) : m_td( td ), - m_class( 0 ) + m_class( nullptr ) { m_td.makeComplete(); if (! m_td.get()->bComplete) @@ -94,7 +94,7 @@ JNI_interface_type_info::JNI_interface_type_info( if (is_XInterface( m_td.get()->pWeakRef )) { - m_methods = 0; // no methods + m_methods = nullptr; // no methods } else { @@ -146,7 +146,7 @@ JNI_interface_type_info::JNI_interface_type_info( static_cast<jclass>(jo_class.get()), method_name.getStr(), method_signature.getStr() ); jni.ensure_no_exception(); - assert( 0 != m_methods[ nMethodIndex ] ); + assert( nullptr != m_methods[ nMethodIndex ] ); ++nMethodIndex; } else // attribute @@ -184,7 +184,7 @@ JNI_interface_type_info::JNI_interface_type_info( static_cast<jclass>(jo_class.get()), method_name.getStr(), method_signature.getStr() ); jni.ensure_no_exception(); - assert( 0 != m_methods[ nMethodIndex ] ); + assert( nullptr != m_methods[ nMethodIndex ] ); ++nMethodIndex; if (! attribute_td->bReadOnly) { @@ -204,7 +204,7 @@ JNI_interface_type_info::JNI_interface_type_info( static_cast<jclass>(jo_class.get()), method_name.getStr(), method_signature.getStr() ); jni.ensure_no_exception(); - assert( 0 != m_methods[ nMethodIndex ] ); + assert( nullptr != m_methods[ nMethodIndex ] ); ++nMethodIndex; } } @@ -234,8 +234,8 @@ void JNI_compound_type_info::destroy( JNIEnv * jni_env ) JNI_compound_type_info::JNI_compound_type_info( JNI_context const & jni, typelib_TypeDescription * td_ ) : JNI_type_info( jni, td_ ), - m_exc_ctor( 0 ), - m_fields( 0 ) + m_exc_ctor( nullptr ), + m_fields( nullptr ) { assert( typelib_TypeClass_STRUCT == m_td.get()->eTypeClass || typelib_TypeClass_EXCEPTION == m_td.get()->eTypeClass ); @@ -268,7 +268,7 @@ JNI_compound_type_info::JNI_compound_type_info( m_exc_ctor = jni->GetMethodID( static_cast<jclass>(jo_class.get()), "<init>", "(Ljava/lang/String;)V" ); jni.ensure_no_exception(); - assert( 0 != m_exc_ctor ); + assert( nullptr != m_exc_ctor ); } // retrieve info for base type @@ -276,10 +276,10 @@ JNI_compound_type_info::JNI_compound_type_info( type_equals( td->aBase.pWeakRef, jni_info->m_RuntimeException_type.getTypeLibType()) - ? 0 + ? nullptr : reinterpret_cast< typelib_TypeDescription * >( td->pBaseTypeDescription ); - m_base = (0 == base_td ? 0 : jni_info->get_type_info( jni, base_td )); + m_base = (nullptr == base_td ? nullptr : jni_info->get_type_info( jni, base_td )); try { @@ -292,12 +292,12 @@ JNI_compound_type_info::JNI_compound_type_info( { // coverity [ctor_dtor_leak] m_fields = new jfieldID[ 2 ]; - m_fields[ 0 ] = 0; // special Throwable.getMessage() + m_fields[ 0 ] = nullptr; // special Throwable.getMessage() // field Context m_fields[ 1 ] = jni->GetFieldID( static_cast<jclass>(jo_class.get()), "Context", "Ljava/lang/Object;" ); jni.ensure_no_exception(); - assert( 0 != m_fields[ 1 ] ); + assert( nullptr != m_fields[ 1 ] ); } else { @@ -310,7 +310,7 @@ JNI_compound_type_info::JNI_compound_type_info( OString sig; if (td->aBase.eTypeClass == typelib_TypeClass_STRUCT && reinterpret_cast< typelib_StructTypeDescription * >( - td)->pParameterizedTypes != 0 + td)->pParameterizedTypes != nullptr && reinterpret_cast< typelib_StructTypeDescription * >( td)->pParameterizedTypes[nPos]) { @@ -330,7 +330,7 @@ JNI_compound_type_info::JNI_compound_type_info( static_cast<jclass>(jo_class.get()), member_name.getStr(), sig.getStr() ); jni.ensure_no_exception(); - assert( 0 != m_fields[ nPos ] ); + assert( nullptr != m_fields[ nPos ] ); } } } @@ -375,7 +375,7 @@ JNI_type_info const * JNI_info::create_type_info( JNI_type_info * info; ClearableMutexGuard guard( m_mutex ); JNI_type_info_holder & holder = m_type_map[ uno_name ]; - if (0 == holder.m_info) // new insertion + if (nullptr == holder.m_info) // new insertion { holder.m_info = new_info; guard.clear(); @@ -481,7 +481,7 @@ JNI_info::JNI_info( jmethodID methodForName ) : m_class_Class( classClass ), m_method_Class_forName( methodForName ), - m_class_JNI_proxy( 0 ), + m_class_JNI_proxy( nullptr ), m_XInterface_queryInterface_td( (reinterpret_cast< typelib_InterfaceTypeDescription * >( css::uno::TypeDescription( @@ -490,7 +490,7 @@ JNI_info::JNI_info( m_Exception_type(cppu::UnoType<css::uno::Exception>::get()), m_RuntimeException_type(cppu::UnoType<css::uno::RuntimeException>::get()), m_void_type(cppu::UnoType<void>::get()), - m_XInterface_type_info( 0 ) + m_XInterface_type_info( nullptr ) { JNI_context jni( this, jni_env, class_loader ); // !no proper jni_info! @@ -542,162 +542,162 @@ JNI_info::JNI_info( m_method_Object_toString = jni->GetMethodID( static_cast<jclass>(jo_Object.get()), "toString", "()Ljava/lang/String;" ); jni.ensure_no_exception(); - assert( 0 != m_method_Object_toString ); + assert( nullptr != m_method_Object_toString ); // method Class.getName() m_method_Class_getName = jni->GetMethodID( static_cast<jclass>(jo_Class.get()), "getName", "()Ljava/lang/String;" ); jni.ensure_no_exception(); - assert( 0 != m_method_Class_getName ); + assert( nullptr != m_method_Class_getName ); // method Throwable.getMessage() m_method_Throwable_getMessage = jni->GetMethodID( static_cast<jclass>(jo_Throwable.get()), "getMessage", "()Ljava/lang/String;" ); jni.ensure_no_exception(); - assert( 0 != m_method_Throwable_getMessage ); + assert( nullptr != m_method_Throwable_getMessage ); // method Character.charValue() m_method_Character_charValue = jni->GetMethodID( static_cast<jclass>(jo_Character.get()), "charValue", "()C" ); jni.ensure_no_exception(); - assert( 0 != m_method_Character_charValue ); + assert( nullptr != m_method_Character_charValue ); // method Boolean.booleanValue() m_method_Boolean_booleanValue = jni->GetMethodID( static_cast<jclass>(jo_Boolean.get()), "booleanValue", "()Z" ); jni.ensure_no_exception(); - assert( 0 != m_method_Boolean_booleanValue ); + assert( nullptr != m_method_Boolean_booleanValue ); // method Byte.byteValue() m_method_Byte_byteValue = jni->GetMethodID( static_cast<jclass>(jo_Byte.get()), "byteValue", "()B" ); jni.ensure_no_exception(); - assert( 0 != m_method_Byte_byteValue ); + assert( nullptr != m_method_Byte_byteValue ); // method Short.shortValue() m_method_Short_shortValue = jni->GetMethodID( static_cast<jclass>(jo_Short.get()), "shortValue", "()S" ); jni.ensure_no_exception(); - assert( 0 != m_method_Short_shortValue ); + assert( nullptr != m_method_Short_shortValue ); // method Integer.intValue() m_method_Integer_intValue = jni->GetMethodID( static_cast<jclass>(jo_Integer.get()), "intValue", "()I" ); jni.ensure_no_exception(); - assert( 0 != m_method_Integer_intValue ); + assert( nullptr != m_method_Integer_intValue ); // method Long.longValue() m_method_Long_longValue = jni->GetMethodID( static_cast<jclass>(jo_Long.get()), "longValue", "()J" ); jni.ensure_no_exception(); - assert( 0 != m_method_Long_longValue ); + assert( nullptr != m_method_Long_longValue ); // method Float.floatValue() m_method_Float_floatValue = jni->GetMethodID( static_cast<jclass>(jo_Float.get()), "floatValue", "()F" ); jni.ensure_no_exception(); - assert( 0 != m_method_Float_floatValue ); + assert( nullptr != m_method_Float_floatValue ); // method Double.doubleValue() m_method_Double_doubleValue = jni->GetMethodID( static_cast<jclass>(jo_Double.get()), "doubleValue", "()D" ); jni.ensure_no_exception(); - assert( 0 != m_method_Double_doubleValue ); + assert( nullptr != m_method_Double_doubleValue ); // ctor Character( char ) m_ctor_Character_with_char = jni->GetMethodID( static_cast<jclass>(jo_Character.get()), "<init>", "(C)V" ); jni.ensure_no_exception(); - assert( 0 != m_ctor_Character_with_char ); + assert( nullptr != m_ctor_Character_with_char ); // ctor Boolean( boolean ) m_ctor_Boolean_with_boolean = jni->GetMethodID( static_cast<jclass>(jo_Boolean.get()), "<init>", "(Z)V" ); jni.ensure_no_exception(); - assert( 0 != m_ctor_Boolean_with_boolean ); + assert( nullptr != m_ctor_Boolean_with_boolean ); // ctor Byte( byte ) m_ctor_Byte_with_byte = jni->GetMethodID( static_cast<jclass>(jo_Byte.get()), "<init>", "(B)V" ); jni.ensure_no_exception(); - assert( 0 != m_ctor_Byte_with_byte ); + assert( nullptr != m_ctor_Byte_with_byte ); // ctor Short( short ) m_ctor_Short_with_short = jni->GetMethodID( static_cast<jclass>(jo_Short.get()), "<init>", "(S)V" ); jni.ensure_no_exception(); - assert( 0 != m_ctor_Short_with_short ); + assert( nullptr != m_ctor_Short_with_short ); // ctor Integer( int ) m_ctor_Integer_with_int = jni->GetMethodID( static_cast<jclass>(jo_Integer.get()), "<init>", "(I)V" ); jni.ensure_no_exception(); - assert( 0 != m_ctor_Integer_with_int ); + assert( nullptr != m_ctor_Integer_with_int ); // ctor Long( long ) m_ctor_Long_with_long = jni->GetMethodID( static_cast<jclass>(jo_Long.get()), "<init>", "(J)V" ); jni.ensure_no_exception(); - assert( 0 != m_ctor_Long_with_long ); + assert( nullptr != m_ctor_Long_with_long ); // ctor Float( float ) m_ctor_Float_with_float = jni->GetMethodID( static_cast<jclass>(jo_Float.get()), "<init>", "(F)V" ); jni.ensure_no_exception(); - assert( 0 != m_ctor_Float_with_float ); + assert( nullptr != m_ctor_Float_with_float ); // ctor Double( double ) m_ctor_Double_with_double = jni->GetMethodID( static_cast<jclass>(jo_Double.get()), "<init>", "(D)V" ); jni.ensure_no_exception(); - assert( 0 != m_ctor_Double_with_double ); + assert( nullptr != m_ctor_Double_with_double ); // static method UnoRuntime.generateOid() m_method_UnoRuntime_generateOid = jni->GetStaticMethodID( static_cast<jclass>(jo_UnoRuntime.get()), "generateOid", "(Ljava/lang/Object;)Ljava/lang/String;" ); jni.ensure_no_exception(); - assert( 0 != m_method_UnoRuntime_generateOid ); + assert( nullptr != m_method_UnoRuntime_generateOid ); // static method UnoRuntime.queryInterface() m_method_UnoRuntime_queryInterface = jni->GetStaticMethodID( static_cast<jclass>(jo_UnoRuntime.get()), "queryInterface", "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)Ljava/lang/Object;" ); jni.ensure_no_exception(); - assert( 0 != m_method_UnoRuntime_queryInterface ); + assert( nullptr != m_method_UnoRuntime_queryInterface ); // field Enum.m_value m_field_Enum_m_value = jni->GetFieldID( static_cast<jclass>(jo_Enum.get()), "m_value", "I" ); jni.ensure_no_exception(); - assert( 0 != m_field_Enum_m_value ); + assert( nullptr != m_field_Enum_m_value ); // static method TypeClass.fromInt() m_method_TypeClass_fromInt = jni->GetStaticMethodID( static_cast<jclass>(jo_TypeClass.get()), "fromInt", "(I)Lcom/sun/star/uno/TypeClass;" ); jni.ensure_no_exception(); - assert( 0 != m_method_TypeClass_fromInt ); + assert( nullptr != m_method_TypeClass_fromInt ); // ctor Type( Class ) m_ctor_Type_with_Class = jni->GetMethodID( static_cast<jclass>(jo_Type.get()), "<init>", "(Ljava/lang/Class;)V" ); jni.ensure_no_exception(); - assert( 0 != m_ctor_Type_with_Class ); + assert( nullptr != m_ctor_Type_with_Class ); // ctor Type( String, TypeClass ) m_ctor_Type_with_Name_TypeClass = jni->GetMethodID( static_cast<jclass>(jo_Type.get()), "<init>", "(Ljava/lang/String;Lcom/sun/star/uno/TypeClass;)V" ); jni.ensure_no_exception(); - assert( 0 != m_ctor_Type_with_Name_TypeClass ); + assert( nullptr != m_ctor_Type_with_Name_TypeClass ); // field Type._typeName m_field_Type__typeName = jni->GetFieldID( static_cast<jclass>(jo_Type.get()), "_typeName", "Ljava/lang/String;" ); jni.ensure_no_exception(); - assert( 0 != m_field_Type__typeName ); + assert( nullptr != m_field_Type__typeName ); // ctor Any( Type, Object ) m_ctor_Any_with_Type_Object = jni->GetMethodID( static_cast<jclass>(jo_Any.get()), "<init>", "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V" ); jni.ensure_no_exception(); - assert( 0 != m_ctor_Any_with_Type_Object ); + assert( nullptr != m_ctor_Any_with_Type_Object ); // field Any._type m_field_Any__type = jni->GetFieldID( static_cast<jclass>(jo_Any.get()), "_type", "Lcom/sun/star/uno/Type;" ); jni.ensure_no_exception(); - assert( 0 != m_field_Any__type ); + assert( nullptr != m_field_Any__type ); // field Any._object m_field_Any__object = jni->GetFieldID( static_cast<jclass>(jo_Any.get()), "_object", "Ljava/lang/Object;" ); jni.ensure_no_exception(); - assert( 0 != m_field_Any__object ); + assert( nullptr != m_field_Any__object ); // method IEnvironment.getRegisteredInterface() m_method_IEnvironment_getRegisteredInterface = jni->GetMethodID( @@ -705,21 +705,21 @@ JNI_info::JNI_info( "getRegisteredInterface", "(Ljava/lang/String;Lcom/sun/star/uno/Type;)Ljava/lang/Object;" ); jni.ensure_no_exception(); - assert( 0 != m_method_IEnvironment_getRegisteredInterface ); + assert( nullptr != m_method_IEnvironment_getRegisteredInterface ); // method IEnvironment.registerInterface() m_method_IEnvironment_registerInterface = jni->GetMethodID( static_cast<jclass>(jo_IEnvironment.get()), "registerInterface", "(Ljava/lang/Object;[Ljava/lang/String;Lcom/sun/star/uno/Type;)" "Ljava/lang/Object;" ); jni.ensure_no_exception(); - assert( 0 != m_method_IEnvironment_registerInterface ); + assert( nullptr != m_method_IEnvironment_registerInterface ); // static method JNI_proxy.get_proxy_ctor() m_method_JNI_proxy_get_proxy_ctor = jni->GetStaticMethodID( static_cast<jclass>(jo_JNI_proxy.get()), "get_proxy_ctor", "(Ljava/lang/Class;)Ljava/lang/reflect/Constructor;" ); jni.ensure_no_exception(); - assert( 0 != m_method_JNI_proxy_get_proxy_ctor ); + assert( nullptr != m_method_JNI_proxy_get_proxy_ctor ); // static method JNI_proxy.create() m_method_JNI_proxy_create = jni->GetStaticMethodID( static_cast<jclass>(jo_JNI_proxy.get()), "create", @@ -727,38 +727,38 @@ JNI_info::JNI_info( "/String;Ljava/lang/reflect/Constructor;" "Lcom/sun/star/lib/util/AsynchronousFinalizer;)Ljava/lang/Object;" ); jni.ensure_no_exception(); - assert( 0 != m_method_JNI_proxy_create ); + assert( nullptr != m_method_JNI_proxy_create ); // field JNI_proxy.m_receiver_handle m_field_JNI_proxy_m_receiver_handle = jni->GetFieldID( static_cast<jclass>(jo_JNI_proxy.get()), "m_receiver_handle", "J" ); jni.ensure_no_exception(); - assert( 0 != m_field_JNI_proxy_m_receiver_handle ); + assert( nullptr != m_field_JNI_proxy_m_receiver_handle ); // field JNI_proxy.m_td_handle m_field_JNI_proxy_m_td_handle = jni->GetFieldID( static_cast<jclass>(jo_JNI_proxy.get()), "m_td_handle", "J" ); jni.ensure_no_exception(); - assert( 0 != m_field_JNI_proxy_m_td_handle ); + assert( nullptr != m_field_JNI_proxy_m_td_handle ); // field JNI_proxy.m_type m_field_JNI_proxy_m_type = jni->GetFieldID( static_cast<jclass>(jo_JNI_proxy.get()), "m_type", "Lcom/sun/star/uno/Type;" ); jni.ensure_no_exception(); - assert( 0 != m_field_JNI_proxy_m_type ); + assert( nullptr != m_field_JNI_proxy_m_type ); // field JNI_proxy.m_oid m_field_JNI_proxy_m_oid = jni->GetFieldID( static_cast<jclass>(jo_JNI_proxy.get()), "m_oid", "Ljava/lang/String;" ); jni.ensure_no_exception(); - assert( 0 != m_field_JNI_proxy_m_oid ); + assert( nullptr != m_field_JNI_proxy_m_oid ); // ctor AsynchronousFinalizer m_ctor_AsynchronousFinalizer = jni->GetMethodID( static_cast<jclass>(jo_AsynchronousFinalizer.get()), "<init>", "()V" ); jni.ensure_no_exception(); - assert( 0 != m_ctor_AsynchronousFinalizer ); + assert( nullptr != m_ctor_AsynchronousFinalizer ); // method AsynchronousFinalizer.drain() m_method_AsynchronousFinalizer_drain = jni->GetMethodID( static_cast<jclass>(jo_AsynchronousFinalizer.get()), "drain", "()V" ); jni.ensure_no_exception(); - assert( 0 != m_method_AsynchronousFinalizer_drain ); + assert( nullptr != m_method_AsynchronousFinalizer_drain ); // get java env OUString java_env_type_name( UNO_LB_JAVA ); @@ -766,13 +766,13 @@ JNI_info::JNI_info( jni, ustring_to_jstring( jni, java_env_type_name.pData ) ); jvalue args[ 2 ]; args[ 0 ].l = jo_java.get(); - args[ 1 ].l = 0; + args[ 1 ].l = nullptr; jmethodID method_getEnvironment = jni->GetStaticMethodID( static_cast<jclass>(jo_UnoRuntime.get()), "getEnvironment", "(Ljava/lang/String;Ljava/lang/Object;)" "Lcom/sun/star/uno/IEnvironment;" ); jni.ensure_no_exception(); - assert( 0 != method_getEnvironment ); + assert( nullptr != method_getEnvironment ); JLocalAutoRef jo_java_env( jni, jni->CallStaticObjectMethodA( static_cast<jclass>(jo_UnoRuntime.get()), method_getEnvironment, args ) ); @@ -781,7 +781,7 @@ JNI_info::JNI_info( jfieldID field_Any_VOID = jni->GetStaticFieldID( static_cast<jclass>(jo_Any.get()), "VOID", "Lcom/sun/star/uno/Any;" ); jni.ensure_no_exception(); - assert( 0 != field_Any_VOID ); + assert( nullptr != field_Any_VOID ); JLocalAutoRef jo_Any_VOID( jni, jni->GetStaticObjectField( static_cast<jclass>(jo_Any.get()), field_Any_VOID ) ); @@ -789,7 +789,7 @@ JNI_info::JNI_info( jfieldID field_Type_UNSIGNED_SHORT = jni->GetStaticFieldID( static_cast<jclass>(jo_Type.get()), "UNSIGNED_SHORT", "Lcom/sun/star/uno/Type;" ); jni.ensure_no_exception(); - assert( 0 != field_Type_UNSIGNED_SHORT ); + assert( nullptr != field_Type_UNSIGNED_SHORT ); JLocalAutoRef jo_Type_UNSIGNED_SHORT( jni, jni->GetStaticObjectField( static_cast<jclass>(jo_Type.get()), field_Type_UNSIGNED_SHORT ) ); @@ -797,7 +797,7 @@ JNI_info::JNI_info( jfieldID field_Type_UNSIGNED_LONG = jni->GetStaticFieldID( static_cast<jclass>(jo_Type.get()), "UNSIGNED_LONG", "Lcom/sun/star/uno/Type;" ); jni.ensure_no_exception(); - assert( 0 != field_Type_UNSIGNED_LONG ); + assert( nullptr != field_Type_UNSIGNED_LONG ); JLocalAutoRef jo_Type_UNSIGNED_LONG( jni, jni->GetStaticObjectField( static_cast<jclass>(jo_Type.get()), field_Type_UNSIGNED_LONG ) ); @@ -805,7 +805,7 @@ JNI_info::JNI_info( jfieldID field_Type_UNSIGNED_HYPER = jni->GetStaticFieldID( static_cast<jclass>(jo_Type.get()), "UNSIGNED_HYPER", "Lcom/sun/star/uno/Type;" ); jni.ensure_no_exception(); - assert( 0 != field_Type_UNSIGNED_HYPER ); + assert( nullptr != field_Type_UNSIGNED_HYPER ); JLocalAutoRef jo_Type_UNSIGNED_HYPER( jni, jni->GetStaticObjectField( static_cast<jclass>(jo_Type.get()), field_Type_UNSIGNED_HYPER ) ); @@ -883,7 +883,7 @@ void JNI_info::destruct( JNIEnv * jni_env ) { iPos->second.m_info->destroy( jni_env ); } - if (0 != m_XInterface_type_info) + if (nullptr != m_XInterface_type_info) { const_cast< JNI_interface_type_info * >( m_XInterface_type_info )->destroy( jni_env ); @@ -926,7 +926,7 @@ JNI_info const * JNI_info::get_jni_info( uno_vm->getVirtualMachine() ); JNIEnv * jni_env = guard.getEnvironment(); JNI_context jni( - 0, jni_env, static_cast< jobject >(uno_vm->getClassLoader()) ); + nullptr, jni_env, static_cast< jobject >(uno_vm->getClassLoader()) ); jclass jo_class; jmethodID jo_forName; @@ -942,13 +942,13 @@ JNI_info const * JNI_info::get_jni_info( jni->GetStaticFieldID( static_cast<jclass>(jo_JNI_info_holder.get()), "s_jni_info_handle", "J" ); jni.ensure_no_exception(); - assert( 0 != field_s_jni_info_handle ); + assert( nullptr != field_s_jni_info_handle ); JNI_info const * jni_info = reinterpret_cast< JNI_info const * >( jni->GetStaticLongField( static_cast<jclass>(jo_JNI_info_holder.get()), field_s_jni_info_handle ) ); - if (0 == jni_info) // un-initialized? + if (nullptr == jni_info) // un-initialized? { JNI_info * new_info = new JNI_info( jni_env, static_cast< jobject >(uno_vm->getClassLoader()), jo_class, @@ -960,7 +960,7 @@ JNI_info const * JNI_info::get_jni_info( jni->GetStaticLongField( static_cast<jclass>(jo_JNI_info_holder.get()), field_s_jni_info_handle ) ); - if (0 == jni_info) // still un-initialized? + if (nullptr == jni_info) // still un-initialized? { jni->SetStaticLongField( static_cast<jclass>(jo_JNI_info_holder.get()), field_s_jni_info_handle, diff --git a/bridges/source/jni_uno/jni_info.h b/bridges/source/jni_uno/jni_info.h index 9f68a7104e3c..962503b1337d 100644 --- a/bridges/source/jni_uno/jni_info.h +++ b/bridges/source/jni_uno/jni_info.h @@ -110,7 +110,7 @@ struct JNI_type_info_holder: private boost::noncopyable { JNI_type_info * m_info; inline JNI_type_info_holder() - : m_info( 0 ) + : m_info( NULL ) {} }; diff --git a/bridges/source/jni_uno/jni_java2uno.cxx b/bridges/source/jni_uno/jni_java2uno.cxx index 1b6e52c96e40..14ea786dce43 100644 --- a/bridges/source/jni_uno/jni_java2uno.cxx +++ b/bridges/source/jni_uno/jni_java2uno.cxx @@ -36,9 +36,9 @@ jobject Bridge::map_to_java( uno_Interface * pUnoI, JNI_interface_type_info const * info ) const { // get oid - rtl_uString * pOid = 0; + rtl_uString * pOid = nullptr; (*m_uno_env->getObjectIdentifier)( m_uno_env, &pOid, pUnoI ); - assert( 0 != pOid ); + assert( nullptr != pOid ); OUString oid( pOid, SAL_NO_ACQUIRE ); // opt getRegisteredInterface() @@ -51,7 +51,7 @@ jobject Bridge::map_to_java( getJniInfo()->m_method_IEnvironment_getRegisteredInterface, args ); jni.ensure_no_exception(); - if (0 == jo_iface) // no registered iface + if (nullptr == jo_iface) // no registered iface { // register uno interface (*m_uno_env->registerInterface)( @@ -82,7 +82,7 @@ jobject Bridge::map_to_java( jni.ensure_no_exception(); } - assert( 0 != jo_iface ); + assert( nullptr != jo_iface ); return jo_iface; } @@ -108,15 +108,15 @@ void Bridge::handle_uno_exc( JNI_context const & jni, uno_Any * uno_exc ) const try { map_to_java( - jni, &java_exc, uno_exc->pData, uno_exc->pType, 0, + jni, &java_exc, uno_exc->pData, uno_exc->pType, nullptr, true /* in */, false /* no out */ ); } catch (...) { - uno_any_destruct( uno_exc, 0 ); + uno_any_destruct( uno_exc, nullptr ); throw; } - uno_any_destruct( uno_exc, 0 ); + uno_any_destruct( uno_exc, nullptr ); JLocalAutoRef jo_exc( jni, java_exc.l ); jint res = jni->Throw( static_cast<jthrowable>(jo_exc.get()) ); @@ -125,7 +125,7 @@ void Bridge::handle_uno_exc( JNI_context const & jni, uno_Any * uno_exc ) const // call toString() JLocalAutoRef jo_descr( jni, jni->CallObjectMethodA( - jo_exc.get(), getJniInfo()->m_method_Object_toString, 0 ) ); + jo_exc.get(), getJniInfo()->m_method_Object_toString, nullptr ) ); jni.ensure_no_exception(); throw BridgeRuntimeError( "throwing java exception failed: " @@ -139,7 +139,7 @@ void Bridge::handle_uno_exc( JNI_context const & jni, uno_Any * uno_exc ) const "thrown exception is no uno exception: " + OUString::unacquired( &uno_exc->pType->pTypeName ) + jni.get_stack_trace() ); - uno_any_destruct( uno_exc, 0 ); + uno_any_destruct( uno_exc, nullptr ); throw BridgeRuntimeError( message ); } } @@ -187,7 +187,7 @@ jobject Bridge::call_uno( (nParams * sizeof (void *)) + return_size + (nParams * sizeof (largest)) )); void ** uno_args = reinterpret_cast<void **>(mem); - void * uno_ret = return_size == 0 ? 0 : (mem + (nParams * sizeof (void *))); + void * uno_ret = return_size == 0 ? nullptr : (mem + (nParams * sizeof (void *))); largest * uno_args_mem = reinterpret_cast<largest *> (mem + (nParams * sizeof (void *)) + return_size); @@ -221,7 +221,7 @@ jobject Bridge::call_uno( jvalue java_arg; java_arg.l = jo_arg.get(); map_to_uno( - jni, uno_args[ nPos ], java_arg, type, 0, + jni, uno_args[ nPos ], java_arg, type, nullptr, false /* no assign */, param.bOut, true /* special wrapped integral types */ ); } @@ -234,7 +234,7 @@ jobject Bridge::call_uno( if (p.bIn) { uno_type_destructData( - uno_args[ n ], p.pTypeRef, 0 ); + uno_args[ n ], p.pTypeRef, nullptr ); } #ifdef BROKEN_ALLOCA if (uno_args[ nPos ] && uno_args[ nPos ] != &uno_args_mem[ nPos ]) @@ -254,7 +254,7 @@ jobject Bridge::call_uno( // call binary uno (*pUnoI->pDispatcher)( pUnoI, member_td, uno_ret, uno_args, &uno_exc ); - if (0 == uno_exc) + if (nullptr == uno_exc) { // convert out args; destruct uno args for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) @@ -272,7 +272,7 @@ jobject Bridge::call_uno( jvalue java_arg; java_arg.l = jo_out_holder.get(); map_to_java( - jni, &java_arg, uno_args[ nPos ], type, 0, + jni, &java_arg, uno_args[ nPos ], type, nullptr, true /* in */, true /* out holder */ ); } catch (...) @@ -281,14 +281,14 @@ jobject Bridge::call_uno( for ( sal_Int32 n = nPos; n < nParams; ++n ) { uno_type_destructData( - uno_args[ n ], pParams[ n ].pTypeRef, 0 ); + uno_args[ n ], pParams[ n ].pTypeRef, nullptr ); #ifdef BROKEN_ALLOCA if (uno_args[ nPos ] && uno_args[ nPos ] != &uno_args_mem[ nPos ]) free( uno_args[ nPos ] ); #endif } // cleanup uno return value - uno_type_destructData( uno_ret, return_type, 0 ); + uno_type_destructData( uno_ret, return_type, nullptr ); #ifdef BROKEN_ALLOCA free( mem ); #endif @@ -298,7 +298,7 @@ jobject Bridge::call_uno( if (typelib_TypeClass_DOUBLE < type->eTypeClass && typelib_TypeClass_ENUM != type->eTypeClass) // opt { - uno_type_destructData( uno_args[ nPos ], type, 0 ); + uno_type_destructData( uno_args[ nPos ], type, nullptr ); #ifdef BROKEN_ALLOCA if (uno_args[ nPos ] && uno_args[ nPos ] != &uno_args_mem[ nPos ]) free( uno_args[ nPos ] ); @@ -313,13 +313,13 @@ jobject Bridge::call_uno( try { map_to_java( - jni, &java_ret, uno_ret, return_type, 0, + jni, &java_ret, uno_ret, return_type, nullptr, true /* in */, false /* no out */, true /* special_wrapped_integral_types */ ); } catch (...) { - uno_type_destructData( uno_ret, return_type, 0 ); + uno_type_destructData( uno_ret, return_type, nullptr ); #ifdef BROKEN_ALLOCA free( mem ); #endif @@ -328,7 +328,7 @@ jobject Bridge::call_uno( if (typelib_TypeClass_DOUBLE < return_type->eTypeClass && typelib_TypeClass_ENUM != return_type->eTypeClass) // opt { - uno_type_destructData( uno_ret, return_type, 0 ); + uno_type_destructData( uno_ret, return_type, nullptr ); } #ifdef BROKEN_ALLOCA free( mem ); @@ -338,7 +338,7 @@ jobject Bridge::call_uno( #ifdef BROKEN_ALLOCA free( mem ); #endif - return 0; // void return + return nullptr; // void return } else // exception occurred { @@ -347,7 +347,7 @@ jobject Bridge::call_uno( { typelib_MethodParameter const & param = pParams[ nPos ]; if (param.bIn) - uno_type_destructData( uno_args[ nPos ], param.pTypeRef, 0 ); + uno_type_destructData( uno_args[ nPos ], param.pTypeRef, nullptr ); #ifdef BROKEN_ALLOCA if (uno_args[ nPos ] && uno_args[ nPos ] != &uno_args_mem[ nPos ]) free( uno_args[ nPos ] ); @@ -358,7 +358,7 @@ jobject Bridge::call_uno( #ifdef BROKEN_ALLOCA free( mem ); #endif - return 0; + return nullptr; } } @@ -446,14 +446,14 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( (*pUnoI->pDispatcher)( pUnoI, jni_info->m_XInterface_queryInterface_td.get(), &uno_ret, uno_args, &uno_exc ); - if (0 == uno_exc) + if (nullptr == uno_exc) { - jobject jo_ret = 0; + jobject jo_ret = nullptr; if (typelib_TypeClass_INTERFACE == uno_ret.pType->eTypeClass) { uno_Interface * pUnoRet = static_cast<uno_Interface *>(uno_ret.pReserved); - if (0 != pUnoRet) + if (nullptr != pUnoRet) { try { @@ -462,18 +462,18 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( } catch (...) { - uno_any_destruct( &uno_ret, 0 ); + uno_any_destruct( &uno_ret, nullptr ); throw; } } } - uno_any_destruct( &uno_ret, 0 ); + uno_any_destruct( &uno_ret, nullptr ); return jo_ret; } else { bridge->handle_uno_exc( jni, uno_exc ); - return 0; + return nullptr; } } @@ -552,7 +552,7 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( return bridge->call_uno( jni, pUnoI, member_td.get(), attr_td->pAttributeTypeRef, - 0, 0, + 0, nullptr, jo_args ); } else if ('s' == method_name[ 0 ]) @@ -599,7 +599,7 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( { assert( false ); } - return 0; + return nullptr; } catch (const ::jvmaccess::VirtualMachine::AttachGuard::CreationException &) { @@ -613,7 +613,7 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( { assert( false ); } - return 0; + return nullptr; } } diff --git a/bridges/source/jni_uno/jni_uno2java.cxx b/bridges/source/jni_uno/jni_uno2java.cxx index b461ead27ed2..1642c7e7aa8f 100644 --- a/bridges/source/jni_uno/jni_uno2java.cxx +++ b/bridges/source/jni_uno/jni_uno2java.cxx @@ -75,7 +75,7 @@ void Bridge::handle_java_exc( JLocalAutoRef jo_class( jni, jni->GetObjectClass( jo_exc.get() ) ); JLocalAutoRef jo_class_name( jni, jni->CallObjectMethodA( - jo_class.get(), getJniInfo()->m_method_Class_getName, 0 ) ); + jo_class.get(), getJniInfo()->m_method_Class_getName, nullptr ) ); jni.ensure_no_exception(); OUString exc_name( jstring_to_oustring( jni, static_cast<jstring>(jo_class_name.get()) ) ); @@ -86,7 +86,7 @@ void Bridge::handle_java_exc( // call toString() JLocalAutoRef jo_descr( jni, jni->CallObjectMethodA( - jo_exc.get(), getJniInfo()->m_method_Object_toString, 0 ) ); + jo_exc.get(), getJniInfo()->m_method_Object_toString, nullptr ) ); jni.ensure_no_exception(); throw BridgeRuntimeError( "non-UNO exception occurred: " @@ -98,7 +98,7 @@ void Bridge::handle_java_exc( jvalue val; val.l = jo_exc.get(); map_to_uno( - jni, uno_data.get(), val, td.get()->pWeakRef, 0, + jni, uno_data.get(), val, td.get()->pWeakRef, nullptr, false /* no assign */, false /* no out param */ ); #if OSL_DEBUG_LEVEL > 0 @@ -162,11 +162,11 @@ void Bridge::call_java( try { typelib_MethodParameter const & param = params[ nPos ]; - java_args[ nPos ].l = 0; // if out: build up array[ 1 ] + java_args[ nPos ].l = nullptr; // if out: build up array[ 1 ] map_to_java( jni, &java_args[ nPos ], uno_args[ nPos ], - param.pTypeRef, 0, + param.pTypeRef, nullptr, param.bIn /* convert uno value */, param.bOut /* build up array[ 1 ] */ ); } @@ -219,20 +219,20 @@ void Bridge::call_java( jni.ensure_no_exception(); JLocalAutoRef jo_descr( jni, jni->CallObjectMethodA( - jo_method.get(), getJniInfo()->m_method_Object_toString, 0 ) ); + jo_method.get(), getJniInfo()->m_method_Object_toString, nullptr ) ); jni.ensure_no_exception(); trace_buf.append( jstring_to_oustring( jni, static_cast<jstring>(jo_descr.get()) ) ); trace_buf.append( " on " ); jo_descr.reset( jni->CallObjectMethodA( - javaI, getJniInfo()->m_method_Object_toString, 0 ) ); + javaI, getJniInfo()->m_method_Object_toString, nullptr ) ); jni.ensure_no_exception(); trace_buf.append( jstring_to_oustring( jni, static_cast<jstring>(jo_descr.get()) ) ); trace_buf.append( " (" ); JLocalAutoRef jo_class( jni, jni->GetObjectClass( javaI ) ); jo_descr.reset( jni->CallObjectMethodA( - jo_class.get(), getJniInfo()->m_method_Object_toString, 0 ) ); + jo_class.get(), getJniInfo()->m_method_Object_toString, nullptr ) ); jni.ensure_no_exception(); trace_buf.append( jstring_to_oustring( jni, static_cast<jstring>(jo_descr.get()) ) ); trace_buf.append( ")" ); @@ -317,7 +317,7 @@ void Bridge::call_java( { map_to_uno( jni, uno_args[ nPos ], - java_args[ nPos ], param.pTypeRef, 0, + java_args[ nPos ], param.pTypeRef, nullptr, param.bIn /* assign if inout */, true /* out param */ ); } @@ -330,7 +330,7 @@ void Bridge::call_java( if (! p.bIn) { uno_type_destructData( - uno_args[ n ], p.pTypeRef, 0 ); + uno_args[ n ], p.pTypeRef, nullptr ); } } // cleanup java temp local refs @@ -366,7 +366,7 @@ void Bridge::call_java( jvalue val; val.l = java_ret.get(); map_to_uno( - jni, uno_ret, val, return_type, 0, + jni, uno_ret, val, return_type, nullptr, false /* no assign */, false /* no out param */ ); } catch (...) @@ -378,7 +378,7 @@ void Bridge::call_java( if (! param.bIn) { uno_type_destructData( - uno_args[ i ], param.pTypeRef, 0 ); + uno_args[ i ], param.pTypeRef, nullptr ); } } #ifdef BROKEN_ALLOCA @@ -389,7 +389,7 @@ void Bridge::call_java( } // else: already set integral uno return value // no exception occurred - *uno_exc = 0; + *uno_exc = nullptr; } #ifdef BROKEN_ALLOCA free( java_args ); @@ -487,12 +487,12 @@ uno_Interface * Bridge::map_to_uno( JLocalAutoRef jo_oid( jni, compute_oid( jni, javaI ) ); OUString oid( jstring_to_oustring( jni, static_cast<jstring>(jo_oid.get()) ) ); - uno_Interface * pUnoI = 0; + uno_Interface * pUnoI = nullptr; (*m_uno_env->getRegisteredInterface)( m_uno_env, reinterpret_cast<void **>(&pUnoI), oid.pData, reinterpret_cast<typelib_InterfaceTypeDescription *>(info->m_td.get()) ); - if (0 == pUnoI) // no existing interface, register new proxy + if (nullptr == pUnoI) // no existing interface, register new proxy { // refcount initially 1 pUnoI = new UNO_proxy( @@ -595,7 +595,7 @@ void SAL_CALL UNO_proxy_dispatch( typelib_InterfaceAttributeTypeDescription const * >( member_td ); com::sun::star::uno::TypeDescription attrib_holder; - while ( attrib_td->pBaseRef != 0 ) { + while ( attrib_td->pBaseRef != nullptr ) { attrib_holder = com::sun::star::uno::TypeDescription( attrib_td->pBaseRef ); assert( @@ -607,7 +607,7 @@ void SAL_CALL UNO_proxy_dispatch( } typelib_InterfaceTypeDescription * iface_td = attrib_td->pInterface; - if (0 == uno_ret) // is setter method + if (nullptr == uno_ret) // is setter method { typelib_MethodParameter param; param.pTypeRef = attrib_td->pAttributeTypeRef; @@ -619,15 +619,15 @@ void SAL_CALL UNO_proxy_dispatch( attrib_td->nIndex, 1, // get, then set method bridge->getJniInfo()->m_void_type.getTypeLibType(), ¶m, 1, - 0, uno_args, uno_exc ); + nullptr, uno_args, uno_exc ); } else // is getter method { bridge->call_java( that->m_javaI, iface_td, attrib_td->nIndex, 0, attrib_td->pAttributeTypeRef, - 0, 0, // no params - uno_ret, 0, uno_exc ); + nullptr, 0, // no params + uno_ret, nullptr, uno_exc ); } break; } @@ -638,7 +638,7 @@ void SAL_CALL UNO_proxy_dispatch( typelib_InterfaceMethodTypeDescription const * >( member_td ); com::sun::star::uno::TypeDescription method_holder; - while ( method_td->pBaseRef != 0 ) { + while ( method_td->pBaseRef != nullptr ) { method_holder = com::sun::star::uno::TypeDescription( method_td->pBaseRef ); assert( @@ -664,13 +664,13 @@ void SAL_CALL UNO_proxy_dispatch( "queryInterface() call demands an INTERFACE type!" ); } - uno_Interface * pInterface = 0; + uno_Interface * pInterface = nullptr; (*bridge->m_uno_env->getRegisteredInterface)( bridge->m_uno_env, reinterpret_cast<void **>(&pInterface), that->m_oid.pData, reinterpret_cast<typelib_InterfaceTypeDescription *>(demanded_td.get()) ); - if (0 == pInterface) + if (nullptr == pInterface) { JNI_info const * jni_info = bridge->getJniInfo(); JNI_guarded_context jni( @@ -727,36 +727,36 @@ void SAL_CALL UNO_proxy_dispatch( uno_any_construct( static_cast<uno_Any *>(uno_ret), &pUnoI2, - demanded_td.get(), 0 ); + demanded_td.get(), nullptr ); (*pUnoI2->release)( pUnoI2 ); } else // object does not support demanded interface { uno_any_construct( static_cast< uno_Any * >( uno_ret ), - 0, 0, 0 ); + nullptr, nullptr, nullptr ); } // no exception occurred - *uno_exc = 0; + *uno_exc = nullptr; } } else { uno_any_construct( static_cast< uno_Any * >( uno_ret ), - &pInterface, demanded_td.get(), 0 ); + &pInterface, demanded_td.get(), nullptr ); (*pInterface->release)( pInterface ); - *uno_exc = 0; + *uno_exc = nullptr; } break; } case 1: // acquire this proxy that->acquire(); - *uno_exc = 0; + *uno_exc = nullptr; break; case 2: // release this proxy that->release(); - *uno_exc = 0; + *uno_exc = nullptr; break; default: // arbitrary method call bridge->call_java( @@ -795,7 +795,7 @@ void SAL_CALL UNO_proxy_dispatch( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() ); ::com::sun::star::uno::Type const & exc_type = cppu::UnoType<decltype(exc)>::get(); - uno_type_any_construct( *uno_exc, &exc, exc_type.getTypeLibType(), 0 ); + uno_type_any_construct( *uno_exc, &exc, exc_type.getTypeLibType(), nullptr ); SAL_INFO("bridges", exc.Message); } catch (::jvmaccess::VirtualMachine::AttachGuard::CreationException &) @@ -806,7 +806,7 @@ void SAL_CALL UNO_proxy_dispatch( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() ); ::com::sun::star::uno::Type const & exc_type = cppu::UnoType<decltype(exc)>::get(); - uno_type_any_construct( *uno_exc, &exc, exc_type.getTypeLibType(), 0 ); + uno_type_any_construct( *uno_exc, &exc, exc_type.getTypeLibType(), nullptr ); SAL_WARN("bridges", exc.Message); } } diff --git a/bridges/source/jni_uno/nativethreadpool.cxx b/bridges/source/jni_uno/nativethreadpool.cxx index c5a5aef490ca..ee40e6b53e82 100644 --- a/bridges/source/jni_uno/nativethreadpool.cxx +++ b/bridges/source/jni_uno/nativethreadpool.cxx @@ -55,7 +55,7 @@ struct Job { void throwOutOfMemory(JNIEnv * env) { jclass c = env->FindClass("java/lang/OutOfMemoryError"); - if (c != 0) { + if (c != nullptr) { env->ThrowNew(c, ""); } } @@ -87,7 +87,7 @@ extern "C" SAL_JNI_EXPORT jbyteArray JNICALL Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_threadId( JNIEnv * env, SAL_UNUSED_PARAMETER jclass) SAL_THROW_EXTERN_C() { - sal_Sequence * s = 0; + sal_Sequence * s = nullptr; uno_getIdOfCurrentThread(&s); //TODO: out of memory uno_releaseIdFromCurrentThread(); rtl::ByteSequence seq(s); @@ -95,12 +95,12 @@ Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_threadId( sal_Int32 n = seq.getLength(); jbyteArray a = env->NewByteArray(n); // sal_Int32 and jsize are compatible here - if (a == 0) { - return 0; + if (a == nullptr) { + return nullptr; } - void * p = env->GetPrimitiveArrayCritical(a, 0); - if (p == 0) { - return 0; + void * p = env->GetPrimitiveArrayCritical(a, nullptr); + if (p == nullptr) { + return nullptr; } memcpy(p, seq.getConstArray(), n); // sal_Int8 and jbyte ought to be compatible @@ -115,17 +115,17 @@ Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_create( JavaVM * vm; if (env->GetJavaVM(&vm) != JNI_OK) { //TODO: no Java exception raised? jclass c = env->FindClass("java/lang/RuntimeException"); - if (c != 0) { + if (c != nullptr) { env->ThrowNew(c, "JNI GetJavaVM failed"); } return 0; } jclass c = env->FindClass("com/sun/star/lib/uno/environments/remote/Job"); - if (c == 0) { + if (c == nullptr) { return 0; } jmethodID execute = env->GetMethodID(c, "execute", "()Ljava/lang/Object;"); - if (execute == 0) { + if (execute == nullptr) { return 0; } try { @@ -154,8 +154,8 @@ Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_enter( uno_threadpool_enter( reinterpret_cast< Pool * >(pool)->pool, reinterpret_cast< void ** >(&job)); - if (job == 0) { - return 0; + if (job == nullptr) { + return nullptr; } jobject ref = env->NewLocalRef(job); env->DeleteGlobalRef(job); @@ -175,8 +175,8 @@ Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_putJob( JNIEnv * env, SAL_UNUSED_PARAMETER jclass, jlong pool, jbyteArray threadId, jobject job, jboolean request, jboolean oneWay) SAL_THROW_EXTERN_C() { - void * s = env->GetPrimitiveArrayCritical(threadId, 0); - if (s == 0) { + void * s = env->GetPrimitiveArrayCritical(threadId, nullptr); + if (s == nullptr) { return; } rtl::ByteSequence seq( @@ -187,13 +187,13 @@ Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_putJob( env->ReleasePrimitiveArrayCritical(threadId, s, JNI_ABORT); Pool * p = reinterpret_cast< Pool * >(pool); jobject ref = env->NewGlobalRef(job); - if (ref == 0) { + if (ref == nullptr) { return; } - Job * j = 0; + Job * j = nullptr; if (request) { j = new(std::nothrow) Job(p, ref); - if (j == 0) { + if (j == nullptr) { env->DeleteGlobalRef(ref); throwOutOfMemory(env); return; @@ -202,7 +202,7 @@ Java_com_sun_star_lib_uno_environments_remote_NativeThreadPool_putJob( uno_threadpool_putJob( p->pool, seq.getHandle(), request ? static_cast< void * >(j) : static_cast< void * >(ref), - request ? executeRequest : 0, oneWay); + request ? executeRequest : nullptr, oneWay); } extern "C" SAL_JNI_EXPORT void JNICALL |