unix/modjni: jvalue2py: Handle boolean.
This commit is contained in:
parent
15018291b2
commit
6196aa45ed
|
@ -242,9 +242,12 @@ STATIC bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out) {
|
||||||
// it.
|
// it.
|
||||||
#define MATCH(s, static) (!strncmp(s, static, sizeof(static) - 1))
|
#define MATCH(s, static) (!strncmp(s, static, sizeof(static) - 1))
|
||||||
STATIC mp_obj_t jvalue2py(const char *jtypesig, jobject arg) {
|
STATIC mp_obj_t jvalue2py(const char *jtypesig, jobject arg) {
|
||||||
|
const char *org_jtype = jtypesig;
|
||||||
mp_obj_t ret;
|
mp_obj_t ret;
|
||||||
if (arg == NULL || MATCH(jtypesig, "void")) {
|
if (arg == NULL || MATCH(jtypesig, "void")) {
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
|
} else if (MATCH(jtypesig, "boolean")) {
|
||||||
|
return mp_obj_new_bool((bool)arg);
|
||||||
} else if (MATCH(jtypesig, "int")) {
|
} else if (MATCH(jtypesig, "int")) {
|
||||||
return mp_obj_new_int((mp_int_t)arg);
|
return mp_obj_new_int((mp_int_t)arg);
|
||||||
} else if (MATCH(jtypesig, "java.lang.String")) {
|
} else if (MATCH(jtypesig, "java.lang.String")) {
|
||||||
|
@ -269,7 +272,7 @@ ret_string:;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Unknown return type: %s\n", jtypesig);
|
printf("Unknown return type: %s\n", org_jtype);
|
||||||
|
|
||||||
return MP_OBJ_NULL;
|
return MP_OBJ_NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue