From c4ab49201b128bbaf4d58f00d685faa6ee3cb2c1 Mon Sep 17 00:00:00 2001 From: Ben Gardner Date: Sat, 15 Apr 2023 02:43:40 -0500 Subject: [PATCH] Fix compile warning when appending UTF-8/ASCII strings to ustring16 String constants are (const char *), but UTF-8 strings must be treated as an array of bytes when fiddling with the bits. The following comparison fails without this change, as uchar8_t is a signed char, which cannot be 0xC0: const uchar8_t* c2 = other; ... else if (c2[l] == 0xC0 || c2[l] == 0xC1) ... --- include/irrUString.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/irrUString.h b/include/irrUString.h index b0b730f..bd6953b 100644 --- a/include/irrUString.h +++ b/include/irrUString.h @@ -1323,7 +1323,7 @@ public: // Determine if the string is long enough for a BOM. u32 len = 0; - const uchar8_t* p = other; + const u8* p = reinterpret_cast(other); do { ++len; @@ -1338,10 +1338,10 @@ public: } // If a BOM was found, don't include it in the string. - const uchar8_t* c2 = other; + const u8* c2 = reinterpret_cast(other); if (c_bom != unicode::EUTFE_NONE) { - c2 = other + unicode::BOM_UTF8_LEN; + c2 += unicode::BOM_UTF8_LEN; length -= unicode::BOM_UTF8_LEN; }