From da95f17cb69fe9eb18be44aaac9f71a68445e91c Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 10 Nov 2015 10:24:34 +0100 Subject: loplugin:nullptr (automatic rewrite) Change-Id: I162b47199e959f97c3bed1f307225db944017e4f --- stoc/source/corereflection/base.hxx | 8 +- stoc/source/corereflection/crarray.cxx | 6 +- stoc/source/corereflection/crbase.cxx | 4 +- stoc/source/corereflection/crcomp.cxx | 10 +- stoc/source/corereflection/crefl.cxx | 12 +- stoc/source/corereflection/crenum.cxx | 2 +- stoc/source/corereflection/criface.cxx | 50 +++--- stoc/source/implementationregistration/implreg.cxx | 14 +- stoc/source/inspect/introspection.cxx | 4 +- stoc/source/invocation/invocation.cxx | 14 +- .../source/invocation_adapterfactory/iafactory.cxx | 98 ++++++------ stoc/source/javaloader/javaloader.cxx | 22 +-- stoc/source/javavm/javavm.cxx | 174 ++++++++++----------- stoc/source/namingservice/namingservice.cxx | 4 +- stoc/source/proxy_factory/proxyfac.cxx | 44 +++--- stoc/source/security/access_controller.cxx | 22 +-- stoc/source/security/permissions.cxx | 6 +- stoc/source/typeconv/convert.cxx | 10 +- stoc/source/uriproc/UriReferenceFactory.cxx | 8 +- .../UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx | 2 +- 20 files changed, 257 insertions(+), 257 deletions(-) diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx index 3033479ab252..fc081a69f576 100644 --- a/stoc/source/corereflection/base.hxx +++ b/stoc/source/corereflection/base.hxx @@ -206,7 +206,7 @@ public: const OUString & rName, typelib_TypeClass eTypeClass, typelib_TypeDescription * pTypeDescr ) : IdlClassImpl( pReflection, rName, eTypeClass, pTypeDescr ) - , _pSortedMemberInit( 0 ) + , _pSortedMemberInit( nullptr ) , _nMethods( 0 ) , _nAttributes( 0 ) {} @@ -241,7 +241,7 @@ public: const OUString & rName, typelib_TypeClass eTypeClass, typelib_TypeDescription * pTypeDescr ) : IdlClassImpl( pReflection, rName, eTypeClass, pTypeDescr ) - , _pFields( 0 ) + , _pFields( nullptr ) {} virtual ~CompoundIdlClassImpl(); @@ -304,7 +304,7 @@ public: const OUString & rName, typelib_TypeClass eTypeClass, typelib_TypeDescription * pTypeDescr ) : IdlClassImpl( pReflection, rName, eTypeClass, pTypeDescr ) - , _pFields( 0 ) + , _pFields( nullptr ) {} virtual ~EnumIdlClassImpl(); @@ -354,7 +354,7 @@ inline bool extract( IdlReflectionServiceImpl * pRefl ) { rDest.clear(); - if (0 != pTo) + if (nullptr != pTo) { if (! rObj.hasValue()) return true; diff --git a/stoc/source/corereflection/crarray.cxx b/stoc/source/corereflection/crarray.cxx index 7d70747670f6..1241430aebcc 100644 --- a/stoc/source/corereflection/crarray.cxx +++ b/stoc/source/corereflection/crarray.cxx @@ -54,7 +54,7 @@ void ArrayIdlClassImpl::release() throw() Sequence< Type > ArrayIdlClassImpl::getTypes() throw (css::uno::RuntimeException, std::exception) { - static ::cppu::OTypeCollection * s_pTypes = 0; + static ::cppu::OTypeCollection * s_pTypes = nullptr; if (! s_pTypes) { ::osl::MutexGuard aGuard( getMutexAccess() ); @@ -136,7 +136,7 @@ Any ArrayIdlClassImpl::get( const Any & rArray, sal_Int32 nIndex ) } Any aRet; - typelib_TypeDescription * pElemTypeDescr = 0; + typelib_TypeDescription * pElemTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElemTypeDescr, getTypeDescr()->pType ); uno_any_destruct( &aRet, reinterpret_cast< uno_ReleaseFunc >(cpp_release) ); uno_any_construct( &aRet, &pSeq->elements[nIndex * pElemTypeDescr->nSize], @@ -174,7 +174,7 @@ void ArrayIdlClassImpl::set( Any & rArray, sal_Int32 nIndex, const Any & rNewVal rArray.pData = ppSeq; pSeq = *ppSeq; - typelib_TypeDescription * pElemTypeDescr = 0; + typelib_TypeDescription * pElemTypeDescr = nullptr; TYPELIB_DANGER_GET( &pElemTypeDescr, getTypeDescr()->pType ); if (! coerce_assign( &pSeq->elements[nIndex * pElemTypeDescr->nSize], diff --git a/stoc/source/corereflection/crbase.cxx b/stoc/source/corereflection/crbase.cxx index 903f94501679..f74620bdbc5c 100644 --- a/stoc/source/corereflection/crbase.cxx +++ b/stoc/source/corereflection/crbase.cxx @@ -35,7 +35,7 @@ ClassNameList g_aClassNames; ::osl::Mutex & getMutexAccess() { - static ::osl::Mutex * s_pMutex = 0; + static ::osl::Mutex * s_pMutex = nullptr; if (! s_pMutex) { ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); @@ -149,7 +149,7 @@ void IdlClassImpl::createObject( Any & rObj ) { rObj.clear(); uno_any_destruct( &rObj, reinterpret_cast< uno_ReleaseFunc >(cpp_release) ); - uno_any_construct( &rObj, 0, getTypeDescr(), 0 ); + uno_any_construct( &rObj, nullptr, getTypeDescr(), nullptr ); } // what TODO ???? diff --git a/stoc/source/corereflection/crcomp.cxx b/stoc/source/corereflection/crcomp.cxx index e23c41f3d39f..6bf3f72092ca 100644 --- a/stoc/source/corereflection/crcomp.cxx +++ b/stoc/source/corereflection/crcomp.cxx @@ -96,7 +96,7 @@ void IdlCompFieldImpl::release() throw() Sequence< Type > IdlCompFieldImpl::getTypes() throw (css::uno::RuntimeException, std::exception) { - static ::cppu::OTypeCollection * s_pTypes = 0; + static ::cppu::OTypeCollection * s_pTypes = nullptr; if (! s_pTypes) { ::osl::MutexGuard aGuard( getMutexAccess() ); @@ -174,7 +174,7 @@ Any IdlCompFieldImpl::get( const Any & rObj ) if (rObj.getValueTypeClass() == css::uno::TypeClass_STRUCT || rObj.getValueTypeClass() == css::uno::TypeClass_EXCEPTION) { - typelib_TypeDescription * pObjTD = 0; + typelib_TypeDescription * pObjTD = nullptr; TYPELIB_DANGER_GET( &pObjTD, rObj.getValueTypeRef() ); typelib_TypeDescription * pTD = pObjTD; @@ -207,7 +207,7 @@ void IdlCompFieldImpl::set( const Any & rObj, const Any & rValue ) if (rObj.getValueTypeClass() == css::uno::TypeClass_STRUCT || rObj.getValueTypeClass() == css::uno::TypeClass_EXCEPTION) { - typelib_TypeDescription * pObjTD = 0; + typelib_TypeDescription * pObjTD = nullptr; TYPELIB_DANGER_GET( &pObjTD, rObj.getValueTypeRef() ); typelib_TypeDescription * pTD = pObjTD; @@ -244,7 +244,7 @@ void IdlCompFieldImpl::set( Any & rObj, const Any & rValue ) if (rObj.getValueTypeClass() == css::uno::TypeClass_STRUCT || rObj.getValueTypeClass() == css::uno::TypeClass_EXCEPTION) { - typelib_TypeDescription * pObjTD = 0; + typelib_TypeDescription * pObjTD = nullptr; TYPELIB_DANGER_GET( &pObjTD, rObj.getValueTypeRef() ); typelib_TypeDescription * pTD = pObjTD; @@ -366,7 +366,7 @@ Sequence< Reference< XIdlField > > CompoundIdlClassImpl::getFields() for ( sal_Int32 nPos = pCompTypeDescr->nMembers; nPos--; ) { - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; TYPELIB_DANGER_GET( &pTD, ppTypeRefs[nPos] ); OSL_ENSURE( pTD, "### cannot get field in struct!" ); if (pTD) diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx index b97d03e38a43..fc077043f219 100644 --- a/stoc/source/corereflection/crefl.cxx +++ b/stoc/source/corereflection/crefl.cxx @@ -100,7 +100,7 @@ void IdlReflectionServiceImpl::release() throw() Sequence< Type > IdlReflectionServiceImpl::getTypes() throw (css::uno::RuntimeException, std::exception) { - static OTypeCollection * s_pTypes = 0; + static OTypeCollection * s_pTypes = nullptr; if (! s_pTypes) { MutexGuard aGuard( _aComponentMutex ); @@ -236,7 +236,7 @@ Reference< XIdlClass > IdlReflectionServiceImpl::forName( const OUString & rType else { // try to get _type_ by name - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; typelib_typedescription_getByName( &pTD, rTypeName.pData ); if (pTD) { @@ -279,7 +279,7 @@ Any IdlReflectionServiceImpl::getByHierarchicalName( const OUString & rName ) // so the second retrieving via c typelib callback chain should succeed... // try to get _type_ by name - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; typelib_typedescription_getByName( &pTD, rName.pData ); aRet.clear(); // kick XTypeDescription interface @@ -343,7 +343,7 @@ Reference< XIdlClass > IdlReflectionServiceImpl::forType( typelib_TypeDescriptio Reference< XIdlClass > IdlReflectionServiceImpl::forType( typelib_TypeDescriptionReference * pRef ) throw(css::uno::RuntimeException) { - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; TYPELIB_DANGER_GET( &pTD, pRef ); if (pTD) { @@ -434,9 +434,9 @@ static const struct ImplementationEntry g_entries[] = { IdlReflectionServiceImpl_create, core_getImplementationName, core_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 + nullptr, 0 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL reflection_component_getFactory( diff --git a/stoc/source/corereflection/crenum.cxx b/stoc/source/corereflection/crenum.cxx index b8802908a888..5003574629e4 100644 --- a/stoc/source/corereflection/crenum.cxx +++ b/stoc/source/corereflection/crenum.cxx @@ -95,7 +95,7 @@ void IdlEnumFieldImpl::release() throw() Sequence< Type > IdlEnumFieldImpl::getTypes() throw (css::uno::RuntimeException, std::exception) { - static ::cppu::OTypeCollection * s_pTypes = 0; + static ::cppu::OTypeCollection * s_pTypes = nullptr; if (! s_pTypes) { ::osl::MutexGuard aGuard( getMutexAccess() ); diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx index f84c60f5bc4b..de8e73c959c1 100644 --- a/stoc/source/corereflection/criface.cxx +++ b/stoc/source/corereflection/criface.cxx @@ -108,7 +108,7 @@ void IdlAttributeFieldImpl::release() throw() Sequence< Type > IdlAttributeFieldImpl::getTypes() throw (css::uno::RuntimeException, std::exception) { - static ::cppu::OTypeCollection * s_pTypes = 0; + static ::cppu::OTypeCollection * s_pTypes = nullptr; if (! s_pTypes) { ::osl::MutexGuard aGuard( getMutexAccess() ); @@ -186,7 +186,7 @@ Any IdlAttributeFieldImpl::get( const Any & rObj ) uno_Any * pExc = &aExc; void * pReturn = alloca( pTD->nSize ); - (*pUnoI->pDispatcher)( pUnoI, getTypeDescr(), pReturn, 0, &pExc ); + (*pUnoI->pDispatcher)( pUnoI, getTypeDescr(), pReturn, nullptr, &pExc ); (*pUnoI->release)( pUnoI ); checkException( @@ -196,7 +196,7 @@ Any IdlAttributeFieldImpl::get( const Any & rObj ) uno_any_destruct( &aRet, reinterpret_cast< uno_ReleaseFunc >(cpp_release) ); uno_any_constructAndConvert( &aRet, pReturn, pTD, getReflection()->getUno2Cpp().get() ); - uno_destructData( pReturn, pTD, 0 ); + uno_destructData( pReturn, pTD, nullptr ); return aRet; } throw IllegalArgumentException( @@ -253,7 +253,7 @@ void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue ) } else { - typelib_TypeDescription * pValueTD = 0; + typelib_TypeDescription * pValueTD = nullptr; TYPELIB_DANGER_GET( &pValueTD, rValue.getValueTypeRef() ); // construct temp uno val to do proper assignment: todo opt void * pTemp = alloca( pValueTD->nSize ); @@ -263,9 +263,9 @@ void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue ) pArg, pTD ); // assignment does simple conversion bAssign = uno_assignData( - pArg, pTD, pTemp, pValueTD, 0, 0, 0 ); + pArg, pTD, pTemp, pValueTD, nullptr, nullptr, nullptr ); uno_destructData( - pTemp, pValueTD, 0 ); + pTemp, pValueTD, nullptr ); TYPELIB_DANGER_RELEASE( pValueTD ); } @@ -273,10 +273,10 @@ void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue ) { uno_Any aExc; uno_Any * pExc = &aExc; - (*pUnoI->pDispatcher)( pUnoI, getTypeDescr(), 0, pArgs, &pExc ); + (*pUnoI->pDispatcher)( pUnoI, getTypeDescr(), nullptr, pArgs, &pExc ); (*pUnoI->release)( pUnoI ); - uno_destructData( pArg, pTD, 0 ); + uno_destructData( pArg, pTD, nullptr ); checkException( pExc, *static_cast< Reference< XInterface > const * >( @@ -303,13 +303,13 @@ void IdlAttributeFieldImpl::set( const Any & rObj, const Any & rValue ) void IdlAttributeFieldImpl::checkException( uno_Any * exception, Reference< XInterface > const & context) { - if (exception != 0) { + if (exception != nullptr) { Any e; uno_any_destruct(&e, reinterpret_cast< uno_ReleaseFunc >(cpp_release)); uno_type_any_constructAndConvert( &e, exception->pData, exception->pType, getReflection()->getUno2Cpp().get()); - uno_any_destruct(exception, 0); + uno_any_destruct(exception, nullptr); if (e.isExtractableTo( cppu::UnoType::get())) { @@ -344,9 +344,9 @@ public: IdlInterfaceMethodImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName, typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr ) : IdlMemberImpl( pReflection, rName, pTypeDescr, pDeclTypeDescr ) - , _pExceptionTypes( 0 ) - , _pParamTypes( 0 ) - , _pParamInfos( 0 ) + , _pExceptionTypes( nullptr ) + , _pParamTypes( nullptr ) + , _pParamInfos( nullptr ) {} virtual ~IdlInterfaceMethodImpl(); @@ -402,7 +402,7 @@ void IdlInterfaceMethodImpl::release() throw() Sequence< Type > IdlInterfaceMethodImpl::getTypes() throw (css::uno::RuntimeException, std::exception) { - static ::cppu::OTypeCollection * s_pTypes = 0; + static ::cppu::OTypeCollection * s_pTypes = nullptr; if (! s_pTypes) { ::osl::MutexGuard aGuard( getMutexAccess() ); @@ -613,7 +613,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & Any * pCppArgs = rArgs.getArray(); typelib_MethodParameter * pParams = getMethodTypeDescr()->pParams; - typelib_TypeDescription * pReturnType = 0; + typelib_TypeDescription * pReturnType = nullptr; TYPELIB_DANGER_GET( &pReturnType, getMethodTypeDescr()->pReturnTypeRef ); @@ -624,7 +624,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & // convert arguments for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) { - ppParamTypes[nPos] = 0; + ppParamTypes[nPos] = nullptr; TYPELIB_DANGER_GET( ppParamTypes + nPos, pParams[nPos].pTypeRef ); typelib_TypeDescription * pTD = ppParamTypes[nPos]; @@ -661,7 +661,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & } else { - typelib_TypeDescription * pValueTD = 0; + typelib_TypeDescription * pValueTD = nullptr; TYPELIB_DANGER_GET( &pValueTD, pCppArgs[nPos].getValueTypeRef() ); // construct temp uno val to do proper assignment: todo opt void * pTemp = alloca( pValueTD->nSize ); @@ -672,9 +672,9 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & ppUnoArgs[nPos], pTD ); // assignment does simple conversion bAssign = uno_assignData( - ppUnoArgs[nPos], pTD, pTemp, pValueTD, 0, 0, 0 ); + ppUnoArgs[nPos], pTD, pTemp, pValueTD, nullptr, nullptr, nullptr ); uno_destructData( - pTemp, pValueTD, 0 ); + pTemp, pValueTD, nullptr ); TYPELIB_DANGER_RELEASE( pValueTD ); } @@ -688,7 +688,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & while (nPos--) { if (pParams[nPos].bIn) - uno_destructData( ppUnoArgs[nPos], ppParamTypes[nPos], 0 ); + uno_destructData( ppUnoArgs[nPos], ppParamTypes[nPos], nullptr ); TYPELIB_DANGER_RELEASE( ppParamTypes[nPos] ); } TYPELIB_DANGER_RELEASE( pReturnType ); @@ -713,7 +713,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & while (nParams--) { if (pParams[nParams].bIn) - uno_destructData( ppUnoArgs[nParams], ppParamTypes[nParams], 0 ); + uno_destructData( ppUnoArgs[nParams], ppParamTypes[nParams], nullptr ); TYPELIB_DANGER_RELEASE( ppParamTypes[nParams] ); } TYPELIB_DANGER_RELEASE( pReturnType ); @@ -727,7 +727,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & uno_type_copyAndConvertData( &aExc.TargetException, pUnoExc, cppu::UnoType::get().getTypeLibType(), getReflection()->getUno2Cpp().get() ); - uno_any_destruct( pUnoExc, 0 ); + uno_any_destruct( pUnoExc, nullptr ); throw aExc; } else @@ -744,7 +744,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & &pCppArgs[nParams], ppUnoArgs[nParams], ppParamTypes[nParams], getReflection()->getUno2Cpp().get() ); } - uno_destructData( ppUnoArgs[nParams], ppParamTypes[nParams], 0 ); + uno_destructData( ppUnoArgs[nParams], ppParamTypes[nParams], nullptr ); TYPELIB_DANGER_RELEASE( ppParamTypes[nParams] ); } uno_any_destruct( @@ -752,7 +752,7 @@ Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & uno_any_constructAndConvert( &aRet, pUnoReturn, pReturnType, getReflection()->getUno2Cpp().get() ); - uno_destructData( pUnoReturn, pReturnType, 0 ); + uno_destructData( pUnoReturn, pReturnType, nullptr ); TYPELIB_DANGER_RELEASE( pReturnType ); } return aRet; @@ -816,7 +816,7 @@ void InterfaceIdlClassImpl::initMembers() // attributes at the back } - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; typelib_typedescriptionreference_getDescription( &pTD, ppAllMembers[nPos] ); assert(pTD && "### cannot get type description!"); pSortedMemberInit[nIndex].first = reinterpret_cast(pTD)->pMemberName; diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index dc1a17a0da70..08bf4a8fafcb 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -95,7 +95,7 @@ struct StringPool: private boost::noncopyable const StringPool &spool() { - static StringPool *pPool = 0; + static StringPool *pPool = nullptr; if( ! pPool ) { MutexGuard guard( Mutex::getGlobalMutex() ); @@ -129,8 +129,8 @@ static void deleteAllLinkReferences(const Reference < XSimpleRegistry >& xReg, OUString aLinkName; OUString aLinkParent; Reference < XRegistryKey > xLinkParent; - const sal_Unicode* pTmpName = NULL; - const sal_Unicode* pShortName = NULL; + const sal_Unicode* pTmpName = nullptr; + const sal_Unicode* pShortName = nullptr; sal_Int32 sEnd = 0; for (sal_Int32 i = 0; i < linkNames.getLength(); i++) @@ -144,7 +144,7 @@ static void deleteAllLinkReferences(const Reference < XSimpleRegistry >& xReg, sal_Int32 nIndex = rtl_ustr_indexOfChar( pTmpName, '%' ); if ( nIndex == -1 ) - pShortName = 0; + pShortName = nullptr; else pShortName = pTmpName+nIndex; @@ -152,7 +152,7 @@ static void deleteAllLinkReferences(const Reference < XSimpleRegistry >& xReg, { nIndex = rtl_ustr_indexOfChar( pShortName+2, '%' ); if ( nIndex == -1 ) - pShortName = 0; + pShortName = nullptr; else pShortName += nIndex+2; } @@ -207,7 +207,7 @@ static void prepareLink( const Reference < XSimpleRegistry > & xDest, const sal_Unicode* pShortName; sal_Int32 nIndex = rtl_ustr_indexOfChar( pTmpName, '%' ); if ( nIndex == -1 ) - pShortName = 0; + pShortName = nullptr; else pShortName = pTmpName+nIndex; @@ -218,7 +218,7 @@ static void prepareLink( const Reference < XSimpleRegistry > & xDest, { nIndex = rtl_ustr_indexOfChar( pShortName+2, '%' ); if ( nIndex == -1 ) - pShortName = 0; + pShortName = nullptr; else pShortName += nIndex+2; } diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index aedda924a1f9..e5eae6ca9983 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -286,7 +286,7 @@ IntrospectionAccessStatic_Impl::IntrospectionAccessStatic_Impl( Reference< XIdlR mbIdlArray = false; mbUnoTunnel = false; - mpOrgPropertyHandleArray = NULL; + mpOrgPropertyHandleArray = nullptr; mnPropCount = 0; //mnDangerousPropCount = 0; @@ -2535,7 +2535,7 @@ css::uno::Reference Implementation::inspect( } else { - xImplClass2 = NULL; + xImplClass2 = nullptr; } } } diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx index 494fa4037b92..74d3f1decad9 100644 --- a/stoc/source/invocation/invocation.cxx +++ b/stoc/source/invocation/invocation.cxx @@ -823,14 +823,14 @@ void Invocation_Impl::getInfoSequenceImpl } // Setting up result sequences - OUString* pRetStrings = NULL; + OUString* pRetStrings = nullptr; if( pStringSeq ) { pStringSeq->realloc( nTotalCount ); pRetStrings = pStringSeq->getArray(); } - InvocationInfo* pRetInfos = NULL; + InvocationInfo* pRetInfos = nullptr; if( pInfoSeq ) { pInfoSeq->realloc( nTotalCount ); @@ -873,7 +873,7 @@ Sequence< OUString > SAL_CALL Invocation_Impl::getMemberNames( ) return _xDirect2->getMemberNames(); } Sequence< OUString > aRetSeq; - getInfoSequenceImpl( &aRetSeq, NULL ); + getInfoSequenceImpl( &aRetSeq, nullptr ); return aRetSeq; } @@ -885,7 +885,7 @@ Sequence< InvocationInfo > SAL_CALL Invocation_Impl::getInfo( ) return _xDirect2->getInfo(); } Sequence< InvocationInfo > aRetSeq; - getInfoSequenceImpl( NULL, &aRetSeq ); + getInfoSequenceImpl( nullptr, &aRetSeq ); return aRetSeq; } @@ -1004,7 +1004,7 @@ void Invocation_Impl::fillInfoForMethod // XTypeProvider Sequence< Type > SAL_CALL Invocation_Impl::getTypes() throw( RuntimeException, std::exception ) { - static Sequence< Type > const * s_pTypes = 0; + static Sequence< Type > const * s_pTypes = nullptr; if (! s_pTypes) { Sequence< Type > types( 4 +8 ); @@ -1180,9 +1180,9 @@ static const struct ImplementationEntry g_entries[] = { InvocationService_CreateInstance, inv_getImplementationName, inv_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 + nullptr, 0 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL invocation_component_getFactory( diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx index 2702b6aa24af..8e39086c7874 100644 --- a/stoc/source/invocation_adapterfactory/iafactory.cxx +++ b/stoc/source/invocation_adapterfactory/iafactory.cxx @@ -220,7 +220,7 @@ static inline void constructRuntimeException( RuntimeException exc( rMsg ); // no conversion needed due to binary compatibility + no convertible type ::uno_type_any_construct( - pExc, &exc, cppu::UnoType::get().getTypeLibType(), 0 ); + pExc, &exc, cppu::UnoType::get().getTypeLibType(), nullptr ); } @@ -242,11 +242,11 @@ bool AdapterImpl::coerce_assign( if (typelib_TypeClass_ANY == pType->eTypeClass) { ::uno_type_any_assign( - static_cast(pDest), pSource->pData, pSource->pType, 0, 0 ); + static_cast(pDest), pSource->pData, pSource->pType, nullptr, nullptr ); return true; } if (::uno_type_assignData( - pDest, pType, pSource->pData, pSource->pType, 0, 0, 0 )) + pDest, pType, pSource->pData, pSource->pType, nullptr, nullptr, nullptr )) { return true; } @@ -273,7 +273,7 @@ bool AdapterImpl::coerce_assign( { // is RuntimeException or derived: rethrow uno_type_any_construct( - pOutExc, p_exc->pData, p_exc->pType, 0 ); + pOutExc, p_exc->pData, p_exc->pType, nullptr ); } else { @@ -283,15 +283,15 @@ bool AdapterImpl::coerce_assign( static_cast< Exception const * >( p_exc->pData )->Message ); } - ::uno_any_destruct( p_exc, 0 ); + ::uno_any_destruct( p_exc, nullptr ); // pOutExc constructed return false; } else { bool succ = ::uno_type_assignData( - pDest, pType, ret.pData, ret.pType, 0, 0, 0 ); - ::uno_any_destruct( &ret, 0 ); + pDest, pType, ret.pData, ret.pType, nullptr, nullptr, nullptr ); + ::uno_any_destruct( &ret, nullptr ); OSL_ENSURE( succ, "### conversion succeeded, but assignment failed!?" ); if (! succ) @@ -313,12 +313,12 @@ inline bool AdapterImpl::coerce_construct( { if (typelib_TypeClass_ANY == pType->eTypeClass) { - ::uno_type_copyData( pDest, pSource, pType, 0 ); + ::uno_type_copyData( pDest, pSource, pType, nullptr ); return true; } if (type_equals( pType, pSource->pType)) { - ::uno_type_copyData( pDest, pSource->pData, pType, 0 ); + ::uno_type_copyData( pDest, pSource->pData, pType, nullptr ); return true; } ::uno_type_constructData( pDest, pType ); @@ -338,7 +338,7 @@ static void handleInvokExc( uno_Any * pDest, uno_Any * pSource ) &static_cast< reflection::InvocationTargetException * >( pSource->pData )->TargetException; ::uno_type_any_construct( - pDest, target_exc->pData, target_exc->pType, 0 ); + pDest, target_exc->pData, target_exc->pType, nullptr ); } else // all other exceptions are wrapped to RuntimeException { @@ -374,7 +374,7 @@ void AdapterImpl::getValue( if (pInvokExc) // getValue() call exception { handleInvokExc( *ppException, pInvokExc ); - ::uno_any_destruct( pInvokExc, 0 ); // cleanup + ::uno_any_destruct( pInvokExc, nullptr ); // cleanup } else // invocation call succeeded { @@ -384,9 +384,9 @@ void AdapterImpl::getValue( pMemberType)->pAttributeTypeRef, &aInvokRet, *ppException )) { - *ppException = 0; // no exceptions be thrown + *ppException = nullptr; // no exceptions be thrown } - ::uno_any_destruct( &aInvokRet, 0 ); + ::uno_any_destruct( &aInvokRet, nullptr ); } } @@ -398,7 +398,7 @@ void AdapterImpl::setValue( ::uno_type_any_construct( &aInvokVal, pArgs[0], reinterpret_cast( - pMemberType)->pAttributeTypeRef, 0 ); + pMemberType)->pAttributeTypeRef, nullptr ); void * pInvokArgs[2]; pInvokArgs[0] = const_cast( @@ -409,19 +409,19 @@ void AdapterImpl::setValue( // setValue() (*m_pReceiver->pDispatcher)( - m_pReceiver, m_pFactory->m_pSetValueTD, 0, pInvokArgs, &pInvokExc ); + m_pReceiver, m_pFactory->m_pSetValueTD, nullptr, pInvokArgs, &pInvokExc ); if (pInvokExc) // setValue() call exception { handleInvokExc( *ppException, pInvokExc ); - ::uno_any_destruct( pInvokExc, 0 ); // cleanup + ::uno_any_destruct( pInvokExc, nullptr ); // cleanup } else // invocation call succeeded { - *ppException = 0; // no exceptions be thrown + *ppException = nullptr; // no exceptions be thrown } - ::uno_any_destruct( &aInvokVal, 0 ); // cleanup + ::uno_any_destruct( &aInvokVal, nullptr ); // cleanup } void AdapterImpl::invoke( @@ -434,9 +434,9 @@ void AdapterImpl::invoke( reinterpret_cast(pMemberType)->pParams; // in params - uno_Sequence * pInParamsSeq = 0; + uno_Sequence * pInParamsSeq = nullptr; ::uno_sequence_construct( - &pInParamsSeq, m_pFactory->m_pAnySeqTD, 0, nParams, 0 ); + &pInParamsSeq, m_pFactory->m_pAnySeqTD, nullptr, nParams, nullptr ); uno_Any * pInAnys = reinterpret_cast(pInParamsSeq->elements); sal_Int32 nOutParams = 0; sal_Int32 nPos; @@ -446,7 +446,7 @@ void AdapterImpl::invoke( if (rParam.bIn) // is in/inout param { ::uno_type_any_assign( - &pInAnys[nPos], pArgs[nPos], rParam.pTypeRef, 0, 0 ); + &pInAnys[nPos], pArgs[nPos], rParam.pTypeRef, nullptr, nullptr ); } // else: pure out is empty any @@ -477,7 +477,7 @@ void AdapterImpl::invoke( if (pInvokExc) { handleInvokExc( *ppException, pInvokExc ); - ::uno_any_destruct( pInvokExc, 0 ); // cleanup + ::uno_any_destruct( pInvokExc, nullptr ); // cleanup } else // no invocation exception { @@ -520,7 +520,7 @@ void AdapterImpl::invoke( if (! rParam2.bIn) // is pure out param { ::uno_type_destructData( - pArgs[nIndex2], rParam2.pTypeRef, 0 ); + pArgs[nIndex2], rParam2.pTypeRef, nullptr ); } } } @@ -534,7 +534,7 @@ void AdapterImpl::invoke( pMemberType)->pReturnTypeRef, &aInvokRet, *ppException )) { - *ppException = 0; // no exception + *ppException = nullptr; // no exception } } } @@ -546,13 +546,13 @@ void AdapterImpl::invoke( "out params lengths differ after invocation call!" ); } // cleanup invok out params - ::uno_destructData( &pOutIndices, m_pFactory->m_pShortSeqTD, 0 ); - ::uno_destructData( &pOutParams, m_pFactory->m_pAnySeqTD, 0 ); + ::uno_destructData( &pOutIndices, m_pFactory->m_pShortSeqTD, nullptr ); + ::uno_destructData( &pOutParams, m_pFactory->m_pAnySeqTD, nullptr ); // cleanup invok return value - ::uno_any_destruct( &aInvokRet, 0 ); + ::uno_any_destruct( &aInvokRet, nullptr ); } // cleanup constructed in params - ::uno_destructData( &pInParamsSeq, m_pFactory->m_pAnySeqTD, 0 ); + ::uno_destructData( &pInParamsSeq, m_pFactory->m_pAnySeqTD, nullptr ); } extern "C" @@ -579,7 +579,7 @@ static void SAL_CALL adapter_dispatch( { AdapterImpl * that = static_cast< InterfaceAdapterImpl * >( pUnoI )->m_pAdapter; - *ppException = 0; // no exc + *ppException = nullptr; // no exc typelib_TypeDescriptionReference * pDemanded = *static_cast(pArgs[0]); // pInterfaces[0] is XInterface @@ -594,21 +594,21 @@ static void SAL_CALL adapter_dispatch( uno_Interface * pUnoI2 = &that->m_pInterfaces[nPos]; ::uno_any_construct( static_cast(pReturn), &pUnoI2, - &pTD->aBase, 0 ); + &pTD->aBase, nullptr ); return; } pTD = pTD->pBaseTypeDescription; } } - ::uno_any_construct( static_cast(pReturn), 0, 0, 0 ); // clear() + ::uno_any_construct( static_cast(pReturn), nullptr, nullptr, nullptr ); // clear() break; } case 1: // acquire() - *ppException = 0; // no exc + *ppException = nullptr; // no exc adapter_acquire( pUnoI ); break; case 2: // release() - *ppException = 0; // no exc + *ppException = nullptr; // no exc adapter_release( pUnoI ); break; @@ -651,7 +651,7 @@ AdapterImpl::AdapterImpl( pInterface->release = adapter_release; pInterface->pDispatcher = adapter_dispatch; pInterface->m_pAdapter = this; - pInterface->m_pTypeDescr = 0; + pInterface->m_pTypeDescr = nullptr; pTypes[nPos].getDescription( reinterpret_cast(&pInterface->m_pTypeDescr) ); OSL_ASSERT( pInterface->m_pTypeDescr ); @@ -671,7 +671,7 @@ AdapterImpl::AdapterImpl( // map receiver m_pReceiver = static_cast(m_pFactory->m_aCpp2Uno.mapInterface( xReceiver.get(), cppu::UnoType::get() )); - OSL_ASSERT( 0 != m_pReceiver ); + OSL_ASSERT( nullptr != m_pReceiver ); if (! m_pReceiver) { throw RuntimeException( "cannot map receiver!" ); @@ -682,12 +682,12 @@ AdapterImpl::AdapterImpl( FactoryImpl::FactoryImpl( Reference< XComponentContext > const & xContext ) - : m_pInvokMethodTD( 0 ), - m_pSetValueTD( 0 ), - m_pGetValueTD( 0 ), - m_pAnySeqTD( 0 ), - m_pShortSeqTD( 0 ), - m_pConvertToTD( 0 ) + : m_pInvokMethodTD( nullptr ), + m_pSetValueTD( nullptr ), + m_pGetValueTD( nullptr ), + m_pAnySeqTD( nullptr ), + m_pShortSeqTD( nullptr ), + m_pConvertToTD( nullptr ) { // C++/UNO bridge OUString aCppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; @@ -705,7 +705,7 @@ FactoryImpl::FactoryImpl( Reference< XComponentContext > const & xContext ) UNO_QUERY_THROW ); m_pConverter = static_cast(m_aCpp2Uno.mapInterface( xConverter.get(), cppu::UnoType::get() )); - OSL_ASSERT( 0 != m_pConverter ); + OSL_ASSERT( nullptr != m_pConverter ); // some type info: // sequence< any > @@ -716,7 +716,7 @@ FactoryImpl::FactoryImpl( Reference< XComponentContext > const & xContext ) cppu::UnoType>::get(); rShortSeqType.getDescription( &m_pShortSeqTD ); // script.XInvocation - typelib_TypeDescription * pTD = 0; + typelib_TypeDescription * pTD = nullptr; const Type & rInvType = cppu::UnoType::get(); TYPELIB_DANGER_GET( &pTD, rInvType.getTypeLibType() ); typelib_InterfaceTypeDescription * pITD; @@ -770,7 +770,7 @@ static inline AdapterImpl * lookup_adapter( t_ptr_set & adapters_set = map[ key ]; *pp_adapter_set = &adapters_set; if (adapters_set.empty()) - return 0; // shortcut + return nullptr; // shortcut // find matching adapter Type const * pTypes = rTypes.getConstArray(); sal_Int32 nTypes = rTypes.getLength(); @@ -803,7 +803,7 @@ static inline AdapterImpl * lookup_adapter( return that; ++iPos; } - return 0; + return nullptr; } // XInvocationAdapterFactory2 impl @@ -823,7 +823,7 @@ Reference< XInterface > FactoryImpl::createAdapter( ClearableMutexGuard guard( m_mutex ); that = lookup_adapter( &adapter_set, m_receiver2adapters, xKey.get(), rTypes ); - if (0 == that) // no entry + if (nullptr == that) // no entry { guard.clear(); // create adapter; already acquired: m_nRef == 1 @@ -833,7 +833,7 @@ Reference< XInterface > FactoryImpl::createAdapter( ClearableMutexGuard guard2( m_mutex ); that = lookup_adapter( &adapter_set, m_receiver2adapters, xKey.get(), rTypes ); - if (0 == that) // again no entry + if (nullptr == that) // again no entry { pair< t_ptr_set::iterator, bool > i(adapter_set->insert(pNew)); SAL_WARN_IF( @@ -917,9 +917,9 @@ static const struct ::cppu::ImplementationEntry g_entries[] = ::stoc_invadp::invadp_getImplementationName, ::stoc_invadp::invadp_getSupportedServiceNames, ::cppu::createOneInstanceComponentFactory, - 0, 0 + nullptr, 0 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL invocadapt_component_getFactory( diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx index a602619607fa..7017956520c4 100644 --- a/stoc/source/javaloader/javaloader.cxx +++ b/stoc/source/javaloader/javaloader.cxx @@ -130,9 +130,9 @@ const css::uno::Reference & JavaComponentLoader::getJavaL if (m_javaLoader.is()) return m_javaLoader; - uno_Environment * pJava_environment = NULL; - uno_Environment * pUno_environment = NULL; - typelib_InterfaceTypeDescription * pType_XImplementationLoader = 0; + uno_Environment * pJava_environment = nullptr; + uno_Environment * pUno_environment = nullptr; + typelib_InterfaceTypeDescription * pType_XImplementationLoader = nullptr; try { // get a java vm, where we can create a loader @@ -158,7 +158,7 @@ const css::uno::Reference & JavaComponentLoader::getJavaL static_assert(sizeof (sal_Int64) >= sizeof (jvmaccess::UnoVirtualMachine *), "must be at least the same size"); sal_Int64 nPointer = reinterpret_cast< sal_Int64 >( - static_cast< jvmaccess::UnoVirtualMachine * >(0)); + static_cast< jvmaccess::UnoVirtualMachine * >(nullptr)); javaVM_xJavaVM->getJavaVM(processID) >>= nPointer; rtl::Reference< jvmaccess::UnoVirtualMachine > xVirtualMachine( reinterpret_cast< jvmaccess::UnoVirtualMachine * >(nPointer)); @@ -223,7 +223,7 @@ const css::uno::Reference & JavaComponentLoader::getJavaL // why is there no convenient constructor? OUString sCppu_current_lb_name(CPPU_CURRENT_LANGUAGE_BINDING_NAME); - uno_getEnvironment(&pUno_environment, sCppu_current_lb_name.pData, NULL); + uno_getEnvironment(&pUno_environment, sCppu_current_lb_name.pData, nullptr); if(!pUno_environment) throw RuntimeException( "javaloader error - no C++ environment available"); @@ -235,11 +235,11 @@ const css::uno::Reference & JavaComponentLoader::getJavaL // release java environment pJava_environment->release(pJava_environment); - pJava_environment = NULL; + pJava_environment = nullptr; // release uno environment pUno_environment->release(pUno_environment); - pUno_environment = NULL; + pUno_environment = nullptr; cppu::UnoType::get(). getDescription(reinterpret_cast(&pType_XImplementationLoader)); @@ -254,7 +254,7 @@ const css::uno::Reference & JavaComponentLoader::getJavaL "javaloader error - mapping of java XImplementationLoader to c++ failed"); typelib_typedescription_release(reinterpret_cast(pType_XImplementationLoader)); - pType_XImplementationLoader = NULL; + pType_XImplementationLoader = nullptr; } catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) { @@ -349,7 +349,7 @@ css::uno::Reference SAL_CALL JavaComponentLoader::activate( static Mutex & getInitMutex() { - static Mutex * pMutex = 0; + static Mutex * pMutex = nullptr; if( ! pMutex ) { MutexGuard guard( Mutex::getGlobalMutex() ); @@ -401,9 +401,9 @@ static const struct ImplementationEntry g_entries[] = { JavaComponentLoader_CreateInstance, loader_getImplementationName, loader_getSupportedServiceNames, createSingleComponentFactory, - 0 , 0 + nullptr , 0 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; extern "C" diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index 50e864ed87c7..1e158fa7749e 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -219,8 +219,8 @@ cppu::ImplementationEntry const aServiceImplementation[] serviceGetImplementationName, serviceGetSupportedServiceNames, cppu::createSingleComponentFactory, - 0, 0 }, - { 0, 0, 0, 0, 0, 0 } }; + nullptr, 0 }, + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; typedef std::stack< jvmaccess::VirtualMachine::AttachGuard * > GuardStack; @@ -229,7 +229,7 @@ extern "C" { static void destroyAttachGuards(void * pData) { GuardStack * pStack = static_cast< GuardStack * >(pData); - if (pStack != 0) + if (pStack != nullptr) { while (!pStack->empty()) { @@ -271,10 +271,10 @@ void getINetPropsFromConfig(stoc_javavm::JVM * pjvm, css::uno::Reference xConfRegistry = xSMgr->createInstanceWithContext( "com.sun.star.configuration.ConfigurationRegistry", xCtx ); - if(!xConfRegistry.is()) throw css::uno::RuntimeException("javavm.cxx: couldn't get ConfigurationRegistry", 0); + if(!xConfRegistry.is()) throw css::uno::RuntimeException("javavm.cxx: couldn't get ConfigurationRegistry", nullptr); css::uno::Reference xConfRegistry_simple(xConfRegistry, css::uno::UNO_QUERY); - if(!xConfRegistry_simple.is()) throw css::uno::RuntimeException("javavm.cxx: couldn't get ConfigurationRegistry", 0); + if(!xConfRegistry_simple.is()) throw css::uno::RuntimeException("javavm.cxx: couldn't get ConfigurationRegistry", nullptr); xConfRegistry_simple->open("org.openoffice.Inet", sal_True, sal_False); css::uno::Reference xRegistryRootKey = xConfRegistry_simple->getRootKey(); @@ -362,13 +362,13 @@ void getDefaultLocaleFromConfig( xSMgr->createInstanceWithContext( "com.sun.star.configuration.ConfigurationRegistry", xCtx ); if(!xConfRegistry.is()) throw css::uno::RuntimeException( - OUString("javavm.cxx: couldn't get ConfigurationRegistry"), 0); + OUString("javavm.cxx: couldn't get ConfigurationRegistry"), nullptr); css::uno::Reference xConfRegistry_simple( xConfRegistry, css::uno::UNO_QUERY); if(!xConfRegistry_simple.is()) throw css::uno::RuntimeException( - OUString("javavm.cxx: couldn't get ConfigurationRegistry"), 0); + OUString("javavm.cxx: couldn't get ConfigurationRegistry"), nullptr); xConfRegistry_simple->open("org.openoffice.Setup", sal_True, sal_False); css::uno::Reference xRegistryRootKey = xConfRegistry_simple->getRootKey(); @@ -417,13 +417,13 @@ void getJavaPropsFromSafetySettings( xCtx); if(!xConfRegistry.is()) throw css::uno::RuntimeException( - OUString("javavm.cxx: couldn't get ConfigurationRegistry"), 0); + OUString("javavm.cxx: couldn't get ConfigurationRegistry"), nullptr); css::uno::Reference xConfRegistry_simple( xConfRegistry, css::uno::UNO_QUERY); if(!xConfRegistry_simple.is()) throw css::uno::RuntimeException( - OUString("javavm.cxx: couldn't get ConfigurationRegistry"), 0); + OUString("javavm.cxx: couldn't get ConfigurationRegistry"), nullptr); xConfRegistry_simple->open( "org.openoffice.Office.Java", @@ -475,7 +475,7 @@ static void setTimeZone(stoc_javavm::JVM * pjvm) throw() { ** This function doesn't detect MEZ, MET or "W. Europe Standard Time" */ struct tm *tmData; - time_t clock = time(NULL); + time_t clock = time(nullptr); tzset(); tmData = localtime(&clock); #ifdef MACOSX @@ -570,7 +570,7 @@ JavaVirtualMachine::JavaVirtualMachine( JavaVirtualMachine_Impl(m_aMutex), m_xContext(rContext), m_bDisposed(false), - m_pJavaVm(0), + m_pJavaVm(nullptr), m_bDontCreateJvm(false), m_aAttachGuards(destroyAttachGuards) // TODO check for validity {} @@ -595,7 +595,7 @@ JavaVirtualMachine::initialize(css::uno::Sequence< css::uno::Any > const & sizeof (sal_Int64) >= sizeof (jvmaccess::UnoVirtualMachine *), "Pointer cannot be represented as sal_Int64"); sal_Int64 nPointer = reinterpret_cast< sal_Int64 >( - static_cast< jvmaccess::UnoVirtualMachine * >(0)); + static_cast< jvmaccess::UnoVirtualMachine * >(nullptr)); val.Value >>= nPointer; m_xUnoVirtualMachine = reinterpret_cast< jvmaccess::UnoVirtualMachine * >(nPointer); @@ -604,14 +604,14 @@ JavaVirtualMachine::initialize(css::uno::Sequence< css::uno::Any > const & sizeof (sal_Int64) >= sizeof (jvmaccess::VirtualMachine *), "Pointer cannot be represented as sal_Int64"); sal_Int64 nPointer = reinterpret_cast< sal_Int64 >( - static_cast< jvmaccess::VirtualMachine * >(0)); + static_cast< jvmaccess::VirtualMachine * >(nullptr)); if (rArguments.getLength() == 1) rArguments[0] >>= nPointer; rtl::Reference< jvmaccess::VirtualMachine > vm( reinterpret_cast< jvmaccess::VirtualMachine * >(nPointer)); if (vm.is()) { try { - m_xUnoVirtualMachine = new jvmaccess::UnoVirtualMachine(vm, 0); + m_xUnoVirtualMachine = new jvmaccess::UnoVirtualMachine(vm, nullptr); } catch (jvmaccess::UnoVirtualMachine::CreationException &) { throw css::uno::RuntimeException( OUString("jvmaccess::UnoVirtualMachine::CreationException"), @@ -655,13 +655,13 @@ JavaVirtualMachine::getSupportedServiceNames() namespace { struct JavaInfoGuard: private boost::noncopyable { - JavaInfoGuard(): info(0) {} + JavaInfoGuard(): info(nullptr) {} ~JavaInfoGuard() { jfw_freeJavaInfo(info); } void clear() { jfw_freeJavaInfo(info); - info = 0; + info = nullptr; } JavaInfo * info; @@ -730,11 +730,11 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId) arPropStrings[index] = sOption; arOptions[index].optionString = const_cast(arPropStrings[index].getStr()); - arOptions[index].extraInfo = 0; + arOptions[index].extraInfo = nullptr; index ++; } - JNIEnv * pMainThreadEnv = 0; + JNIEnv * pMainThreadEnv = nullptr; javaFrameworkError errcode = JFW_E_NONE; if (getenv("STOC_FORCE_NO_JRE")) @@ -776,7 +776,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId) //An unexpected error occurred throw css::uno::RuntimeException( OUString("[JavaVirtualMachine]:An unexpected error occurred" - " while searching for a Java!"), 0); + " while searching for a Java!"), nullptr); } } case JFW_E_INVALID_SETTINGS: @@ -811,7 +811,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId) //we search another one. As long as there is a javaldx, we should //never come into this situation. javaldx checks always if the JRE //still exist. - JavaInfo * pJavaInfo = NULL; + JavaInfo * pJavaInfo = nullptr; if (JFW_E_NONE == jfw_getSelectedJRE(&pJavaInfo)) { sal_Bool bExist = sal_False; @@ -866,7 +866,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId) //An unexpected error occurred throw css::uno::RuntimeException( OUString("[JavaVirtualMachine]:An unexpected error occurred" - " while starting Java!"), 0); + " while starting Java!"), nullptr); } if (bStarted) @@ -899,7 +899,7 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId) } switch (returnType) { default: // RETURN_JAVAVM - if (m_pJavaVm == 0) { + if (m_pJavaVm == nullptr) { throw css::uno::RuntimeException( OUString("JavaVirtualMachine service was initialized in a way" " that the requested JavaVM pointer is not available"), @@ -958,7 +958,7 @@ sal_Bool SAL_CALL JavaVirtualMachine::isThreadAttached() // registerThread: GuardStack * pStack = static_cast< GuardStack * >(m_aAttachGuards.getData()); - return pStack != 0 && !pStack->empty(); + return pStack != nullptr && !pStack->empty(); } void SAL_CALL JavaVirtualMachine::registerThread() @@ -974,7 +974,7 @@ void SAL_CALL JavaVirtualMachine::registerThread() static_cast< cppu::OWeakObject * >(this)); GuardStack * pStack = static_cast< GuardStack * >(m_aAttachGuards.getData()); - if (pStack == 0) + if (pStack == nullptr) { pStack = new GuardStack; m_aAttachGuards.setData(pStack); @@ -1007,7 +1007,7 @@ void SAL_CALL JavaVirtualMachine::revokeThread() static_cast< cppu::OWeakObject * >(this)); GuardStack * pStack = static_cast< GuardStack * >(m_aAttachGuards.getData()); - if (pStack == 0 || pStack->empty()) + if (pStack == nullptr || pStack->empty()) throw css::uno::RuntimeException( OUString("JavaVirtualMachine::revokeThread: no matching registerThread"), static_cast< cppu::OWeakObject * >(this)); @@ -1163,12 +1163,12 @@ void SAL_CALL JavaVirtualMachine::elementReplaced( // call java.lang.System.setProperty // String setProperty( String key, String value) jclass jcSystem= pJNIEnv->FindClass("java/lang/System"); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:FindClass java/lang/System", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:FindClass java/lang/System", nullptr); jmethodID jmSetProps= pJNIEnv->GetStaticMethodID( jcSystem, "setProperty","(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetStaticMethodID java.lang.System.setProperty", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetStaticMethodID java.lang.System.setProperty", nullptr); jstring jsPropName= pJNIEnv->NewString( aPropertyName.getStr(), aPropertyName.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); // remove the property if it does not have a value ( user left the dialog field empty) // or if the port is set to 0 @@ -1179,14 +1179,14 @@ void SAL_CALL JavaVirtualMachine::elementReplaced( { // call java.lang.System.getProperties jmethodID jmGetProps= pJNIEnv->GetStaticMethodID( jcSystem, "getProperties","()Ljava/util/Properties;"); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetStaticMethodID java.lang.System.getProperties", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetStaticMethodID java.lang.System.getProperties", nullptr); jobject joProperties= pJNIEnv->CallStaticObjectMethod( jcSystem, jmGetProps); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.getProperties", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.getProperties", nullptr); // call java.util.Properties.remove jclass jcProperties= pJNIEnv->FindClass("java/util/Properties"); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:FindClass java/util/Properties", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:FindClass java/util/Properties", nullptr); jmethodID jmRemove= pJNIEnv->GetMethodID( jcProperties, "remove", "(Ljava/lang/Object;)Ljava/lang/Object;"); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetMethodID java.util.Properties.remove", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetMethodID java.util.Properties.remove", nullptr); pJNIEnv->CallObjectMethod( joProperties, jmRemove, jsPropName); // special case for ftp.nonProxyHosts and http.nonProxyHosts. The office only @@ -1194,7 +1194,7 @@ void SAL_CALL JavaVirtualMachine::elementReplaced( if (!aPropertyName2.isEmpty()) { jstring jsPropName2= pJNIEnv->NewString( aPropertyName2.getStr(), aPropertyName2.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); pJNIEnv->CallObjectMethod( joProperties, jmRemove, jsPropName2); } } @@ -1202,20 +1202,20 @@ void SAL_CALL JavaVirtualMachine::elementReplaced( { // Change the Value of the property jstring jsPropValue= pJNIEnv->NewString( aPropertyValue.getStr(), aPropertyValue.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); pJNIEnv->CallStaticObjectMethod( jcSystem, jmSetProps, jsPropName, jsPropValue); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", nullptr); // special case for ftp.nonProxyHosts and http.nonProxyHosts. The office only // has a value for two java properties if (!aPropertyName2.isEmpty()) { jstring jsPropName2= pJNIEnv->NewString( aPropertyName2.getStr(), aPropertyName2.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); jsPropValue= pJNIEnv->NewString( aPropertyValue.getStr(), aPropertyValue.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); pJNIEnv->CallStaticObjectMethod( jcSystem, jmSetProps, jsPropName2, jsPropValue); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", nullptr); } } @@ -1225,9 +1225,9 @@ void SAL_CALL JavaVirtualMachine::elementReplaced( if (bSecurityChanged) { jmethodID jmGetSecur= pJNIEnv->GetStaticMethodID( jcSystem,"getSecurityManager","()Ljava/lang/SecurityManager;"); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetStaticMethodID java.lang.System.getSecurityManager", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetStaticMethodID java.lang.System.getSecurityManager", nullptr); jobject joSecur= pJNIEnv->CallStaticObjectMethod( jcSystem, jmGetSecur); - if (joSecur != 0) + if (joSecur != nullptr) { // Make sure the SecurityManager is our SandboxSecurity // FindClass("com.sun.star.lib.sandbox.SandboxSecurityManager" only worked at the first time @@ -1239,11 +1239,11 @@ void SAL_CALL JavaVirtualMachine::elementReplaced( // The SecurityManagers class Name must be com.sun.star.lib.sandbox.SandboxSecurity jclass jcSec= pJNIEnv->GetObjectClass( joSecur); jclass jcClass= pJNIEnv->FindClass("java/lang/Class"); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:FindClass java.lang.Class", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:FindClass java.lang.Class", nullptr); jmethodID jmName= pJNIEnv->GetMethodID( jcClass,"getName","()Ljava/lang/String;"); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetMethodID java.lang.Class.getName", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetMethodID java.lang.Class.getName", nullptr); jstring jsClass= static_cast(pJNIEnv->CallObjectMethod( jcSec, jmName)); - const jchar* jcharName= pJNIEnv->GetStringChars( jsClass, NULL); + const jchar* jcharName= pJNIEnv->GetStringChars( jsClass, nullptr); OUString sName( jcharName); bool bIsSandbox; if ( sName == "com.sun.star.lib.sandbox.SandboxSecurity" ) @@ -1256,9 +1256,9 @@ void SAL_CALL JavaVirtualMachine::elementReplaced( { // call SandboxSecurity.reset jmethodID jmReset= pJNIEnv->GetMethodID( jcSec,"reset","()V"); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetMethodID com.sun.star.lib.sandbox.SandboxSecurity.reset", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetMethodID com.sun.star.lib.sandbox.SandboxSecurity.reset", nullptr); pJNIEnv->CallVoidMethod( joSecur, jmReset); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallVoidMethod com.sun.star.lib.sandbox.SandboxSecurity.reset", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallVoidMethod com.sun.star.lib.sandbox.SandboxSecurity.reset", nullptr); } } } @@ -1267,7 +1267,7 @@ void SAL_CALL JavaVirtualMachine::elementReplaced( { throw css::uno::RuntimeException( OUString("jvmaccess::VirtualMachine::AttachGuard::CreationException"), - 0); + nullptr); } } } @@ -1412,32 +1412,32 @@ void JavaVirtualMachine::setINetSettingsInVM(bool set_reset) // create Java Properties as JNI strings jstring jsFtpProxyHost= pJNIEnv->NewString( sFtpProxyHost.getStr(), sFtpProxyHost.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); jstring jsFtpProxyPort= pJNIEnv->NewString( sFtpProxyPort.getStr(), sFtpProxyPort.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); jstring jsFtpNonProxyHosts= pJNIEnv->NewString( sFtpNonProxyHosts.getStr(), sFtpNonProxyHosts.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); jstring jsHttpProxyHost= pJNIEnv->NewString( sHttpProxyHost.getStr(), sHttpProxyHost.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); jstring jsHttpProxyPort= pJNIEnv->NewString( sHttpProxyPort.getStr(), sHttpProxyPort.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); jstring jsHttpNonProxyHosts= pJNIEnv->NewString( sHttpNonProxyHosts.getStr(), sHttpNonProxyHosts.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); // prepare java.lang.System.setProperty jclass jcSystem= pJNIEnv->FindClass("java/lang/System"); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:FindClass java/lang/System", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:FindClass java/lang/System", nullptr); jmethodID jmSetProps= pJNIEnv->GetStaticMethodID( jcSystem, "setProperty","(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetStaticMethodID java.lang.System.setProperty", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetStaticMethodID java.lang.System.setProperty", nullptr); // call java.lang.System.getProperties jmethodID jmGetProps= pJNIEnv->GetStaticMethodID( jcSystem, "getProperties","()Ljava/util/Properties;"); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetStaticMethodID java.lang.System.getProperties", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetStaticMethodID java.lang.System.getProperties", nullptr); jobject joProperties= pJNIEnv->CallStaticObjectMethod( jcSystem, jmGetProps); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.getProperties", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.getProperties", nullptr); // prepare java.util.Properties.remove jclass jcProperties= pJNIEnv->FindClass("java/util/Properties"); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:FindClass java/util/Properties", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:FindClass java/util/Properties", nullptr); if (set_reset) { @@ -1457,44 +1457,44 @@ void JavaVirtualMachine::setINetSettingsInVM(bool set_reset) if( propName.equals( sFtpProxyHost)) { jstring jsVal= pJNIEnv->NewString( propValue.getStr(), propValue.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); pJNIEnv->CallStaticObjectMethod( jcSystem, jmSetProps, jsFtpProxyHost, jsVal); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", nullptr); } else if( propName.equals( sFtpProxyPort)) { jstring jsVal= pJNIEnv->NewString( propValue.getStr(), propValue.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); pJNIEnv->CallStaticObjectMethod( jcSystem, jmSetProps, jsFtpProxyPort, jsVal); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", nullptr); } else if( propName.equals( sFtpNonProxyHosts)) { jstring jsVal= pJNIEnv->NewString( propValue.getStr(), propValue.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); pJNIEnv->CallStaticObjectMethod( jcSystem, jmSetProps, jsFtpNonProxyHosts, jsVal); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", nullptr); } else if( propName.equals( sHttpProxyHost)) { jstring jsVal= pJNIEnv->NewString( propValue.getStr(), propValue.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); pJNIEnv->CallStaticObjectMethod( jcSystem, jmSetProps, jsHttpProxyHost, jsVal); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", nullptr); } else if( propName.equals( sHttpProxyPort)) { jstring jsVal= pJNIEnv->NewString( propValue.getStr(), propValue.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); pJNIEnv->CallStaticObjectMethod( jcSystem, jmSetProps, jsHttpProxyPort, jsVal); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", nullptr); } else if( propName.equals( sHttpNonProxyHosts)) { jstring jsVal= pJNIEnv->NewString( propValue.getStr(), propValue.getLength()); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:NewString", nullptr); pJNIEnv->CallStaticObjectMethod( jcSystem, jmSetProps, jsHttpNonProxyHosts, jsVal); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:CallStaticObjectMethod java.lang.System.setProperty", nullptr); } } } @@ -1502,7 +1502,7 @@ void JavaVirtualMachine::setINetSettingsInVM(bool set_reset) { // call java.util.Properties.remove jmethodID jmRemove= pJNIEnv->GetMethodID( jcProperties, "remove", "(Ljava/lang/Object;)Ljava/lang/Object;"); - if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetMethodID java.util.Property.remove", 0); + if(pJNIEnv->ExceptionOccurred()) throw css::uno::RuntimeException("JNI:GetMethodID java.util.Property.remove", nullptr); pJNIEnv->CallObjectMethod( joProperties, jmRemove, jsFtpProxyHost); pJNIEnv->CallObjectMethod( joProperties, jmRemove, jsFtpProxyPort); pJNIEnv->CallObjectMethod( joProperties, jmRemove, jsFtpNonProxyHosts); @@ -1538,82 +1538,82 @@ void JavaVirtualMachine::setUpUnoVirtualMachine(JNIEnv * environment) { } catch (css::lang::IllegalArgumentException &) {} jclass class_URLClassLoader = environment->FindClass( "java/net/URLClassLoader"); - if (class_URLClassLoader == 0) { + if (class_URLClassLoader == nullptr) { handleJniException(environment); } jmethodID ctor_URLClassLoader = environment->GetMethodID( class_URLClassLoader, "", "([Ljava/net/URL;)V"); - if (ctor_URLClassLoader == 0) { + if (ctor_URLClassLoader == nullptr) { handleJniException(environment); } jclass class_URL = environment->FindClass("java/net/URL"); - if (class_URL == 0) { + if (class_URL == nullptr) { handleJniException(environment); } jmethodID ctor_URL_1 = environment->GetMethodID( class_URL, "", "(Ljava/lang/String;)V"); - if (ctor_URL_1 == 0) { + if (ctor_URL_1 == nullptr) { handleJniException(environment); } jvalue args[3]; args[0].l = environment->NewString( static_cast< jchar const * >(baseUrl.getStr()), static_cast< jsize >(baseUrl.getLength())); - if (args[0].l == 0) { + if (args[0].l == nullptr) { handleJniException(environment); } jobject base = environment->NewObjectA(class_URL, ctor_URL_1, args); - if (base == 0) { + if (base == nullptr) { handleJniException(environment); } jmethodID ctor_URL_2 = environment->GetMethodID( class_URL, "", "(Ljava/net/URL;Ljava/lang/String;)V"); - if (ctor_URL_2 == 0) { + if (ctor_URL_2 == nullptr) { handleJniException(environment); } jobjectArray classpath = jvmaccess::ClassPath::translateToUrls( m_xContext, environment, classPath); - if (classpath == 0) { + if (classpath == nullptr) { handleJniException(environment); } args[0].l = base; args[1].l = environment->NewStringUTF("unoloader.jar"); - if (args[1].l == 0) { + if (args[1].l == nullptr) { handleJniException(environment); } args[0].l = environment->NewObjectA(class_URL, ctor_URL_2, args); - if (args[0].l == 0) { + if (args[0].l == nullptr) { handleJniException(environment); } args[0].l = environment->NewObjectArray(1, class_URL, args[0].l); - if (args[0].l == 0) { + if (args[0].l == nullptr) { handleJniException(environment); } jobject cl1 = environment->NewObjectA( class_URLClassLoader, ctor_URLClassLoader, args); - if (cl1 == 0) { + if (cl1 == nullptr) { handleJniException(environment); } jmethodID method_loadClass = environment->GetMethodID( class_URLClassLoader, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;"); - if (method_loadClass == 0) { + if (method_loadClass == nullptr) { handleJniException(environment); } args[0].l = environment->NewStringUTF( "com.sun.star.lib.unoloader.UnoClassLoader"); - if (args[0].l == 0) { + if (args[0].l == nullptr) { handleJniException(environment); } jclass class_UnoClassLoader = static_cast< jclass >( environment->CallObjectMethodA(cl1, method_loadClass, args)); - if (class_UnoClassLoader == 0) { + if (class_UnoClassLoader == nullptr) { handleJniException(environment); } jmethodID ctor_UnoClassLoader = environment->GetMethodID( class_UnoClassLoader, "", "(Ljava/net/URL;[Ljava/net/URL;Ljava/lang/ClassLoader;)V"); - if (ctor_UnoClassLoader == 0) { + if (ctor_UnoClassLoader == nullptr) { handleJniException(environment); } args[0].l = base; @@ -1621,7 +1621,7 @@ void JavaVirtualMachine::setUpUnoVirtualMachine(JNIEnv * environment) { args[2].l = cl1; jobject cl2 = environment->NewObjectA( class_UnoClassLoader, ctor_UnoClassLoader, args); - if (cl2 == 0) { + if (cl2 == nullptr) { handleJniException(environment); } try { diff --git a/stoc/source/namingservice/namingservice.cxx b/stoc/source/namingservice/namingservice.cxx index 3fd0f80d0f9d..e276b1ed1aef 100644 --- a/stoc/source/namingservice/namingservice.cxx +++ b/stoc/source/namingservice/namingservice.cxx @@ -159,9 +159,9 @@ static const struct ImplementationEntry g_entries[] = { NamingService_Impl_create, ns_getImplementationName, ns_getSupportedServiceNames, createSingleComponentFactory, - 0, 0 + nullptr, 0 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL namingservice_component_getFactory( diff --git a/stoc/source/proxy_factory/proxyfac.cxx b/stoc/source/proxy_factory/proxyfac.cxx index 24ac8e6620e1..bafd2f27eda9 100644 --- a/stoc/source/proxy_factory/proxyfac.cxx +++ b/stoc/source/proxy_factory/proxyfac.cxx @@ -97,17 +97,17 @@ UnoInterfaceReference FactoryImpl::binuno_queryInterface( typelib_InterfaceTypeDescription * pTypeDescr ) { // init queryInterface() td - static typelib_TypeDescription * s_pQITD = 0; - if (s_pQITD == 0) + static typelib_TypeDescription * s_pQITD = nullptr; + if (s_pQITD == nullptr) { ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if (s_pQITD == 0) + if (s_pQITD == nullptr) { - typelib_TypeDescription * pTXInterfaceDescr = 0; + typelib_TypeDescription * pTXInterfaceDescr = nullptr; TYPELIB_DANGER_GET( &pTXInterfaceDescr, cppu::UnoType::get().getTypeLibType() ); - typelib_TypeDescription * pQITD = 0; + typelib_TypeDescription * pQITD = nullptr; typelib_typedescriptionreference_getDescription( &pQITD, reinterpret_cast< typelib_InterfaceTypeDescription * >( pTXInterfaceDescr )->ppAllMembers[ 0 ] ); @@ -129,7 +129,7 @@ UnoInterfaceReference FactoryImpl::binuno_queryInterface( unoI.dispatch( s_pQITD, &ret_val, args, &exc ); - if (exc == 0) + if (exc == nullptr) { UnoInterfaceReference ret; if (ret_val.pType->eTypeClass == typelib_TypeClass_INTERFACE) @@ -140,7 +140,7 @@ UnoInterfaceReference FactoryImpl::binuno_queryInterface( } else { - uno_any_destruct( &ret_val, 0 ); + uno_any_destruct( &ret_val, nullptr ); } return ret; } @@ -155,7 +155,7 @@ UnoInterfaceReference FactoryImpl::binuno_queryInterface( uno_type_copyAndConvertData( &cpp_exc, exc, cppu::UnoType::get().getTypeLibType(), m_uno2cpp.get() ); - uno_any_destruct( exc, 0 ); + uno_any_destruct( exc, nullptr ); ::cppu::throwException( cpp_exc ); OSL_ASSERT( false ); // way of no return return UnoInterfaceReference(); // for dummy @@ -217,7 +217,7 @@ static void SAL_CALL binuno_proxy_acquire( uno_Interface * pUnoI ) // rebirth of zombie uno_ExtEnvironment * uno_env = that->m_root->m_factory->m_uno_env.get()->pExtEnv; - OSL_ASSERT( uno_env != 0 ); + OSL_ASSERT( uno_env != nullptr ); (*uno_env->registerProxyInterface)( uno_env, reinterpret_cast< void ** >( &pUnoI ), binuno_proxy_free, that->m_oid.pData, @@ -235,7 +235,7 @@ static void SAL_CALL binuno_proxy_release( uno_Interface * pUnoI ) { uno_ExtEnvironment * uno_env = that->m_root->m_factory->m_uno_env.get()->pExtEnv; - OSL_ASSERT( uno_env != 0 ); + OSL_ASSERT( uno_env != nullptr ); (*uno_env->revokeInterface)( uno_env, pUnoI ); } } @@ -259,7 +259,7 @@ static void SAL_CALL binuno_proxy_dispatch( uno_type_copyAndConvertData( pReturn, &ret, cppu::UnoType::get().getTypeLibType(), that->m_root->m_factory->m_cpp2uno.get() ); - *ppException = 0; // no exc + *ppException = nullptr; // no exc } catch (RuntimeException &) { @@ -273,11 +273,11 @@ static void SAL_CALL binuno_proxy_dispatch( } case 1: // acquire() binuno_proxy_acquire( pUnoI ); - *ppException = 0; // no exc + *ppException = nullptr; // no exc break; case 2: // release() binuno_proxy_release( pUnoI ); - *ppException = 0; // no exc + *ppException = nullptr; // no exc break; default: that->m_target.dispatch( pMemberType, pReturn, pArgs, ppException ); @@ -327,13 +327,13 @@ Any ProxyRoot::queryAggregation( Type const & rType ) Any ret( OWeakAggObject::queryAggregation( rType ) ); if (! ret.hasValue()) { - typelib_TypeDescription * pTypeDescr = 0; + typelib_TypeDescription * pTypeDescr = nullptr; TYPELIB_DANGER_GET( &pTypeDescr, rType.getTypeLibType() ); try { Reference< XInterface > xProxy; uno_ExtEnvironment * cpp_env = m_factory->m_cpp_env.get()->pExtEnv; - OSL_ASSERT( cpp_env != 0 ); + OSL_ASSERT( cpp_env != nullptr ); // mind a new delegator, calculate current root: Reference< XInterface > xRoot( @@ -367,7 +367,7 @@ Any ProxyRoot::queryAggregation( Type const & rType ) SAL_NO_ACQUIRE ); uno_ExtEnvironment * uno_env = m_factory->m_uno_env.get()->pExtEnv; - OSL_ASSERT( uno_env != 0 ); + OSL_ASSERT( uno_env != nullptr ); (*uno_env->registerProxyInterface)( uno_env, reinterpret_cast< void ** >( &proxy.m_pUnoI ), binuno_proxy_free, oid.pData, @@ -401,21 +401,21 @@ FactoryImpl::FactoryImpl() OUString cpp = CPPU_CURRENT_LANGUAGE_BINDING_NAME; uno_getEnvironment( - reinterpret_cast< uno_Environment ** >( &m_uno_env ), uno.pData, 0 ); + reinterpret_cast< uno_Environment ** >( &m_uno_env ), uno.pData, nullptr ); OSL_ENSURE( m_uno_env.is(), "### cannot get binary uno env!" ); uno_getEnvironment( - reinterpret_cast< uno_Environment ** >( &m_cpp_env ), cpp.pData, 0 ); + reinterpret_cast< uno_Environment ** >( &m_cpp_env ), cpp.pData, nullptr ); OSL_ENSURE( m_cpp_env.is(), "### cannot get C++ uno env!" ); uno_getMapping( reinterpret_cast< uno_Mapping ** >( &m_uno2cpp ), - m_uno_env.get(), m_cpp_env.get(), 0 ); + m_uno_env.get(), m_cpp_env.get(), nullptr ); OSL_ENSURE( m_uno2cpp.is(), "### cannot get bridge uno <-> C++!" ); uno_getMapping( reinterpret_cast< uno_Mapping ** >( &m_cpp2uno ), - m_cpp_env.get(), m_uno_env.get(), 0 ); + m_cpp_env.get(), m_uno_env.get(), nullptr ); OSL_ENSURE( m_cpp2uno.is(), "### cannot get bridge C++ <-> uno!" ); } @@ -476,9 +476,9 @@ static const ::cppu::ImplementationEntry g_entries [] = { proxyfac_create, proxyfac_getImplementationName, proxyfac_getSupportedServiceNames, ::cppu::createSingleComponentFactory, - 0, 0 + nullptr, 0 }, - { 0, 0, 0, 0, 0, 0 } + { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; } diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx index 72eea5142258..7ad6b3ec74a4 100644 --- a/stoc/source/security/access_controller.cxx +++ b/stoc/source/security/access_controller.cxx @@ -293,7 +293,7 @@ public: explicit cc_reset( void * cc ) : m_cc( cc ) {} inline ~cc_reset() - { ::uno_setCurrentContext( m_cc, s_envType.pData, 0 ); } + { ::uno_setCurrentContext( m_cc, s_envType.pData, nullptr ); } }; struct MutexHolder @@ -377,7 +377,7 @@ AccessController::AccessController( Reference< XComponentContext > const & xComp , m_mode( ON ) // default , m_defaultPerm_init( false ) , m_singleUser_init( false ) - , m_rec( 0 ) + , m_rec( nullptr ) { // The .../mode value had originally been set in // cppu::add_access_control_entries (cppuhelper/source/servicefactory.cxx) @@ -527,14 +527,14 @@ static void dumpPermissions( inline void AccessController::clearPostPoned() { delete static_cast< t_rec_vec * >( m_rec.getData() ); - m_rec.setData( 0 ); + m_rec.setData( nullptr ); } void AccessController::checkAndClearPostPoned() { // check postponed permissions std::unique_ptr< t_rec_vec > rec( static_cast< t_rec_vec * >( m_rec.getData() ) ); - m_rec.setData( 0 ); // takeover ownership + m_rec.setData( nullptr ); // takeover ownership OSL_ASSERT( rec.get() ); if (rec.get()) { @@ -753,7 +753,7 @@ PermissionCollection AccessController::getEffectivePermissions( // don't check postponed, just cleanup clearPostPoned(); delete static_cast< t_rec_vec * >( m_rec.getData() ); - m_rec.setData( 0 ); + m_rec.setData( nullptr ); throw; } catch (Exception &) @@ -788,7 +788,7 @@ void AccessController::checkPermission( // first dynamic check of ac contexts Reference< XCurrentContext > xContext; - ::uno_getCurrentContext( reinterpret_cast(&xContext), s_envType.pData, 0 ); + ::uno_getCurrentContext( reinterpret_cast(&xContext), s_envType.pData, nullptr ); Reference< security::XAccessControlContext > xACC( getDynamicRestriction( xContext ) ); if (xACC.is()) { @@ -819,13 +819,13 @@ Any AccessController::doRestricted( if (xRestriction.is()) { Reference< XCurrentContext > xContext; - ::uno_getCurrentContext( reinterpret_cast(&xContext), s_envType.pData, 0 ); + ::uno_getCurrentContext( reinterpret_cast(&xContext), s_envType.pData, nullptr ); // override restriction Reference< XCurrentContext > xNewContext( new acc_CurrentContext( xContext, acc_Intersection::create( xRestriction, getDynamicRestriction( xContext ) ) ) ); - ::uno_setCurrentContext( xNewContext.get(), s_envType.pData, 0 ); + ::uno_setCurrentContext( xNewContext.get(), s_envType.pData, nullptr ); cc_reset reset( xContext.get() ); return xAction->run(); } @@ -852,7 +852,7 @@ Any AccessController::doPrivileged( } Reference< XCurrentContext > xContext; - ::uno_getCurrentContext( reinterpret_cast(&xContext), s_envType.pData, 0 ); + ::uno_getCurrentContext( reinterpret_cast(&xContext), s_envType.pData, nullptr ); Reference< security::XAccessControlContext > xOldRestr( getDynamicRestriction( xContext ) ); @@ -862,7 +862,7 @@ Any AccessController::doPrivileged( // override restriction Reference< XCurrentContext > xNewContext( new acc_CurrentContext( xContext, acc_Union::create( xRestriction, xOldRestr ) ) ); - ::uno_setCurrentContext( xNewContext.get(), s_envType.pData, 0 ); + ::uno_setCurrentContext( xNewContext.get(), s_envType.pData, nullptr ); cc_reset reset( xContext.get() ); return xAction->run(); } @@ -887,7 +887,7 @@ Reference< security::XAccessControlContext > AccessController::getContext() } Reference< XCurrentContext > xContext; - ::uno_getCurrentContext( reinterpret_cast(&xContext), s_envType.pData, 0 ); + ::uno_getCurrentContext( reinterpret_cast(&xContext), s_envType.pData, nullptr ); return acc_Intersection::create( getDynamicRestriction( xContext ), diff --git a/stoc/source/security/permissions.cxx b/stoc/source/security/permissions.cxx index c9a22a575e79..77f99b79fe7b 100644 --- a/stoc/source/security/permissions.cxx +++ b/stoc/source/security/permissions.cxx @@ -127,7 +127,7 @@ public: virtual OUString toString() const override; }; -char const * SocketPermission::s_actions [] = { "accept", "connect", "listen", "resolve", 0 }; +char const * SocketPermission::s_actions [] = { "accept", "connect", "listen", "resolve", nullptr }; SocketPermission::SocketPermission( connection::SocketPermission const & perm, @@ -289,11 +289,11 @@ public: virtual OUString toString() const override; }; -char const * FilePermission::s_actions [] = { "read", "write", "execute", "delete", 0 }; +char const * FilePermission::s_actions [] = { "read", "write", "execute", "delete", nullptr }; static OUString const & getWorkingDir() { - static OUString * s_workingDir = 0; + static OUString * s_workingDir = nullptr; if (! s_workingDir) { OUString workingDir; diff --git a/stoc/source/typeconv/convert.cxx b/stoc/source/typeconv/convert.cxx index 44bfe6c94a31..46c06225f920 100644 --- a/stoc/source/typeconv/convert.cxx +++ b/stoc/source/typeconv/convert.cxx @@ -533,7 +533,7 @@ Any SAL_CALL TypeConverter_Impl::convertTo( const Any& rVal, const Type& aDestTy if (! rVal.hasValue()) { // void -> interface (null) - void * null_ref = 0; + void * null_ref = nullptr; aRet.setValue( &null_ref, aDestType ); break; } @@ -564,19 +564,19 @@ Any SAL_CALL TypeConverter_Impl::convertTo( const Any& rVal, const Type& aDestTy TypeDescription aSourceTD( aSourceType ); TypeDescription aDestTD( aDestType ); - typelib_TypeDescription * pSourceElementTD = 0; + typelib_TypeDescription * pSourceElementTD = nullptr; TYPELIB_DANGER_GET( &pSourceElementTD, reinterpret_cast(aSourceTD.get())->pType ); - typelib_TypeDescription * pDestElementTD = 0; + typelib_TypeDescription * pDestElementTD = nullptr; TYPELIB_DANGER_GET( &pDestElementTD, reinterpret_cast(aDestTD.get())->pType ); sal_uInt32 nPos = (*static_cast(rVal.getValue()))->nElements; - uno_Sequence * pRet = 0; + uno_Sequence * pRet = nullptr; uno_sequence_construct( - &pRet, aDestTD.get(), 0, nPos, + &pRet, aDestTD.get(), nullptr, nPos, reinterpret_cast< uno_AcquireFunc >(cpp_acquire) ); aRet.setValue( &pRet, aDestTD.get() ); uno_destructData( diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx index 021a80651e58..2c5a34a415fc 100644 --- a/stoc/source/uriproc/UriReferenceFactory.cxx +++ b/stoc/source/uriproc/UriReferenceFactory.cxx @@ -218,7 +218,7 @@ css::uno::Reference< css::uri::XUriReference > parseGeneric( } else { if (schemeSpecificPart.isEmpty()) { // The scheme-specific part of an opaque URI must not be empty: - return 0; + return nullptr; } path = schemeSpecificPart; } @@ -404,7 +404,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeAbsolute( { if (!baseUriReference.is() || !baseUriReference->isAbsolute() || !baseUriReference->isHierarchical() || !uriReference.is()) { - return 0; + return nullptr; } else if (uriReference->isAbsolute()) { return clone(uriReference); } else if (!uriReference->hasAuthority() @@ -473,7 +473,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeAbsolute( } else { switch (excessParentSegments) { case css::uri::RelativeUriExcessParentSegments_ERROR: - return 0; + return nullptr; case css::uri::RelativeUriExcessParentSegments_RETAIN: if (!slash) { @@ -520,7 +520,7 @@ css::uno::Reference< css::uri::XUriReference > Factory::makeRelative( { if (!baseUriReference.is() || !baseUriReference->isAbsolute() || !baseUriReference->isHierarchical() || !uriReference.is()) { - return 0; + return nullptr; } else if (!uriReference->isAbsolute() || !uriReference->isHierarchical() || !baseUriReference->getScheme().equalsIgnoreAsciiCase( uriReference->getScheme())) { diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx index 66e5644849c9..b6811f8a27c0 100644 --- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx +++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTscript.cxx @@ -424,7 +424,7 @@ Parser::parse( throw (css::uno::RuntimeException, std::exception) { if (!parseSchemeSpecificPart(schemeSpecificPart)) { - return 0; + return nullptr; } return new UrlReference(scheme, schemeSpecificPart); } -- cgit