From 509fbd91ed545d05cc266a80ec19fe7b9c9d28db Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 20 Jul 2018 13:25:21 +0300 Subject: we don't need two name sets for the same array of functions --- include/delphi/m_core.inc | 75 ++++---------------------------------------- include/delphi/m_helpers.inc | 13 -------- include/m_core.h | 25 +++++---------- include/m_database.h | 2 +- 4 files changed, 15 insertions(+), 100 deletions(-) (limited to 'include') 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 -- cgit v1.2.3