From d7e53c4d5a748d5ef8c934e90dc59ff23c667420 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 26 Dec 2021 15:13:30 +0300 Subject: WCHAR -> wchar_t --- plugins/CryptoPP/src/cpp_svcs.cpp | 20 ++++++++++---------- plugins/CryptoPP/src/utf8.cpp | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'plugins/CryptoPP/src') diff --git a/plugins/CryptoPP/src/cpp_svcs.cpp b/plugins/CryptoPP/src/cpp_svcs.cpp index 00f8b19d8a..c7a47f058b 100644 --- a/plugins/CryptoPP/src/cpp_svcs.cpp +++ b/plugins/CryptoPP/src/cpp_svcs.cpp @@ -158,8 +158,8 @@ LPSTR __cdecl cpp_encodeA(HANDLE context, LPCSTR msg) if (ptr->features & FEATURES_UTF8) { // ansi message: convert to unicode->utf-8 and encrypt. int slen = (int)strlen(szOldMsg) + 1; - LPWSTR wstring = (LPWSTR)alloca(slen*sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, szOldMsg, -1, wstring, slen*sizeof(WCHAR)); + LPWSTR wstring = (LPWSTR)alloca(slen*sizeof(wchar_t)); + MultiByteToWideChar(CP_ACP, 0, szOldMsg, -1, wstring, slen*sizeof(wchar_t)); // encrypt szNewMsg = cpp_encrypt(ptr, utf8encode(wstring)); } @@ -242,18 +242,18 @@ LPSTR __cdecl cpp_decode(HANDLE context, LPCSTR szEncMsg) // utf8 message: convert to unicode -> ansii LPWSTR wstring = utf8decode(szOldMsg); int wlen = (int)wcslen(wstring) + 1; - szNewMsg = (LPSTR)mir_alloc(wlen*(sizeof(WCHAR)+2)); // work.zy@gmail.com + szNewMsg = (LPSTR)mir_alloc(wlen*(sizeof(wchar_t)+2)); // work.zy@gmail.com WideCharToMultiByte(CP_ACP, 0, wstring, -1, szNewMsg, wlen, nullptr, nullptr); - memcpy(szNewMsg + strlen(szNewMsg) + 1, wstring, wlen*sizeof(WCHAR)); // work.zy@gmail.com + memcpy(szNewMsg + strlen(szNewMsg) + 1, wstring, wlen*sizeof(wchar_t)); // work.zy@gmail.com } else { // ansi message: convert to unicode int slen = (int)strlen(szOldMsg) + 1; - szNewMsg = (LPSTR)mir_alloc(slen*(sizeof(WCHAR)+1)); + szNewMsg = (LPSTR)mir_alloc(slen*(sizeof(wchar_t)+1)); memcpy(szNewMsg, szOldMsg, slen); - WCHAR* wstring = (LPWSTR)alloca(slen*sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, szOldMsg, -1, wstring, slen*sizeof(WCHAR)); - memcpy(szNewMsg + slen, wstring, slen*sizeof(WCHAR)); + wchar_t* wstring = (LPWSTR)alloca(slen*sizeof(wchar_t)); + MultiByteToWideChar(CP_ACP, 0, szOldMsg, -1, wstring, slen*sizeof(wchar_t)); + memcpy(szNewMsg + slen, wstring, slen*sizeof(wchar_t)); } } mir_free(ptr->tmp); @@ -281,8 +281,8 @@ LPSTR __cdecl cpp_decodeU(HANDLE context, LPCSTR szEncMsg) else { // ansi message: convert to utf8 int slen = (int)strlen(szOldMsg) + 1; - LPWSTR wstring = (LPWSTR)alloca(slen*sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, szOldMsg, -1, wstring, slen*sizeof(WCHAR)); + LPWSTR wstring = (LPWSTR)alloca(slen*sizeof(wchar_t)); + MultiByteToWideChar(CP_ACP, 0, szOldMsg, -1, wstring, slen*sizeof(wchar_t)); szNewMsg = mir_strdup(utf8encode(wstring)); } } diff --git a/plugins/CryptoPP/src/utf8.cpp b/plugins/CryptoPP/src/utf8.cpp index 83d4e4a97a..6a0a6e21a7 100644 --- a/plugins/CryptoPP/src/utf8.cpp +++ b/plugins/CryptoPP/src/utf8.cpp @@ -54,7 +54,7 @@ LPWSTR __cdecl utf8decode(LPCSTR str) size_t len = strlen(str) + 1; SAFE_FREE(wszOut); - if ((wszOut = (LPWSTR)malloc(len*sizeof(WCHAR))) == nullptr) + if ((wszOut = (LPWSTR)malloc(len*sizeof(wchar_t))) == nullptr) return nullptr; p = (LPSTR)str; i = 0; -- cgit v1.2.3