mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
Merge pull request #2116 from dsugisawa-mixi/master
fix example of bare_api, check empty string
This commit is contained in:
commit
9a4c76d18d
@ -414,6 +414,7 @@ static int _count_utf8_bytes(const uint16_t *buf, size_t len) {
|
||||
}
|
||||
|
||||
static void print_utf16(uint16_t *temp_buf, size_t buf_len) {
|
||||
if ((temp_buf[0] & 0xff) == 0) return; // empty
|
||||
size_t utf16_len = ((temp_buf[0] & 0xff) - 2) / sizeof(uint16_t);
|
||||
size_t utf8_len = (size_t) _count_utf8_bytes(temp_buf + 1, utf16_len);
|
||||
_convert_utf16le_to_utf8(temp_buf + 1, utf16_len, (uint8_t *) temp_buf, sizeof(uint16_t) * buf_len);
|
||||
|
Loading…
x
Reference in New Issue
Block a user