From ee57c7fe7f30f82a2a2c637125ce3ee31d008576 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 15 Aug 2018 13:06:48 +0300 Subject: Windows string types removed from m_core.h --- include/m_core.h | 10 +++++----- src/mir_core/src/cmdline.cpp | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/m_core.h b/include/m_core.h index 19f8446bb9..2a55341499 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -70,8 +70,8 @@ extern "C" /////////////////////////////////////////////////////////////////////////////// // command line support -MIR_CORE_DLL(void) CmdLine_Parse(LPTSTR ptszCmdLine); -MIR_CORE_DLL(LPCTSTR) CmdLine_GetOption(LPCTSTR ptszParameter); +MIR_CORE_DLL(void) CmdLine_Parse(const wchar_t *ptszCmdLine); +MIR_CORE_DLL(const wchar_t*) CmdLine_GetOption(const wchar_t *ptszParameter); /////////////////////////////////////////////////////////////////////////////// // database functions @@ -139,8 +139,8 @@ MIR_CORE_DLL(int) CallFunctionAsync(void (__stdcall *func)(void *), void *ar MIR_CORE_DLL(void) KillModuleServices(HINSTANCE hInst); MIR_CORE_DLL(void) KillObjectServices(void* pObject); -MIR_APP_DLL(int) ProtoServiceExists(LPCSTR szModule, const char *szService); -MIR_APP_DLL(INT_PTR) CallProtoService(LPCSTR szModule, const char *szService, WPARAM wParam = 0, LPARAM lParam = 0); +MIR_APP_DLL(int) ProtoServiceExists(const char *szModule, const char *szService); +MIR_APP_DLL(INT_PTR) CallProtoService(const char *szModule, const char *szService, WPARAM wParam = 0, LPARAM lParam = 0); /////////////////////////////////////////////////////////////////////////////// // exceptions @@ -315,7 +315,7 @@ MIR_CORE_DLL(int) mir_vsnwprintf(wchar_t *buffer, size_t count, const wchar_t struct PROTO_INTERFACE; -MIR_APP_DLL(INT_PTR) ProtoBroadcastAck(LPCSTR szModule, MCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam); +MIR_APP_DLL(INT_PTR) ProtoBroadcastAck(const char *szModule, MCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam); // avatar support functions diff --git a/src/mir_core/src/cmdline.cpp b/src/mir_core/src/cmdline.cpp index 2acfac2185..1f1616c81c 100644 --- a/src/mir_core/src/cmdline.cpp +++ b/src/mir_core/src/cmdline.cpp @@ -27,11 +27,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct CmdLineParam { - __inline CmdLineParam(LPCTSTR _name, LPCTSTR _value) : + __inline CmdLineParam(const wchar_t *_name, const wchar_t *_value) : name(_name), value(_value) {} - LPCTSTR name, value; + const wchar_t *name, *value; }; static int CompareParams(const CmdLineParam *p1, const CmdLineParam *p2) @@ -41,11 +41,11 @@ static int CompareParams(const CmdLineParam *p1, const CmdLineParam *p2) static OBJLIST arParams(5, CompareParams); -MIR_CORE_DLL(void) CmdLine_Parse(LPTSTR ptszCmdLine) +MIR_CORE_DLL(void) CmdLine_Parse(const wchar_t *ptszCmdLine) { bool bPrevSpace = true; - for (LPTSTR p = ptszCmdLine; *p; p++) { - if ( *p == ' ' || *p == '\t') { + for (wchar_t *p = NEWWSTR_ALLOCA(ptszCmdLine); *p; p++) { + if (*p == ' ' || *p == '\t') { *p = 0; bPrevSpace = true; continue; @@ -59,12 +59,12 @@ MIR_CORE_DLL(void) CmdLine_Parse(LPTSTR ptszCmdLine) } else continue; // skip a text that isn't an option - wchar_t *pOptionName = p+1; + wchar_t *pOptionName = p + 1; if ((p = wcspbrk(pOptionName, L" \t=:")) == nullptr) { // no more text in string arParams.insert(new CmdLineParam(pOptionName, L"")); break; } - + if (*p == ' ' || *p == '\t') { arParams.insert(new CmdLineParam(pOptionName, L"")); p--; // the cycle will wipe this space automatically @@ -81,7 +81,7 @@ MIR_CORE_DLL(void) CmdLine_Parse(LPTSTR ptszCmdLine) } } -MIR_CORE_DLL(LPCTSTR) CmdLine_GetOption(const wchar_t* ptszParameter) +MIR_CORE_DLL(const wchar_t*) CmdLine_GetOption(const wchar_t* ptszParameter) { CmdLineParam tmp(ptszParameter, nullptr); int idx = arParams.getIndex(&tmp); -- cgit v1.2.3