Kaydet (Commit) 79a359fe authored tarafından Stephan Bergmann's avatar Stephan Bergmann

jboolean-related clean-up

Change-Id: Iecd03d0343b9b7c3a8b23b5a1e9654148b94d44c
üst 1cb0b37a
...@@ -87,7 +87,7 @@ SAL_DLLPUBLIC_EXPORT jlong JNICALL Java_com_sun_star_comp_beans_LocalOfficeWindo ...@@ -87,7 +87,7 @@ SAL_DLLPUBLIC_EXPORT jlong JNICALL Java_com_sun_star_comp_beans_LocalOfficeWindo
/* Get the AWT */ /* Get the AWT */
awt.version = JAWT_VERSION_1_3; awt.version = JAWT_VERSION_1_3;
result = JAWT_GetAWT(env, &awt); result = JAWT_GetAWT(env, &awt);
if (result == JNI_FALSE) if (!result)
ThrowException(env, "java/lang/RuntimeException", "JAWT_GetAWT failed"); ThrowException(env, "java/lang/RuntimeException", "JAWT_GetAWT failed");
/* Get the drawing surface */ /* Get the drawing surface */
......
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
inline void JNI_context::ensure_no_exception() const inline void JNI_context::ensure_no_exception() const
{ {
if (JNI_FALSE != m_env->ExceptionCheck()) if (m_env->ExceptionCheck())
{ {
java_exc_occurred(); java_exc_occurred();
} }
...@@ -104,7 +104,7 @@ inline void JNI_context::ensure_no_exception() const ...@@ -104,7 +104,7 @@ inline void JNI_context::ensure_no_exception() const
inline bool JNI_context::assert_no_exception() const inline bool JNI_context::assert_no_exception() const
{ {
if (JNI_FALSE != m_env->ExceptionCheck()) if (m_env->ExceptionCheck())
{ {
SAL_WARN("bridges", "unexpected java exception occurred"); SAL_WARN("bridges", "unexpected java exception occurred");
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
......
...@@ -288,7 +288,7 @@ void JNI_context::java_exc_occurred() const ...@@ -288,7 +288,7 @@ void JNI_context::java_exc_occurred() const
// call toString(); don't rely on m_jni_info // call toString(); don't rely on m_jni_info
jclass jo_class = m_env->FindClass( "java/lang/Object" ); jclass jo_class = m_env->FindClass( "java/lang/Object" );
if (JNI_FALSE != m_env->ExceptionCheck()) if (m_env->ExceptionCheck())
{ {
m_env->ExceptionClear(); m_env->ExceptionClear();
throw BridgeRuntimeError( throw BridgeRuntimeError(
...@@ -298,7 +298,7 @@ void JNI_context::java_exc_occurred() const ...@@ -298,7 +298,7 @@ void JNI_context::java_exc_occurred() const
// method Object.toString() // method Object.toString()
jmethodID method_Object_toString = m_env->GetMethodID( jmethodID method_Object_toString = m_env->GetMethodID(
static_cast<jclass>(jo_Object.get()), "toString", "()Ljava/lang/String;" ); static_cast<jclass>(jo_Object.get()), "toString", "()Ljava/lang/String;" );
if (JNI_FALSE != m_env->ExceptionCheck()) if (m_env->ExceptionCheck())
{ {
m_env->ExceptionClear(); m_env->ExceptionClear();
throw BridgeRuntimeError( throw BridgeRuntimeError(
...@@ -523,8 +523,8 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( ...@@ -523,8 +523,8 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping(
*ppMapping = 0; *ppMapping = 0;
} }
static_assert(JNI_FALSE == sal_False, "must be equal"); static_assert(int(JNI_FALSE) == int(sal_False), "must be equal");
static_assert(JNI_TRUE == sal_True, "must be equal"); static_assert(int(JNI_TRUE) == int(sal_True), "must be equal");
static_assert(sizeof (jboolean) == sizeof (sal_Bool), "must be the same size"); static_assert(sizeof (jboolean) == sizeof (sal_Bool), "must be the same size");
static_assert(sizeof (jchar) == sizeof (sal_Unicode), "must be the same size"); static_assert(sizeof (jchar) == sizeof (sal_Unicode), "must be the same size");
static_assert(sizeof (jdouble) == sizeof (double), "must be the same size"); static_assert(sizeof (jdouble) == sizeof (double), "must be the same size");
......
...@@ -461,8 +461,7 @@ void Bridge::map_to_uno( ...@@ -461,8 +461,7 @@ void Bridge::map_to_uno(
JLocalAutoRef jo_type( jni ); JLocalAutoRef jo_type( jni );
JLocalAutoRef jo_wrapped_holder( jni ); JLocalAutoRef jo_wrapped_holder( jni );
if (JNI_FALSE != jni->IsInstanceOf( if (jni->IsInstanceOf( java_data.l, getJniInfo()->m_class_Any ))
java_data.l, getJniInfo()->m_class_Any ))
{ {
// boxed any // boxed any
jo_type.reset( jni->GetObjectField( jo_type.reset( jni->GetObjectField(
......
...@@ -428,7 +428,7 @@ void write_to_storage_stream_from_buffer( JNIEnv* env, jobject /*obj_this*/, jst ...@@ -428,7 +428,7 @@ void write_to_storage_stream_from_buffer( JNIEnv* env, jobject /*obj_this*/, jst
if ( xOut.is() ) if ( xOut.is() )
{ {
jbyte *buf = env->GetByteArrayElements(buffer,NULL); jbyte *buf = env->GetByteArrayElements(buffer,NULL);
if (JNI_FALSE != env->ExceptionCheck()) if (env->ExceptionCheck())
{ {
env->ExceptionClear(); env->ExceptionClear();
OSL_FAIL("ExceptionClear"); OSL_FAIL("ExceptionClear");
......
...@@ -139,7 +139,7 @@ namespace connectivity ...@@ -139,7 +139,7 @@ namespace connectivity
OUString StorageContainer::jstring2ustring(JNIEnv * env, jstring jstr) OUString StorageContainer::jstring2ustring(JNIEnv * env, jstring jstr)
{ {
if (JNI_FALSE != env->ExceptionCheck()) if (env->ExceptionCheck())
{ {
env->ExceptionClear(); env->ExceptionClear();
OSL_FAIL("ExceptionClear"); OSL_FAIL("ExceptionClear");
...@@ -156,7 +156,7 @@ namespace connectivity ...@@ -156,7 +156,7 @@ namespace connectivity
env->ReleaseStringChars(jstr,pChar); env->ReleaseStringChars(jstr,pChar);
} }
if (JNI_FALSE != env->ExceptionCheck()) if (env->ExceptionCheck())
{ {
env->ExceptionClear(); env->ExceptionClear();
OSL_FAIL("ExceptionClear"); OSL_FAIL("ExceptionClear");
...@@ -334,7 +334,7 @@ namespace connectivity ...@@ -334,7 +334,7 @@ namespace connectivity
void StorageContainer::throwJavaException(const Exception& _aException,JNIEnv * env) void StorageContainer::throwJavaException(const Exception& _aException,JNIEnv * env)
{ {
if (JNI_FALSE != env->ExceptionCheck()) if (env->ExceptionCheck())
env->ExceptionClear(); env->ExceptionClear();
OString cstr( OUStringToOString(_aException.Message, RTL_TEXTENCODING_JAVA_UTF8 ) ); OString cstr( OUStringToOString(_aException.Message, RTL_TEXTENCODING_JAVA_UTF8 ) );
OSL_TRACE( __FILE__": forwarding Exception: %s", cstr.getStr() ); OSL_TRACE( __FILE__": forwarding Exception: %s", cstr.getStr() );
......
...@@ -76,7 +76,7 @@ extern "C" SAL_JNI_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_S ...@@ -76,7 +76,7 @@ extern "C" SAL_JNI_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_S
catch(const Exception& e) catch(const Exception& e)
{ {
OSL_FAIL("Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement"); OSL_FAIL("Exception caught! : Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement");
if (JNI_FALSE != env->ExceptionCheck()) if (env->ExceptionCheck())
env->ExceptionClear(); env->ExceptionClear();
OString cstr( OUStringToOString(e.Message, RTL_TEXTENCODING_JAVA_UTF8 ) ); OString cstr( OUStringToOString(e.Message, RTL_TEXTENCODING_JAVA_UTF8 ) );
OSL_TRACE( __FILE__": forwarding Exception: %s", cstr.getStr() ); OSL_TRACE( __FILE__": forwarding Exception: %s", cstr.getStr() );
...@@ -109,7 +109,7 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stora ...@@ -109,7 +109,7 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stora
} }
catch(const NoSuchElementException&) catch(const NoSuchElementException&)
{ {
if (JNI_FALSE != env->ExceptionCheck()) if (env->ExceptionCheck())
env->ExceptionClear(); env->ExceptionClear();
} }
catch(const Exception& e) catch(const Exception& e)
......
...@@ -54,7 +54,7 @@ inline OUString jstring_to_oustring( jstring jstr, JNIEnv * jni_env ) ...@@ -54,7 +54,7 @@ inline OUString jstring_to_oustring( jstring jstr, JNIEnv * jni_env )
rtl_uString * ustr = rtl_uString * ustr =
static_cast<rtl_uString *>(rtl_allocateMemory( sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) )); static_cast<rtl_uString *>(rtl_allocateMemory( sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ));
jni_env->GetStringRegion( jstr, 0, len, ustr->buffer ); jni_env->GetStringRegion( jstr, 0, len, ustr->buffer );
OSL_ASSERT( JNI_FALSE == jni_env->ExceptionCheck() ); OSL_ASSERT( !jni_env->ExceptionCheck() );
ustr->refCount = 1; ustr->refCount = 1;
ustr->length = len; ustr->length = len;
ustr->buffer[ len ] = '\0'; ustr->buffer[ len ] = '\0';
...@@ -77,7 +77,7 @@ jobject Java_com_sun_star_comp_helper_Bootstrap_cppuhelper_1bootstrap( ...@@ -77,7 +77,7 @@ jobject Java_com_sun_star_comp_helper_Bootstrap_cppuhelper_1bootstrap(
{ {
// name // name
jstring jstr = static_cast<jstring>(jni_env->GetObjectArrayElement( jpairs, nPos )); jstring jstr = static_cast<jstring>(jni_env->GetObjectArrayElement( jpairs, nPos ));
if (JNI_FALSE != jni_env->ExceptionCheck()) if (jni_env->ExceptionCheck())
{ {
jni_env->ExceptionClear(); jni_env->ExceptionClear();
throw RuntimeException( "index out of bounds?!" ); throw RuntimeException( "index out of bounds?!" );
...@@ -87,7 +87,7 @@ jobject Java_com_sun_star_comp_helper_Bootstrap_cppuhelper_1bootstrap( ...@@ -87,7 +87,7 @@ jobject Java_com_sun_star_comp_helper_Bootstrap_cppuhelper_1bootstrap(
OUString name( ::javaunohelper::jstring_to_oustring( jstr, jni_env ) ); OUString name( ::javaunohelper::jstring_to_oustring( jstr, jni_env ) );
// value // value
jstr = static_cast<jstring>(jni_env->GetObjectArrayElement( jpairs, nPos +1 )); jstr = static_cast<jstring>(jni_env->GetObjectArrayElement( jpairs, nPos +1 ));
if (JNI_FALSE != jni_env->ExceptionCheck()) if (jni_env->ExceptionCheck())
{ {
jni_env->ExceptionClear(); jni_env->ExceptionClear();
throw RuntimeException( "index out of bounds?!" ); throw RuntimeException( "index out of bounds?!" );
......
...@@ -1248,14 +1248,14 @@ void SAL_CALL JavaVirtualMachine::elementReplaced( ...@@ -1248,14 +1248,14 @@ void SAL_CALL JavaVirtualMachine::elementReplaced(
jstring jsClass= static_cast<jstring>(pJNIEnv->CallObjectMethod( jcSec, jmName)); jstring jsClass= static_cast<jstring>(pJNIEnv->CallObjectMethod( jcSec, jmName));
const jchar* jcharName= pJNIEnv->GetStringChars( jsClass, NULL); const jchar* jcharName= pJNIEnv->GetStringChars( jsClass, NULL);
OUString sName( jcharName); OUString sName( jcharName);
jboolean bIsSandbox; bool bIsSandbox;
if ( sName == "com.sun.star.lib.sandbox.SandboxSecurity" ) if ( sName == "com.sun.star.lib.sandbox.SandboxSecurity" )
bIsSandbox= JNI_TRUE; bIsSandbox= true;
else else
bIsSandbox= JNI_FALSE; bIsSandbox= false;
pJNIEnv->ReleaseStringChars( jsClass, jcharName); pJNIEnv->ReleaseStringChars( jsClass, jcharName);
if (bIsSandbox == JNI_TRUE) if (bIsSandbox)
{ {
// call SandboxSecurity.reset // call SandboxSecurity.reset
jmethodID jmReset= pJNIEnv->GetMethodID( jcSec,"reset","()V"); jmethodID jmReset= pJNIEnv->GetMethodID( jcSec,"reset","()V");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment