summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-12 15:08:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-16 08:21:56 +0200
commit2d2906da813362d83bc6a7d7093eefcc9566dbb1 (patch)
tree5df99a62f3a998e241f88deaedb0ed42ca153438 /bridges
parent4db9b09cf035e2c9efe44e64c00999be08ccab01 (diff)
loplugin:useuniqueptr in bridges
Change-Id: I7bf75ffafa63ec88e89192ed32880675c9ae1d61 Reviewed-on: https://gerrit.libreoffice.org/52883 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/jni_uno/jni_info.cxx14
-rw-r--r--bridges/source/jni_uno/jni_info.h4
2 files changed, 9 insertions, 9 deletions
diff --git a/bridges/source/jni_uno/jni_info.cxx b/bridges/source/jni_uno/jni_info.cxx
index 82b773d6d58c..9b43356856af 100644
--- a/bridges/source/jni_uno/jni_info.cxx
+++ b/bridges/source/jni_uno/jni_info.cxx
@@ -61,7 +61,7 @@ void JNI_interface_type_info::destroy( JNIEnv * jni_env )
JNI_type_info::destruct( jni_env );
jni_env->DeleteGlobalRef( m_proxy_ctor );
jni_env->DeleteGlobalRef( m_type );
- delete [] m_methods;
+ m_methods.reset();
delete this;
}
@@ -104,7 +104,7 @@ JNI_interface_type_info::JNI_interface_type_info(
reinterpret_cast< typelib_InterfaceTypeDescription * >(
m_td.get() );
// coverity [ctor_dtor_leak]
- m_methods = new jmethodID[ td->nMapFunctionIndexToMemberIndex ];
+ m_methods.reset(new jmethodID[ td->nMapFunctionIndexToMemberIndex ]);
sal_Int32 nMethodIndex = 0;
typelib_TypeDescriptionReference ** ppMembers = td->ppMembers;
sal_Int32 nMembers = td->nMembers;
@@ -211,7 +211,7 @@ JNI_interface_type_info::JNI_interface_type_info(
}
catch (...)
{
- delete [] m_methods;
+ m_methods.reset();
throw;
}
}
@@ -224,7 +224,7 @@ JNI_interface_type_info::JNI_interface_type_info(
void JNI_compound_type_info::destroy( JNIEnv * jni_env )
{
JNI_type_info::destruct( jni_env );
- delete [] m_fields;
+ m_fields.reset();
delete this;
}
@@ -289,7 +289,7 @@ JNI_compound_type_info::JNI_compound_type_info(
jni_info->m_RuntimeException_type.getTypeLibType() ))
{
// coverity [ctor_dtor_leak]
- m_fields = new jfieldID[ 2 ];
+ m_fields.reset(new jfieldID[ 2 ]);
m_fields[ 0 ] = nullptr; // special Throwable.getMessage()
// field Context
m_fields[ 1 ] = jni->GetFieldID(
@@ -301,7 +301,7 @@ JNI_compound_type_info::JNI_compound_type_info(
{
// retrieve field ids for all direct members
sal_Int32 nMembers = td->nMembers;
- m_fields = new jfieldID[ nMembers ];
+ m_fields.reset(new jfieldID[ nMembers ]);
for ( sal_Int32 nPos = 0; nPos < nMembers; ++nPos )
{
@@ -334,7 +334,7 @@ JNI_compound_type_info::JNI_compound_type_info(
}
catch (...)
{
- delete [] m_fields;
+ m_fields.reset();
throw;
}
diff --git a/bridges/source/jni_uno/jni_info.h b/bridges/source/jni_uno/jni_info.h
index 920e78453afe..98ba7c9e505a 100644
--- a/bridges/source/jni_uno/jni_info.h
+++ b/bridges/source/jni_uno/jni_info.h
@@ -82,7 +82,7 @@ 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;
+ std::unique_ptr<jmethodID[]> m_methods;
virtual void destroy( JNIEnv * jni_env ) override;
explicit JNI_interface_type_info(
@@ -98,7 +98,7 @@ struct JNI_compound_type_info : public JNI_type_info
// ctor( msg ) for exceptions
jmethodID m_exc_ctor;
// sorted via typelib member index
- jfieldID * m_fields;
+ std::unique_ptr<jfieldID[]> m_fields;
virtual void destroy( JNIEnv * jni_env ) override;
explicit JNI_compound_type_info(