From df51f338983ba85feffcbd2209100c6927dda8a5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 16 Jan 2017 18:19:15 +0300 Subject: Utf8DecodeT/Utf8EncodeT macros considered useless and replaced with Utf8DecodeW/Utf8EncodeW --- include/m_core.h | 3 --- plugins/MirLua/Modules/WinAPI/src/winapi.cpp | 8 ++++---- plugins/MirLua/src/m_clist.cpp | 4 ++-- plugins/MirLua/src/m_genmenu.cpp | 2 +- plugins/MirLua/src/main.cpp | 8 -------- protocols/Tox/src/tox_core.cpp | 4 ++-- protocols/Tox/src/tox_options.cpp | 4 ++-- src/core/stdauth/src/authdialogs.cpp | 18 +++++++++--------- src/core/stdfile/src/file.cpp | 4 ++-- src/core/stdfile/src/filexferdlg.cpp | 2 +- src/core/stdhelp/src/about.cpp | 2 +- src/core/stdssl/src/netlibssl.cpp | 2 +- 12 files changed, 25 insertions(+), 36 deletions(-) diff --git a/include/m_core.h b/include/m_core.h index d973a63da3..2f5073cf16 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -495,9 +495,6 @@ MIR_CORE_DLL(int) Ucs2toUtf8Len(const wchar_t *src); MIR_CORE_DLL(BOOL) Utf8CheckString(const char* str); -#define Utf8DecodeT Utf8DecodeW -#define Utf8EncodeT Utf8EncodeW - #define mir_utf8decode(A, B) Utf8Decode(A, B) #define mir_utf8decodecp(A, B, C) Utf8DecodeCP(A, B, C) #define mir_utf8decodeW(A) Utf8DecodeW(A) diff --git a/plugins/MirLua/Modules/WinAPI/src/winapi.cpp b/plugins/MirLua/Modules/WinAPI/src/winapi.cpp index 40c80555bf..da4f62ec50 100644 --- a/plugins/MirLua/Modules/WinAPI/src/winapi.cpp +++ b/plugins/MirLua/Modules/WinAPI/src/winapi.cpp @@ -217,10 +217,10 @@ static int lua_GetRegValue(lua_State *L) case REG_SZ: case REG_LINK: case REG_EXPAND_SZ: - { - ptrA str(Utf8EncodeT((wchar_t*)value)); - lua_pushlstring(L, str, mir_strlen(str)); - } + { + ptrA str(Utf8EncodeW((wchar_t*)value)); + lua_pushlstring(L, str, mir_strlen(str)); + } break; default: diff --git a/plugins/MirLua/src/m_clist.cpp b/plugins/MirLua/src/m_clist.cpp index 59a5415b32..7620ef9e9e 100644 --- a/plugins/MirLua/src/m_clist.cpp +++ b/plugins/MirLua/src/m_clist.cpp @@ -6,7 +6,7 @@ static int clist_AddMainMenuRoot(lua_State *L) int position = lua_tointeger(L, 2); HANDLE hIcon = (HANDLE)lua_touserdata(L, 3); - HGENMENU res = Menu_CreateRoot(MO_MAIN, ptrW(Utf8DecodeT(name)), position, hIcon); + HGENMENU res = Menu_CreateRoot(MO_MAIN, ptrW(Utf8DecodeW(name)), position, hIcon); lua_pushlightuserdata(L, res); return 1; @@ -29,7 +29,7 @@ static int clist_AddContactMenuRoot(lua_State *L) int position = lua_tointeger(L, 2); HANDLE hIcon = (HANDLE)lua_touserdata(L, 3); - HGENMENU res = Menu_CreateRoot(MO_MAIN, ptrW(Utf8DecodeT(name)), position, hIcon); + HGENMENU res = Menu_CreateRoot(MO_MAIN, ptrW(Utf8DecodeW(name)), position, hIcon); lua_pushlightuserdata(L, res); return 1; diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp index 0eaafee37a..2359549fb5 100644 --- a/plugins/MirLua/src/m_genmenu.cpp +++ b/plugins/MirLua/src/m_genmenu.cpp @@ -47,7 +47,7 @@ void MakeMenuItem(lua_State *L, CMenuItem &mi) int position = lua_tointeger(L, 3); HANDLE hIcon = (HANDLE)lua_touserdata(L, 4); - HGENMENU res = Menu_CreateRoot(hMenuObject, ptrW(Utf8DecodeT(name)), position, hIcon); + HGENMENU res = Menu_CreateRoot(hMenuObject, ptrW(Utf8DecodeW(name)), position, hIcon); lua_pushlightuserdata(L, res); return 1; diff --git a/plugins/MirLua/src/main.cpp b/plugins/MirLua/src/main.cpp index 0539404a7d..03aed915d7 100644 --- a/plugins/MirLua/src/main.cpp +++ b/plugins/MirLua/src/main.cpp @@ -74,14 +74,6 @@ extern "C" int __declspec(dllexport) Load(void) hRecvMessage = CreateHookableEvent(MODULE PSR_MESSAGE); CreateProtoServiceFunction(MODULE, PSR_MESSAGE, FilterRecvMessage); - - /*CreateProtoServiceFunction(MODULE, PSR_AUTH, FilterRecvAuth); - CreateProtoServiceFunction(MODULE, PSR_FILE, FilterRecvFile); - CreateProtoServiceFunction(MODULE, PSR_URL, FilterRecvUrl); - CreateProtoServiceFunction(MODULE, PSR_CONTACTS, FilterRecvUrl); - CreateProtoServiceFunction(MODULE, PSR_AWAYMSG, FilterRecvUrl);*/ - - return 0; } diff --git a/protocols/Tox/src/tox_core.cpp b/protocols/Tox/src/tox_core.cpp index 7ac8d3a55b..bae27a52e7 100644 --- a/protocols/Tox/src/tox_core.cpp +++ b/protocols/Tox/src/tox_core.cpp @@ -95,7 +95,7 @@ bool CToxProto::InitToxCore(CToxThread *toxThread) /*uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 }; tox_self_get_name(toxThread->Tox(), nick); - setWString("Nick", ptrW(Utf8DecodeT((char*)nick)));*/ + setWString("Nick", ptrW(Utf8DecodeW((char*)nick)));*/ ptrA nick(mir_utf8encodeW(ptrW(getWStringA("Nick")))); tox_self_set_name(toxThread->Tox(), (uint8_t*)(char*)nick, mir_strlen(nick), &error); @@ -107,7 +107,7 @@ bool CToxProto::InitToxCore(CToxThread *toxThread) /*uint8_t statusMessage[TOX_MAX_STATUS_MESSAGE_LENGTH] = { 0 }; tox_self_get_status_message(toxThread->Tox(), statusMessage); - setWString("StatusMsg", ptrW(Utf8DecodeT((char*)statusMessage)));*/ + setWString("StatusMsg", ptrW(Utf8DecodeW((char*)statusMessage)));*/ ptrA statusMessage(mir_utf8encodeW(ptrW(getWStringA("StatusMsg")))); tox_self_set_status_message(toxThread->Tox(), (uint8_t*)(char*)statusMessage, mir_strlen(statusMessage), &error); diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 8a865f58fa..5e5e37492f 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -143,13 +143,13 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*) uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 }; tox_self_get_name(toxThread.Tox(), nick); - ptrW nickname(Utf8DecodeT((char*)nick)); + ptrW nickname(Utf8DecodeW((char*)nick)); m_proto->setWString("Nick", nickname); m_nickname.SetText(nickname); uint8_t statusMessage[TOX_MAX_STATUS_MESSAGE_LENGTH] = { 0 }; tox_self_get_status_message(toxThread.Tox(), statusMessage); - m_proto->setWString("StatusMsg", ptrW(Utf8DecodeT((char*)statusMessage))); + m_proto->setWString("StatusMsg", ptrW(Utf8DecodeW((char*)statusMessage))); ShowWindow(m_profileCreate.GetHwnd(), FALSE); ShowWindow(m_profileImport.GetHwnd(), FALSE); diff --git a/src/core/stdauth/src/authdialogs.cpp b/src/core/stdauth/src/authdialogs.cpp index 7ddfd7c407..97845bd930 100644 --- a/src/core/stdauth/src/authdialogs.cpp +++ b/src/core/stdauth/src/authdialogs.cpp @@ -55,10 +55,10 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar PROTOACCOUNT* acc = Proto_GetAccount(dbei.szModule); - wchar_t* lastT = dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2u(last); - wchar_t* firstT = dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2u(first); - wchar_t* nickT = dbei.flags & DBEF_UTF ? Utf8DecodeT(nick) : mir_a2u(nick); - wchar_t* emailT = dbei.flags & DBEF_UTF ? Utf8DecodeT(email) : mir_a2u(email); + wchar_t* lastT = dbei.flags & DBEF_UTF ? Utf8DecodeW(last) : mir_a2u(last); + wchar_t* firstT = dbei.flags & DBEF_UTF ? Utf8DecodeW(first) : mir_a2u(first); + wchar_t* nickT = dbei.flags & DBEF_UTF ? Utf8DecodeW(nick) : mir_a2u(nick); + wchar_t* emailT = dbei.flags & DBEF_UTF ? Utf8DecodeW(email) : mir_a2u(email); wchar_t name[128] = L""; int off = 0; @@ -179,11 +179,11 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP PROTOACCOUNT *acc = Proto_GetAccount(dbei.szModule); - ptrW lastT(dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2u(last)); - ptrW firstT(dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2u(first)); - ptrW nickT(dbei.flags & DBEF_UTF ? Utf8DecodeT(nick) : mir_a2u(nick)); - ptrW emailT(dbei.flags & DBEF_UTF ? Utf8DecodeT(email) : mir_a2u(email)); - ptrW reasonT(dbei.flags & DBEF_UTF ? Utf8DecodeT(reason) : mir_a2u(reason)); + ptrW lastT(dbei.flags & DBEF_UTF ? Utf8DecodeW(last) : mir_a2u(last)); + ptrW firstT(dbei.flags & DBEF_UTF ? Utf8DecodeW(first) : mir_a2u(first)); + ptrW nickT(dbei.flags & DBEF_UTF ? Utf8DecodeW(nick) : mir_a2u(nick)); + ptrW emailT(dbei.flags & DBEF_UTF ? Utf8DecodeW(email) : mir_a2u(email)); + ptrW reasonT(dbei.flags & DBEF_UTF ? Utf8DecodeW(reason) : mir_a2u(reason)); wchar_t name[128] = L""; int off = 0; diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index d07d8b3ee8..7bb233df4f 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -373,9 +373,9 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam) if (bUnicode) { pszFiles = (char**)alloca(pre->fileCount * sizeof(char*)); for (int i = 0; i < pre->fileCount; i++) - pszFiles[i] = Utf8EncodeT(pre->files.w[i]); + pszFiles[i] = Utf8EncodeW(pre->files.w[i]); - szDescr = Utf8EncodeT(pre->descr.w); + szDescr = Utf8EncodeW(pre->descr.w); } else { pszFiles = pre->files.a; diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index bf8088ab0c..9427d258b2 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -80,7 +80,7 @@ void FillSendData(FileDlgData *dat, DBEVENTINFO& dbei) dbei.eventType = EVENTTYPE_FILE; dbei.flags = DBEF_SENT; dbei.timestamp = time(NULL); - char *szFileNames = Utf8EncodeT(dat->szFilenames), *szMsg = Utf8EncodeT(dat->szMsg); + char *szFileNames = Utf8EncodeW(dat->szFilenames), *szMsg = Utf8EncodeW(dat->szMsg); dbei.flags |= DBEF_UTF; dbei.cbBlob = int(sizeof(DWORD) + mir_strlen(szFileNames) + mir_strlen(szMsg) + 2); diff --git a/src/core/stdhelp/src/about.cpp b/src/core/stdhelp/src/about.cpp index 75a859b520..83adcdd3c4 100644 --- a/src/core/stdhelp/src/about.cpp +++ b/src/core/stdhelp/src/about.cpp @@ -67,7 +67,7 @@ INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar wchar_t *ptszMsg; if (ResSize >=3 && pszMsgt[0] == '\xef' && pszMsgt[1] == '\xbb' && pszMsgt[2] == '\xbf') - ptszMsg = Utf8DecodeT(pszMsgt + 3); + ptszMsg = Utf8DecodeW(pszMsgt + 3); else ptszMsg = mir_a2u_cp(pszMsgt, 1252); diff --git a/src/core/stdssl/src/netlibssl.cpp b/src/core/stdssl/src/netlibssl.cpp index ac76c28064..f06947bb8d 100644 --- a/src/core/stdssl/src/netlibssl.cpp +++ b/src/core/stdssl/src/netlibssl.cpp @@ -82,7 +82,7 @@ static void ReportSslError(SECURITY_STATUS scRet, int line, bool = false) wchar_t szMsgBuf2[512]; mir_snwprintf(szMsgBuf2, L"SSL connection failure (%x %u): %s", scRet, line, szMsgBuf); - char* szMsg = Utf8EncodeT(szMsgBuf2); + char* szMsg = Utf8EncodeW(szMsgBuf2); Netlib_Logf(NULL, szMsg); mir_free(szMsg); -- cgit v1.2.3