auto_ptr -> heap_ptr
Change-Id: I2c6bb5c0ad9a844826498a1c8495249dd88a9942
This commit is contained in:
@@ -25,12 +25,11 @@
|
|||||||
|
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
#include "jvmaccess/unovirtualmachine.hxx"
|
#include "jvmaccess/unovirtualmachine.hxx"
|
||||||
|
#include "o3tl/heap_ptr.hxx"
|
||||||
#include "rtl/ref.hxx"
|
#include "rtl/ref.hxx"
|
||||||
#include "rtl/strbuf.hxx"
|
#include "rtl/strbuf.hxx"
|
||||||
#include "uno/lbnames.h"
|
#include "uno/lbnames.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace ::std;
|
|
||||||
using namespace ::rtl;
|
using namespace ::rtl;
|
||||||
using namespace ::osl;
|
using namespace ::osl;
|
||||||
using namespace ::jni_uno;
|
using namespace ::jni_uno;
|
||||||
@@ -311,11 +310,9 @@ void JNI_context::java_exc_occurred() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
jsize len = m_env->GetStringLength( (jstring) jo_descr.get() );
|
jsize len = m_env->GetStringLength( (jstring) jo_descr.get() );
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
o3tl::heap_ptr< rtl_mem > ustr_mem(
|
||||||
auto_ptr< rtl_mem > ustr_mem(
|
|
||||||
rtl_mem::allocate(
|
rtl_mem::allocate(
|
||||||
sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ) );
|
sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ) );
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
|
||||||
rtl_uString * ustr = (rtl_uString *)ustr_mem.get();
|
rtl_uString * ustr = (rtl_uString *)ustr_mem.get();
|
||||||
m_env->GetStringRegion( (jstring) jo_descr.get(), 0, len, ustr->buffer );
|
m_env->GetStringRegion( (jstring) jo_descr.get(), 0, len, ustr->buffer );
|
||||||
if (m_env->ExceptionCheck())
|
if (m_env->ExceptionCheck())
|
||||||
@@ -389,11 +386,9 @@ OUString JNI_context::get_stack_trace( jobject jo_exc ) const
|
|||||||
{
|
{
|
||||||
jsize len =
|
jsize len =
|
||||||
m_env->GetStringLength( (jstring) jo_stack_trace.get() );
|
m_env->GetStringLength( (jstring) jo_stack_trace.get() );
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
o3tl::heap_ptr< rtl_mem > ustr_mem(
|
||||||
auto_ptr< rtl_mem > ustr_mem(
|
|
||||||
rtl_mem::allocate(
|
rtl_mem::allocate(
|
||||||
sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ) );
|
sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ) );
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
|
||||||
rtl_uString * ustr = (rtl_uString *)ustr_mem.get();
|
rtl_uString * ustr = (rtl_uString *)ustr_mem.get();
|
||||||
m_env->GetStringRegion(
|
m_env->GetStringRegion(
|
||||||
(jstring) jo_stack_trace.get(), 0, len, ustr->buffer );
|
(jstring) jo_stack_trace.get(), 0, len, ustr->buffer );
|
||||||
|
@@ -23,11 +23,10 @@
|
|||||||
|
|
||||||
#include "jni_bridge.h"
|
#include "jni_bridge.h"
|
||||||
|
|
||||||
|
#include "o3tl/heap_ptr.hxx"
|
||||||
#include "rtl/strbuf.hxx"
|
#include "rtl/strbuf.hxx"
|
||||||
#include "uno/sequence2.h"
|
#include "uno/sequence2.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace ::std;
|
|
||||||
using namespace ::rtl;
|
using namespace ::rtl;
|
||||||
|
|
||||||
namespace jni_uno
|
namespace jni_uno
|
||||||
@@ -36,10 +35,8 @@ namespace jni_uno
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
inline rtl_mem * seq_allocate( sal_Int32 nElements, sal_Int32 nSize )
|
inline rtl_mem * seq_allocate( sal_Int32 nElements, sal_Int32 nSize )
|
||||||
{
|
{
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
o3tl::heap_ptr< rtl_mem > seq(
|
||||||
auto_ptr< rtl_mem > seq(
|
|
||||||
rtl_mem::allocate( SAL_SEQUENCE_HEADER_SIZE + (nElements * nSize) ) );
|
rtl_mem::allocate( SAL_SEQUENCE_HEADER_SIZE + (nElements * nSize) ) );
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
|
||||||
uno_Sequence * p = (uno_Sequence *)seq.get();
|
uno_Sequence * p = (uno_Sequence *)seq.get();
|
||||||
p->nRefCount = 1;
|
p->nRefCount = 1;
|
||||||
p->nElements = nElements;
|
p->nElements = nElements;
|
||||||
@@ -130,9 +127,7 @@ void createDefaultUnoValue(
|
|||||||
|
|
||||||
case typelib_TypeClass_SEQUENCE:
|
case typelib_TypeClass_SEQUENCE:
|
||||||
{
|
{
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
o3tl::heap_ptr< rtl_mem > seq(seq_allocate(0, 0));
|
||||||
auto_ptr< rtl_mem > seq(seq_allocate(0, 0));
|
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
|
||||||
if (assign) {
|
if (assign) {
|
||||||
uno_type_destructData(uno_data, type, 0);
|
uno_type_destructData(uno_data, type, 0);
|
||||||
}
|
}
|
||||||
@@ -566,10 +561,8 @@ void Bridge::map_to_uno(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
o3tl::heap_ptr< rtl_mem > mem(
|
||||||
auto_ptr< rtl_mem > mem(
|
|
||||||
rtl_mem::allocate( sizeof (sal_Int64) ) );
|
rtl_mem::allocate( sizeof (sal_Int64) ) );
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
|
||||||
*(jlong *) mem.get() = jni->CallLongMethodA(
|
*(jlong *) mem.get() = jni->CallLongMethodA(
|
||||||
java_data.l, m_jni_info->m_method_Long_longValue, 0 );
|
java_data.l, m_jni_info->m_method_Long_longValue, 0 );
|
||||||
jni.ensure_no_exception();
|
jni.ensure_no_exception();
|
||||||
@@ -586,10 +579,8 @@ void Bridge::map_to_uno(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
o3tl::heap_ptr< rtl_mem > mem(
|
||||||
auto_ptr< rtl_mem > mem(
|
|
||||||
rtl_mem::allocate( sizeof (float) ) );
|
rtl_mem::allocate( sizeof (float) ) );
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
|
||||||
*(jfloat *) mem.get() = jni->CallFloatMethodA(
|
*(jfloat *) mem.get() = jni->CallFloatMethodA(
|
||||||
java_data.l, m_jni_info->m_method_Float_floatValue, 0 );
|
java_data.l, m_jni_info->m_method_Float_floatValue, 0 );
|
||||||
jni.ensure_no_exception();
|
jni.ensure_no_exception();
|
||||||
@@ -608,10 +599,8 @@ void Bridge::map_to_uno(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
o3tl::heap_ptr< rtl_mem > mem(
|
||||||
auto_ptr< rtl_mem > mem(
|
|
||||||
rtl_mem::allocate( sizeof (double) ) );
|
rtl_mem::allocate( sizeof (double) ) );
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
|
||||||
*(jdouble *) mem.get() =
|
*(jdouble *) mem.get() =
|
||||||
jni->CallDoubleMethodA(
|
jni->CallDoubleMethodA(
|
||||||
java_data.l,
|
java_data.l,
|
||||||
@@ -641,10 +630,8 @@ void Bridge::map_to_uno(
|
|||||||
case typelib_TypeClass_STRUCT:
|
case typelib_TypeClass_STRUCT:
|
||||||
case typelib_TypeClass_EXCEPTION:
|
case typelib_TypeClass_EXCEPTION:
|
||||||
{
|
{
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
o3tl::heap_ptr< rtl_mem > mem(
|
||||||
auto_ptr< rtl_mem > mem(
|
|
||||||
rtl_mem::allocate( value_td.get()->nSize ) );
|
rtl_mem::allocate( value_td.get()->nSize ) );
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
|
||||||
map_to_uno(
|
map_to_uno(
|
||||||
jni, mem.get(), java_data, value_td.get()->pWeakRef, 0,
|
jni, mem.get(), java_data, value_td.get()->pWeakRef, 0,
|
||||||
false /* no assign */, false /* no out param */ );
|
false /* no assign */, false /* no out param */ );
|
||||||
@@ -985,9 +972,7 @@ void Bridge::map_to_uno(
|
|||||||
typelib_TypeDescriptionReference * element_type =
|
typelib_TypeDescriptionReference * element_type =
|
||||||
((typelib_IndirectTypeDescription *)td.get())->pType;
|
((typelib_IndirectTypeDescription *)td.get())->pType;
|
||||||
|
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
o3tl::heap_ptr< rtl_mem > seq;
|
||||||
auto_ptr< rtl_mem > seq;
|
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
|
||||||
sal_Int32 nElements = jni->GetArrayLength( (jarray) java_data.l );
|
sal_Int32 nElements = jni->GetArrayLength( (jarray) java_data.l );
|
||||||
|
|
||||||
switch (element_type->eTypeClass)
|
switch (element_type->eTypeClass)
|
||||||
|
@@ -20,6 +20,8 @@
|
|||||||
#ifndef INCLUDED_JNI_HELPER_H
|
#ifndef INCLUDED_JNI_HELPER_H
|
||||||
#define INCLUDED_JNI_HELPER_H
|
#define INCLUDED_JNI_HELPER_H
|
||||||
|
|
||||||
|
#include <o3tl/heap_ptr.hxx>
|
||||||
|
|
||||||
#include "jni_base.h"
|
#include "jni_base.h"
|
||||||
#include "jni_info.h"
|
#include "jni_info.h"
|
||||||
|
|
||||||
@@ -38,11 +40,9 @@ inline void jstring_to_ustring(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
jsize len = jni->GetStringLength( jstr );
|
jsize len = jni->GetStringLength( jstr );
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
o3tl::heap_ptr< rtl_mem > mem(
|
||||||
::std::auto_ptr< rtl_mem > mem(
|
|
||||||
rtl_mem::allocate(
|
rtl_mem::allocate(
|
||||||
sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ) );
|
sizeof (rtl_uString) + (len * sizeof (sal_Unicode)) ) );
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
|
||||||
rtl_uString * ustr = (rtl_uString *)mem.get();
|
rtl_uString * ustr = (rtl_uString *)mem.get();
|
||||||
jni->GetStringRegion( jstr, 0, len, (jchar *) ustr->buffer );
|
jni->GetStringRegion( jstr, 0, len, (jchar *) ustr->buffer );
|
||||||
jni.ensure_no_exception();
|
jni.ensure_no_exception();
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include <o3tl/heap_ptr.hxx>
|
||||||
#include <sal/alloca.h>
|
#include <sal/alloca.h>
|
||||||
|
|
||||||
#include "com/sun/star/uno/RuntimeException.hpp"
|
#include "com/sun/star/uno/RuntimeException.hpp"
|
||||||
@@ -29,8 +30,6 @@
|
|||||||
|
|
||||||
#include "jni_bridge.h"
|
#include "jni_bridge.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace ::std;
|
|
||||||
using namespace ::rtl;
|
using namespace ::rtl;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@@ -96,9 +95,7 @@ void Bridge::handle_java_exc(
|
|||||||
+ jni.get_stack_trace( jo_exc.get() ) );
|
+ jni.get_stack_trace( jo_exc.get() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH
|
o3tl::heap_ptr< rtl_mem > uno_data( rtl_mem::allocate( td.get()->nSize ) );
|
||||||
auto_ptr< rtl_mem > uno_data( rtl_mem::allocate( td.get()->nSize ) );
|
|
||||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
|
||||||
jvalue val;
|
jvalue val;
|
||||||
val.l = jo_exc.get();
|
val.l = jo_exc.get();
|
||||||
map_to_uno(
|
map_to_uno(
|
||||||
|
Reference in New Issue
Block a user