From b60fd8e140667edca52cc3b7f210d29789d8c455 Mon Sep 17 00:00:00 2001 From: Blendi-Goose <87442375+Blendi-Goose@users.noreply.github.com> Date: Fri, 27 Jun 2025 22:04:12 +0200 Subject: [PATCH] signed chars are a nightmare they should be deleted --- src/unicode.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/unicode.c b/src/unicode.c index 0e48fda..c91465b 100644 --- a/src/unicode.c +++ b/src/unicode.c @@ -2,12 +2,13 @@ #include #include -bool nn_unicode_is_continuation(char byte) { +bool nn_unicode_is_continuation(unsigned char byte) { return (byte >> 6) == 0b10; } -bool nn_unicode_validate(const char *s) { +bool nn_unicode_validate(const char *b) { // TODO: validate UTF-8-ness + const unsigned char* s = (const unsigned char*)b; while (*s) { if(s[0] <= 0x7F) { s++; @@ -81,8 +82,9 @@ unsigned int *nn_unicode_codepoints(const char *s) { return buf; } -size_t nn_unicode_len(const char *s) { +size_t nn_unicode_len(const char *b) { size_t count = 0; + const unsigned char* s = (const unsigned char*)b; while (*s) { count++; if(s[0] <= 0x7F) {