Commit 8906a4d8 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Fixed Java's genwrapper when byte[] in method's arguments

parent 8882c8e2
......@@ -381,6 +381,7 @@ class JavaTranslator(object):
methodDict['objects'] = []
methodDict['lists'] = []
methodDict['array'] = []
methodDict['bytes'] = []
methodDict['returnedObjectGetter'] = ''
for arg in _method.args:
methodDict['params'] += ', '
......@@ -411,7 +412,10 @@ class JavaTranslator(object):
methodDict['params_impl'] += '(' + argCType + ') ' + argname
elif type(arg.type) is AbsApi.BaseType:
if arg.type.name == 'string':
if arg.type.name == 'integer' and arg.type.size is not None and arg.type.isref:
methodDict['bytes'].append({'bytesargname': argname, 'bytesargtype' : self.translate_as_c_base_type(arg.type)})
methodDict['params_impl'] += 'c_' + argname
elif arg.type.name == 'string':
methodDict['strings'].append({'string': argname})
methodDict['params_impl'] += 'c_' + argname
else:
......
......@@ -286,7 +286,9 @@ jobject {{jni_package}}CoreImpl_getMediastreamerFactory(JNIEnv *env, jobject thi
{{return}} {{name}}({{params}}) {
{{#notStatic}}{{classCName}} *cptr = ({{classCName}}*)ptr;{{/notStatic}}{{#strings}}
const char* c_{{string}} = GetStringUTFChars(env, {{string}});
{{/strings}}{{#objects}}
{{/strings}}{{#bytes}}
{{bytesargtype}} c_{{bytesargname}} = ({{bytesargtype}})env->GetByteArrayElements({{bytesargname}}, NULL);
{{/bytes}}{{#objects}}
{{objectClassCName}}* c_{{object}} = NULL;
if ({{object}}) c_{{object}} = ({{objectClassCName}}*)GetObjectNativePtr(env, {{object}});
{{/objects}}{{#lists}}
......@@ -340,7 +342,9 @@ jobject {{jni_package}}CoreImpl_getMediastreamerFactory(JNIEnv *env, jobject thi
{{#hasReturn}}{{return}} jni_result = ({{return}}){{#returnObject}}get{{returnClassName}}(env, (Linphone{{returnClassName}} *){{/returnObject}}{{/hasReturn}}{{c_name}}({{#notStatic}}cptr{{/notStatic}}{{params_impl}}){{#returnObject}}){{/returnObject}};
{{/hasNormalReturn}}{{#strings}}
ReleaseStringUTFChars(env, {{string}}, c_{{string}});
{{/strings}}{{#hasReturn}}return jni_result;{{/hasReturn}}{{#hasListReturn}}return jni_list_result;{{/hasListReturn}}
{{/strings}}{{#bytes}}
env->ReleaseByteArrayElements({{bytesargname}}, (jbyte*)c_{{bytesargname}}, JNI_ABORT);
{{/bytes}}{{#hasReturn}}return jni_result;{{/hasReturn}}{{#hasListReturn}}return jni_list_result;{{/hasListReturn}}
}
{{/methods}}
\ No newline at end of file
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