From 45b5da0977f17ec6b38382d6e444f2079e69927a Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Wed, 31 Jul 2019 17:51:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_player.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_player.cpp b/tests/test_player.cpp index f0ee2dad..6ddfb256 100644 --- a/tests/test_player.cpp +++ b/tests/test_player.cpp @@ -39,9 +39,9 @@ using namespace std; using namespace toolkit; using namespace mediakit; -std::string Utf8ToGbk(std::string src_str) -{ #ifdef WIN32 +std::string Utf8ToGbk(std::string src_str){ + int len = MultiByteToWideChar(CP_UTF8, 0, src_str.c_str(), -1, NULL, 0); wchar_t* wszGBK = new wchar_t[len + 1]; memset(wszGBK, 0, len * 2 + 2); @@ -54,9 +54,6 @@ std::string Utf8ToGbk(std::string src_str) if (wszGBK) delete[] wszGBK; if (szGBK) delete[] szGBK; return strTemp; -#else - return src_str; -#endif } class log4Channel : public LogChannel { @@ -75,6 +72,9 @@ public: printf("%s %s\n", logContext->_function, Utf8ToGbk(logContext->str()).c_str()); } }; +#else +typedef ConsoleChannel log4Channel; +#endif #ifdef WIN32 #include