diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-02-05 11:11:39 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-02-05 11:11:39 +0100 |
commit | 970df64bc975a0a8aaae19bf46157c27f34f9a35 (patch) | |
tree | 82549e71d8a016a2485fe0fb1248ce2160c2dd09 /bridges/source | |
parent | 6b127d40c7d57745bc602d9ff7914392f9d3b92b (diff) |
static assert is enough
Change-Id: I51be076119b23611f006fb4ebefd8f4bb727ded8
Diffstat (limited to 'bridges/source')
-rw-r--r-- | bridges/source/jni_uno/jni_bridge.cxx | 79 |
1 files changed, 34 insertions, 45 deletions
diff --git a/bridges/source/jni_uno/jni_bridge.cxx b/bridges/source/jni_uno/jni_bridge.cxx index 056e26937aed..7de0a7e10c8c 100644 --- a/bridges/source/jni_uno/jni_bridge.cxx +++ b/bridges/source/jni_uno/jni_bridge.cxx @@ -478,58 +478,47 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL uno_ext_getMapping( BOOST_STATIC_ASSERT( sizeof (jshort) == sizeof (sal_Int16) ); BOOST_STATIC_ASSERT( sizeof (jint) == sizeof (sal_Int32) ); BOOST_STATIC_ASSERT( sizeof (jlong) == sizeof (sal_Int64) ); - if ((JNI_FALSE == sal_False) && - (JNI_TRUE == sal_True) && - (sizeof (jboolean) == sizeof (sal_Bool)) && - (sizeof (jchar) == sizeof (sal_Unicode)) && - (sizeof (jdouble) == sizeof (double)) && - (sizeof (jfloat) == sizeof (float)) && - (sizeof (jbyte) == sizeof (sal_Int8)) && - (sizeof (jshort) == sizeof (sal_Int16)) && - (sizeof (jint) == sizeof (sal_Int32)) && - (sizeof (jlong) == sizeof (sal_Int64))) - { - OUString const & from_env_typename = - OUString::unacquired( &pFrom->pTypeName ); - OUString const & to_env_typename = - OUString::unacquired( &pTo->pTypeName ); - uno_Mapping * mapping = 0; + OUString const & from_env_typename = + OUString::unacquired( &pFrom->pTypeName ); + OUString const & to_env_typename = + OUString::unacquired( &pTo->pTypeName ); - try + uno_Mapping * mapping = 0; + + try + { + if ( from_env_typename == UNO_LB_JAVA && to_env_typename == UNO_LB_UNO ) { - if ( from_env_typename == UNO_LB_JAVA && to_env_typename == UNO_LB_UNO ) - { - Bridge * bridge = - new Bridge( pFrom, pTo->pExtEnv, true ); // ref count = 1 - mapping = &bridge->m_java2uno; - uno_registerMapping( - &mapping, Bridge_free, - pFrom, (uno_Environment *)pTo->pExtEnv, 0 ); - } - else if ( from_env_typename == UNO_LB_UNO && to_env_typename == UNO_LB_JAVA ) - { - Bridge * bridge = - new Bridge( pTo, pFrom->pExtEnv, false ); // ref count = 1 - mapping = &bridge->m_uno2java; - uno_registerMapping( - &mapping, Bridge_free, - (uno_Environment *)pFrom->pExtEnv, pTo, 0 ); - } + Bridge * bridge = + new Bridge( pFrom, pTo->pExtEnv, true ); // ref count = 1 + mapping = &bridge->m_java2uno; + uno_registerMapping( + &mapping, Bridge_free, + pFrom, (uno_Environment *)pTo->pExtEnv, 0 ); } - catch (const BridgeRuntimeError & err) + else if ( from_env_typename == UNO_LB_UNO && to_env_typename == UNO_LB_JAVA ) { - SAL_WARN( - "bridges", - "ingoring BridgeRuntimeError \"" << err.m_message << "\""); - } - catch (const ::jvmaccess::VirtualMachine::AttachGuard::CreationException &) - { - SAL_WARN("bridges", "attaching current thread to java failed"); + Bridge * bridge = + new Bridge( pTo, pFrom->pExtEnv, false ); // ref count = 1 + mapping = &bridge->m_uno2java; + uno_registerMapping( + &mapping, Bridge_free, + (uno_Environment *)pFrom->pExtEnv, pTo, 0 ); } - - *ppMapping = mapping; } + catch (const BridgeRuntimeError & err) + { + SAL_WARN( + "bridges", + "ingoring BridgeRuntimeError \"" << err.m_message << "\""); + } + catch (const ::jvmaccess::VirtualMachine::AttachGuard::CreationException &) + { + SAL_WARN("bridges", "attaching current thread to java failed"); + } + + *ppMapping = mapping; } } |