--- drw.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drw.c b/drw.c index ced7d37..b6073a4 100644 --- a/drw.c +++ b/drw.c _AT_@ -25,16 +25,6 @@ utf8decodebyte(const char c, size_t *i) return 0; } -static size_t -utf8validate(long *u, size_t i) -{ - if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF)) - *u = UTF_INVALID; - for (i = 1; *u > utfmax[i]; ++i) - ; - return i; -} - static size_t utf8decode(const char *c, long *u, size_t clen) { _AT_@ -54,8 +44,9 @@ utf8decode(const char *c, long *u, size_t clen) } if (j < len) return 0; - *u = udecoded; - utf8validate(u, len); + + *u = (!BETWEEN(udecoded, utfmin[i], utfmax[i]) || BETWEEN(udecoded, 0xD800, 0xDFFF)) + ? UTF_INVALID : udecoded; return len; } -- 2.30.2Received on Mon Aug 15 2022 - 23:19:41 CEST
This archive was generated by hypermail 2.3.0 : Mon Aug 15 2022 - 23:24:47 CEST