From 6b45663cbb556e252fc6a2b04a1ccc221ad77ba9 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sun, 11 May 2025 19:45:40 -0600 Subject: lib9p: Tidy core_utf8.h --- lib9p/core_utf8.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib9p/core_utf8.h') diff --git a/lib9p/core_utf8.h b/lib9p/core_utf8.h index 636d4eb..2c451e0 100644 --- a/lib9p/core_utf8.h +++ b/lib9p/core_utf8.h @@ -7,10 +7,12 @@ #ifndef _LIB9P_CORE_UTF8_H_ #define _LIB9P_CORE_UTF8_H_ +#include /* for size_t */ +#include /* for uint{n}_t */ + static inline bool _is_valid_utf8(uint8_t *str, size_t len, bool forbid_nul) { uint32_t ch; uint8_t chlen; - assert(str); for (size_t pos = 0; pos < len;) { if ((str[pos] & 0b10000000) == 0b00000000) { ch = str[pos] & 0b01111111; chlen = 1; } else if ((str[pos] & 0b11100000) == 0b11000000) { ch = str[pos] & 0b00011111; chlen = 2; } -- cgit v1.2.3-2-g168b