From 75a1ab97193eea6a7a97ae7bc55bd57725a36e70 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Tue, 2 Dec 2025 20:57:56 -0500 Subject: [PATCH] chore: remove unused Unicode::UCS4ToUTF8 --- src/lib/base/Unicode.cpp | 46 ---------------------------------------- src/lib/base/Unicode.h | 8 ------- 2 files changed, 54 deletions(-) diff --git a/src/lib/base/Unicode.cpp b/src/lib/base/Unicode.cpp index 2567f36d7..36167e670 100644 --- a/src/lib/base/Unicode.cpp +++ b/src/lib/base/Unicode.cpp @@ -207,16 +207,6 @@ std::string Unicode::UCS2ToUTF8(const std::string_view &src, bool *errors) return doUCS2ToUTF8(reinterpret_cast(src.data()), n, errors); } -std::string Unicode::UCS4ToUTF8(const std::string_view &src, bool *errors) -{ - // default to success - resetError(errors); - - // convert - uint32_t n = (uint32_t)src.size() >> 2; - return doUCS4ToUTF8(reinterpret_cast(src.data()), n, errors); -} - std::string Unicode::UTF16ToUTF8(const std::string_view &src, bool *errors) { // default to success @@ -263,42 +253,6 @@ std::string Unicode::doUCS2ToUTF8(const uint8_t *data, uint32_t n, bool *errors) return dst; } -std::string Unicode::doUCS4ToUTF8(const uint8_t *data, uint32_t n, bool *errors) -{ - // make some space - std::string dst; - dst.reserve(n); - - // check if first character is 0xfffe or 0xfeff - bool byteSwapped = false; - if (n >= 1) { - switch (decode32(data, false)) { - case 0x0000feff: - data += 4; - --n; - break; - - case 0x0000fffe: - byteSwapped = true; - data += 4; - --n; - break; - - default: - break; - } - } - - // convert each character - for (; n > 0; --n) { - auto c = decode32(data, byteSwapped); - toUTF8(dst, c, errors); - data += 4; - } - - return dst; -} - std::string Unicode::doUTF16ToUTF8(const uint8_t *data, uint32_t n, bool *errors) { // make some space diff --git a/src/lib/base/Unicode.h b/src/lib/base/Unicode.h index a35e147a0..0a2b53926 100644 --- a/src/lib/base/Unicode.h +++ b/src/lib/base/Unicode.h @@ -67,13 +67,6 @@ public: */ static std::string UCS2ToUTF8(const std::string_view &, bool *errors = nullptr); - //! Convert from UCS-4 to UTF-8 - /*! - Convert from UCS-4 to UTF-8. If errors is not nullptr then *errors is - set to true iff any character could not be decoded. - */ - static std::string UCS4ToUTF8(const std::string_view &, bool *errors = nullptr); - //! Convert from UTF-16 to UTF-8 /*! Convert from UTF-16 to UTF-8. If errors is not nullptr then *errors is @@ -86,7 +79,6 @@ public: private: // internal conversion to UTF8 static std::string doUCS2ToUTF8(const uint8_t *src, uint32_t n, bool *errors); - static std::string doUCS4ToUTF8(const uint8_t *src, uint32_t n, bool *errors); static std::string doUTF16ToUTF8(const uint8_t *src, uint32_t n, bool *errors); // convert characters to/from UTF8