From bb351137cb22a79226aac0f1b6f577bcfb2e6ad5 Mon Sep 17 00:00:00 2001 From: amass <168062547@qq.com> Date: Wed, 19 Jun 2024 23:16:48 +0800 Subject: [PATCH] add adapter. --- Encrypt/SecureHashAlgorithm.h | 1 + Universal/StringUtility.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Encrypt/SecureHashAlgorithm.h b/Encrypt/SecureHashAlgorithm.h index 2e41f9e..9a40cea 100644 --- a/Encrypt/SecureHashAlgorithm.h +++ b/Encrypt/SecureHashAlgorithm.h @@ -3,6 +3,7 @@ #include #include +#include class SecureHashAlgorithmPrivate; diff --git a/Universal/StringUtility.cpp b/Universal/StringUtility.cpp index 17b7acb..57f3dba 100644 --- a/Universal/StringUtility.cpp +++ b/Universal/StringUtility.cpp @@ -97,6 +97,7 @@ slow: } std::string UTF8ToGBK(const std::string &utf8Str) { +#ifdef WIN32 int wideStrLen = MultiByteToWideChar(CP_UTF8, 0, utf8Str.c_str(), -1, NULL, 0); if (wideStrLen == 0) { return ""; @@ -112,8 +113,11 @@ std::string UTF8ToGBK(const std::string &utf8Str) { std::string gbkStr(gbkStrLen, 0); WideCharToMultiByte(CP_ACP, 0, wideStr.c_str(), -1, &gbkStr[0], gbkStrLen, NULL, NULL); - return gbkStr; +#else + assert(false && "not implement."); + return ""; +#endif } } // namespace StringUtility