diff options
| author | Ha Thach <[email protected]> | 2023-08-04 11:00:09 +0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-08-04 11:00:09 +0700 |
| commit | 9a4c76d18d5b5354662fe64c420473aedefc4a58 (patch) | |
| tree | 2cd76bda49059bbf575696218c30fec208a308f4 /examples/host/bare_api/src | |
| parent | 6d03bb9ffc4c80a0c2663f0b791856af89e20adc (diff) | |
| parent | 5e78f08a24a1f53d66be9bc2df82051fc70cdf90 (diff) | |
Merge pull request #2116 from dsugisawa-mixi/master
fix example of bare_api, check empty string
Diffstat (limited to 'examples/host/bare_api/src')
| -rw-r--r-- | examples/host/bare_api/src/main.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/examples/host/bare_api/src/main.c b/examples/host/bare_api/src/main.c index 7286befe0..22676dfc4 100644 --- a/examples/host/bare_api/src/main.c +++ b/examples/host/bare_api/src/main.c @@ -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); |
