]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
(wtf8) wrap 4-bytes-sequence detection in ifdef U32
authorNaitLee <naitli@foxmail.com>
Mon, 10 Jul 2023 14:15:04 +0000 (22:15 +0800)
committerNaitLee <naitli@foxmail.com>
Mon, 10 Jul 2023 14:15:04 +0000 (22:15 +0800)
Signed-off-by: NaitLee <naitli@foxmail.com>
utf8lib.c

index 18b5e09d4de73973b62df12875f2cf80c32449f2..1e34e707c978413cb8ef999db36a6e5dd24ecb8b 100644 (file)
--- a/utf8lib.c
+++ b/utf8lib.c
@@ -975,12 +975,15 @@ int fromwtf8(const char *cstr, int clen, wchar *wstr, int maxwlen)
                if ((byte & 0xf8) == 0xf8)
                        return -1;
                #endif
+               #if WTF8U32
                if ((byte & 0xf8) == 0xf0)
                {
                        length = 4;
                        point = byte & 0x07;
                }
-               else if ((byte & 0xf0) == 0xe0)
+               else
+               #endif
+               if ((byte & 0xf0) == 0xe0)
                {
                        length = 3;
                        point = byte & 0x0f;