Kaydet (Commit) 2d2906da authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in bridges

Change-Id: I7bf75ffafa63ec88e89192ed32880675c9ae1d61
Reviewed-on: https://gerrit.libreoffice.org/52883Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 4db9b09c
......@@ -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;
}
......
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment