summaryrefslogtreecommitdiff
path: root/src/common/tusb_debug.h
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2025-11-05 18:34:09 +0700
committerGitHub <[email protected]>2025-11-05 18:34:09 +0700
commit58b4104015ec10089e8790febe8b3b6cef8b4b09 (patch)
treeb619bbd1b1c002132c4b810d651abfe47b19d9bd /src/common/tusb_debug.h
parenta6c16d147593732028ed89292805e0e6a972e4b5 (diff)
parent1f04fe7924e8777c1583323171c0e1cabcb29062 (diff)
Merge pull request #3326 from hathach/fix-code-alerts
Fix code alerts
Diffstat (limited to 'src/common/tusb_debug.h')
-rw-r--r--src/common/tusb_debug.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/common/tusb_debug.h b/src/common/tusb_debug.h
index e3f9d3f18..a7bf3e959 100644
--- a/src/common/tusb_debug.h
+++ b/src/common/tusb_debug.h
@@ -55,6 +55,7 @@ void tu_print_mem(void const *buf, uint32_t count, uint8_t indent);
extern int CFG_TUSB_DEBUG_PRINTF(const char *format, ...);
#define tu_printf CFG_TUSB_DEBUG_PRINTF
#else
+ #include <stdio.h>
#define tu_printf printf
#endif
@@ -118,7 +119,9 @@ static inline const char* tu_lookup_find(tu_lookup_table_t const* p_table, uint3
// not found return the key value in hex
static char not_found[11];
- snprintf(not_found, sizeof(not_found), "0x%08lX", (unsigned long) key);
+ if (snprintf(not_found, sizeof(not_found), "0x%08lX", (unsigned long) key) <= 0) {
+ not_found[0] = 0;
+ }
return not_found;
}