diff options
| author | Ha Thach <[email protected]> | 2022-03-04 22:59:16 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-03-04 22:59:16 +0700 |
| commit | 8e0b8c15eaf89e956435b8d7df00707b94a090c6 (patch) | |
| tree | 67ceb7a9015fcd817a04b53f50e050b713e5cfa1 /src/common | |
| parent | 5453c7e97f673dfc804524177b5d01c9a6242dcf (diff) | |
| parent | 56c2d4b666856dedd9ced301d8a273c55ee2afd6 (diff) | |
Merge pull request #1369 from tannewt/host_string_desc
Add host string descriptor functions
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/tusb_common.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/tusb_common.h b/src/common/tusb_common.h index 9b9e2b007..26865805e 100644 --- a/src/common/tusb_common.h +++ b/src/common/tusb_common.h @@ -38,6 +38,7 @@ #define TU_MIN(_x, _y) ( ( (_x) < (_y) ) ? (_x) : (_y) ) #define TU_MAX(_x, _y) ( ( (_x) > (_y) ) ? (_x) : (_y) ) +#define TU_U16(_high, _low) ((uint16_t) (((_high) << 8) | (_low))) #define TU_U16_HIGH(_u16) ((uint8_t) (((_u16) >> 8) & 0x00ff)) #define TU_U16_LOW(_u16) ((uint8_t) ((_u16) & 0x00ff)) #define U16_TO_U8S_BE(_u16) TU_U16_HIGH(_u16), TU_U16_LOW(_u16) @@ -349,7 +350,7 @@ static inline const char* tu_lookup_find(tu_lookup_table_t const* p_table, uint3 } // not found return the key value in hex - sprintf(not_found, "0x%08lX", (unsigned long) key); + snprintf(not_found, sizeof(not_found), "0x%08lX", (unsigned long) key); return not_found; } |
