diff options
Diffstat (limited to 'bridges/source/jni_uno')
-rw-r--r-- | bridges/source/jni_uno/java/com/sun/star/bridges/jni_uno/JNI_info_holder.java | 8 | ||||
-rw-r--r-- | bridges/source/jni_uno/java/com/sun/star/bridges/jni_uno/JNI_proxy.java | 24 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_base.h | 30 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_bridge.cxx | 12 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_bridge.h | 18 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_data.cxx | 22 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_helper.h | 2 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_info.cxx | 118 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_info.h | 36 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_java2uno.cxx | 16 | ||||
-rw-r--r-- | bridges/source/jni_uno/jni_uno2java.cxx | 24 | ||||
-rw-r--r-- | bridges/source/jni_uno/nativethreadpool.cxx | 2 |
12 files changed, 156 insertions, 156 deletions
diff --git a/bridges/source/jni_uno/java/com/sun/star/bridges/jni_uno/JNI_info_holder.java b/bridges/source/jni_uno/java/com/sun/star/bridges/jni_uno/JNI_info_holder.java index 223b53a7013f..8041d9a7f96c 100644 --- a/bridges/source/jni_uno/java/com/sun/star/bridges/jni_uno/JNI_info_holder.java +++ b/bridges/source/jni_uno/java/com/sun/star/bridges/jni_uno/JNI_info_holder.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,12 +38,12 @@ public final class JNI_info_holder } private static JNI_info_holder s_holder = new JNI_info_holder(); - + private static long s_jni_info_handle; - + //__________________________________________________________________________ private native void finalize( long jni_info_handle ); - + //__________________________________________________________________________ protected void finalize() { diff --git a/bridges/source/jni_uno/java/com/sun/star/bridges/jni_uno/JNI_proxy.java b/bridges/source/jni_uno/java/com/sun/star/bridges/jni_uno/JNI_proxy.java index 076d568e9c91..877b08287320 100644 --- a/bridges/source/jni_uno/java/com/sun/star/bridges/jni_uno/JNI_proxy.java +++ b/bridges/source/jni_uno/java/com/sun/star/bridges/jni_uno/JNI_proxy.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -46,14 +46,14 @@ public final class JNI_proxy implements java.lang.reflect.InvocationHandler JNI_proxy.class.getClassLoader(); protected static Class s_InvocationHandler [] = new Class [] { java.lang.reflect.InvocationHandler.class }; - + protected long m_bridge_handle; protected IEnvironment m_java_env; protected long m_receiver_handle; protected long m_td_handle; protected Type m_type; protected String m_oid; - protected Class m_class; + protected Class m_class; //__________________________________________________________________________ public static String get_stack_trace( Throwable throwable ) @@ -83,10 +83,10 @@ public final class JNI_proxy implements java.lang.reflect.InvocationHandler } return "\njava stack trace:\n" + trace; } - + //__________________________________________________________________________ private native void finalize( long bridge_handle ); - + //__________________________________________________________________________ public void finalize() { @@ -96,7 +96,7 @@ public final class JNI_proxy implements java.lang.reflect.InvocationHandler } }); } - + //__________________________________________________________________________ private JNI_proxy( long bridge_handle, IEnvironment java_env, @@ -110,7 +110,7 @@ public final class JNI_proxy implements java.lang.reflect.InvocationHandler m_oid = oid; m_class = m_type.getZClass(); } - + //__________________________________________________________________________ public static Object create( long bridge_handle, IEnvironment java_env, @@ -123,7 +123,7 @@ public final class JNI_proxy implements java.lang.reflect.InvocationHandler Object proxy = proxy_ctor.newInstance( new Object [] { handler } ); return java_env.registerInterface( proxy, new String [] { oid }, type ); } - + //__________________________________________________________________________ public static java.lang.reflect.Constructor get_proxy_ctor( Class clazz ) throws Throwable @@ -134,12 +134,12 @@ public final class JNI_proxy implements java.lang.reflect.InvocationHandler com.sun.star.lib.uno.Proxy.class } ); return proxy_class.getConstructor( s_InvocationHandler ); } - + //__________________________________________________________________________ private native Object dispatch_call( long bridge_handle, String decl_class, String method, Object args [] ) throws Throwable; - + // InvocationHandler impl //__________________________________________________________________________ public Object invoke( @@ -148,7 +148,7 @@ public final class JNI_proxy implements java.lang.reflect.InvocationHandler { Class decl_class = method.getDeclaringClass(); String method_name = method.getName(); - + if (Object.class.equals( decl_class )) { if (method_name.equals( "hashCode" )) @@ -205,7 +205,7 @@ public final class JNI_proxy implements java.lang.reflect.InvocationHandler return m_oid; } } - + throw new com.sun.star.uno.RuntimeException( "[jni_uno bridge error] unexpected call on proxy " + proxy.toString() + ": " + method.toString() ); diff --git a/bridges/source/jni_uno/jni_base.h b/bridges/source/jni_uno/jni_base.h index 7601648ad93a..ce8498826dd8 100644 --- a/bridges/source/jni_uno/jni_base.h +++ b/bridges/source/jni_uno/jni_base.h @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -62,7 +62,7 @@ class JNI_info; struct BridgeRuntimeError { ::rtl::OUString m_message; - + inline BridgeRuntimeError( ::rtl::OUString const & message ) : m_message( message ) {} @@ -75,10 +75,10 @@ class JNI_context JNI_info const * m_jni_info; JNIEnv * m_env; jobject m_class_loader; - + JNI_context( JNI_context & ); // not impl void operator = ( JNI_context ); // not impl - + void java_exc_occured() const; public: inline explicit JNI_context( @@ -87,10 +87,10 @@ public: m_env( env ), m_class_loader( class_loader ) {} - + inline JNI_info const * get_info() const { return m_jni_info; } - + inline JNIEnv * operator -> () const { return m_env; } inline JNIEnv * get_jni_env() const @@ -105,10 +105,10 @@ public: jclass findClass( char const * name, jclass classClass, jmethodID methodForName, bool inException) const; - + inline void ensure_no_exception() const; // throws BridgeRuntimeError inline bool assert_no_exception() const; // asserts and clears exception - + ::rtl::OUString get_stack_trace( jobject jo_exc = 0 ) const; }; @@ -141,7 +141,7 @@ class JNI_guarded_context { JNI_guarded_context( JNI_guarded_context & ); // not impl void operator = ( JNI_guarded_context ); // not impl - + public: inline explicit JNI_guarded_context( JNI_info const * jni_info, ::jvmaccess::UnoVirtualMachine * vm_access ) @@ -158,7 +158,7 @@ class JLocalAutoRef { JNI_context const & m_jni; jobject m_jo; - + public: inline JLocalAutoRef( JNI_context const & jni ) : m_jni( jni ), @@ -170,7 +170,7 @@ public: {} inline JLocalAutoRef( JLocalAutoRef & auto_ref ); inline ~JLocalAutoRef() SAL_THROW( () ); - + inline jobject get() const { return m_jo; } inline bool is() const @@ -244,7 +244,7 @@ struct rtl_mem { return mem; } inline static void operator delete ( void *, void * ) {} - + static inline ::std::auto_ptr< rtl_mem > allocate( ::std::size_t bytes ); }; @@ -262,15 +262,15 @@ inline ::std::auto_ptr< rtl_mem > rtl_mem::allocate( ::std::size_t bytes ) class TypeDescr { typelib_TypeDescription * m_td; - + TypeDescr( TypeDescr & ); // not impl void operator = ( TypeDescr ); // not impl - + public: inline explicit TypeDescr( typelib_TypeDescriptionReference * td_ref ); inline ~TypeDescr() SAL_THROW( () ) { TYPELIB_DANGER_RELEASE( m_td ); } - + inline typelib_TypeDescription * get() const { return m_td; } }; diff --git a/bridges/source/jni_uno/jni_bridge.cxx b/bridges/source/jni_uno/jni_bridge.cxx index 3f9f22a98c38..cf572395726d 100644 --- a/bridges/source/jni_uno/jni_bridge.cxx +++ b/bridges/source/jni_uno/jni_bridge.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -72,7 +72,7 @@ void SAL_CALL Mapping_map_to_uno( { uno_Interface ** ppUnoI = (uno_Interface **)ppOut; jobject javaI = (jobject) pIn; - + OSL_ASSERT( sizeof (void *) == sizeof (jobject) ); OSL_ENSURE( ppUnoI && td, "### null ptr!" ); @@ -95,7 +95,7 @@ void SAL_CALL Mapping_map_to_uno( bridge->m_jni_info, reinterpret_cast< ::jvmaccess::UnoVirtualMachine * >( bridge->m_java_env->pContext ) ); - + JNI_interface_type_info const * info = static_cast< JNI_interface_type_info const * >( bridge->m_jni_info->get_type_info( @@ -166,7 +166,7 @@ void SAL_CALL Mapping_map_to_java( bridge->m_jni_info, reinterpret_cast< ::jvmaccess::UnoVirtualMachine * >( bridge->m_java_env->pContext ) ); - + JNI_interface_type_info const * info = static_cast< JNI_interface_type_info const * >( bridge->m_jni_info->get_type_info( @@ -337,7 +337,7 @@ void JNI_context::java_exc_occured() const OUSTR("error examining java exception object!") + get_stack_trace() ); } - + jsize len = m_env->GetStringLength( (jstring) jo_descr.get() ); auto_ptr< rtl_mem > ustr_mem( rtl_mem::allocate( @@ -507,7 +507,7 @@ void SAL_CALL uno_ext_getMapping( OUString::unacquired( &pFrom->pTypeName ); OUString const & to_env_typename = OUString::unacquired( &pTo->pTypeName ); - + uno_Mapping * mapping = 0; try diff --git a/bridges/source/jni_uno/jni_bridge.h b/bridges/source/jni_uno/jni_bridge.h index f2298fbdbe46..3bb1f0372456 100644 --- a/bridges/source/jni_uno/jni_bridge.h +++ b/bridges/source/jni_uno/jni_bridge.h @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -56,25 +56,25 @@ struct Mapping : public uno_Mapping struct Bridge { mutable oslInterlockedCount m_ref; - + uno_ExtEnvironment * m_uno_env; uno_Environment * m_java_env; - + Mapping m_java2uno; Mapping m_uno2java; bool m_registered_java2uno; - + JNI_info const * m_jni_info; - + // ~Bridge() SAL_THROW( () ); explicit Bridge( uno_Environment * java_env, uno_ExtEnvironment * uno_env, bool registered_java2uno ); - + void acquire() const; void release() const; - + // jni_data.cxx void map_to_uno( JNI_context const & jni, @@ -90,7 +90,7 @@ struct Bridge JNI_type_info const * info /* maybe 0 */, bool in_param, bool out_param, bool special_wrapped_integral_types = false ) const; - + // jni_uno2java.cxx void handle_uno_exc( JNI_context const & jni, uno_Any * uno_exc ) const; @@ -104,7 +104,7 @@ struct Bridge jobject map_to_java( JNI_context const & jni, uno_Interface * pUnoI, JNI_interface_type_info const * info ) const; - + // jni_java2uno.cxx void handle_java_exc( JNI_context const & jni, diff --git a/bridges/source/jni_uno/jni_data.cxx b/bridges/source/jni_uno/jni_data.cxx index aca455d154ed..b8dc895b35fd 100644 --- a/bridges/source/jni_uno/jni_data.cxx +++ b/bridges/source/jni_uno/jni_data.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -230,7 +230,7 @@ void Bridge::map_to_uno( OSL_ASSERT( !out_param || (1 == jni->GetArrayLength( (jarray) java_data.l )) ); - + switch (type->eTypeClass) { case typelib_TypeClass_CHAR: @@ -486,7 +486,7 @@ void Bridge::map_to_uno( JLocalAutoRef jo_type( jni ); JLocalAutoRef jo_wrapped_holder( jni ); - + if (JNI_FALSE != jni->IsInstanceOf( java_data.l, m_jni_info->m_class_Any )) { @@ -534,7 +534,7 @@ void Bridge::map_to_uno( jni.ensure_no_exception(); OUString type_name( jstring_to_oustring( jni, (jstring) jo_type_name.get() ) ); - + ::com::sun::star::uno::TypeDescription value_td( type_name ); if (! value_td.is()) { @@ -725,7 +725,7 @@ void Bridge::map_to_uno( buf.append( jni.get_stack_trace() ); throw BridgeRuntimeError( buf.makeStringAndClear() ); } - + *(jint *) uno_data = jni->GetIntField( java_data.l, m_jni_info->m_field_Enum_m_value ); break; @@ -1029,7 +1029,7 @@ void Bridge::map_to_uno( auto_ptr< rtl_mem > seq; sal_Int32 nElements = jni->GetArrayLength( (jarray) java_data.l ); - + switch (element_type->eTypeClass) { case typelib_TypeClass_CHAR: @@ -1869,7 +1869,7 @@ void Bridge::map_to_java( OUStringToOString( type_name, RTL_TEXTENCODING_JAVA_UTF8 ) ); JLocalAutoRef jo_enum_class( jni, find_class( jni, class_name.getStr() ) ); - + JLocalAutoRef jo_enum( jni ); if (in_param) { @@ -2354,7 +2354,7 @@ void Bridge::map_to_java( element_type_name, RTL_TEXTENCODING_JAVA_UTF8 ) ); JLocalAutoRef jo_enum_class( jni, find_class( jni, class_name.getStr() ) ); - + jo_ar.reset( jni->NewObjectArray( nElements, (jclass) jo_enum_class.get(), 0 ) ); @@ -2394,7 +2394,7 @@ void Bridge::map_to_java( { JNI_type_info const * element_info = m_jni_info->get_type_info( jni, element_type ); - + jo_ar.reset( jni->NewObjectArray( nElements, element_info->m_class, 0 ) ); jni.ensure_no_exception(); @@ -2427,7 +2427,7 @@ void Bridge::map_to_java( OString class_name( buf.makeStringAndClear() ); JLocalAutoRef jo_seq_class( jni, find_class( jni, class_name.getStr() ) ); - + jo_ar.reset( jni->NewObjectArray( nElements, (jclass) jo_seq_class.get(), 0 ) ); @@ -2456,7 +2456,7 @@ void Bridge::map_to_java( JNI_interface_type_info const * iface_info = static_cast< JNI_interface_type_info const * >( m_jni_info->get_type_info( jni, element_type ) ); - + jo_ar.reset( jni->NewObjectArray( nElements, iface_info->m_class, 0 ) ); jni.ensure_no_exception(); diff --git a/bridges/source/jni_uno/jni_helper.h b/bridges/source/jni_uno/jni_helper.h index 293bf82d868e..80376dc63085 100644 --- a/bridges/source/jni_uno/jni_helper.h +++ b/bridges/source/jni_uno/jni_helper.h @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/bridges/source/jni_uno/jni_info.cxx b/bridges/source/jni_uno/jni_info.cxx index 6df598859d0a..d4ec229b852f 100644 --- a/bridges/source/jni_uno/jni_info.cxx +++ b/bridges/source/jni_uno/jni_info.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -83,10 +83,10 @@ JNI_interface_type_info::JNI_interface_type_info( : JNI_type_info( jni, td_ ) { OSL_ASSERT( typelib_TypeClass_INTERFACE == m_td.get()->eTypeClass ); - + OUString const & uno_name = OUString::unacquired( &m_td.get()->pTypeName ); JNI_info const * jni_info = jni.get_info(); - + JLocalAutoRef jo_class( jni, find_class( @@ -94,7 +94,7 @@ JNI_interface_type_info::JNI_interface_type_info( ( OUStringToOString( uno_name, RTL_TEXTENCODING_JAVA_UTF8 ). getStr() ) ) ); JLocalAutoRef jo_type( jni, create_type( jni, (jclass) jo_class.get() ) ); - + // get proxy ctor jvalue arg; arg.l = jo_class.get(); @@ -102,7 +102,7 @@ JNI_interface_type_info::JNI_interface_type_info( jni, jni->CallStaticObjectMethodA( jni_info->m_class_JNI_proxy, jni_info->m_method_JNI_proxy_get_proxy_ctor, &arg ) ); - + if (is_XInterface( m_td.get()->pWeakRef )) { m_methods = 0; // no methods @@ -111,21 +111,21 @@ JNI_interface_type_info::JNI_interface_type_info( { // retrieve method ids for all direct members try - { + { typelib_InterfaceTypeDescription * td = reinterpret_cast< typelib_InterfaceTypeDescription * >( m_td.get() ); m_methods = new jmethodID[ td->nMapFunctionIndexToMemberIndex ]; sal_Int32 nMethodIndex = 0; typelib_TypeDescriptionReference ** ppMembers = td->ppMembers; - sal_Int32 nMembers = td->nMembers; - + sal_Int32 nMembers = td->nMembers; + for ( sal_Int32 nPos = 0; nPos < nMembers; ++nPos ) { TypeDescr member_td( ppMembers[ nPos ] ); - + OStringBuffer sig_buf( 64 ); - + if (typelib_TypeClass_INTERFACE_METHOD == member_td.get()->eTypeClass) // method { @@ -133,7 +133,7 @@ JNI_interface_type_info::JNI_interface_type_info( reinterpret_cast< typelib_InterfaceMethodTypeDescription * >( member_td.get() ); - + sig_buf.append( '(' ); for ( sal_Int32 i = 0; i < method_td->nParams; ++i ) { @@ -145,13 +145,13 @@ JNI_interface_type_info::JNI_interface_type_info( } sig_buf.append( ')' ); JNI_info::append_sig( &sig_buf, method_td->pReturnTypeRef ); - + OString method_signature( sig_buf.makeStringAndClear() ); OString method_name( OUStringToOString( OUString::unacquired( &method_td->aBase.pMemberName ), RTL_TEXTENCODING_JAVA_UTF8 ) ); - + m_methods[ nMethodIndex ] = jni->GetMethodID( (jclass) jo_class.get(), method_name.getStr(), method_signature.getStr() ); @@ -168,7 +168,7 @@ JNI_interface_type_info::JNI_interface_type_info( reinterpret_cast< typelib_InterfaceAttributeTypeDescription * >( member_td.get() ); - + // type sig JNI_info::append_sig( &sig_buf, attribute_td->pAttributeTypeRef ); @@ -178,7 +178,7 @@ JNI_interface_type_info::JNI_interface_type_info( OUString const & member_name = OUString::unacquired( &attribute_td->aBase.pMemberName ); - + // getter sig_buf.append( RTL_CONSTASCII_STRINGPARAM("()") ); sig_buf.append( type_sig ); @@ -252,7 +252,7 @@ JNI_compound_type_info::JNI_compound_type_info( typelib_TypeClass_EXCEPTION == m_td.get()->eTypeClass ); typelib_CompoundTypeDescription * td = reinterpret_cast< typelib_CompoundTypeDescription * >( m_td.get() ); - + OUString const & uno_name = OUString::unacquired( &((typelib_TypeDescription *)td)->pTypeName ); @@ -270,7 +270,7 @@ JNI_compound_type_info::JNI_compound_type_info( jni, OUStringToOString( nucleus, RTL_TEXTENCODING_JAVA_UTF8 ).getStr() ) ); - + JNI_info const * jni_info = jni.get_info(); if (typelib_TypeClass_EXCEPTION == m_td.get()->eTypeClass) @@ -281,15 +281,15 @@ JNI_compound_type_info::JNI_compound_type_info( jni.ensure_no_exception(); OSL_ASSERT( 0 != m_exc_ctor ); } - + // retrieve info for base type typelib_TypeDescription * base_td = reinterpret_cast< typelib_TypeDescription * >( td->pBaseTypeDescription ); m_base = (0 == base_td ? 0 : jni_info->get_type_info( jni, base_td )); - + try - { + { if (type_equals( ((typelib_TypeDescription *)td)->pWeakRef, jni_info->m_Exception_type.getTypeLibType() ) || @@ -308,9 +308,9 @@ JNI_compound_type_info::JNI_compound_type_info( else { // retrieve field ids for all direct members - sal_Int32 nMembers = td->nMembers; + sal_Int32 nMembers = td->nMembers; m_fields = new jfieldID[ nMembers ]; - + for ( sal_Int32 nPos = 0; nPos < nMembers; ++nPos ) { OString sig; @@ -327,12 +327,12 @@ JNI_compound_type_info::JNI_compound_type_info( JNI_info::append_sig( &sig_buf, td->ppTypeRefs[ nPos ] ); sig = sig_buf.makeStringAndClear(); } - + OString member_name( OUStringToOString( OUString::unacquired( &td->ppMemberNames[ nPos ] ), RTL_TEXTENCODING_JAVA_UTF8 ) ); - + m_fields[ nPos ] = jni->GetFieldID( (jclass) jo_class.get(), member_name.getStr(), sig.getStr() ); @@ -346,7 +346,7 @@ JNI_compound_type_info::JNI_compound_type_info( delete [] m_fields; throw; } - + m_class = (jclass) jni->NewGlobalRef( jo_class.get() ); } @@ -356,7 +356,7 @@ JNI_type_info const * JNI_info::create_type_info( JNI_context const & jni, typelib_TypeDescription * td ) const { OUString const & uno_name = OUString::unacquired( &td->pTypeName ); - + JNI_type_info * new_info; switch (td->eTypeClass) { @@ -381,7 +381,7 @@ JNI_type_info const * JNI_info::create_type_info( throw BridgeRuntimeError( buf.makeStringAndClear() ); } } - + // look up JNI_type_info * info; ClearableMutexGuard guard( m_mutex ); @@ -397,7 +397,7 @@ JNI_type_info const * JNI_info::create_type_info( info = holder.m_info; guard.clear(); new_info->destroy( jni.get_jni_env() ); - } + } return info; } @@ -409,7 +409,7 @@ JNI_type_info const * JNI_info::get_type_info( { return m_XInterface_type_info; } - + OUString const & uno_name = OUString::unacquired( &td->pTypeName ); JNI_type_info const * info; ClearableMutexGuard guard( m_mutex ); @@ -424,7 +424,7 @@ JNI_type_info const * JNI_info::get_type_info( { info = iFind->second.m_info; } - + return info; } @@ -436,7 +436,7 @@ JNI_type_info const * JNI_info::get_type_info( { return m_XInterface_type_info; } - + OUString const & uno_name = OUString::unacquired( &type->pTypeName ); JNI_type_info const * info; ClearableMutexGuard guard( m_mutex ); @@ -451,7 +451,7 @@ JNI_type_info const * JNI_info::get_type_info( { info = iFind->second.m_info; } - + return info; } @@ -464,13 +464,13 @@ JNI_type_info const * JNI_info::get_type_info( { return m_XInterface_type_info; } - + JNI_type_info const * info; ClearableMutexGuard guard( m_mutex ); t_str2type::const_iterator iFind( m_type_map.find( uno_name ) ); if (iFind == m_type_map.end()) { - guard.clear(); + guard.clear(); css::uno::TypeDescription td( uno_name ); if (! td.is()) { @@ -487,7 +487,7 @@ JNI_type_info const * JNI_info::get_type_info( { info = iFind->second.m_info; } - + return info; } @@ -553,7 +553,7 @@ JNI_info::JNI_info( jni, find_class( jni, "com.sun.star.uno.IEnvironment" ) ); JLocalAutoRef jo_JNI_proxy( jni, find_class( jni, "com.sun.star.bridges.jni_uno.JNI_proxy" ) ); - + // method Object.toString() m_method_Object_toString = jni->GetMethodID( (jclass) jo_Object.get(), "toString", "()Ljava/lang/String;" ); @@ -564,13 +564,13 @@ JNI_info::JNI_info( (jclass) jo_Class.get(), "getName", "()Ljava/lang/String;" ); jni.ensure_no_exception(); OSL_ASSERT( 0 != m_method_Class_getName ); - + // method Throwable.getMessage() m_method_Throwable_getMessage = jni->GetMethodID( (jclass) jo_Throwable.get(), "getMessage", "()Ljava/lang/String;" ); jni.ensure_no_exception(); OSL_ASSERT( 0 != m_method_Throwable_getMessage ); - + // method Character.charValue() m_method_Character_charValue = jni->GetMethodID( (jclass) jo_Character.get(), "charValue", "()C" ); @@ -611,7 +611,7 @@ JNI_info::JNI_info( (jclass) jo_Double.get(), "doubleValue", "()D" ); jni.ensure_no_exception(); OSL_ASSERT( 0 != m_method_Double_doubleValue ); - + // ctor Character( char ) m_ctor_Character_with_char = jni->GetMethodID( (jclass) jo_Character.get(), "<init>", "(C)V" ); @@ -652,7 +652,7 @@ JNI_info::JNI_info( (jclass) jo_Double.get(), "<init>", "(D)V" ); jni.ensure_no_exception(); OSL_ASSERT( 0 != m_ctor_Double_with_double ); - + // static method UnoRuntime.generateOid() m_method_UnoRuntime_generateOid = jni->GetStaticMethodID( (jclass) jo_UnoRuntime.get(), @@ -666,20 +666,20 @@ JNI_info::JNI_info( "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)Ljava/lang/Object;" ); jni.ensure_no_exception(); OSL_ASSERT( 0 != m_method_UnoRuntime_queryInterface ); - + // field Enum.m_value m_field_Enum_m_value = jni->GetFieldID( (jclass) jo_Enum.get(), "m_value", "I" ); jni.ensure_no_exception(); OSL_ASSERT( 0 != m_field_Enum_m_value ); - + // static method TypeClass.fromInt() m_method_TypeClass_fromInt = jni->GetStaticMethodID( (jclass) jo_TypeClass.get(), "fromInt", "(I)Lcom/sun/star/uno/TypeClass;" ); jni.ensure_no_exception(); OSL_ASSERT( 0 != m_method_TypeClass_fromInt ); - + // ctor Type( Class ) m_ctor_Type_with_Class = jni->GetMethodID( (jclass) jo_Type.get(), "<init>", "(Ljava/lang/Class;)V" ); @@ -703,7 +703,7 @@ JNI_info::JNI_info( "<init>", "(Lcom/sun/star/uno/Type;Ljava/lang/Object;)V" ); jni.ensure_no_exception(); OSL_ASSERT( 0 != m_ctor_Any_with_Type_Object ); - + // field Any._type m_field_Any__type = jni->GetFieldID( (jclass) jo_Any.get(), "_type", "Lcom/sun/star/uno/Type;" ); @@ -714,7 +714,7 @@ JNI_info::JNI_info( (jclass) jo_Any.get(), "_object", "Ljava/lang/Object;" ); jni.ensure_no_exception(); OSL_ASSERT( 0 != m_field_Any__object ); - + // method IEnvironment.getRegisteredInterface() m_method_IEnvironment_getRegisteredInterface = jni->GetMethodID( (jclass) jo_IEnvironment.get(), @@ -729,7 +729,7 @@ JNI_info::JNI_info( "Ljava/lang/Object;" ); jni.ensure_no_exception(); OSL_ASSERT( 0 != m_method_IEnvironment_registerInterface ); - + // static method JNI_proxy.get_proxy_ctor() m_method_JNI_proxy_get_proxy_ctor = jni->GetStaticMethodID( (jclass) jo_JNI_proxy.get(), "get_proxy_ctor", @@ -763,7 +763,7 @@ JNI_info::JNI_info( (jclass) jo_JNI_proxy.get(), "m_oid", "Ljava/lang/String;" ); jni.ensure_no_exception(); OSL_ASSERT( 0 != m_field_JNI_proxy_m_oid ); - + // get java env OUString java_env_type_name( RTL_CONSTASCII_USTRINGPARAM(UNO_LB_JAVA) ); JLocalAutoRef jo_java( @@ -780,7 +780,7 @@ JNI_info::JNI_info( JLocalAutoRef jo_java_env( jni, jni->CallStaticObjectMethodA( (jclass) jo_UnoRuntime.get(), method_getEnvironment, args ) ); - + // get com.sun.star.uno.Any.VOID jfieldID field_Any_VOID = jni->GetStaticFieldID( (jclass) jo_Any.get(), "VOID", "Lcom/sun/star/uno/Any;" ); @@ -813,7 +813,7 @@ JNI_info::JNI_info( JLocalAutoRef jo_Type_UNSIGNED_HYPER( jni, jni->GetStaticObjectField( (jclass) jo_Type.get(), field_Type_UNSIGNED_HYPER ) ); - + // make global refs m_class_UnoRuntime = (jclass) jni->NewGlobalRef( jo_UnoRuntime.get() ); @@ -827,7 +827,7 @@ JNI_info::JNI_info( (jclass) jni->NewGlobalRef( jo_TypeClass.get() ); m_class_JNI_proxy = (jclass) jni->NewGlobalRef( jo_JNI_proxy.get() ); - + m_class_Character = (jclass) jni->NewGlobalRef( jo_Character.get() ); m_class_Boolean = @@ -850,7 +850,7 @@ JNI_info::JNI_info( (jclass) jni->NewGlobalRef( jo_Object.get() ); m_class_Class = (jclass) jni->NewGlobalRef( m_class_Class ); - + m_object_Any_VOID = jni->NewGlobalRef( jo_Any_VOID.get() ); m_object_Type_UNSIGNED_SHORT = @@ -860,7 +860,7 @@ JNI_info::JNI_info( m_object_Type_UNSIGNED_HYPER = jni->NewGlobalRef( jo_Type_UNSIGNED_HYPER.get() ); m_object_java_env = jni->NewGlobalRef( jo_java_env.get() ); - + try { css::uno::TypeDescription XInterface_td( @@ -890,14 +890,14 @@ void JNI_info::destruct( JNIEnv * jni_env ) const_cast< JNI_interface_type_info * >( m_XInterface_type_info )->destroy( jni_env ); } - + // free global refs jni_env->DeleteGlobalRef( m_object_java_env ); jni_env->DeleteGlobalRef( m_object_Any_VOID ); jni_env->DeleteGlobalRef( m_object_Type_UNSIGNED_SHORT ); jni_env->DeleteGlobalRef( m_object_Type_UNSIGNED_LONG ); jni_env->DeleteGlobalRef( m_object_Type_UNSIGNED_HYPER ); - + jni_env->DeleteGlobalRef( m_class_Class ); jni_env->DeleteGlobalRef( m_class_Object ); jni_env->DeleteGlobalRef( m_class_String ); @@ -909,7 +909,7 @@ void JNI_info::destruct( JNIEnv * jni_env ) jni_env->DeleteGlobalRef( m_class_Byte ); jni_env->DeleteGlobalRef( m_class_Boolean ); jni_env->DeleteGlobalRef( m_class_Character ); - + jni_env->DeleteGlobalRef( m_class_JNI_proxy ); jni_env->DeleteGlobalRef( m_class_RuntimeException ); jni_env->DeleteGlobalRef( m_class_UnoRuntime ); @@ -944,7 +944,7 @@ JNI_info const * JNI_info::get_jni_info( (jclass) jo_JNI_info_holder.get(), "s_jni_info_handle", "J" ); jni.ensure_no_exception(); OSL_ASSERT( 0 != field_s_jni_info_handle ); - + JNI_info const * jni_info = reinterpret_cast< JNI_info const * >( jni->GetStaticLongField( @@ -954,7 +954,7 @@ JNI_info const * JNI_info::get_jni_info( JNI_info * new_info = new JNI_info( jni_env, static_cast< jobject >(uno_vm->getClassLoader()), jo_class, jo_forName ); - + ClearableMutexGuard g( Mutex::getGlobalMutex() ); jni_info = reinterpret_cast< JNI_info const * >( @@ -974,7 +974,7 @@ JNI_info const * JNI_info::get_jni_info( new_info->destroy( jni_env ); } } - + return jni_info; } @@ -993,7 +993,7 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1info_1holder_finalize__J( reinterpret_cast< ::jni_uno::JNI_info * >( jni_info_handle ); jni_info->destroy( jni_env ); } - + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/bridges/source/jni_uno/jni_info.h b/bridges/source/jni_uno/jni_info.h index 1382c6f9f4d8..e8cacd8bbc05 100644 --- a/bridges/source/jni_uno/jni_info.h +++ b/bridges/source/jni_uno/jni_info.h @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -75,7 +75,7 @@ struct JNI_type_info { ::com::sun::star::uno::TypeDescription m_td; jclass m_class; - + virtual void destroy( JNIEnv * jni_env ) = 0; protected: inline void destruct( JNIEnv * jni_env ) @@ -91,8 +91,8 @@ struct JNI_interface_type_info : public JNI_type_info jobject m_proxy_ctor; // proxy ctor jobject m_type; // sorted via typelib function index - jmethodID * m_methods; - + jmethodID * m_methods; + virtual void destroy( JNIEnv * jni_env ); explicit JNI_interface_type_info( JNI_context const & jni, typelib_TypeDescription * td ); @@ -106,7 +106,7 @@ struct JNI_compound_type_info : public JNI_type_info jmethodID m_exc_ctor; // sorted via typelib member index jfieldID * m_fields; - + virtual void destroy( JNIEnv * jni_env ); explicit JNI_compound_type_info( JNI_context const & jni, typelib_TypeDescription * td ); @@ -129,7 +129,7 @@ class JNI_info { mutable ::osl::Mutex m_mutex; mutable t_str2type m_type_map; - + public: // These two are needed very early by find_class from within the ctor: jclass m_class_Class; @@ -141,7 +141,7 @@ public: jobject m_object_Type_UNSIGNED_SHORT; jobject m_object_Type_UNSIGNED_LONG; jobject m_object_Type_UNSIGNED_HYPER; - + // jclass m_class_Object; jclass m_class_Character; @@ -153,14 +153,14 @@ public: jclass m_class_Float; jclass m_class_Double; jclass m_class_String; - + jclass m_class_UnoRuntime; jclass m_class_RuntimeException; jclass m_class_Any; jclass m_class_Type; jclass m_class_TypeClass; jclass m_class_JNI_proxy; - + // jmethodID m_method_Object_toString; jmethodID m_method_Class_getName; @@ -172,7 +172,7 @@ public: jmethodID m_ctor_Integer_with_int; jmethodID m_ctor_Long_with_long; jmethodID m_ctor_Float_with_float; - jmethodID m_ctor_Double_with_double; + jmethodID m_ctor_Double_with_double; jmethodID m_method_Boolean_booleanValue; jmethodID m_method_Byte_byteValue; jmethodID m_method_Character_charValue; @@ -181,7 +181,7 @@ public: jmethodID m_method_Integer_intValue; jmethodID m_method_Long_longValue; jmethodID m_method_Short_shortValue; - + // jmethodID m_method_IEnvironment_getRegisteredInterface; jmethodID m_method_IEnvironment_registerInterface; @@ -195,7 +195,7 @@ public: jfieldID m_field_Type__typeName; jmethodID m_method_TypeClass_fromInt; jfieldID m_field_Enum_m_value; - + // jmethodID m_method_JNI_proxy_get_proxy_ctor; jmethodID m_method_JNI_proxy_create; @@ -210,8 +210,8 @@ public: ::com::sun::star::uno::Type const & m_RuntimeException_type; ::com::sun::star::uno::Type const & m_void_type; // - JNI_interface_type_info const * m_XInterface_type_info; - + JNI_interface_type_info const * m_XInterface_type_info; + // JNI_type_info const * get_type_info( JNI_context const & jni, @@ -226,18 +226,18 @@ public: inline static void append_sig( ::rtl::OStringBuffer * buf, typelib_TypeDescriptionReference * type, bool use_Object_for_type_XInterface = true, bool use_slashes = true ); - + // get this static JNI_info const * get_jni_info( rtl::Reference< jvmaccess::UnoVirtualMachine > const & uno_vm ); inline void destroy( JNIEnv * jni_env ); - + private: JNI_type_info const * create_type_info( JNI_context const & jni, typelib_TypeDescription * td ) const; - + void destruct( JNIEnv * jni_env ); - + JNI_info( JNIEnv * jni_env, jobject class_loader, jclass classClass, jmethodID methodForName ); inline ~JNI_info() {} diff --git a/bridges/source/jni_uno/jni_java2uno.cxx b/bridges/source/jni_uno/jni_java2uno.cxx index fa32e879f1bd..bd1bd2d734e0 100644 --- a/bridges/source/jni_uno/jni_java2uno.cxx +++ b/bridges/source/jni_uno/jni_java2uno.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -198,7 +198,7 @@ jobject Bridge::call_uno( return_size = sizeof (largest); break; } - + #ifdef BROKEN_ALLOCA char * mem = (char *) malloc( #else @@ -210,7 +210,7 @@ jobject Bridge::call_uno( void * uno_ret = return_size == 0 ? 0 : (mem + (nParams * sizeof (void *))); largest * uno_args_mem = (largest *) (mem + (nParams * sizeof (void *)) + return_size); - + OSL_ASSERT( (0 == nParams) || (nParams == jni->GetArrayLength( jo_args )) ); for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) { @@ -506,14 +506,14 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( } typelib_InterfaceTypeDescription * td = - reinterpret_cast< typelib_InterfaceTypeDescription * >( + reinterpret_cast< typelib_InterfaceTypeDescription * >( jni->GetLongField( jo_proxy, jni_info->m_field_JNI_proxy_m_td_handle ) ); uno_Interface * pUnoI = reinterpret_cast< uno_Interface * >( jni->GetLongField( jo_proxy, jni_info->m_field_JNI_proxy_m_receiver_handle ) ); - + typelib_TypeDescriptionReference ** ppAllMembers = td->ppAllMembers; for ( sal_Int32 nPos = td->nAllMembers; nPos--; ) { @@ -522,7 +522,7 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_dispatch_1call( // typelib_typedescriptionreference_getDescription() typelib_TypeDescriptionReference * member_type = ppAllMembers[ nPos ]; - + // check method_name against fully qualified type_name // of member_type; type_name is of the form // <name> "::" <method_name> *(":@" <idx> "," <idx> ":" <name>) @@ -677,7 +677,7 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_finalize__J( reinterpret_cast< typelib_TypeDescription * >( jni->GetLongField( jo_proxy, jni_info->m_field_JNI_proxy_m_td_handle ) ); - + #if OSL_DEBUG_LEVEL > 1 { JLocalAutoRef jo_oid( @@ -685,7 +685,7 @@ JNICALL Java_com_sun_star_bridges_jni_1uno_JNI_1proxy_finalize__J( jo_proxy, jni_info->m_field_JNI_proxy_m_oid ) ); OUString oid( jstring_to_oustring( jni, (jstring) jo_oid.get() ) ); OString cstr_msg( - OUStringToOString( + OUStringToOString( OUSTR("freeing java uno proxy: ") + oid, RTL_TEXTENCODING_ASCII_US ) ); OSL_TRACE( cstr_msg.getStr() ); diff --git a/bridges/source/jni_uno/jni_uno2java.cxx b/bridges/source/jni_uno/jni_uno2java.cxx index 70e139d66aab..d4c59ab2ad11 100644 --- a/bridges/source/jni_uno/jni_uno2java.cxx +++ b/bridges/source/jni_uno/jni_uno2java.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -89,7 +89,7 @@ void Bridge::handle_java_exc( jni.ensure_no_exception(); OUString exc_name( jstring_to_oustring( jni, (jstring) jo_class_name.get() ) ); - + ::com::sun::star::uno::TypeDescription td( exc_name.pData ); if (!td.is() || (typelib_TypeClass_EXCEPTION != td.get()->eTypeClass)) { @@ -148,11 +148,11 @@ void Bridge::call_java( void * uno_ret, void * uno_args [], uno_Any ** uno_exc ) const { OSL_ASSERT( function_pos_offset == 0 || function_pos_offset == 1 ); - + JNI_guarded_context jni( m_jni_info, reinterpret_cast< ::jvmaccess::UnoVirtualMachine * >( m_java_env->pContext ) ); - + // assure fully initialized iface_td: ::com::sun::star::uno::TypeDescription iface_holder; if (! iface_td->aBase.bComplete) { @@ -171,14 +171,14 @@ void Bridge::call_java( iface_holder.get() ); OSL_ASSERT( iface_td->aBase.eTypeClass == typelib_TypeClass_INTERFACE ); } - + // prepare java args, save param td #ifdef BROKEN_ALLOCA jvalue * java_args = (jvalue *) malloc( sizeof (jvalue) * nParams ); #else jvalue * java_args = (jvalue *) alloca( sizeof (jvalue) * nParams ); #endif - + sal_Int32 nPos; for ( nPos = 0; nPos < nParams; ++nPos ) { @@ -227,7 +227,7 @@ void Bridge::call_java( && function_pos < iface_td->nMapFunctionIndexToMemberIndex, "### illegal function index!" ); function_pos -= base_members_function_pos; - + JNI_interface_type_info const * info = static_cast< JNI_interface_type_info const * >( m_jni_info->get_type_info( jni, &iface_td->aBase ) ); @@ -525,7 +525,7 @@ uno_Interface * Bridge::map_to_uno( pUnoI = new UNO_proxy( jni, const_cast< Bridge * >( this ), javaI, (jstring) jo_oid.get(), oid, info ); - + (*m_uno_env->registerProxyInterface)( m_uno_env, (void **)&pUnoI, UNO_proxy_free, @@ -555,7 +555,7 @@ void SAL_CALL UNO_proxy_free( uno_ExtEnvironment * env, void * proxy ) } #if OSL_DEBUG_LEVEL > 1 OString cstr_msg( - OUStringToOString( + OUStringToOString( OUSTR("freeing binary uno proxy: ") + that->m_oid, RTL_TEXTENCODING_ASCII_US ) ); OSL_TRACE( cstr_msg.getStr() ); @@ -567,7 +567,7 @@ void SAL_CALL UNO_proxy_free( uno_ExtEnvironment * env, void * proxy ) bridge->m_jni_info, reinterpret_cast< ::jvmaccess::UnoVirtualMachine * >( bridge->m_java_env->pContext ) ); - + jni->DeleteGlobalRef( that->m_javaI ); jni->DeleteGlobalRef( that->m_jo_oid ); } @@ -740,7 +740,7 @@ void SAL_CALL UNO_proxy_dispatch( jni_info->m_class_UnoRuntime, jni_info->m_method_UnoRuntime_queryInterface, args ) ); - + if (jni->ExceptionCheck()) { JLocalAutoRef jo_exc( jni, jni->ExceptionOccurred() ); @@ -772,7 +772,7 @@ void SAL_CALL UNO_proxy_dispatch( reinterpret_cast< typelib_InterfaceTypeDescription * >( info->m_td.get() ) ); - + uno_any_construct( (uno_Any *)uno_ret, &pUnoI2, demanded_td.get(), 0 ); diff --git a/bridges/source/jni_uno/nativethreadpool.cxx b/bridges/source/jni_uno/nativethreadpool.cxx index 9c92e89c5b07..870b67844806 100644 --- a/bridges/source/jni_uno/nativethreadpool.cxx +++ b/bridges/source/jni_uno/nativethreadpool.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite |