From b400d56585b2e8a78cbaabed57f52ad6758c248c Mon Sep 17 00:00:00 2001 From: Benau Date: Sun, 16 Sep 2018 00:29:59 +0800 Subject: [PATCH] Don't use static in unicode conversion due to multiple threads usage now --- src/utils/string_utils.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/utils/string_utils.cpp b/src/utils/string_utils.cpp index ff16a431e..d9ca981d9 100644 --- a/src/utils/string_utils.cpp +++ b/src/utils/string_utils.cpp @@ -790,12 +790,9 @@ namespace StringUtils std::string wideToUtf8(const wchar_t* input) { - static std::vector utf8line; - utf8line.clear(); - + std::vector utf8line; utf8::utf16to8(input, input + wcslen(input), back_inserter(utf8line)); utf8line.push_back(0); - return std::string(&utf8line[0]); } // wideToUtf8 @@ -811,12 +808,9 @@ namespace StringUtils /** Converts the irrlicht wide string to an utf8-encoded std::string. */ irr::core::stringw utf8ToWide(const char* input) { - static std::vector utf16line; - utf16line.clear(); - + std::vector utf16line; utf8::utf8to16(input, input + strlen(input), back_inserter(utf16line)); utf16line.push_back(0); - return irr::core::stringw(&utf16line[0]); } // utf8ToWide