diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-07-11 14:32:07 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-07-11 14:32:07 +0200 |
commit | f541b99855bd70781f8d7d655ab259ff9eb596f0 (patch) | |
tree | 162ea1823d835f484f08aaaf2390a9130a23d5e9 /bridges/source/jni_uno | |
parent | 545d5157f26b7fd3c5648ae6e727b1e1addca68f (diff) |
loplugin:nullptr: Better heuristic to determine code shared between C and C++
Change-Id: I51e1c5fa4639e51fac90f92adf3d87d12960d589
Diffstat (limited to 'bridges/source/jni_uno')
-rw-r--r-- | bridges/source/jni_uno/jni_base.h | 22 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_helper.h | 14 |
2 files changed, 18 insertions, 18 deletions
diff --git a/bridges/source/jni_uno/jni_base.h b/bridges/source/jni_uno/jni_base.h index f5b53429b705..a84701d3f2ff 100644 --- a/bridges/source/jni_uno/jni_base.h +++ b/bridges/source/jni_uno/jni_base.h @@ -91,7 +91,7 @@ public: inline void ensure_no_exception() const; // throws BridgeRuntimeError inline bool assert_no_exception() const; // asserts and clears exception - OUString get_stack_trace( jobject jo_exc = NULL ) const; + OUString get_stack_trace( jobject jo_exc = nullptr ) const; }; inline void JNI_context::ensure_no_exception() const @@ -144,7 +144,7 @@ class JLocalAutoRef public: explicit JLocalAutoRef( JNI_context const & jni ) : m_jni( jni ), - m_jo( NULL ) + m_jo( nullptr ) {} explicit JLocalAutoRef( JNI_context const & jni, jobject jo ) : m_jni( jni ), @@ -156,7 +156,7 @@ public: jobject get() const { return m_jo; } bool is() const - { return (NULL != m_jo); } + { return (nullptr != m_jo); } inline jobject release(); inline void reset( jobject jo ); inline JLocalAutoRef & operator = ( JLocalAutoRef & auto_ref ); @@ -164,7 +164,7 @@ public: inline JLocalAutoRef::~JLocalAutoRef() { - if (NULL != m_jo) + if (nullptr != m_jo) m_jni->DeleteLocalRef( m_jo ); } @@ -172,13 +172,13 @@ inline JLocalAutoRef::JLocalAutoRef( JLocalAutoRef & auto_ref ) : m_jni( auto_ref.m_jni ), m_jo( auto_ref.m_jo ) { - auto_ref.m_jo = NULL; + auto_ref.m_jo = nullptr; } inline jobject JLocalAutoRef::release() { jobject jo = m_jo; - m_jo = NULL; + m_jo = nullptr; return jo; } @@ -186,7 +186,7 @@ inline void JLocalAutoRef::reset( jobject jo ) { if (jo != m_jo) { - if (NULL != m_jo) + if (nullptr != m_jo) m_jni->DeleteLocalRef( m_jo ); m_jo = jo; } @@ -196,7 +196,7 @@ inline JLocalAutoRef & JLocalAutoRef::operator = ( JLocalAutoRef & auto_ref ) { assert( m_jni.get_jni_env() == auto_ref.m_jni.get_jni_env() ); reset( auto_ref.m_jo ); - auto_ref.m_jo = NULL; + auto_ref.m_jo = nullptr; return *this; } @@ -219,7 +219,7 @@ struct rtl_mem inline rtl_mem * rtl_mem::allocate( ::std::size_t bytes ) { void * p = rtl_allocateMemory( bytes ); - if (NULL == p) + if (nullptr == p) throw BridgeRuntimeError( "out of memory!" ); return static_cast<rtl_mem *>(p); } @@ -242,10 +242,10 @@ public: }; inline TypeDescr::TypeDescr( typelib_TypeDescriptionReference * td_ref ) - : m_td( NULL ) + : m_td( nullptr ) { TYPELIB_DANGER_GET( &m_td, td_ref ); - if (NULL == m_td) + if (nullptr == m_td) { throw BridgeRuntimeError( "cannot get comprehensive type description for " + diff --git a/bridges/source/jni_uno/jni_helper.h b/bridges/source/jni_uno/jni_helper.h index 43b0c9633b76..a31e9386d5b2 100644 --- a/bridges/source/jni_uno/jni_helper.h +++ b/bridges/source/jni_uno/jni_helper.h @@ -34,7 +34,7 @@ namespace jni_uno inline void jstring_to_ustring( JNI_context const & jni, rtl_uString ** out_ustr, jstring jstr ) { - if (NULL == jstr) + if (nullptr == jstr) { rtl_uString_new( out_ustr ); } @@ -51,7 +51,7 @@ inline void jstring_to_ustring( ustr->length = len; ustr->buffer[ len ] = '\0'; mem.release(); - if (NULL != *out_ustr) + if (nullptr != *out_ustr) rtl_uString_release( *out_ustr ); *out_ustr = ustr; } @@ -60,7 +60,7 @@ inline void jstring_to_ustring( inline OUString jstring_to_oustring( JNI_context const & jni, jstring jstr ) { - rtl_uString * ustr = NULL; + rtl_uString * ustr = nullptr; jstring_to_ustring( jni, &ustr, jstr ); return OUString( ustr, SAL_NO_ACQUIRE ); } @@ -80,14 +80,14 @@ inline jclass find_class( JNI_context const & jni, char const * class_name, bool inException = false ) { // find_class may be called before the JNI_info is set: - jclass c=NULL; + jclass c=nullptr; jmethodID m; JNI_info const * info = jni.get_info(); - if (info == NULL) { + if (info == nullptr) { jni.getClassForName(&c, &m); - if (c == NULL) { + if (c == nullptr) { if (inException) { - return NULL; + return nullptr; } jni.ensure_no_exception(); } |