From 871426533f7afe31bc451fa6b407b83db8e52827 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 22 Sep 2011 15:00:08 +0100 Subject: just silence the auto_ptr deprecations in isolation --- bridges/source/jni_uno/jni_bridge.cxx | 4 ++++ bridges/source/jni_uno/jni_data.cxx | 14 ++++++++++++++ bridges/source/jni_uno/jni_helper.h | 2 ++ bridges/source/jni_uno/jni_uno2java.cxx | 2 ++ 4 files changed, 22 insertions(+) (limited to 'bridges') diff --git a/bridges/source/jni_uno/jni_bridge.cxx b/bridges/source/jni_uno/jni_bridge.cxx index d15f05a814fd..cf9f5c2decbe 100644 --- a/bridges/source/jni_uno/jni_bridge.cxx +++ b/bridges/source/jni_uno/jni_bridge.cxx @@ -337,9 +337,11 @@ void JNI_context::java_exc_occurred() const } jsize len = m_env->GetStringLength( (jstring) jo_descr.get() ); + SAL_WNODEPRECATED_DECLARATIONS_PUSH auto_ptr< rtl_mem > ustr_mem( rtl_mem::allocate( sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ) ); + SAL_WNODEPRECATED_DECLARATIONS_POP rtl_uString * ustr = (rtl_uString *)ustr_mem.get(); m_env->GetStringRegion( (jstring) jo_descr.get(), 0, len, ustr->buffer ); if (m_env->ExceptionCheck()) @@ -413,9 +415,11 @@ OUString JNI_context::get_stack_trace( jobject jo_exc ) const { jsize len = m_env->GetStringLength( (jstring) jo_stack_trace.get() ); + SAL_WNODEPRECATED_DECLARATIONS_PUSH auto_ptr< rtl_mem > ustr_mem( rtl_mem::allocate( sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ) ); + SAL_WNODEPRECATED_DECLARATIONS_POP rtl_uString * ustr = (rtl_uString *)ustr_mem.get(); m_env->GetStringRegion( (jstring) jo_stack_trace.get(), 0, len, ustr->buffer ); diff --git a/bridges/source/jni_uno/jni_data.cxx b/bridges/source/jni_uno/jni_data.cxx index aca455d154ed..5edb23868da6 100644 --- a/bridges/source/jni_uno/jni_data.cxx +++ b/bridges/source/jni_uno/jni_data.cxx @@ -45,8 +45,10 @@ namespace jni_uno //------------------------------------------------------------------------------ inline rtl_mem * seq_allocate( sal_Int32 nElements, sal_Int32 nSize ) { + SAL_WNODEPRECATED_DECLARATIONS_PUSH auto_ptr< rtl_mem > seq( rtl_mem::allocate( SAL_SEQUENCE_HEADER_SIZE + (nElements * nSize) ) ); + SAL_WNODEPRECATED_DECLARATIONS_POP uno_Sequence * p = (uno_Sequence *)seq.get(); p->nRefCount = 1; p->nElements = nElements; @@ -137,7 +139,9 @@ void createDefaultUnoValue( case typelib_TypeClass_SEQUENCE: { + SAL_WNODEPRECATED_DECLARATIONS_PUSH auto_ptr< rtl_mem > seq(seq_allocate(0, 0)); + SAL_WNODEPRECATED_DECLARATIONS_POP if (assign) { uno_type_destructData(uno_data, type, 0); } @@ -603,8 +607,10 @@ void Bridge::map_to_uno( } else { + SAL_WNODEPRECATED_DECLARATIONS_PUSH auto_ptr< rtl_mem > mem( rtl_mem::allocate( sizeof (sal_Int64) ) ); + SAL_WNODEPRECATED_DECLARATIONS_POP *(jlong *) mem.get() = jni->CallLongMethodA( java_data.l, m_jni_info->m_method_Long_longValue, 0 ); jni.ensure_no_exception(); @@ -621,8 +627,10 @@ void Bridge::map_to_uno( } else { + SAL_WNODEPRECATED_DECLARATIONS_PUSH auto_ptr< rtl_mem > mem( rtl_mem::allocate( sizeof (float) ) ); + SAL_WNODEPRECATED_DECLARATIONS_POP *(jfloat *) mem.get() = jni->CallFloatMethodA( java_data.l, m_jni_info->m_method_Float_floatValue, 0 ); jni.ensure_no_exception(); @@ -641,8 +649,10 @@ void Bridge::map_to_uno( } else { + SAL_WNODEPRECATED_DECLARATIONS_PUSH auto_ptr< rtl_mem > mem( rtl_mem::allocate( sizeof (double) ) ); + SAL_WNODEPRECATED_DECLARATIONS_POP *(jdouble *) mem.get() = jni->CallDoubleMethodA( java_data.l, @@ -672,8 +682,10 @@ void Bridge::map_to_uno( case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: { + SAL_WNODEPRECATED_DECLARATIONS_PUSH auto_ptr< rtl_mem > mem( rtl_mem::allocate( value_td.get()->nSize ) ); + SAL_WNODEPRECATED_DECLARATIONS_POP map_to_uno( jni, mem.get(), java_data, value_td.get()->pWeakRef, 0, false /* no assign */, false /* no out param */ ); @@ -1027,7 +1039,9 @@ void Bridge::map_to_uno( typelib_TypeDescriptionReference * element_type = ((typelib_IndirectTypeDescription *)td.get())->pType; + SAL_WNODEPRECATED_DECLARATIONS_PUSH auto_ptr< rtl_mem > seq; + SAL_WNODEPRECATED_DECLARATIONS_POP sal_Int32 nElements = jni->GetArrayLength( (jarray) java_data.l ); switch (element_type->eTypeClass) diff --git a/bridges/source/jni_uno/jni_helper.h b/bridges/source/jni_uno/jni_helper.h index 293bf82d868e..f124dd37b594 100644 --- a/bridges/source/jni_uno/jni_helper.h +++ b/bridges/source/jni_uno/jni_helper.h @@ -47,9 +47,11 @@ inline void jstring_to_ustring( else { jsize len = jni->GetStringLength( jstr ); + SAL_WNODEPRECATED_DECLARATIONS_PUSH ::std::auto_ptr< rtl_mem > mem( rtl_mem::allocate( sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ) ); + SAL_WNODEPRECATED_DECLARATIONS_POP rtl_uString * ustr = (rtl_uString *)mem.get(); jni->GetStringRegion( jstr, 0, len, (jchar *) ustr->buffer ); jni.ensure_no_exception(); diff --git a/bridges/source/jni_uno/jni_uno2java.cxx b/bridges/source/jni_uno/jni_uno2java.cxx index 5fa8fa3e01b3..17f6d9c99fea 100644 --- a/bridges/source/jni_uno/jni_uno2java.cxx +++ b/bridges/source/jni_uno/jni_uno2java.cxx @@ -106,7 +106,9 @@ void Bridge::handle_java_exc( throw BridgeRuntimeError( buf.makeStringAndClear() ); } + SAL_WNODEPRECATED_DECLARATIONS_PUSH auto_ptr< rtl_mem > uno_data( rtl_mem::allocate( td.get()->nSize ) ); + SAL_WNODEPRECATED_DECLARATIONS_POP jvalue val; val.l = jo_exc.get(); map_to_uno( -- cgit v1.2.3