From f4c3651f8f2b588b3ebb8bb7b2dfe01a77e322a9 Mon Sep 17 00:00:00 2001 From: Horror Proton <107091537+horror-proton@users.noreply.github.com> Date: Tue, 4 Oct 2022 22:37:09 +0800 Subject: [PATCH] fix: fix a null-terminated string issue --- src/MeoAssistant/Utils/AsstUtils.hpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/MeoAssistant/Utils/AsstUtils.hpp b/src/MeoAssistant/Utils/AsstUtils.hpp index 2b41691c79..21cf31bef1 100644 --- a/src/MeoAssistant/Utils/AsstUtils.hpp +++ b/src/MeoAssistant/Utils/AsstUtils.hpp @@ -419,13 +419,7 @@ namespace asst::utils ifs.close(); std::string str = iss.str(); - static constexpr char _Bom[] = { - static_cast(0xEF), - static_cast(0xBB), - static_cast(0xBF), - }; - - if (str.starts_with(_Bom)) { + if (str.starts_with("\xEF\xBB\xBF")) { str.assign(str.begin() + 3, str.end()); } return str;