From 4bc8a415027414d1aa84c2ea8d706b1ade5e2451 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Sat, 24 Feb 2024 18:40:16 +0100 Subject: [PATCH] Minor Berry fixes (#20799) --- lib/libesp32/berry_mapping/src/be_cb_module.c | 2 +- lib/libesp32/berry_mapping/src/be_class_wrapper.c | 7 ++++--- lib/libesp32/berry_mapping/src/be_const_members.c | 1 + lib/libesp32/berry_mapping/src/be_mapping.h | 1 - 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/libesp32/berry_mapping/src/be_cb_module.c b/lib/libesp32/berry_mapping/src/be_cb_module.c index 111ba95e0..f0f2ab2d6 100644 --- a/lib/libesp32/berry_mapping/src/be_cb_module.c +++ b/lib/libesp32/berry_mapping/src/be_cb_module.c @@ -280,7 +280,7 @@ void be_cb_deinit(bvm *vm) { for (int32_t slot = 0; slot < BE_MAX_CB; slot++) { if (be_cb_hooks[slot].vm == vm) { be_cb_hooks[slot].vm = NULL; - be_cb_hooks[slot].f.type == BE_NIL; + be_cb_hooks[slot].f.type = BE_NIL; } } // remove the vm gen_cb for this vm diff --git a/lib/libesp32/berry_mapping/src/be_class_wrapper.c b/lib/libesp32/berry_mapping/src/be_class_wrapper.c index 2f29ab95a..9e2f052d1 100644 --- a/lib/libesp32/berry_mapping/src/be_class_wrapper.c +++ b/lib/libesp32/berry_mapping/src/be_class_wrapper.c @@ -12,6 +12,7 @@ #include "be_mapping.h" #include "be_exec.h" #include +#include typedef intptr_t (*fn_any_callable)(intptr_t p0, intptr_t p1, intptr_t p2, intptr_t p3, intptr_t p4, intptr_t p5, intptr_t p6, intptr_t p7); @@ -191,13 +192,13 @@ intptr_t be_convert_single_elt(bvm *vm, int idx, const char * arg_type, int *buf be_pop(vm, 3 + ret); // berry_log_C("func=%p", func); - return (int32_t) func; + return (intptr_t) func; } else { be_raisef(vm, "type_error", "Can't find callback generator: 'cb.make_cb'"); } } else if (be_iscomptr(vm, idx)) { // if it's a pointer, just pass it without any change - return (int32_t) be_tocomptr(vm, idx);; + return (intptr_t) be_tocomptr(vm, idx);; } else { be_raise(vm, "type_error", "Closure expected for callback type"); } @@ -314,7 +315,7 @@ int be_check_arg_type(bvm *vm, int arg_start, int argc, const char * arg_type, i p_idx++; } - for (uint32_t i = 0; i < argc; i++) { + for (int i = 0; i < argc; i++) { type_short_name[0] = 0; // clear string // extract individual type if (arg_type) { diff --git a/lib/libesp32/berry_mapping/src/be_const_members.c b/lib/libesp32/berry_mapping/src/be_const_members.c index 753f30940..29c60d7ca 100644 --- a/lib/libesp32/berry_mapping/src/be_const_members.c +++ b/lib/libesp32/berry_mapping/src/be_const_members.c @@ -23,6 +23,7 @@ #include "be_mapping.h" #include "be_exec.h" #include "be_string.h" +#include "be_module.h" #include /*********************************************************************************************\ * Takes a pointer to be_const_member_t array and size diff --git a/lib/libesp32/berry_mapping/src/be_mapping.h b/lib/libesp32/berry_mapping/src/be_mapping.h index f0ab9d22c..8310a580d 100644 --- a/lib/libesp32/berry_mapping/src/be_mapping.h +++ b/lib/libesp32/berry_mapping/src/be_mapping.h @@ -23,7 +23,6 @@ typedef const void* be_constptr; .v.nf = (const void*) &ctype_func_def##_f, \ .type = BE_CTYPE_FUNC \ } -typedef const void* be_constptr; #define be_const_static_ctype_func(_f) { \ .v.nf = (const void*) &ctype_func_def##_f, \ .type = BE_CTYPE_FUNC | BE_STATIC \