unix/modjni: Fix method argument matching.
This commit is contained in:
parent
f3ca8623f7
commit
0eba162ab5
|
@ -28,6 +28,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "py/nlr.h"
|
#include "py/nlr.h"
|
||||||
#include "py/runtime0.h"
|
#include "py/runtime0.h"
|
||||||
|
@ -298,6 +299,9 @@ STATIC bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out) {
|
||||||
}
|
}
|
||||||
} else if (type == &jobject_type) {
|
} else if (type == &jobject_type) {
|
||||||
printf("TODO: Check java arg type!!\n");
|
printf("TODO: Check java arg type!!\n");
|
||||||
|
while (isalpha(*arg_type) || *arg_type == '.') {
|
||||||
|
arg_type++;
|
||||||
|
}
|
||||||
mp_obj_jobject_t *jo = arg;
|
mp_obj_jobject_t *jo = arg;
|
||||||
out->l = jo->obj;
|
out->l = jo->obj;
|
||||||
} else {
|
} else {
|
||||||
|
@ -359,7 +363,7 @@ STATIC mp_obj_t call_method(jobject obj, const char *name, jarray methods, bool
|
||||||
// printf("name=%p meth_name=%s\n", name, meth_name);
|
// printf("name=%p meth_name=%s\n", name, meth_name);
|
||||||
|
|
||||||
bool found = true;
|
bool found = true;
|
||||||
for (int i = 0; i < n_args; i++) {
|
for (int i = 0; i < n_args && *arg_types != ')'; i++) {
|
||||||
if (!py2jvalue(&arg_types, args[i], &jargs[i])) {
|
if (!py2jvalue(&arg_types, args[i], &jargs[i])) {
|
||||||
goto next_method;
|
goto next_method;
|
||||||
}
|
}
|
||||||
|
@ -369,6 +373,10 @@ STATIC mp_obj_t call_method(jobject obj, const char *name, jarray methods, bool
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*arg_types != ')') {
|
||||||
|
goto next_method;
|
||||||
|
}
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
// printf("found!\n");
|
// printf("found!\n");
|
||||||
jmethodID method_id = JJ(FromReflectedMethod, meth);
|
jmethodID method_id = JJ(FromReflectedMethod, meth);
|
||||||
|
|
Loading…
Reference in New Issue