diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-23 09:57:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-23 11:57:29 +0200 |
commit | 8256c139519c2431fdfe612c534416a7c93a9a38 (patch) | |
tree | 9bd5b2f8b0b134b598079033c40205ed3ea97453 /bridges | |
parent | 476c50943864e70a4758ccf01e2567067bc7c44f (diff) |
loplugin:comparisonwithconstant in bridges
Change-Id: I14983a829daf481e31eaa955b0756bda89b87ee1
Reviewed-on: https://gerrit.libreoffice.org/37940
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'bridges')
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx | 4 | ||||
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx | 8 | ||||
-rw-r--r-- | bridges/source/cpp_uno/shared/bridge.cxx | 2 | ||||
-rw-r--r-- | bridges/source/cpp_uno/shared/component.cxx | 16 | ||||
-rw-r--r-- | bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx | 2 | ||||
-rw-r--r-- | bridges/source/cpp_uno/shared/unointerfaceproxy.cxx | 4 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_bridge.cxx | 18 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_data.cxx | 96 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_info.cxx | 128 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_java2uno.cxx | 42 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_uno2java.cxx | 20 |
11 files changed, 170 insertions, 170 deletions
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 f5c4dc0facdf..0c41d0358773 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx @@ -481,7 +481,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( TYPELIB_DANGER_GET( &pTD, type->ppMembers[ nPos ] ); assert(pTD); - if ( typelib_TypeClass_INTERFACE_ATTRIBUTE == pTD->eTypeClass ) + if ( pTD->eTypeClass == typelib_TypeClass_INTERFACE_ATTRIBUTE ) { typelib_InterfaceAttributeTypeDescription *pAttrTD = reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>( pTD ); @@ -498,7 +498,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( code = codeSnippet( code, nFunctionOffset++, nVtableOffset, false ); } } - else if ( typelib_TypeClass_INTERFACE_METHOD == pTD->eTypeClass ) + else if ( pTD->eTypeClass == typelib_TypeClass_INTERFACE_METHOD ) { typelib_InterfaceMethodTypeDescription *pMethodTD = reinterpret_cast<typelib_InterfaceMethodTypeDescription *>( 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 04d13e80c748..12df659b41cd 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx @@ -50,10 +50,10 @@ static OUString toUNOname( char const * p ) // example: N3com3sun4star4lang24IllegalArgumentExceptionE OUStringBuffer buf( 64 ); - assert( 'N' == *p ); + assert( *p == 'N' ); ++p; // skip N - while ('E' != *p) + while (*p != 'E') { // read chars count long n = (*p++ - '0'); @@ -64,7 +64,7 @@ static OUString toUNOname( char const * p ) } buf.appendAscii( p, n ); p += n; - if ('E' != *p) + if (*p != 'E') buf.append( '.' ); } @@ -156,7 +156,7 @@ void fillUnoException( __cxxabiv1::__cxa_exception * header, uno_Any * pUnoExc, fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() ); #endif typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); - if (nullptr == pExcTypeDescr) + if (pExcTypeDescr == nullptr) { RuntimeException aRE( "exception type not found: " + unoName ); Type const & rType = cppu::UnoType<decltype(aRE)>::get(); diff --git a/bridges/source/cpp_uno/shared/bridge.cxx b/bridges/source/cpp_uno/shared/bridge.cxx index 004f8954986e..f752c626d253 100644 --- a/bridges/source/cpp_uno/shared/bridge.cxx +++ b/bridges/source/cpp_uno/shared/bridge.cxx @@ -151,7 +151,7 @@ uno_Mapping * Bridge::createMapping( void Bridge::acquire() { - if (1 == osl_atomic_increment( &nRef )) + if (osl_atomic_increment( &nRef ) == 1) { if (bExportCpp2Uno) { diff --git a/bridges/source/cpp_uno/shared/component.cxx b/bridges/source/cpp_uno/shared/component.cxx index e58092064513..960fc9991cf1 100644 --- a/bridges/source/cpp_uno/shared/component.cxx +++ b/bridges/source/cpp_uno/shared/component.cxx @@ -201,11 +201,11 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( OUString from_envTypeName(cppu::EnvDcp::getTypeName(pFrom->pTypeName)); OUString to_envTypeName(cppu::EnvDcp::getTypeName(pTo->pTypeName)); - if (0 == rtl_ustr_ascii_compare( + if (rtl_ustr_ascii_compare( from_envTypeName.pData->buffer, - CPPU_CURRENT_LANGUAGE_BINDING_NAME ) && - 0 == rtl_ustr_ascii_compare( - to_envTypeName.pData->buffer, UNO_LB_UNO )) + CPPU_CURRENT_LANGUAGE_BINDING_NAME ) == 0 && + rtl_ustr_ascii_compare( + to_envTypeName.pData->buffer, UNO_LB_UNO ) == 0) { // ref count initially 1 pMapping = bridges::cpp_uno::shared::Bridge::createMapping( @@ -215,11 +215,11 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( &pFrom->pExtEnv->aBase, &pTo->pExtEnv->aBase, nullptr ); } - else if (0 == rtl_ustr_ascii_compare( + else if (rtl_ustr_ascii_compare( to_envTypeName.pData->buffer, - CPPU_CURRENT_LANGUAGE_BINDING_NAME ) && - 0 == rtl_ustr_ascii_compare( - from_envTypeName.pData->buffer, UNO_LB_UNO )) + CPPU_CURRENT_LANGUAGE_BINDING_NAME ) == 0 && + rtl_ustr_ascii_compare( + from_envTypeName.pData->buffer, UNO_LB_UNO ) == 0) { // ref count initially 1 pMapping = bridges::cpp_uno::shared::Bridge::createMapping( diff --git a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx index c06f5775f2a8..3fe7d98ea452 100644 --- a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx +++ b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx @@ -120,7 +120,7 @@ com::sun::star::uno::XInterface * CppInterfaceProxy::create( void CppInterfaceProxy::acquireProxy() { - if (1 == osl_atomic_increment( &nRef )) + if (osl_atomic_increment( &nRef ) == 1) { // rebirth of proxy zombie // register at cpp env diff --git a/bridges/source/cpp_uno/shared/unointerfaceproxy.cxx b/bridges/source/cpp_uno/shared/unointerfaceproxy.cxx index e36ced8e5d6e..698624ea49b0 100644 --- a/bridges/source/cpp_uno/shared/unointerfaceproxy.cxx +++ b/bridges/source/cpp_uno/shared/unointerfaceproxy.cxx @@ -51,8 +51,8 @@ void freeUnoInterfaceProxy(uno_ExtEnvironment * pEnv, void * pProxy) void acquireProxy(uno_Interface * pUnoI) { - if (1 == osl_atomic_increment( - & static_cast< UnoInterfaceProxy * >( pUnoI )->nRef )) + if (osl_atomic_increment( + & static_cast< UnoInterfaceProxy * >( pUnoI )->nRef ) == 1) { // rebirth of proxy zombie // register at uno env diff --git a/bridges/source/jni_uno/jni_bridge.cxx b/bridges/source/jni_uno/jni_bridge.cxx index ad744b87a869..7926994ebfc2 100644 --- a/bridges/source/jni_uno/jni_bridge.cxx +++ b/bridges/source/jni_uno/jni_bridge.cxx @@ -67,9 +67,9 @@ void SAL_CALL Mapping_map_to_uno( assert(ppUnoI != nullptr); assert(td != nullptr); - if (nullptr == javaI) + if (javaI == nullptr) { - if (nullptr != *ppUnoI) + if (*ppUnoI != nullptr) { uno_Interface * p = *ppUnoI; (*p->release)( p ); @@ -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 (nullptr != *ppUnoI) + if (*ppUnoI != nullptr) { uno_Interface * p = *ppUnoI; (*p->release)( p ); @@ -128,9 +128,9 @@ void SAL_CALL Mapping_map_to_java( try { - if (nullptr == pUnoI) + if (pUnoI == nullptr) { - if (nullptr != *ppJavaI) + if (*ppJavaI != nullptr) { Bridge const * bridge = static_cast< Mapping const * >( mapping )->m_bridge; @@ -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 (nullptr != *ppJavaI) + if (*ppJavaI != nullptr) jni->DeleteGlobalRef( *ppJavaI ); *ppJavaI = jni->NewGlobalRef( jlocal ); jni->DeleteLocalRef( jlocal ); @@ -194,7 +194,7 @@ namespace jni_uno void Bridge::acquire() const { - if (1 == osl_atomic_increment( &m_ref )) + if (osl_atomic_increment( &m_ref ) == 1) { if (m_registered_java2uno) { @@ -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() && (nullptr != method)) + if (assert_no_exception() && (method != nullptr)) { jvalue arg; arg.l = jo_exc; @@ -517,7 +517,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( assert(ppMapping != nullptr); assert(pFrom != nullptr); assert(pTo != nullptr); - if (nullptr != *ppMapping) + if (*ppMapping != nullptr) { (*(*ppMapping)->release)( *ppMapping ); *ppMapping = nullptr; diff --git a/bridges/source/jni_uno/jni_data.cxx b/bridges/source/jni_uno/jni_data.cxx index 44f1efbe0431..11ebf3589602 100644 --- a/bridges/source/jni_uno/jni_data.cxx +++ b/bridges/source/jni_uno/jni_data.cxx @@ -218,7 +218,7 @@ void Bridge::map_to_uno( { assert( !out_param || - (1 == jni->GetArrayLength( static_cast<jarray>(java_data.l) )) ); + (jni->GetArrayLength( static_cast<jarray>(java_data.l) ) == 1) ); switch (type->eTypeClass) { @@ -379,7 +379,7 @@ void Bridge::map_to_uno( jni.ensure_no_exception(); java_data.l = jo_out_holder.get(); } - if (nullptr == java_data.l) + if (java_data.l == nullptr) { throw BridgeRuntimeError( "[map_to_uno():" + OUString::unacquired( &type->pTypeName ) @@ -401,7 +401,7 @@ void Bridge::map_to_uno( jni.ensure_no_exception(); java_data.l = jo_out_holder.get(); } - if (nullptr == java_data.l) + if (java_data.l == nullptr) { throw BridgeRuntimeError( "[map_to_uno():" + OUString::unacquired( &type->pTypeName ) @@ -450,7 +450,7 @@ void Bridge::map_to_uno( } uno_Any * pAny = static_cast<uno_Any *>(uno_data); - if (nullptr == java_data.l) // null-ref maps to XInterface null-ref + if (java_data.l == nullptr) // null-ref maps to XInterface null-ref { if (assign) uno_any_destruct( pAny, nullptr ); @@ -668,7 +668,7 @@ void Bridge::map_to_uno( jni.ensure_no_exception(); java_data.l = jo_out_holder.get(); } - if (nullptr == java_data.l) + if (java_data.l == nullptr) { 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 (nullptr == java_data.l) + if (java_data.l == nullptr) { throw BridgeRuntimeError( "[map_to_uno():" + OUString::unacquired( &type->pTypeName ) + "] null-ref given!" + jni.get_stack_trace() ); } - if (nullptr == info) + if (info == nullptr) info = getJniInfo()->get_type_info( jni, type ); JNI_compound_type_info const * comp_info = static_cast< JNI_compound_type_info const * >( info ); @@ -713,7 +713,7 @@ void Bridge::map_to_uno( sal_Int32 nMembers = comp_td->nMembers; try { - if (nullptr != comp_td->pBaseTypeDescription) + if (comp_td->pBaseTypeDescription != nullptr) { map_to_uno( jni, uno_data, java_data, @@ -883,7 +883,7 @@ void Bridge::map_to_uno( { JLocalAutoRef jo_field( jni ); bool checkNull; - if (nullptr == field_id) + if (field_id == nullptr) { // special for Message: call Throwable.getMessage() assert( @@ -894,7 +894,7 @@ void Bridge::map_to_uno( type, getJniInfo()->m_RuntimeException_type. getTypeLibType() ) ); - assert( 0 == nPos ); // first member + assert( nPos == 0 ); // first member // call getMessage() jo_field.reset( jni->CallObjectMethodA( @@ -936,7 +936,7 @@ void Bridge::map_to_uno( uno_type_destructData( p, comp_td->ppTypeRefs[ nCleanup ], nullptr ); } - if (nullptr != comp_td->pBaseTypeDescription) + if (comp_td->pBaseTypeDescription != nullptr) { uno_destructData( uno_data, &comp_td->pBaseTypeDescription->aBase, nullptr ); @@ -956,7 +956,7 @@ void Bridge::map_to_uno( jni.ensure_no_exception(); java_data.l = jo_out_holder.get(); } - if (nullptr == java_data.l) + if (java_data.l == nullptr) { throw BridgeRuntimeError( "[map_to_uno():" + OUString::unacquired( &type->pTypeName ) @@ -1044,9 +1044,9 @@ void Bridge::map_to_uno( seq = seq_allocate( nElements, element_td.get()->nSize ); JNI_type_info const * element_info; - if (typelib_TypeClass_STRUCT == element_type->eTypeClass || - typelib_TypeClass_EXCEPTION == element_type->eTypeClass || - typelib_TypeClass_INTERFACE == element_type->eTypeClass) + if (element_type->eTypeClass == typelib_TypeClass_STRUCT || + element_type->eTypeClass == typelib_TypeClass_EXCEPTION || + element_type->eTypeClass == typelib_TypeClass_INTERFACE) { element_info = getJniInfo()->get_type_info( jni, element_td.get() ); @@ -1115,19 +1115,19 @@ void Bridge::map_to_uno( java_data.l = jo_out_holder.get(); } - if (nullptr == java_data.l) // null-ref + if (java_data.l == nullptr) // null-ref { if (assign) { uno_Interface * p = *static_cast<uno_Interface **>(uno_data); - if (nullptr != p) + if (p != nullptr) (*p->release)( p ); } *static_cast<uno_Interface **>(uno_data) = nullptr; } else { - if (nullptr == info) + if (info == nullptr) 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 (nullptr != p) + if (p != nullptr) (*p->release)( p ); } *static_cast<uno_Interface **>(uno_data) = pUnoI; @@ -1172,7 +1172,7 @@ void Bridge::map_to_java( case typelib_TypeClass_CHAR: if (out_param) { - if (nullptr == java_data->l) + if (java_data->l == nullptr) { JLocalAutoRef jo_ar( jni, jni->NewCharArray( 1 ) ); jni.ensure_no_exception(); @@ -1211,7 +1211,7 @@ void Bridge::map_to_java( case typelib_TypeClass_BOOLEAN: if (out_param) { - if (nullptr == java_data->l) + if (java_data->l == nullptr) { JLocalAutoRef jo_ar( jni, jni->NewBooleanArray( 1 ) ); jni.ensure_no_exception(); @@ -1252,7 +1252,7 @@ void Bridge::map_to_java( case typelib_TypeClass_BYTE: if (out_param) { - if (nullptr == java_data->l) + if (java_data->l == nullptr) { JLocalAutoRef jo_ar( jni, jni->NewByteArray( 1 ) ); jni.ensure_no_exception(); @@ -1292,7 +1292,7 @@ void Bridge::map_to_java( case typelib_TypeClass_UNSIGNED_SHORT: if (out_param) { - if (nullptr == java_data->l) + if (java_data->l == nullptr) { JLocalAutoRef jo_ar( jni, jni->NewShortArray( 1 ) ); jni.ensure_no_exception(); @@ -1332,7 +1332,7 @@ void Bridge::map_to_java( case typelib_TypeClass_UNSIGNED_LONG: if (out_param) { - if (nullptr == java_data->l) + if (java_data->l == nullptr) { JLocalAutoRef jo_ar( jni, jni->NewIntArray( 1 ) ); jni.ensure_no_exception(); @@ -1372,7 +1372,7 @@ void Bridge::map_to_java( case typelib_TypeClass_UNSIGNED_HYPER: if (out_param) { - if (nullptr == java_data->l) + if (java_data->l == nullptr) { JLocalAutoRef jo_ar( jni, jni->NewLongArray( 1 ) ); jni.ensure_no_exception(); @@ -1411,7 +1411,7 @@ void Bridge::map_to_java( case typelib_TypeClass_FLOAT: if (out_param) { - if (nullptr == java_data->l) + if (java_data->l == nullptr) { JLocalAutoRef jo_ar( jni, jni->NewFloatArray( 1 ) ); jni.ensure_no_exception(); @@ -1450,7 +1450,7 @@ void Bridge::map_to_java( case typelib_TypeClass_DOUBLE: if (out_param) { - if (nullptr == java_data->l) + if (java_data->l == nullptr) { JLocalAutoRef jo_ar( jni, jni->NewDoubleArray( 1 ) ); jni.ensure_no_exception(); @@ -1499,7 +1499,7 @@ void Bridge::map_to_java( ustring_to_jstring( jni, *static_cast<rtl_uString * const *>(uno_data) ) ); } - if (nullptr == java_data->l) + if (java_data->l == nullptr) { java_data->l = jni->NewObjectArray( 1, getJniInfo()->m_class_String, jo_in.get() ); @@ -1533,7 +1533,7 @@ void Bridge::map_to_java( *static_cast<typelib_TypeDescriptionReference * const *>(uno_data) ) ); } - if (nullptr == java_data->l) + if (java_data->l == nullptr) { java_data->l = jni->NewObjectArray( 1, getJniInfo()->m_class_Type, jo_in.get() ); @@ -1643,8 +1643,8 @@ void Bridge::map_to_java( // determine inner element type ::com::sun::star::uno::Type element_type( reinterpret_cast<typelib_IndirectTypeDescription *>(seq_td.get())->pType ); - while (typelib_TypeClass_SEQUENCE == - element_type.getTypeLibType()->eTypeClass) + while (element_type.getTypeLibType()->eTypeClass == + typelib_TypeClass_SEQUENCE) { TypeDescr element_td( element_type.getTypeLibType() ); typelib_typedescriptionreference_assign( @@ -1682,7 +1682,7 @@ void Bridge::map_to_java( uno_Interface * pUnoI = static_cast<uno_Interface *>(pAny->pReserved); if (is_XInterface( pAny->pType )) { - if (nullptr != pUnoI) + if (pUnoI != nullptr) { jo_any.reset( map_to_java( @@ -1696,7 +1696,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 (nullptr != pUnoI) + if (pUnoI != nullptr) { jo_any.reset( map_to_java( jni, pUnoI, iface_info ) ); } @@ -1755,7 +1755,7 @@ void Bridge::map_to_java( if (out_param) { - if (nullptr == java_data->l) + if (java_data->l == nullptr) { java_data->l = jni->NewObjectArray( 1, getJniInfo()->m_class_Object, jo_any.get() ); @@ -1794,7 +1794,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( nullptr != method_id ); + assert( method_id != nullptr ); jvalue arg; arg.i = *static_cast<jint const *>(uno_data); @@ -1805,7 +1805,7 @@ void Bridge::map_to_java( } if (out_param) { - if (nullptr == java_data->l) + if (java_data->l == nullptr) { java_data->l = jni->NewObjectArray( 1, static_cast<jclass>(jo_enum_class.get()), jo_enum.get() ); @@ -1827,7 +1827,7 @@ void Bridge::map_to_java( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { - if (nullptr == info) + if (info == nullptr) info = getJniInfo()->get_type_info( jni, type ); JNI_compound_type_info const * comp_info = static_cast< JNI_compound_type_info const * >( info ); @@ -1835,7 +1835,7 @@ void Bridge::map_to_java( JLocalAutoRef jo_comp( jni ); if (in_param) { - if (typelib_TypeClass_EXCEPTION == type->eTypeClass) + if (type->eTypeClass == typelib_TypeClass_EXCEPTION) { JLocalAutoRef jo_message( jni, ustring_to_jstring( jni, *static_cast<rtl_uString * const *>(uno_data) ) ); @@ -1853,7 +1853,7 @@ void Bridge::map_to_java( } for ( JNI_compound_type_info const * linfo = comp_info; - nullptr != linfo; + linfo != nullptr; linfo = static_cast< JNI_compound_type_info const * >( linfo->m_base ) ) { @@ -1869,7 +1869,7 @@ void Bridge::map_to_java( for ( sal_Int32 nPos = comp_td->nMembers; nPos--; ) { jfieldID field_id = linfo->m_fields[ nPos ]; - if (nullptr != field_id) + if (field_id != nullptr) { void const * p = static_cast<char const *>(uno_data) + pMemberOffsets[ nPos ]; @@ -2063,7 +2063,7 @@ void Bridge::map_to_java( } if (out_param) { - if (nullptr == java_data->l) + if (java_data->l == nullptr) { java_data->l = jni->NewObjectArray( 1, comp_info->m_class, jo_comp.get() ); @@ -2283,7 +2283,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( nullptr != method_id ); + assert( method_id != nullptr ); sal_Int32 const * p = reinterpret_cast<sal_Int32 const *>(seq->elements); for ( sal_Int32 nPos = 0; nPos < nElements; ++nPos ) @@ -2379,7 +2379,7 @@ void Bridge::map_to_java( for ( sal_Int32 nPos = 0; nPos < nElements; ++nPos ) { uno_Interface * pUnoI = pp[ nPos ]; - if (nullptr != pUnoI) + if (pUnoI != nullptr) { JLocalAutoRef jo_element( jni, map_to_java( jni, pUnoI, iface_info ) ); @@ -2404,7 +2404,7 @@ void Bridge::map_to_java( if (out_param) { - if (nullptr == java_data->l) + if (java_data->l == nullptr) { JLocalAutoRef jo_element_class( jni, jni->GetObjectClass( jo_ar.get() ) ); @@ -2439,9 +2439,9 @@ void Bridge::map_to_java( if (in_param) { uno_Interface * pUnoI = *static_cast<uno_Interface * const *>(uno_data); - if (nullptr != pUnoI) + if (pUnoI != nullptr) { - if (nullptr == info) + if (info == nullptr) info = getJniInfo()->get_type_info( jni, type ); JNI_interface_type_info const * iface_info = static_cast< JNI_interface_type_info const * >( info ); @@ -2450,9 +2450,9 @@ void Bridge::map_to_java( } if (out_param) { - if (nullptr == java_data->l) + if (java_data->l == nullptr) { - if (nullptr == info) + if (info == nullptr) 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_info.cxx b/bridges/source/jni_uno/jni_info.cxx index 70df22a1b1e4..c2334071b676 100644 --- a/bridges/source/jni_uno/jni_info.cxx +++ b/bridges/source/jni_uno/jni_info.cxx @@ -70,7 +70,7 @@ JNI_interface_type_info::JNI_interface_type_info( JNI_context const & jni, typelib_TypeDescription * td_ ) : JNI_type_info( jni, td_ ) { - assert( typelib_TypeClass_INTERFACE == m_td.get()->eTypeClass ); + assert( m_td.get()->eTypeClass == typelib_TypeClass_INTERFACE ); OUString const & uno_name = OUString::unacquired( &m_td.get()->pTypeName ); JNI_info const * jni_info = jni.get_info(); @@ -115,8 +115,8 @@ JNI_interface_type_info::JNI_interface_type_info( OStringBuffer sig_buf( 64 ); - if (typelib_TypeClass_INTERFACE_METHOD == - member_td.get()->eTypeClass) // method + if (member_td.get()->eTypeClass == + typelib_TypeClass_INTERFACE_METHOD) // method { typelib_InterfaceMethodTypeDescription * method_td = reinterpret_cast< @@ -145,14 +145,14 @@ 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( nullptr != m_methods[ nMethodIndex ] ); + assert( m_methods[ nMethodIndex ] != nullptr ); ++nMethodIndex; } else // attribute { assert( - typelib_TypeClass_INTERFACE_ATTRIBUTE == - member_td.get()->eTypeClass ); + member_td.get()->eTypeClass == + typelib_TypeClass_INTERFACE_ATTRIBUTE ); typelib_InterfaceAttributeTypeDescription * attribute_td = reinterpret_cast< typelib_InterfaceAttributeTypeDescription * >( @@ -183,7 +183,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( nullptr != m_methods[ nMethodIndex ] ); + assert( m_methods[ nMethodIndex ] != nullptr ); ++nMethodIndex; if (! attribute_td->bReadOnly) { @@ -203,7 +203,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( nullptr != m_methods[ nMethodIndex ] ); + assert( m_methods[ nMethodIndex ] != nullptr ); ++nMethodIndex; } } @@ -235,8 +235,8 @@ JNI_compound_type_info::JNI_compound_type_info( m_exc_ctor( nullptr ), m_fields( nullptr ) { - assert( typelib_TypeClass_STRUCT == m_td.get()->eTypeClass || - typelib_TypeClass_EXCEPTION == m_td.get()->eTypeClass ); + assert( m_td.get()->eTypeClass == typelib_TypeClass_STRUCT || + m_td.get()->eTypeClass == typelib_TypeClass_EXCEPTION ); typelib_CompoundTypeDescription * td = reinterpret_cast< typelib_CompoundTypeDescription * >( m_td.get() ); @@ -260,13 +260,13 @@ JNI_compound_type_info::JNI_compound_type_info( JNI_info const * jni_info = jni.get_info(); - if (typelib_TypeClass_EXCEPTION == m_td.get()->eTypeClass) + if (m_td.get()->eTypeClass == typelib_TypeClass_EXCEPTION) { // retrieve exc ctor( msg ) m_exc_ctor = jni->GetMethodID( static_cast<jclass>(jo_class.get()), "<init>", "(Ljava/lang/String;)V" ); jni.ensure_no_exception(); - assert( nullptr != m_exc_ctor ); + assert( m_exc_ctor != nullptr ); } // retrieve info for base type @@ -277,7 +277,7 @@ JNI_compound_type_info::JNI_compound_type_info( ? nullptr : reinterpret_cast< typelib_TypeDescription * >( td->pBaseTypeDescription ); - m_base = (nullptr == base_td ? nullptr : jni_info->get_type_info( jni, base_td )); + m_base = (base_td == nullptr ? nullptr : jni_info->get_type_info( jni, base_td )); try { @@ -295,7 +295,7 @@ JNI_compound_type_info::JNI_compound_type_info( m_fields[ 1 ] = jni->GetFieldID( static_cast<jclass>(jo_class.get()), "Context", "Ljava/lang/Object;" ); jni.ensure_no_exception(); - assert( nullptr != m_fields[ 1 ] ); + assert( m_fields[ 1 ] != nullptr ); } else { @@ -328,7 +328,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( nullptr != m_fields[ nPos ] ); + assert( m_fields[ nPos ] != nullptr ); } } } @@ -372,7 +372,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 (nullptr == holder.m_info) // new insertion + if (holder.m_info == nullptr) // new insertion { holder.m_info = new_info; guard.clear(); @@ -539,162 +539,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( nullptr != m_method_Object_toString ); + assert( m_method_Object_toString != nullptr ); // method Class.getName() m_method_Class_getName = jni->GetMethodID( static_cast<jclass>(jo_Class.get()), "getName", "()Ljava/lang/String;" ); jni.ensure_no_exception(); - assert( nullptr != m_method_Class_getName ); + assert( m_method_Class_getName != nullptr ); // method Throwable.getMessage() m_method_Throwable_getMessage = jni->GetMethodID( static_cast<jclass>(jo_Throwable.get()), "getMessage", "()Ljava/lang/String;" ); jni.ensure_no_exception(); - assert( nullptr != m_method_Throwable_getMessage ); + assert( m_method_Throwable_getMessage != nullptr ); // method Character.charValue() m_method_Character_charValue = jni->GetMethodID( static_cast<jclass>(jo_Character.get()), "charValue", "()C" ); jni.ensure_no_exception(); - assert( nullptr != m_method_Character_charValue ); + assert( m_method_Character_charValue != nullptr ); // method Boolean.booleanValue() m_method_Boolean_booleanValue = jni->GetMethodID( static_cast<jclass>(jo_Boolean.get()), "booleanValue", "()Z" ); jni.ensure_no_exception(); - assert( nullptr != m_method_Boolean_booleanValue ); + assert( m_method_Boolean_booleanValue != nullptr ); // method Byte.byteValue() m_method_Byte_byteValue = jni->GetMethodID( static_cast<jclass>(jo_Byte.get()), "byteValue", "()B" ); jni.ensure_no_exception(); - assert( nullptr != m_method_Byte_byteValue ); + assert( m_method_Byte_byteValue != nullptr ); // method Short.shortValue() m_method_Short_shortValue = jni->GetMethodID( static_cast<jclass>(jo_Short.get()), "shortValue", "()S" ); jni.ensure_no_exception(); - assert( nullptr != m_method_Short_shortValue ); + assert( m_method_Short_shortValue != nullptr ); // method Integer.intValue() m_method_Integer_intValue = jni->GetMethodID( static_cast<jclass>(jo_Integer.get()), "intValue", "()I" ); jni.ensure_no_exception(); - assert( nullptr != m_method_Integer_intValue ); + assert( m_method_Integer_intValue != nullptr ); // method Long.longValue() m_method_Long_longValue = jni->GetMethodID( static_cast<jclass>(jo_Long.get()), "longValue", "()J" ); jni.ensure_no_exception(); - assert( nullptr != m_method_Long_longValue ); + assert( m_method_Long_longValue != nullptr ); // method Float.floatValue() m_method_Float_floatValue = jni->GetMethodID( static_cast<jclass>(jo_Float.get()), "floatValue", "()F" ); jni.ensure_no_exception(); - assert( nullptr != m_method_Float_floatValue ); + assert( m_method_Float_floatValue != nullptr ); // method Double.doubleValue() m_method_Double_doubleValue = jni->GetMethodID( static_cast<jclass>(jo_Double.get()), "doubleValue", "()D" ); jni.ensure_no_exception(); - assert( nullptr != m_method_Double_doubleValue ); + assert( m_method_Double_doubleValue != nullptr ); // ctor Character( char ) m_ctor_Character_with_char = jni->GetMethodID( static_cast<jclass>(jo_Character.get()), "<init>", "(C)V" ); jni.ensure_no_exception(); - assert( nullptr != m_ctor_Character_with_char ); + assert( m_ctor_Character_with_char != nullptr ); // ctor Boolean( boolean ) m_ctor_Boolean_with_boolean = jni->GetMethodID( static_cast<jclass>(jo_Boolean.get()), "<init>", "(Z)V" ); jni.ensure_no_exception(); - assert( nullptr != m_ctor_Boolean_with_boolean ); + assert( m_ctor_Boolean_with_boolean != nullptr ); // ctor Byte( byte ) m_ctor_Byte_with_byte = jni->GetMethodID( static_cast<jclass>(jo_Byte.get()), "<init>", "(B)V" ); jni.ensure_no_exception(); - assert( nullptr != m_ctor_Byte_with_byte ); + assert( m_ctor_Byte_with_byte != nullptr ); // ctor Short( short ) m_ctor_Short_with_short = jni->GetMethodID( static_cast<jclass>(jo_Short.get()), "<init>", "(S)V" ); jni.ensure_no_exception(); - assert( nullptr != m_ctor_Short_with_short ); + assert( m_ctor_Short_with_short != nullptr ); // ctor Integer( int ) m_ctor_Integer_with_int = jni->GetMethodID( static_cast<jclass>(jo_Integer.get()), "<init>", "(I)V" ); jni.ensure_no_exception(); - assert( nullptr != m_ctor_Integer_with_int ); + assert( m_ctor_Integer_with_int != nullptr ); // ctor Long( long ) m_ctor_Long_with_long = jni->GetMethodID( static_cast<jclass>(jo_Long.get()), "<init>", "(J)V" ); jni.ensure_no_exception(); - assert( nullptr != m_ctor_Long_with_long ); + assert( m_ctor_Long_with_long != nullptr ); // ctor Float( float ) m_ctor_Float_with_float = jni->GetMethodID( static_cast<jclass>(jo_Float.get()), "<init>", "(F)V" ); jni.ensure_no_exception(); - assert( nullptr != m_ctor_Float_with_float ); + assert( m_ctor_Float_with_float != nullptr ); // ctor Double( double ) m_ctor_Double_with_double = jni->GetMethodID( static_cast<jclass>(jo_Double.get()), "<init>", "(D)V" ); jni.ensure_no_exception(); - assert( nullptr != m_ctor_Double_with_double ); + assert( m_ctor_Double_with_double != nullptr ); // 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( nullptr != m_method_UnoRuntime_generateOid ); + assert( m_method_UnoRuntime_generateOid != nullptr ); // 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( nullptr != m_method_UnoRuntime_queryInterface ); + assert( m_method_UnoRuntime_queryInterface != nullptr ); // 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( nullptr != m_field_Enum_m_value ); + assert( m_field_Enum_m_value != nullptr ); // 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( nullptr != m_method_TypeClass_fromInt ); + assert( m_method_TypeClass_fromInt != nullptr ); // 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( nullptr != m_ctor_Type_with_Class ); + assert( m_ctor_Type_with_Class != nullptr ); // 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( nullptr != m_ctor_Type_with_Name_TypeClass ); + assert( m_ctor_Type_with_Name_TypeClass != nullptr ); // field Type._typeName m_field_Type_typeName = jni->GetFieldID( static_cast<jclass>(jo_Type.get()), "_typeName", "Ljava/lang/String;" ); jni.ensure_no_exception(); - assert( nullptr != m_field_Type_typeName ); + assert( m_field_Type_typeName != nullptr ); // 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( nullptr != m_ctor_Any_with_Type_Object ); + assert( m_ctor_Any_with_Type_Object != nullptr ); // 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( nullptr != m_field_Any_type ); + assert( m_field_Any_type != nullptr ); // field Any._object m_field_Any_object = jni->GetFieldID( static_cast<jclass>(jo_Any.get()), "_object", "Ljava/lang/Object;" ); jni.ensure_no_exception(); - assert( nullptr != m_field_Any_object ); + assert( m_field_Any_object != nullptr ); // method IEnvironment.getRegisteredInterface() m_method_IEnvironment_getRegisteredInterface = jni->GetMethodID( @@ -702,21 +702,21 @@ JNI_info::JNI_info( "getRegisteredInterface", "(Ljava/lang/String;Lcom/sun/star/uno/Type;)Ljava/lang/Object;" ); jni.ensure_no_exception(); - assert( nullptr != m_method_IEnvironment_getRegisteredInterface ); + assert( m_method_IEnvironment_getRegisteredInterface != nullptr ); // 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( nullptr != m_method_IEnvironment_registerInterface ); + assert( m_method_IEnvironment_registerInterface != nullptr ); // 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( nullptr != m_method_JNI_proxy_get_proxy_ctor ); + assert( m_method_JNI_proxy_get_proxy_ctor != nullptr ); // static method JNI_proxy.create() m_method_JNI_proxy_create = jni->GetStaticMethodID( static_cast<jclass>(jo_JNI_proxy.get()), "create", @@ -724,38 +724,38 @@ JNI_info::JNI_info( "/String;Ljava/lang/reflect/Constructor;" "Lcom/sun/star/lib/util/AsynchronousFinalizer;)Ljava/lang/Object;" ); jni.ensure_no_exception(); - assert( nullptr != m_method_JNI_proxy_create ); + assert( m_method_JNI_proxy_create != nullptr ); // 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( nullptr != m_field_JNI_proxy_m_receiver_handle ); + assert( m_field_JNI_proxy_m_receiver_handle != nullptr ); // 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( nullptr != m_field_JNI_proxy_m_td_handle ); + assert( m_field_JNI_proxy_m_td_handle != nullptr ); // 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( nullptr != m_field_JNI_proxy_m_type ); + assert( m_field_JNI_proxy_m_type != nullptr ); // 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( nullptr != m_field_JNI_proxy_m_oid ); + assert( m_field_JNI_proxy_m_oid != nullptr ); // ctor AsynchronousFinalizer m_ctor_AsynchronousFinalizer = jni->GetMethodID( static_cast<jclass>(jo_AsynchronousFinalizer.get()), "<init>", "()V" ); jni.ensure_no_exception(); - assert( nullptr != m_ctor_AsynchronousFinalizer ); + assert( m_ctor_AsynchronousFinalizer != nullptr ); // method AsynchronousFinalizer.drain() m_method_AsynchronousFinalizer_drain = jni->GetMethodID( static_cast<jclass>(jo_AsynchronousFinalizer.get()), "drain", "()V" ); jni.ensure_no_exception(); - assert( nullptr != m_method_AsynchronousFinalizer_drain ); + assert( m_method_AsynchronousFinalizer_drain != nullptr ); // get java env OUString java_env_type_name( UNO_LB_JAVA ); @@ -769,7 +769,7 @@ JNI_info::JNI_info( "(Ljava/lang/String;Ljava/lang/Object;)" "Lcom/sun/star/uno/IEnvironment;" ); jni.ensure_no_exception(); - assert( nullptr != method_getEnvironment ); + assert( method_getEnvironment != nullptr ); JLocalAutoRef jo_java_env( jni, jni->CallStaticObjectMethodA( static_cast<jclass>(jo_UnoRuntime.get()), method_getEnvironment, args ) ); @@ -778,7 +778,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( nullptr != field_Any_VOID ); + assert( field_Any_VOID != nullptr ); JLocalAutoRef jo_Any_VOID( jni, jni->GetStaticObjectField( static_cast<jclass>(jo_Any.get()), field_Any_VOID ) ); @@ -786,7 +786,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( nullptr != field_Type_UNSIGNED_SHORT ); + assert( field_Type_UNSIGNED_SHORT != nullptr ); JLocalAutoRef jo_Type_UNSIGNED_SHORT( jni, jni->GetStaticObjectField( static_cast<jclass>(jo_Type.get()), field_Type_UNSIGNED_SHORT ) ); @@ -794,7 +794,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( nullptr != field_Type_UNSIGNED_LONG ); + assert( field_Type_UNSIGNED_LONG != nullptr ); JLocalAutoRef jo_Type_UNSIGNED_LONG( jni, jni->GetStaticObjectField( static_cast<jclass>(jo_Type.get()), field_Type_UNSIGNED_LONG ) ); @@ -802,7 +802,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( nullptr != field_Type_UNSIGNED_HYPER ); + assert( field_Type_UNSIGNED_HYPER != nullptr ); JLocalAutoRef jo_Type_UNSIGNED_HYPER( jni, jni->GetStaticObjectField( static_cast<jclass>(jo_Type.get()), field_Type_UNSIGNED_HYPER ) ); @@ -878,7 +878,7 @@ void JNI_info::destruct( JNIEnv * jni_env ) { i.second.m_info->destroy( jni_env ); } - if (nullptr != m_XInterface_type_info) + if (m_XInterface_type_info != nullptr) { const_cast< JNI_interface_type_info * >( m_XInterface_type_info )->destroy( jni_env ); @@ -937,13 +937,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( nullptr != field_s_jni_info_handle ); + assert( field_s_jni_info_handle != nullptr ); 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 (nullptr == jni_info) // un-initialized? + if (jni_info == nullptr) // un-initialized? { JNI_info * new_info = new JNI_info( jni_env, static_cast< jobject >(uno_vm->getClassLoader()), jo_class, @@ -955,7 +955,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 (nullptr == jni_info) // still un-initialized? + if (jni_info == nullptr) // 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_java2uno.cxx b/bridges/source/jni_uno/jni_java2uno.cxx index 98fb8f5bcd00..48219c4fec09 100644 --- a/bridges/source/jni_uno/jni_java2uno.cxx +++ b/bridges/source/jni_uno/jni_java2uno.cxx @@ -38,7 +38,7 @@ jobject Bridge::map_to_java( // get oid rtl_uString * pOid = nullptr; (*m_uno_env->getObjectIdentifier)( m_uno_env, &pOid, pUnoI ); - assert( nullptr != pOid ); + assert( pOid != nullptr ); 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 (nullptr == jo_iface) // no registered iface + if (jo_iface == nullptr) // no registered iface { // register uno interface (*m_uno_env->registerInterface)( @@ -82,14 +82,14 @@ jobject Bridge::map_to_java( jni.ensure_no_exception(); } - assert( nullptr != jo_iface ); + assert( jo_iface != nullptr ); return jo_iface; } void Bridge::handle_uno_exc( JNI_context const & jni, uno_Any * uno_exc ) const { - if (typelib_TypeClass_EXCEPTION == uno_exc->pType->eTypeClass) + if (uno_exc->pType->eTypeClass == typelib_TypeClass_EXCEPTION) { #if OSL_DEBUG_LEVEL > 0 // append java stack trace to Message member @@ -119,7 +119,7 @@ void Bridge::handle_uno_exc( JNI_context const & jni, uno_Any * uno_exc ) const JLocalAutoRef jo_exc( jni, java_exc.l ); jint res = jni->Throw( static_cast<jthrowable>(jo_exc.get()) ); - if (0 != res) + if (res != 0) { // call toString() JLocalAutoRef jo_descr( @@ -186,15 +186,15 @@ jobject Bridge::call_uno( largest * uno_args_mem = reinterpret_cast<largest *> (mem + (nParams * sizeof (void *)) + return_size); - assert( (0 == nParams) || (nParams == jni->GetArrayLength( jo_args )) ); + assert( (nParams == 0) || (nParams == jni->GetArrayLength( jo_args )) ); for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) { typelib_MethodParameter const & param = pParams[ nPos ]; typelib_TypeDescriptionReference * type = param.pTypeRef; uno_args[ nPos ] = &uno_args_mem[ nPos ]; - if (typelib_TypeClass_STRUCT == type->eTypeClass || - typelib_TypeClass_EXCEPTION == type->eTypeClass) + if (type->eTypeClass == typelib_TypeClass_STRUCT || + type->eTypeClass == typelib_TypeClass_EXCEPTION) { TypeDescr td( type ); if (sal::static_int_cast< sal_uInt32 >(td.get()->nSize) @@ -238,7 +238,7 @@ jobject Bridge::call_uno( // call binary uno (*pUnoI->pDispatcher)( pUnoI, member_td, uno_ret, uno_args, &uno_exc ); - if (nullptr == uno_exc) + if (uno_exc == nullptr) { // convert out args; destruct uno args for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) @@ -273,13 +273,13 @@ jobject Bridge::call_uno( } } if (typelib_TypeClass_DOUBLE < type->eTypeClass && - typelib_TypeClass_ENUM != type->eTypeClass) // opt + type->eTypeClass != typelib_TypeClass_ENUM) // opt { uno_type_destructData( uno_args[ nPos ], type, nullptr ); } } - if (typelib_TypeClass_VOID != return_type->eTypeClass) + if (return_type->eTypeClass != typelib_TypeClass_VOID) { // convert uno return value jvalue java_ret; @@ -296,7 +296,7 @@ jobject Bridge::call_uno( throw; } if (typelib_TypeClass_DOUBLE < return_type->eTypeClass && - typelib_TypeClass_ENUM != return_type->eTypeClass) // opt + return_type->eTypeClass != typelib_TypeClass_ENUM) // opt { uno_type_destructData( uno_ret, return_type, nullptr ); } @@ -381,7 +381,7 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( jstring_to_oustring( jni, static_cast<jstring>(jo_type_name.get()) ) ); JNI_type_info const * info = jni_info->get_type_info( jni, type_name ); - if (typelib_TypeClass_INTERFACE != info->m_td.get()->eTypeClass) + if (info->m_td.get()->eTypeClass != typelib_TypeClass_INTERFACE) { throw BridgeRuntimeError( "queryInterface() call demands an INTERFACE type!" ); @@ -403,14 +403,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 (nullptr == uno_exc) + if (uno_exc == nullptr) { jobject jo_ret = nullptr; - if (typelib_TypeClass_INTERFACE == uno_ret.pType->eTypeClass) + if (uno_ret.pType->eTypeClass == typelib_TypeClass_INTERFACE) { uno_Interface * pUnoRet = static_cast<uno_Interface *>(uno_ret.pReserved); - if (nullptr != pUnoRet) + if (pUnoRet != nullptr) { try { @@ -462,7 +462,7 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( assert(offset < type_name.getLength()); assert(type_name[offset - 1] == ':' ); sal_Int32 remainder = type_name.getLength() - offset; - if (typelib_TypeClass_INTERFACE_METHOD == member_type->eTypeClass) + if (member_type->eTypeClass == typelib_TypeClass_INTERFACE_METHOD) { if ((method_name.getLength() == remainder || (method_name.getLength() < remainder @@ -484,8 +484,8 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( else // attribute { assert( - typelib_TypeClass_INTERFACE_ATTRIBUTE == - member_type->eTypeClass ); + member_type->eTypeClass == + typelib_TypeClass_INTERFACE_ATTRIBUTE ); if (method_name.getLength() >= 3 && (method_name.getLength() - 3 == remainder @@ -499,7 +499,7 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( method_name.getStr() + 3, method_name.getLength() - 3) == 0) { - if ('g' == method_name[ 0 ]) + if (method_name[ 0 ] == 'g') { TypeDescr member_td( member_type ); typelib_InterfaceAttributeTypeDescription * attr_td = @@ -512,7 +512,7 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( 0, nullptr, jo_args ); } - else if ('s' == method_name[ 0 ]) + else if (method_name[ 0 ] == 's') { TypeDescr member_td( member_type ); typelib_InterfaceAttributeTypeDescription * attr_td = diff --git a/bridges/source/jni_uno/jni_uno2java.cxx b/bridges/source/jni_uno/jni_uno2java.cxx index 730a9a338532..58edc8dde002 100644 --- a/bridges/source/jni_uno/jni_uno2java.cxx +++ b/bridges/source/jni_uno/jni_uno2java.cxx @@ -81,7 +81,7 @@ void Bridge::handle_java_exc( jstring_to_oustring( jni, static_cast<jstring>(jo_class_name.get()) ) ); ::com::sun::star::uno::TypeDescription td( exc_name.pData ); - if (!td.is() || (typelib_TypeClass_EXCEPTION != td.get()->eTypeClass)) + if (!td.is() || (td.get()->eTypeClass != typelib_TypeClass_EXCEPTION)) { // call toString() JLocalAutoRef jo_descr( @@ -438,7 +438,7 @@ inline UNO_proxy::UNO_proxy( inline void UNO_proxy::acquire() const { - if (1 == osl_atomic_increment( &m_ref )) + if (osl_atomic_increment( &m_ref ) == 1) { // rebirth of proxy zombie void * that = const_cast< UNO_proxy * >( this ); @@ -454,7 +454,7 @@ inline void UNO_proxy::acquire() const inline void UNO_proxy::release() const { - if (0 == osl_atomic_decrement( &m_ref )) + if (osl_atomic_decrement( &m_ref ) == 0) { // revoke from uno env on last release (*m_bridge->m_uno_env->revokeInterface)( @@ -475,7 +475,7 @@ uno_Interface * Bridge::map_to_uno( m_uno_env, reinterpret_cast<void **>(&pUnoI), oid.pData, reinterpret_cast<typelib_InterfaceTypeDescription *>(info->m_td.get()) ); - if (nullptr == pUnoI) // no existing interface, register new proxy + if (pUnoI == nullptr) // no existing interface, register new proxy { // refcount initially 1 pUnoI = new UNO_proxy( @@ -590,7 +590,7 @@ void SAL_CALL UNO_proxy_dispatch( } typelib_InterfaceTypeDescription * iface_td = attrib_td->pInterface; - if (nullptr == uno_ret) // is setter method + if (uno_ret == nullptr) // is setter method { typelib_MethodParameter param; param.pTypeRef = attrib_td->pAttributeTypeRef; @@ -640,8 +640,8 @@ void SAL_CALL UNO_proxy_dispatch( TypeDescr demanded_td( *static_cast< typelib_TypeDescriptionReference ** >( uno_args[ 0 ] ) ); - if (typelib_TypeClass_INTERFACE != - demanded_td.get()->eTypeClass) + if (demanded_td.get()->eTypeClass != + typelib_TypeClass_INTERFACE) { throw BridgeRuntimeError( "queryInterface() call demands an INTERFACE type!" ); @@ -653,7 +653,7 @@ void SAL_CALL UNO_proxy_dispatch( reinterpret_cast<void **>(&pInterface), that->m_oid.pData, reinterpret_cast<typelib_InterfaceTypeDescription *>(demanded_td.get()) ); - if (nullptr == pInterface) + if (pInterface == nullptr) { JNI_info const * jni_info = bridge->getJniInfo(); JNI_guarded_context jni( @@ -762,8 +762,8 @@ void SAL_CALL UNO_proxy_dispatch( { OUStringBuffer buf( 128 ); buf.append( "[jni_uno bridge error] UNO calling Java method " ); - if (typelib_TypeClass_INTERFACE_METHOD == member_td->eTypeClass || - typelib_TypeClass_INTERFACE_ATTRIBUTE == member_td->eTypeClass) + if (member_td->eTypeClass == typelib_TypeClass_INTERFACE_METHOD || + member_td->eTypeClass == typelib_TypeClass_INTERFACE_ATTRIBUTE) { buf.append( OUString::unacquired( &reinterpret_cast< |