summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-07-20 13:25:21 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-07-20 13:25:21 +0300
commit509fbd91ed545d05cc266a80ec19fe7b9c9d28db (patch)
tree09c2d97d212c0820f6d5e85d7e583b8a56b26ef8
parentc90b4443c10b08eeae9466428255fe8ff7b48d6d (diff)
we don't need two name sets for the same array of functions
-rw-r--r--include/delphi/m_core.inc75
-rw-r--r--include/delphi/m_helpers.inc13
-rw-r--r--include/m_core.h25
-rw-r--r--include/m_database.h2
-rw-r--r--libs/win32/mir_core.libbin322188 -> 322304 bytes
-rw-r--r--libs/win64/mir_core.libbin323344 -> 323458 bytes
-rw-r--r--plugins/CmdLine/src/mimcmd_handlers.cpp2
-rw-r--r--plugins/MirLua/Modules/WinAPI/src/winapi.cpp2
-rw-r--r--plugins/MirLua/src/Modules/m_clist.cpp4
-rw-r--r--plugins/SpellChecker/src/autoreplace.cpp8
-rw-r--r--plugins/Variables/src/parse_miranda.cpp2
-rw-r--r--protocols/EmLanProto/src/mlan.cpp2
-rw-r--r--protocols/Tox/src/tox_core.cpp4
-rw-r--r--protocols/Tox/src/tox_options.cpp4
-rw-r--r--src/core/stdfile/src/file.cpp4
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp6
-rw-r--r--src/core/stdssl/src/netlibssl.cpp2
-rw-r--r--src/core/stduserinfo/src/stdinfo.cpp4
-rw-r--r--src/mir_app/src/auth.cpp18
-rw-r--r--src/mir_app/src/db_events.cpp8
-rw-r--r--src/mir_app/src/help.cpp2
-rw-r--r--src/mir_app/src/miranda.h2
-rw-r--r--src/mir_app/src/netliblog.cpp6
-rw-r--r--src/mir_app/src/pluginopts.cpp2
-rw-r--r--src/mir_app/src/xmlParser.cpp2
-rw-r--r--src/mir_core/src/langpack.cpp2
-rw-r--r--src/mir_core/src/mir_core.def14
-rw-r--r--src/mir_core/src/mir_core64.def14
-rw-r--r--src/mir_core/src/utf.cpp32
29 files changed, 88 insertions, 173 deletions
diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc
index 28653f3bd1..33ff1fdfb8 100644
--- a/include/delphi/m_core.inc
+++ b/include/delphi/m_core.inc
@@ -540,13 +540,6 @@ type
pThreadFuncEx = function (ptr:pointer):uint_ptr; stdcall;
pThreadFuncOwner = function (owner:pointer;param:pointer):uint_ptr; cdecl;
-function Thread_Push(hInst:HINST; Owner:pointer):int_ptr; stdcall;
- external CoreDLL name 'Thread_Push';
-function Thread_Pop():int_ptr; stdcall;
- external CoreDLL name 'Thread_Pop';
-procedure Thread_Wait(); stdcall;
- external CoreDLL name 'Thread_Wait';
-
function mir_forkthread(aFunc:pThreadFunc; arg:pointer):THANDLE; stdcall;
external CoreDLL;
@@ -559,71 +552,15 @@ function mir_forkthreadowner(aFunc:pThreadFuncOwner; owner:pointer; arg:pointer;
procedure Thread_SetName(const szThreadName:PAnsiChar); stdcall;
external CoreDLL name 'Thread_SetName';
-procedure KillObjectThreads(pObject:pointer); stdcall;
- external CoreDLL name 'KillObjectThreads';
-
-
-///////////////////////////////////////////////////////////////////////////////
-// utf8 interface
-{ commented to avoid newer Delphi version conflicts
-function Utf8Decode(str:PAnsiChar; var ucs2:PWideChar):PAnsiChar;stdcall;
- external CoreDLL name 'Utf8Decode';
-function Utf8DecodeCP(str:PAnsiChar; codepage:int; var ucs2:PWideChar):PAnsiChar;stdcall;
- external CoreDLL name 'Utf8DecodeCP';
-
-function Utf8DecodeW(const str:PAnsiChar):PWideChar;stdcall;
- external CoreDLL name 'Utf8DecodeW';
-
-function Utf8Encode(const src:PAnsiChar):PAnsiChar;stdcall;
- external CoreDLL name 'Utf8Encode';
-function Utf8EncodeCP(const src:PAnsiChar;codepage:int):PAnsiChar;stdcall;
- external CoreDLL name 'Utf8EncodeCP';
-
-function Utf8EncodeW(const src:PWideChar):PAnsiChar;stdcall;
- external CoreDLL name 'Utf8EncodeW';
-
-function Ucs2toUtf8Len(const src:PWideChar):int; stdcall;
- external CoreDLL name 'Ucs2toUtf8Len';
-
-function Utf8CheckString(const astr:PAnsiChar):bool;stdcall;
- external CoreDLL name 'Utf8CheckString';
-}
-// aliases
-function mir_utf8decode(str:PAnsiChar; var ucs2:PWideChar):PAnsiChar;stdcall;
- external CoreDLL name 'Utf8Decode';
-function mir_utf8decodecp(str:PAnsiChar; codepage:int; var ucs2:PWideChar):PAnsiChar;stdcall;
- external CoreDLL name 'Utf8DecodeCP';
-function mir_utf8decodew(const str:PAnsiChar):PWideChar;stdcall;
- external CoreDLL name 'Utf8DecodeW';
-
-function mir_utf8encode(const src:PAnsiChar):PAnsiChar;stdcall;
- external CoreDLL name 'Utf8Encode';
-function mir_utf8encodecp(const src:PAnsiChar;codepage:int):PAnsiChar;stdcall;
- external CoreDLL name 'Utf8EncodeCP';
-
-function mir_utf8encodew(const src:PWideChar):PAnsiChar;stdcall;
- external CoreDLL name 'Utf8EncodeW';
-
-function mir_utf8lenW(const src:PWideChar):int; stdcall;
- external CoreDLL name 'Ucs2toUtf8Len';
-
-function mir_utf8checkstring(const astr:PAnsiChar):bool;stdcall;
- external CoreDLL name 'Utf8CheckString';
-
///////////////////////////////////////////////////////////////////////////////
// Window subclassing
-procedure mir_subclassWindow(Wnd:HWND; WndProc:TWNDPROC); stdcall;
- external CoreDLL name 'mir_subclassWindow';
-procedure mir_subclassWindowFull(Wnd:HWND; WndProc, OldWndProc:TWNDPROC); stdcall;
- external CoreDLL name 'mir_subclassWindowFull';
-function mir_callNextSubclass(Wnd:HWND; WndProc:TWNDPROC; uMsg:uint; wParam:WPARAM; lParam:LPARAM ):LRESULT; stdcall;
- external CoreDLL name 'mir_callNextSubclass';
-procedure mir_unsubclassWindow(Wnd:HWND; WndProc:TWNDPROC); stdcall;
- external CoreDLL name 'mir_unsubclassWindow';
-
-procedure KillModuleSubclassing(hInst: HMODULE);
- external CoreDLL name 'KillModuleSubclassing';
+procedure mir_subclassWindow(Wnd:HWND; WndProc:TWNDPROC); stdcall; external CoreDLL;
+procedure mir_subclassWindowFull(Wnd:HWND; WndProc, OldWndProc:TWNDPROC); stdcall; external CoreDLL;
+function mir_callNextSubclass(Wnd:HWND; WndProc:TWNDPROC; uMsg:uint; wParam:WPARAM; lParam:LPARAM ):LRESULT; stdcall; external CoreDLL;
+procedure mir_unsubclassWindow(Wnd:HWND; WndProc:TWNDPROC); stdcall; external CoreDLL;
+
+procedure KillModuleSubclassing(hInst: HMODULE); external CoreDLL;
///////////////////////////////////////////////////////////////////////////////
// Windows utilities
diff --git a/include/delphi/m_helpers.inc b/include/delphi/m_helpers.inc
index cedf8998d5..1b1d95c378 100644
--- a/include/delphi/m_helpers.inc
+++ b/include/delphi/m_helpers.inc
@@ -20,7 +20,6 @@ function mir_hashstr (const key:PAnsiChar):uint; {inline;}
function mir_hashstrW(const key:PWideChar):uint; {inline;}
function lrtrim (str:PAnsiChar):PAnsiChar; {inline}
function lrtrimp(str:PAnsiChar):PAnsiChar; {inline}
-function mir_utf8decodeA(const src:PAnsiChar):PAnsiChar; {inline}
function Translate (sz: PAnsiChar): PAnsiChar;
function Translatew(sz: PWideChar): PWideChar;
@@ -198,18 +197,6 @@ begin
result:=ltrimp(rtrim(str));
end;
-function mir_utf8decodeA(const src:PAnsiChar):PAnsiChar;
-type
- pPWideChar = ^PWidechar;
-var
- tmp:PAnsiChar;
-begin
- tmp:=mir_strdup(src);
- mir_utf8decode(tmp,pPWideChar(nil)^);
- result:=tmp;
-end;
-
-
function TranslateW(sz: PWideChar): PWideChar;
begin
result:=TranslateW_LP(sz, @g_plugin);
diff --git a/include/m_core.h b/include/m_core.h
index ab7b00e0a4..19f8446bb9 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -480,27 +480,18 @@ MIR_CORE_DLL(void) KillObjectThreads(void* pObject);
///////////////////////////////////////////////////////////////////////////////
// utf8 interface
-MIR_CORE_DLL(char*) Utf8Decode(char* str, wchar_t** ucs2);
-MIR_CORE_DLL(char*) Utf8DecodeCP(char* str, int codepage, wchar_t** ucs2);
+MIR_CORE_DLL(BOOL) Utf8CheckString(const char* str);
MIR_CORE_DLL(int) Utf8toUcs2(const char *src, size_t srclen, wchar_t *dst, size_t dstlen); // returns 0 on error
-MIR_CORE_DLL(wchar_t*) Utf8DecodeW(const char* str);
-
-MIR_CORE_DLL(char*) Utf8Encode(const char* str);
-MIR_CORE_DLL(char*) Utf8EncodeCP(const char* src, int codepage);
+MIR_CORE_DLL(char*) mir_utf8decode(char* str, wchar_t** ucs2);
+MIR_CORE_DLL(char*) mir_utf8decodecp(char* str, int codepage, wchar_t** ucs2);
+MIR_CORE_DLL(wchar_t*) mir_utf8decodeW(const char* str);
-MIR_CORE_DLL(char*) Utf8EncodeW(const wchar_t* str);
-MIR_CORE_DLL(int) Ucs2toUtf8Len(const wchar_t *src);
-
-MIR_CORE_DLL(BOOL) Utf8CheckString(const char* str);
+MIR_CORE_DLL(char*) mir_utf8encode(const char* str);
+MIR_CORE_DLL(char*) mir_utf8encodecp(const char* src, int codepage);
+MIR_CORE_DLL(char*) mir_utf8encodeW(const wchar_t* str);
-#define mir_utf8decode(A, B) Utf8Decode(A, B)
-#define mir_utf8decodecp(A, B, C) Utf8DecodeCP(A, B, C)
-#define mir_utf8decodeW(A) Utf8DecodeW(A)
-#define mir_utf8encode(A) Utf8Encode(A)
-#define mir_utf8encodecp(A, B) Utf8EncodeCP(A, B)
-#define mir_utf8encodeW(A) Utf8EncodeW(A)
-#define mir_utf8lenW(A) Ucs2toUtf8Len(A)
+MIR_CORE_DLL(int) mir_utf8lenW(const wchar_t *src);
__forceinline char* mir_utf8decodeA(const char* src)
{
diff --git a/include/m_database.h b/include/m_database.h
index 1e3dd69a85..3bec61cb65 100644
--- a/include/m_database.h
+++ b/include/m_database.h
@@ -188,7 +188,7 @@ typedef struct
wchar_t* getString(const char *str) const
{
- return (flags & DBEF_UTF) ? Utf8DecodeW(str) : mir_a2u(str);
+ return (flags & DBEF_UTF) ? mir_utf8decodeW(str) : mir_a2u(str);
}
#endif
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib
index b7dac5c94b..5132907f4c 100644
--- a/libs/win32/mir_core.lib
+++ b/libs/win32/mir_core.lib
Binary files differ
diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib
index 6ab685fc5b..ac3abb7997 100644
--- a/libs/win64/mir_core.lib
+++ b/libs/win64/mir_core.lib
Binary files differ
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp
index 8a0a2eaa9f..78bd0710e2 100644
--- a/plugins/CmdLine/src/mimcmd_handlers.cpp
+++ b/plugins/CmdLine/src/mimcmd_handlers.cpp
@@ -720,7 +720,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re
if (hContact) {
bShouldProcessAcks = TRUE;
- ptrA szMessage(Utf8EncodeW(message));
+ ptrA szMessage(mir_utf8encodeW(message));
HANDLE hProcess = (HANDLE)ProtoChainSend(hContact, PSS_MESSAGE, 0, szMessage);
const int MAX_COUNT = 60;
int counter = 0;
diff --git a/plugins/MirLua/Modules/WinAPI/src/winapi.cpp b/plugins/MirLua/Modules/WinAPI/src/winapi.cpp
index 11b7daebd7..b5184af254 100644
--- a/plugins/MirLua/Modules/WinAPI/src/winapi.cpp
+++ b/plugins/MirLua/Modules/WinAPI/src/winapi.cpp
@@ -218,7 +218,7 @@ static int lua_GetRegValue(lua_State *L)
case REG_LINK:
case REG_EXPAND_SZ:
{
- ptrA str(Utf8EncodeW((wchar_t*)value));
+ ptrA str(mir_utf8encodeW((wchar_t*)value));
lua_pushlstring(L, str, mir_strlen(str));
}
break;
diff --git a/plugins/MirLua/src/Modules/m_clist.cpp b/plugins/MirLua/src/Modules/m_clist.cpp
index 0b6d390004..6de506cfd0 100644
--- a/plugins/MirLua/src/Modules/m_clist.cpp
+++ b/plugins/MirLua/src/Modules/m_clist.cpp
@@ -44,7 +44,7 @@ static int clist_AddMainMenuRoot(lua_State *L)
int position = lua_tointeger(L, 2);
HANDLE hIcon = (HANDLE)lua_touserdata(L, 3);
- HGENMENU res = g_plugin.addRootMenu(MO_MAIN, ptrW(Utf8DecodeW(name)), position, hIcon);
+ HGENMENU res = g_plugin.addRootMenu(MO_MAIN, ptrW(mir_utf8decodeW(name)), position, hIcon);
if (res != nullptr)
lua_pushlightuserdata(L, res);
else
@@ -75,7 +75,7 @@ static int clist_AddContactMenuRoot(lua_State *L)
int position = lua_tointeger(L, 2);
HANDLE hIcon = (HANDLE)lua_touserdata(L, 3);
- HGENMENU res = g_plugin.addRootMenu(MO_MAIN, ptrW(Utf8DecodeW(name)), position, hIcon);
+ HGENMENU res = g_plugin.addRootMenu(MO_MAIN, ptrW(mir_utf8decodeW(name)), position, hIcon);
if (res != nullptr)
lua_pushlightuserdata(L, res);
else
diff --git a/plugins/SpellChecker/src/autoreplace.cpp b/plugins/SpellChecker/src/autoreplace.cpp
index 2dfe7787df..bec1572b85 100644
--- a/plugins/SpellChecker/src/autoreplace.cpp
+++ b/plugins/SpellChecker/src/autoreplace.cpp
@@ -64,8 +64,8 @@ void AutoReplaceMap::loadAutoReplaceMap()
}
if (p != nullptr) {
- ptrW find(Utf8DecodeW(tmp));
- ptrW replace(Utf8DecodeW(p));
+ ptrW find(mir_utf8decodeW(tmp));
+ ptrW replace(mir_utf8decodeW(p));
lstrtrim(find);
lstrtrim(replace);
@@ -102,8 +102,8 @@ void AutoReplaceMap::writeAutoReplaceMap()
for (; it != m_replacements.end(); it++) {
AutoReplacement &ar = it->second;
- ptrA find(Utf8EncodeW(it->first.c_str()));
- ptrA replace(Utf8EncodeW(ar.replace.c_str()));
+ ptrA find(mir_utf8encodeW(it->first.c_str()));
+ ptrA replace(mir_utf8encodeW(ar.replace.c_str()));
if (ar.useVariables)
fprintf(file, "%s-V>%s\n", (const char *)find, (const char *)replace);
diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp
index 3488fd8d28..e3e042cad5 100644
--- a/plugins/Variables/src/parse_miranda.cpp
+++ b/plugins/Variables/src/parse_miranda.cpp
@@ -166,7 +166,7 @@ static wchar_t* getDBSetting(MCONTACT hContact, char* module, char* setting, wch
var = mir_wstrdup(dbv.pwszVal);
break;
case DBVT_UTF8:
- Utf8Decode(dbv.pszVal, &var);
+ mir_utf8decode(dbv.pszVal, &var);
break;
}
diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp
index 948f011e52..639bb0a0e9 100644
--- a/protocols/EmLanProto/src/mlan.cpp
+++ b/protocols/EmLanProto/src/mlan.cpp
@@ -369,7 +369,7 @@ void CMLan::RecvMessageUrl(CCSDATA* ccs)
if (Utf8CheckString(pre->szMessage))
szMessage = mir_strdup(pre->szMessage);
else
- szMessage = Utf8Encode(pre->szMessage);
+ szMessage = mir_utf8encode(pre->szMessage);
DBEVENTINFO dbei = {};
if (!mir_strcmp(ccs->szProtoService, PSR_MESSAGE))
diff --git a/protocols/Tox/src/tox_core.cpp b/protocols/Tox/src/tox_core.cpp
index f3fa95b84d..b1139c6c4f 100644
--- a/protocols/Tox/src/tox_core.cpp
+++ b/protocols/Tox/src/tox_core.cpp
@@ -74,7 +74,7 @@ void CToxProto::InitToxCore(Tox *tox)
/*uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
tox_self_get_name(toxThread->Tox(), nick);
- setWString("Nick", ptrW(Utf8DecodeW((char*)nick)));*/
+ setWString("Nick", ptrW(mir_utf8decodeW((char*)nick)));*/
ptrA nick(mir_utf8encodeW(ptrW(getWStringA("Nick"))));
tox_self_set_name(tox, (uint8_t*)(char*)nick, mir_strlen(nick), &error);
@@ -83,7 +83,7 @@ void CToxProto::InitToxCore(Tox *tox)
/*uint8_t statusMessage[TOX_MAX_STATUS_MESSAGE_LENGTH] = { 0 };
tox_self_get_status_message(toxThread->Tox(), statusMessage);
- setWString("StatusMsg", ptrW(Utf8DecodeW((char*)statusMessage)));*/
+ setWString("StatusMsg", ptrW(mir_utf8decodeW((char*)statusMessage)));*/
ptrA statusMessage(mir_utf8encodeW(ptrW(getWStringA("StatusMsg"))));
tox_self_set_status_message(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 1d74a5fadc..682ee2cc5d 100644
--- a/protocols/Tox/src/tox_options.cpp
+++ b/protocols/Tox/src/tox_options.cpp
@@ -183,13 +183,13 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*)
uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
tox_self_get_name(toxThread.Tox(), nick);
- ptrW nickname(Utf8DecodeW((char*)nick));
+ ptrW nickname(mir_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(Utf8DecodeW((char*)statusMessage)));
+ m_proto->setWString("StatusMsg", ptrW(mir_utf8decodeW((char*)statusMessage)));
ShowWindow(m_profileCreate.GetHwnd(), FALSE);
ShowWindow(m_profileImport.GetHwnd(), FALSE);
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp
index c9f15ef1d5..7f99a783c0 100644
--- a/src/core/stdfile/src/file.cpp
+++ b/src/core/stdfile/src/file.cpp
@@ -372,9 +372,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] = Utf8EncodeW(pre->files.w[i]);
+ pszFiles[i] = mir_utf8encodeW(pre->files.w[i]);
- szDescr = Utf8EncodeW(pre->descr.w);
+ szDescr = mir_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 f5227c6f79..841d2d0c2c 100644
--- a/src/core/stdfile/src/filexferdlg.cpp
+++ b/src/core/stdfile/src/filexferdlg.cpp
@@ -45,7 +45,7 @@ struct virusscanthreadstartinfo {
wchar_t* PFTS_StringToTchar(int flags, const wchar_t* s)
{
if (flags & PFTS_UTF)
- return Utf8DecodeW((char*)s);
+ return mir_utf8decodeW((char*)s);
if (flags & PFTS_UNICODE)
return mir_wstrdup(s);
return mir_a2u((char*)s);
@@ -54,7 +54,7 @@ wchar_t* PFTS_StringToTchar(int flags, const wchar_t* s)
int PFTS_CompareWithTchar(PROTOFILETRANSFERSTATUS *ft, const wchar_t *s, wchar_t *r)
{
if (ft->flags & PFTS_UTF) {
- wchar_t *ts = Utf8DecodeW((char*)s);
+ wchar_t *ts = mir_utf8decodeW((char*)s);
int res = mir_wstrcmp(ts, r);
mir_free(ts);
return res;
@@ -79,7 +79,7 @@ void FillSendData(FileDlgData *dat, DBEVENTINFO& dbei)
dbei.eventType = EVENTTYPE_FILE;
dbei.flags = DBEF_SENT;
dbei.timestamp = time(0);
- char *szFileNames = Utf8EncodeW(dat->szFilenames), *szMsg = Utf8EncodeW(dat->szMsg);
+ char *szFileNames = mir_utf8encodeW(dat->szFilenames), *szMsg = mir_utf8encodeW(dat->szMsg);
dbei.flags |= DBEF_UTF;
dbei.cbBlob = int(sizeof(DWORD) + mir_strlen(szFileNames) + mir_strlen(szMsg) + 2);
diff --git a/src/core/stdssl/src/netlibssl.cpp b/src/core/stdssl/src/netlibssl.cpp
index e8a072c3f6..405e9a355c 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 = Utf8EncodeW(szMsgBuf2);
+ char* szMsg = mir_utf8encodeW(szMsgBuf2);
Netlib_Logf(nullptr, szMsg);
mir_free(szMsg);
diff --git a/src/core/stduserinfo/src/stdinfo.cpp b/src/core/stduserinfo/src/stdinfo.cpp
index 22f17335fe..338007fb4f 100644
--- a/src/core/stduserinfo/src/stdinfo.cpp
+++ b/src/core/stduserinfo/src/stdinfo.cpp
@@ -187,14 +187,14 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule
unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0');
if (!unspecified) {
WCHAR *wszStr;
- Utf8Decode(dbv.pszVal, &wszStr);
+ mir_utf8decode(dbv.pszVal, &wszStr);
SetDlgItemTextW(hwndDlg, idCtrl, TranslateW(wszStr));
mir_free(wszStr);
goto LBL_Exit;
}
pstr = dbv.pszVal;
- Utf8Decode(dbv.pszVal, nullptr);
+ mir_utf8decode(dbv.pszVal, nullptr);
break;
default:
diff --git a/src/mir_app/src/auth.cpp b/src/mir_app/src/auth.cpp
index 6633802df0..0e94be47c5 100644
--- a/src/mir_app/src/auth.cpp
+++ b/src/mir_app/src/auth.cpp
@@ -81,11 +81,11 @@ public:
SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
SendMessage(m_hwnd, WM_SETICON, ICON_BIG, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0));
- 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));
+ ptrW lastT(dbei.flags & DBEF_UTF ? mir_utf8decodeW(last) : mir_a2u(last));
+ ptrW firstT(dbei.flags & DBEF_UTF ? mir_utf8decodeW(first) : mir_a2u(first));
+ ptrW nickT(dbei.flags & DBEF_UTF ? mir_utf8decodeW(nick) : mir_a2u(nick));
+ ptrW emailT(dbei.flags & DBEF_UTF ? mir_utf8decodeW(email) : mir_a2u(email));
+ ptrW reasonT(dbei.flags & DBEF_UTF ? mir_utf8decodeW(reason) : mir_a2u(reason));
wchar_t name[128] = L"";
int off = 0;
@@ -223,10 +223,10 @@ public:
PROTOACCOUNT* acc = Proto_GetAccount(dbei.szModule);
- 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 lastT(dbei.flags & DBEF_UTF ? mir_utf8decodeW(last) : mir_a2u(last));
+ ptrW firstT(dbei.flags & DBEF_UTF ? mir_utf8decodeW(first) : mir_a2u(first));
+ ptrW nickT(dbei.flags & DBEF_UTF ? mir_utf8decodeW(nick) : mir_a2u(nick));
+ ptrW emailT(dbei.flags & DBEF_UTF ? mir_utf8decodeW(email) : mir_a2u(email));
wchar_t name[128] = L"";
int off = 0;
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp
index 4b000a1f75..fb1dd02cb6 100644
--- a/src/mir_app/src/db_events.cpp
+++ b/src/mir_app/src/db_events.cpp
@@ -96,7 +96,7 @@ static wchar_t* getEventString(DBEVENTINFO *dbei, LPSTR &buf)
{
LPSTR in = buf;
buf += mir_strlen(buf) + 1;
- return (dbei->flags & DBEF_UTF) ? Utf8DecodeW(in) : mir_a2u(in);
+ return (dbei->flags & DBEF_UTF) ? mir_utf8decodeW(in) : mir_a2u(in);
}
static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatype)
@@ -184,7 +184,7 @@ static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatyp
if (dbei->flags & DBEF_UTF) {
WCHAR *msg = nullptr;
- Utf8DecodeCP(str, codepage, &msg);
+ mir_utf8decodecp(str, codepage, &msg);
if (msg)
return (INT_PTR)msg;
}
@@ -195,7 +195,7 @@ static INT_PTR DbEventGetTextWorker(DBEVENTINFO *dbei, int codepage, int datatyp
if (datatype == DBVT_ASCIIZ) {
char *msg = mir_strdup((char*)dbei->pBlob);
if (dbei->flags & DBEF_UTF)
- Utf8DecodeCP(msg, codepage, nullptr);
+ mir_utf8decodecp(msg, codepage, nullptr);
return (INT_PTR)msg;
}
@@ -256,7 +256,7 @@ MIR_APP_DLL(HICON) DbEvent_GetIcon(DBEVENTINFO *dbei, int flags)
MIR_APP_DLL(wchar_t*) DbEvent_GetString(DBEVENTINFO *dbei, const char *str)
{
if (dbei->flags & DBEF_UTF)
- return Utf8DecodeW(str);
+ return mir_utf8decodeW(str);
return mir_a2u(str);
}
diff --git a/src/mir_app/src/help.cpp b/src/mir_app/src/help.cpp
index 89faf55ce6..31674a121e 100644
--- a/src/mir_app/src/help.cpp
+++ b/src/mir_app/src/help.cpp
@@ -71,7 +71,7 @@ public:
ptrW ptszMsg;
if (ResSize >= 3 && pszMsgt[0] == '\xef' && pszMsgt[1] == '\xbb' && pszMsgt[2] == '\xbf')
- ptszMsg = Utf8DecodeW(pszMsgt + 3);
+ ptszMsg = mir_utf8decodeW(pszMsgt + 3);
else
ptszMsg = mir_a2u_cp(pszMsgt, 1252);
ctrlCredits.SetText(ptszMsg);
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index b37abcea3b..23eac6d4ea 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -91,7 +91,7 @@ void KillModuleToolbarIcons(HPLUGIN);
__forceinline char* Utf8DecodeA(const char* src)
{
char* tmp = mir_strdup(src);
- Utf8Decode(tmp, nullptr);
+ mir_utf8decode(tmp, nullptr);
return tmp;
}
diff --git a/src/mir_app/src/netliblog.cpp b/src/mir_app/src/netliblog.cpp
index 1321955801..50f3ee946a 100644
--- a/src/mir_app/src/netliblog.cpp
+++ b/src/mir_app/src/netliblog.cpp
@@ -369,7 +369,7 @@ void PROTO_INTERFACE::debugLogW(const wchar_t *wszFormat, ...)
va_list args;
va_start(args, wszFormat);
int res = _vsnwprintf(buf, _countof(buf), wszFormat, args);
- NetlibLog_Worker(m_hNetlibUser, ptrA(Utf8EncodeW((res != -1) ? buf : CMStringW().FormatV(wszFormat, args))), 0);
+ NetlibLog_Worker(m_hNetlibUser, ptrA(mir_utf8encodeW((res != -1) ? buf : CMStringW().FormatV(wszFormat, args))), 0);
va_end(args);
}
@@ -392,7 +392,7 @@ MIR_APP_DLL(int) Netlib_LogfW(HNETLIBUSER hUser, const wchar_t *fmt, ...)
wchar_t szText[8000];
mir_vsnwprintf(szText, _countof(szText), fmt, va);
va_end(va);
- return NetlibLog_Worker(hUser, ptrA(Utf8EncodeW(szText)), 0);
+ return NetlibLog_Worker(hUser, ptrA(mir_utf8encodeW(szText)), 0);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -404,7 +404,7 @@ MIR_APP_DLL(int) Netlib_Log(HNETLIBUSER hUser, const char *pszStr)
MIR_APP_DLL(int) Netlib_LogW(HNETLIBUSER hUser, const wchar_t *pwszStr)
{
- return NetlibLog_Worker(hUser, ptrA(Utf8EncodeW(pwszStr)), 0);
+ return NetlibLog_Worker(hUser, ptrA(mir_utf8encodeW(pwszStr)), 0);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp
index 96b1f8e01d..c196e30494 100644
--- a/src/mir_app/src/pluginopts.cpp
+++ b/src/mir_app/src/pluginopts.cpp
@@ -48,7 +48,7 @@ static wchar_t* sttUtf8auto(const char *src)
char *p = NEWSTR_ALLOCA(src);
wchar_t *pwszRes;
- return (Utf8Decode(p, &pwszRes) != nullptr) ? pwszRes : mir_a2u_cp(src, 1250);
+ return (mir_utf8decode(p, &pwszRes) != nullptr) ? pwszRes : mir_a2u_cp(src, 1250);
}
static int sttSortPlugins(const PluginListItemData *p1, const PluginListItemData *p2)
diff --git a/src/mir_app/src/xmlParser.cpp b/src/mir_app/src/xmlParser.cpp
index fbacef5451..53c57fea06 100644
--- a/src/mir_app/src/xmlParser.cpp
+++ b/src/mir_app/src/xmlParser.cpp
@@ -857,7 +857,7 @@ XMLSTR fromXMLString(XMLCSTR s, int lo, XML *pXML)
#ifndef _XMLWIDECHAR
if (characterEncoding != XMLNode::char_encoding_legacy)
- Utf8Decode((XMLSTR)s, nullptr);
+ mir_utf8decode((XMLSTR)s, nullptr);
#endif
return (XMLSTR)s;
diff --git a/src/mir_core/src/langpack.cpp b/src/mir_core/src/langpack.cpp
index 5e6f4ad62b..d924f13f6d 100644
--- a/src/mir_core/src/langpack.cpp
+++ b/src/mir_core/src/langpack.cpp
@@ -366,7 +366,7 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start
lpinfo.szAuthors = szAuthors;
- ptrW buf(Utf8DecodeW(szLanguage));
+ ptrW buf(mir_utf8decodeW(szLanguage));
if (buf)
wcsncpy_s(lpinfo.tszLanguage, buf, _TRUNCATE);
else if (lpinfo.Locale != 0)
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index 5fafb02730..7e9b81dd67 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -60,14 +60,14 @@ TranslateA_LP @63
TranslateDialog_LP @64
TranslateMenu_LP @65
TranslateW_LP @66
-Ucs2toUtf8Len @67
+mir_utf8lenW @67
UnhookEvent @68
-Utf8Decode @70
-Utf8DecodeCP @71
-Utf8DecodeW @72
-Utf8Encode @73
-Utf8EncodeCP @74
-Utf8EncodeW @75
+mir_utf8decode @70
+mir_utf8decodecp @71
+mir_utf8decodeW @72
+mir_utf8encode @73
+mir_utf8encodecp @74
+mir_utf8encodeW @75
mir_forkthread @76
mir_forkthreadex @77
ltrim @78
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 8b92b73dec..0a3759fa9f 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -60,14 +60,14 @@ TranslateA_LP @63
TranslateDialog_LP @64
TranslateMenu_LP @65
TranslateW_LP @66
-Ucs2toUtf8Len @67
+mir_utf8lenW @67
UnhookEvent @68
-Utf8Decode @70
-Utf8DecodeCP @71
-Utf8DecodeW @72
-Utf8Encode @73
-Utf8EncodeCP @74
-Utf8EncodeW @75
+mir_utf8decode @70
+mir_utf8decodecp @71
+mir_utf8decodeW @72
+mir_utf8encode @73
+mir_utf8encodecp @74
+mir_utf8encodeW @75
mir_forkthread @76
mir_forkthreadex @77
ltrim @78
diff --git a/src/mir_core/src/utf.cpp b/src/mir_core/src/utf.cpp
index a5c1f8cca0..580bf35db9 100644
--- a/src/mir_core/src/utf.cpp
+++ b/src/mir_core/src/utf.cpp
@@ -60,7 +60,7 @@ static unsigned int getSurrogateValue(const wchar_t *src, unsigned int srclen)
}
/* query necessary dst length for src string */
-static int Ucs2toUtf8Len(const wchar_t *src, unsigned int srclen)
+static int mir_utf8len(const wchar_t *src, unsigned int srclen)
{
int len;
unsigned int val;
@@ -88,12 +88,12 @@ static int Ucs2toUtf8Len(const wchar_t *src, unsigned int srclen)
return len;
}
-MIR_CORE_DLL(int) Ucs2toUtf8Len(const wchar_t *src)
+MIR_CORE_DLL(int) mir_utf8lenW(const wchar_t *src)
{
if (src == nullptr)
return 0;
- return Ucs2toUtf8Len(src, (int)wcslen(src));
+ return mir_utf8len(src, (int)wcslen(src));
}
/* wide char to UTF-8 string conversion */
@@ -236,9 +236,9 @@ MIR_CORE_DLL(int) Utf8toUcs2(const char *src, size_t srclen, wchar_t *dst, size_
}
/////////////////////////////////////////////////////////////////////////////////////////
-// Utf8Decode - converts UTF8-encoded string to the UCS2/MBCS format
+// mir_utf8decode - converts UTF8-encoded string to the UCS2/MBCS format
-MIR_CORE_DLL(char*) Utf8DecodeCP(char *str, int codepage, wchar_t **ucs2)
+MIR_CORE_DLL(char*) mir_utf8decodecp(char *str, int codepage, wchar_t **ucs2)
{
bool needs_free = false;
wchar_t* tempBuf = nullptr;
@@ -291,12 +291,12 @@ MIR_CORE_DLL(char*) Utf8DecodeCP(char *str, int codepage, wchar_t **ucs2)
return str;
}
-MIR_CORE_DLL(char*) Utf8Decode(char *str, wchar_t **ucs2)
+MIR_CORE_DLL(char*) mir_utf8decode(char *str, wchar_t **ucs2)
{
- return Utf8DecodeCP(str, Langpack_GetDefaultCodePage(), ucs2);
+ return mir_utf8decodecp(str, Langpack_GetDefaultCodePage(), ucs2);
}
-MIR_CORE_DLL(wchar_t*) Utf8DecodeW(const char *str)
+MIR_CORE_DLL(wchar_t*) mir_utf8decodeW(const char *str)
{
if (str == nullptr)
return nullptr;
@@ -322,9 +322,9 @@ MIR_CORE_DLL(wchar_t*) Utf8DecodeW(const char *str)
}
/////////////////////////////////////////////////////////////////////////////////////////
-// Utf8Encode - converts MBCS string to the UTF8-encoded format
+// mir_utf8encode - converts MBCS string to the UTF8-encoded format
-MIR_CORE_DLL(char*) Utf8EncodeCP(const char* src, int codepage)
+MIR_CORE_DLL(char*) mir_utf8encodecp(const char* src, int codepage)
{
int len;
bool needs_free = false;
@@ -348,7 +348,7 @@ MIR_CORE_DLL(char*) Utf8EncodeCP(const char* src, int codepage)
len = MultiByteToWideChar(codepage, 0, src, -1, tempBuf, len + 1);
- int destlen = Ucs2toUtf8Len(tempBuf, len);
+ int destlen = mir_utf8len(tempBuf, len);
if (destlen >= 0) {
result = (char*)mir_alloc(destlen + 1);
if (result) {
@@ -363,22 +363,22 @@ MIR_CORE_DLL(char*) Utf8EncodeCP(const char* src, int codepage)
return result;
}
-MIR_CORE_DLL(char*) Utf8Encode(const char* src)
+MIR_CORE_DLL(char*) mir_utf8encode(const char* src)
{
- return Utf8EncodeCP(src, Langpack_GetDefaultCodePage());
+ return mir_utf8encodecp(src, Langpack_GetDefaultCodePage());
}
/////////////////////////////////////////////////////////////////////////////////////////
-// Utf8Encode - converts UCS2 string to the UTF8-encoded format
+// mir_utf8encode - converts UCS2 string to the UTF8-encoded format
-MIR_CORE_DLL(char*) Utf8EncodeW(const wchar_t* src)
+MIR_CORE_DLL(char*) mir_utf8encodeW(const wchar_t* src)
{
if (src == nullptr)
return nullptr;
int len = (int)wcslen(src);
- int destlen = Ucs2toUtf8Len(src, len);
+ int destlen = mir_utf8len(src, len);
if (destlen < 0) return nullptr;
char* result = (char*)mir_alloc(destlen + 1);