From 8af589882e3adc71a87b976c6619686a28a7df7d Mon Sep 17 00:00:00 2001 From: rjkiv <76180273+rjkiv@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:34:39 -0700 Subject: [PATCH] revert wideStringToString --- strutil.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/strutil.cpp b/strutil.cpp index b8192ec..5aaff44 100644 --- a/strutil.cpp +++ b/strutil.cpp @@ -116,24 +116,24 @@ std::string wideStringToString(const uint16_t *src, int len = -1) { len = src ? wstrlen(src) : 0; } - std::u16string u16str; - for(const uint16_t* p = src; *p != 0; p++){ - u16str.push_back(*p); - } + // std::u16string u16str; + // for(const uint16_t* p = src; *p != 0; p++){ + // u16str.push_back(*p); + // } - std::wstring_convert, char16_t> convert; - return convert.to_bytes(reinterpret_cast(u16str.data())); + // std::wstring_convert, char16_t> convert; + // return convert.to_bytes(reinterpret_cast(u16str.data())); // the old implementation - // std::string res(len, '\0'); - // for (int i = 0; i < len; i++) { - // if(src[i] > 255){ - // DEBUG_LOG("Encountered wide char with value 0x%X!\n", src[i]); - // assert(src[i] <= 255); - // } - // res[i] = src[i] & 0xFF; - // } - // return res; + std::string res(len, '\0'); + for (int i = 0; i < len; i++) { + if(src[i] > 255){ + // DEBUG_LOG("Encountered wide char with value 0x%X!\n", src[i]); + // assert(src[i] <= 255); + } + res[i] = src[i] & 0xFF; + } + return res; } std::vector stringToWideString(const char *src) {