fix(ble_mesh): Miscellaneous bugfixes according to our internal bug report (v2)

This commit is contained in:
luoxu
2026-06-05 14:32:21 +08:00
committed by Liu Linyan
parent a0688c6e32
commit 4a4b74fd6d
81 changed files with 1297 additions and 793 deletions
+13 -1
View File
@@ -16,7 +16,10 @@
const char *bt_hex(const void *buf, size_t len)
{
static const char hex[] = "0123456789abcdef";
static char hexbufs[2][129];
/* WARNING: Buffer count limits concurrent bt_hex() calls in a single
* expression or across threads. Increase if more simultaneous calls needed.
*/
static char hexbufs[4][129];
static uint8_t curbuf;
const uint8_t *b = buf;
char *str = NULL;
@@ -25,6 +28,11 @@ const char *bt_hex(const void *buf, size_t len)
str = hexbufs[curbuf++];
curbuf %= ARRAY_SIZE(hexbufs);
if (buf == NULL) {
str[0] = '\0';
return str;
}
len = MIN(len, (sizeof(hexbufs[0]) - 1) / 2);
for (i = 0; i < len; i++) {
@@ -39,6 +47,10 @@ const char *bt_hex(const void *buf, size_t len)
void mem_rcopy(uint8_t *dst, uint8_t const *src, uint16_t len)
{
if (dst == NULL || src == NULL || len == 0) {
return;
}
src += len;
while (len--) {
*dst++ = *--src;