|
@@ -253,59 +253,6 @@ private:
|
|
|
CHTTPClient& operator=(const CHTTPClient& Copy);
|
|
|
};
|
|
|
|
|
|
-///*TODO(80374374@3/9/2023): 抽出作为公共函数 */
|
|
|
-#if defined(_MSC_VER)
|
|
|
-char* ConvertUtf8ToGBK(const char* strUtf8)
|
|
|
-{
|
|
|
- int len = MultiByteToWideChar(CP_UTF8, 0, strUtf8, -1, NULL, 0);
|
|
|
- WCHAR* wszGBK = new WCHAR[len + 1];
|
|
|
- memset(wszGBK, 0, len * 2 + 2);
|
|
|
- MultiByteToWideChar(CP_UTF8, 0, strUtf8, -1, wszGBK, len);
|
|
|
-
|
|
|
- len = WideCharToMultiByte(CP_ACP, 0, wszGBK, -1, NULL, 0, NULL, NULL);
|
|
|
- char* szGBK = new char[len + 1];
|
|
|
- memset(szGBK, 0, len + 1);
|
|
|
- WideCharToMultiByte(CP_ACP, 0, wszGBK, -1, szGBK, len, NULL, NULL);
|
|
|
- delete[] wszGBK;
|
|
|
-
|
|
|
- return szGBK;
|
|
|
-}
|
|
|
-
|
|
|
-void ConvertUtf8ToGBK(std::string& str)
|
|
|
-{
|
|
|
- char* dst = ConvertUtf8ToGBK(str.c_str());
|
|
|
- str = dst;
|
|
|
- delete[] dst;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-char* ConvertGBKToUtf8(const char* gbk, int* n)
|
|
|
-{
|
|
|
- int len = MultiByteToWideChar(CP_ACP, 0, gbk, -1, NULL, 0);
|
|
|
- WCHAR* wszGBK = new WCHAR[len + 1];
|
|
|
- memset(wszGBK, 0, len * 2 + 2);
|
|
|
- MultiByteToWideChar(CP_ACP, 0, gbk, -1, wszGBK, len);
|
|
|
-
|
|
|
- len = WideCharToMultiByte(CP_UTF8, 0, wszGBK, -1, NULL, 0, NULL, NULL);
|
|
|
- char* szUtf8 = new char[len + 1];
|
|
|
- memset(szUtf8, 0, len + 1);
|
|
|
- WideCharToMultiByte(CP_UTF8, 0, wszGBK, -1, szUtf8, len, NULL, NULL);
|
|
|
-
|
|
|
- delete[] wszGBK;
|
|
|
- *n = len - 1;
|
|
|
- return szUtf8;
|
|
|
-}
|
|
|
-
|
|
|
-void ConvertGBKToUtf8(std::string& str)
|
|
|
-{
|
|
|
- int len = 0;
|
|
|
- char* dst = ConvertGBKToUtf8(str.c_str(), &len);
|
|
|
- str = dst;
|
|
|
- delete[] dst;
|
|
|
-}
|
|
|
-#endif //_MSC_VER
|
|
|
-
|
|
|
-
|
|
|
RVCCOMM_API IHttpFunc* create_http(LogFnCallback oLogger)
|
|
|
{
|
|
|
return new CHTTPClient(oLogger);
|