From c4d90d46367f4a537452165d5c3009c79f1af18e Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Tue, 9 May 2023 22:10:16 +0200 Subject: [PATCH] Berry suppress warnings (#18626) --- lib/libesp32/berry/default/be_re_lib.c | 24 +++++++++---------- lib/libesp32/berry/src/be_introspectlib.c | 4 ++-- lib/libesp32/berry/src/be_solidifylib.c | 6 ++--- .../src/solidify/solidified_Matter_TLV.h | 22 ++++++++--------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/libesp32/berry/default/be_re_lib.c b/lib/libesp32/berry/default/be_re_lib.c index 956757858..f06a794b8 100644 --- a/lib/libesp32/berry/default/be_re_lib.c +++ b/lib/libesp32/berry/default/be_re_lib.c @@ -40,10 +40,10 @@ int be_re_compile(bvm *vm) { int32_t argc = be_top(vm); // Get the number of arguments if (argc >= 1 && be_isstring(vm, 1)) { const char * regex_str = be_tostring(vm, 1); - int sz = re1_5_sizecode(regex_str); - if (sz < 0) { + int sz = re1_5_sizecode(regex_str); + if (sz < 0) { be_raise(vm, "internal_error", "error in regex"); - } + } ByteProg *code = be_os_malloc(sizeof(ByteProg) + sz); int ret = re1_5_compilecode(code, regex_str); @@ -107,10 +107,10 @@ int be_re_match_search(bvm *vm, bbool is_anchored, bbool size_only) { if (offset >= hay_len) { be_return_nil(vm); } // any match of empty string returns nil, this catches implicitly when hay_len == 0 hay += offset; // shift to offset - int sz = re1_5_sizecode(regex_str); - if (sz < 0) { + int sz = re1_5_sizecode(regex_str); + if (sz < 0) { be_raise(vm, "internal_error", "error in regex"); - } + } ByteProg *code = be_os_malloc(sizeof(ByteProg) + sz); int ret = re1_5_compilecode(code, regex_str); @@ -132,10 +132,10 @@ int be_re_match_search_all(bvm *vm, bbool is_anchored) { if (argc >= 3) { limit = be_toint(vm, 3); } - int sz = re1_5_sizecode(regex_str); - if (sz < 0) { + int sz = re1_5_sizecode(regex_str); + if (sz < 0) { be_raise(vm, "internal_error", "error in regex"); - } + } ByteProg *code = be_os_malloc(sizeof(ByteProg) + sz); int ret = re1_5_compilecode(code, regex_str); @@ -322,10 +322,10 @@ int be_re_split(bvm *vm) { if (argc >= 3) { split_limit = be_toint(vm, 3); } - int sz = re1_5_sizecode(regex_str); - if (sz < 0) { + int sz = re1_5_sizecode(regex_str); + if (sz < 0) { be_raise(vm, "internal_error", "error in regex"); - } + } ByteProg *code = be_os_malloc(sizeof(ByteProg) + sz); int ret = re1_5_compilecode(code, regex_str); diff --git a/lib/libesp32/berry/src/be_introspectlib.c b/lib/libesp32/berry/src/be_introspectlib.c index 047815558..a87ce3932 100644 --- a/lib/libesp32/berry/src/be_introspectlib.c +++ b/lib/libesp32/berry/src/be_introspectlib.c @@ -109,7 +109,7 @@ static int m_toptr(bvm *vm) be_pushcomptr(vm, var_toobj(v)); be_return(vm); } else if (var_type(v) == BE_INT) { - be_pushcomptr(vm, (void*) var_toint(v)); + be_pushcomptr(vm, (void*) (intptr_t) var_toint(v)); be_return(vm); } else { be_raise(vm, "value_error", "unsupported for this type"); @@ -126,7 +126,7 @@ static int m_fromptr(bvm *vm) if (be_iscomptr(vm, 1)) { v = be_tocomptr(vm, 1); } else { - v = (void*) be_toint(vm, 1); + v = (void*) (intptr_t) be_toint(vm, 1); } if (v) { bgcobject *ptr = (bgcobject*)v; diff --git a/lib/libesp32/berry/src/be_solidifylib.c b/lib/libesp32/berry/src/be_solidifylib.c index 43d9107a3..ed3cea948 100644 --- a/lib/libesp32/berry/src/be_solidifylib.c +++ b/lib/libesp32/berry/src/be_solidifylib.c @@ -136,7 +136,7 @@ static void m_solidify_map(bvm *vm, bbool str_literal, bmap * map, const char *c #if BE_INTGER_TYPE == 2 logfmt(" { be_const_key_int(%lli, %i), ", node->key.v.i, key_next); #else - logfmt(" { be_const_key_int(%li, %i), ", node->key.v.i, key_next); + logfmt(" { be_const_key_int(%i, %i), ", node->key.v.i, key_next); #endif m_solidify_bvalue(vm, str_literal, &node->value, class_name, NULL, fout); } else { @@ -179,14 +179,14 @@ static void m_solidify_bvalue(bvm *vm, bbool str_literal, bvalue * value, const #if BE_INTGER_TYPE == 2 logfmt("be_const_int(%lli)", var_toint(value)); #else - logfmt("be_const_int(%li)", var_toint(value)); + logfmt("be_const_int(%i)", var_toint(value)); #endif break; case BE_INDEX: #if BE_INTGER_TYPE == 2 logfmt("be_const_var(%lli)", var_toint(value)); #else - logfmt("be_const_var(%li)", var_toint(value)); + logfmt("be_const_var(%i)", var_toint(value)); #endif break; case BE_REAL: diff --git a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_TLV.h b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_TLV.h index 6cc6300b0..b1e3292f3 100644 --- a/lib/libesp32/berry_matter/src/solidify/solidified_Matter_TLV.h +++ b/lib/libesp32/berry_matter/src/solidify/solidified_Matter_TLV.h @@ -3282,18 +3282,18 @@ be_local_class(Matter_TLV, be_const_int(0), be_const_int(4), be_const_int(8), - be_const_int(4294967295), - be_const_int(4294967294), - be_const_int(4294967292), - be_const_int(4294967288), - be_const_int(4294967295), - be_const_int(4294967294), - be_const_int(4294967292), - be_const_int(4294967288), + be_const_int(-1), + be_const_int(-2), + be_const_int(-4), + be_const_int(-8), + be_const_int(-1), + be_const_int(-2), + be_const_int(-4), + be_const_int(-8), be_const_int(0), - be_const_int(4294967197), - be_const_int(4294967197), - be_const_int(4294967197), + be_const_int(-99), + be_const_int(-99), + be_const_int(-99), be_const_int(0), })) ) } )) }, { be_const_key_weak(EOC, -1), be_const_int(24) },