auto_ptr -> heap_ptr

Change-Id: I2c6bb5c0ad9a844826498a1c8495249dd88a9942
This commit is contained in:
Stephan Bergmann
2014-02-07 16:05:55 +01:00
parent cf1f27affc
commit ae2ccda117
4 changed files with 16 additions and 39 deletions

View File

@@ -25,12 +25,11 @@
#include <boost/static_assert.hpp>
#include "jvmaccess/unovirtualmachine.hxx"
#include "o3tl/heap_ptr.hxx"
#include "rtl/ref.hxx"
#include "rtl/strbuf.hxx"
#include "uno/lbnames.h"
using namespace ::std;
using namespace ::rtl;
using namespace ::osl;
using namespace ::jni_uno;
@@ -311,11 +310,9 @@ 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(
o3tl::heap_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())
@@ -389,11 +386,9 @@ 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(
o3tl::heap_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 );

View File

@@ -23,11 +23,10 @@
#include "jni_bridge.h"
#include "o3tl/heap_ptr.hxx"
#include "rtl/strbuf.hxx"
#include "uno/sequence2.h"
using namespace ::std;
using namespace ::rtl;
namespace jni_uno
@@ -36,10 +35,8 @@ namespace jni_uno
//------------------------------------------------------------------------------
inline rtl_mem * seq_allocate( sal_Int32 nElements, sal_Int32 nSize )
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
auto_ptr< rtl_mem > seq(
o3tl::heap_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;
@@ -130,9 +127,7 @@ void createDefaultUnoValue(
case typelib_TypeClass_SEQUENCE:
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
auto_ptr< rtl_mem > seq(seq_allocate(0, 0));
SAL_WNODEPRECATED_DECLARATIONS_POP
o3tl::heap_ptr< rtl_mem > seq(seq_allocate(0, 0));
if (assign) {
uno_type_destructData(uno_data, type, 0);
}
@@ -566,10 +561,8 @@ void Bridge::map_to_uno(
}
else
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
auto_ptr< rtl_mem > mem(
o3tl::heap_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();
@@ -586,10 +579,8 @@ void Bridge::map_to_uno(
}
else
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
auto_ptr< rtl_mem > mem(
o3tl::heap_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();
@@ -608,10 +599,8 @@ void Bridge::map_to_uno(
}
else
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
auto_ptr< rtl_mem > mem(
o3tl::heap_ptr< rtl_mem > mem(
rtl_mem::allocate( sizeof (double) ) );
SAL_WNODEPRECATED_DECLARATIONS_POP
*(jdouble *) mem.get() =
jni->CallDoubleMethodA(
java_data.l,
@@ -641,10 +630,8 @@ void Bridge::map_to_uno(
case typelib_TypeClass_STRUCT:
case typelib_TypeClass_EXCEPTION:
{
SAL_WNODEPRECATED_DECLARATIONS_PUSH
auto_ptr< rtl_mem > mem(
o3tl::heap_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 */ );
@@ -985,9 +972,7 @@ 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
o3tl::heap_ptr< rtl_mem > seq;
sal_Int32 nElements = jni->GetArrayLength( (jarray) java_data.l );
switch (element_type->eTypeClass)

View File

@@ -20,6 +20,8 @@
#ifndef INCLUDED_JNI_HELPER_H
#define INCLUDED_JNI_HELPER_H
#include <o3tl/heap_ptr.hxx>
#include "jni_base.h"
#include "jni_info.h"
@@ -38,11 +40,9 @@ inline void jstring_to_ustring(
else
{
jsize len = jni->GetStringLength( jstr );
SAL_WNODEPRECATED_DECLARATIONS_PUSH
::std::auto_ptr< rtl_mem > mem(
o3tl::heap_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();

View File

@@ -21,6 +21,7 @@
#include <cassert>
#include <o3tl/heap_ptr.hxx>
#include <sal/alloca.h>
#include "com/sun/star/uno/RuntimeException.hpp"
@@ -29,8 +30,6 @@
#include "jni_bridge.h"
using namespace ::std;
using namespace ::rtl;
namespace
@@ -96,9 +95,7 @@ void Bridge::handle_java_exc(
+ jni.get_stack_trace( jo_exc.get() ) );
}
SAL_WNODEPRECATED_DECLARATIONS_PUSH
auto_ptr< rtl_mem > uno_data( rtl_mem::allocate( td.get()->nSize ) );
SAL_WNODEPRECATED_DECLARATIONS_POP
o3tl::heap_ptr< rtl_mem > uno_data( rtl_mem::allocate( td.get()->nSize ) );
jvalue val;
val.l = jo_exc.get();
map_to_uno(