From 1b9f36054bddeef87d4f9c139877d28c4e6b1702 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 1 Sep 2015 15:17:39 +0000 Subject: - strdel()/strdelw() moved to the core; - custom implementations removed git-svn-id: http://svn.miranda-ng.org/main/trunk@15135 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- bin10/lib/mir_core.lib | Bin 299232 -> 299588 bytes bin10/lib/mir_core64.lib | Bin 300460 -> 300778 bytes bin12/lib/mir_core.lib | Bin 299232 -> 299588 bytes bin12/lib/mir_core64.lib | Bin 300460 -> 300778 bytes bin14/lib/mir_core.lib | Bin 299232 -> 299588 bytes bin14/lib/mir_core64.lib | Bin 300460 -> 300778 bytes include/m_core.h | 7 +++++++ plugins/PluginUpdater/src/Compat/compat.h | 8 ++++++++ plugins/PluginUpdater/src/DlgUpdate.cpp | 4 ++-- plugins/PluginUpdater/src/Utils.cpp | 9 --------- plugins/PluginUpdater/src/stdafx.h | 1 - plugins/WebView/src/webview_opts.cpp | 11 +---------- protocols/IRCG/src/irclib.cpp | 9 --------- protocols/JabberG/src/jabber_util.cpp | 9 --------- protocols/JabberG/src/stdafx.h | 4 ---- src/mir_core/src/mir_core.def | 2 ++ src/mir_core/src/mir_core64.def | 2 ++ src/mir_core/src/utils.cpp | 22 ++++++++++++++++++++++ 18 files changed, 44 insertions(+), 44 deletions(-) diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib index 4a21171a87..27443ec295 100644 Binary files a/bin10/lib/mir_core.lib and b/bin10/lib/mir_core.lib differ diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib index 057a49680d..9c56d8e857 100644 Binary files a/bin10/lib/mir_core64.lib and b/bin10/lib/mir_core64.lib differ diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib index 4a21171a87..27443ec295 100644 Binary files a/bin12/lib/mir_core.lib and b/bin12/lib/mir_core.lib differ diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib index 057a49680d..9c56d8e857 100644 Binary files a/bin12/lib/mir_core64.lib and b/bin12/lib/mir_core64.lib differ diff --git a/bin14/lib/mir_core.lib b/bin14/lib/mir_core.lib index 4a21171a87..27443ec295 100644 Binary files a/bin14/lib/mir_core.lib and b/bin14/lib/mir_core.lib differ diff --git a/bin14/lib/mir_core64.lib b/bin14/lib/mir_core64.lib index 057a49680d..9c56d8e857 100644 Binary files a/bin14/lib/mir_core64.lib and b/bin14/lib/mir_core64.lib differ diff --git a/include/m_core.h b/include/m_core.h index 8238d91b6d..02acf94b85 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -377,6 +377,9 @@ MIR_CORE_DLL(wchar_t*) ltrimw(wchar_t *str); MIR_CORE_DLL(char*) ltrimp(char *str); // returns pointer to the trimmed portion of string MIR_CORE_DLL(wchar_t*) ltrimpw(wchar_t *str); +MIR_CORE_DLL(char*) strdel(char *str, size_t len); +MIR_CORE_DLL(wchar_t*) strdelw(wchar_t *str, size_t len); + MIR_CORE_DLL(int) wildcmp(const char *name, const char *mask); MIR_CORE_DLL(int) wildcmpw(const wchar_t *name, const wchar_t *mask); @@ -442,6 +445,8 @@ typedef union { #define ltrimt ltrimw #define ltrimpt ltrimpw + #define strdelt strdelw + #define wildcmpt wildcmpw #define wildcmpit wildcmpiw @@ -480,6 +485,8 @@ typedef union { #define ltrimt ltrim #define ltrimpt ltrimp + #define strdelt strdel + #define wildcmpt wildcmp #define wildcmpit wildcmpi diff --git a/plugins/PluginUpdater/src/Compat/compat.h b/plugins/PluginUpdater/src/Compat/compat.h index 5818adcef1..4c0d0849eb 100644 --- a/plugins/PluginUpdater/src/Compat/compat.h +++ b/plugins/PluginUpdater/src/Compat/compat.h @@ -155,5 +155,13 @@ __forceinline TCHAR *Utils_ReplaceVarsT(const TCHAR *szData, MCONTACT hContact, return (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)szData, (LPARAM)&vars); } +void strdelt(TCHAR *parBuffer, int len) +{ + TCHAR* p; + for (p = parBuffer + len; *p != 0; p++) + p[-len] = *p; + + p[-len] = '\0'; +} #define _qtoupper(_c) (((_c) >= 'a' && (_c) <= 'z')?((_c)-('a'+'A')):(_c)) diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index b3298611f1..cba35cebe7 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -646,13 +646,13 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const // remove trailing w or W and try again int iPos = int(p - tszNewName) - 1; - strdel(p - 1, 1); + strdelt(p - 1, 1); if ((item = hashes.find((ServListEntry*)&pName)) == NULL) { Netlib_LogfT(hNetlibUser, _T("File %s: Not found on server, skipping"), ffd.cFileName); continue; } - strdel(tszNewName + iPos, 1); + strdelt(tszNewName + iPos, 1); } #if MIRANDA_VER >= 0x0A00 diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 30f212abe1..47e73a0e53 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -313,15 +313,6 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) return ret; } -void strdel(TCHAR *parBuffer, int len) -{ - TCHAR* p; - for (p = parBuffer + len; *p != 0; p++) - p[-len] = *p; - - p[-len] = '\0'; -} - void __stdcall OpenPluginOptions(void*) { OPENOPTIONSDIALOG ood = {0}; diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index 146c1ac49c..5491dd325b 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -226,7 +226,6 @@ void CheckUpdateOnStartup(); void InitTimer(void *type); bool unzip(const TCHAR *ptszZipFile, TCHAR *ptszDestPath, TCHAR *ptszBackPath,bool ch); -void strdel(TCHAR *parBuffer, int len); /////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp index 1adf9ccb7c..b0a8f1bee3 100644 --- a/plugins/WebView/src/webview_opts.cpp +++ b/plugins/WebView/src/webview_opts.cpp @@ -37,15 +37,6 @@ static TCHAR *EventTypes[] = { LPGENT("A string is present"), LPGENT("The web pa #define M_FILLSCRIPTCOMBO (WM_USER+16) -void strdel(TCHAR *parBuffer, int len) -{ - TCHAR* p; - for (p = parBuffer + len; *p != 0; p++) - p[-len] = *p; - - p[-len] = '\0'; -} - TCHAR* FixButtonText(TCHAR *url, size_t len) { TCHAR buttontext[256], stringbefore[256], newbuttontext[256]; @@ -62,7 +53,7 @@ TCHAR* FixButtonText(TCHAR *url, size_t len) int pos = (stringafter - buttontext); int posbefore = (stringafter - buttontext) - 1; int posafter = (stringafter - buttontext) + 1; - strdel(stringafter, 1); + strdelt(stringafter, 1); _tcsncpy_s(stringbefore, pos, buttontext, _TRUNCATE); mir_sntprintf(newbuttontext, _T("%s!!%s"), stringbefore, stringafter); diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 8b40818a9e..8c19c1c7b3 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -1390,15 +1390,6 @@ void DoIncomingDcc(HANDLE hConnection, DWORD dwRemoteIP, void * p1) // ident server -void strdel(char* parBuffer, int len) -{ - char *p; - for (p = parBuffer + len; *p != 0; p++) - p[-len] = *p; - - p[-len] = '\0'; -} - void DoIdent(HANDLE hConnection, DWORD, void* extra) { CIrcProto *ppro = (CIrcProto*)extra; diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 77534292f5..1e671818ea 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -134,15 +134,6 @@ TCHAR* JabberPrepareJid(LPCTSTR jid) return szNewJid; } -void strdel(char* parBuffer, int len) -{ - char* p; - for (p = parBuffer + len; *p != 0; p++) - p[-len] = *p; - - p[-len] = '\0'; -} - void __stdcall JabberUrlDecodeW(WCHAR *str) { if (str == NULL) diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index bab4c80f57..5645dc0090 100644 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -759,10 +759,6 @@ bool JabberReadXep203delay(HXML node, time_t &msgTime); int UIEmulateBtnClick(HWND hwndDlg, UINT idcButton); void UIShowControls(HWND hwndDlg, int *idList, int nCmdShow); -//---- jabber_xml.cpp ------------------------------------------------------------------- - -void strdel(char* parBuffer, int len); - //---- jabber_userinfo.cpp -------------------------------------------------------------- void JabberUserInfoUpdate(MCONTACT hContact); diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 57f8bfcfd9..6ec2a2e42e 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -981,3 +981,5 @@ mir_strncmp @1138 mir_strncmpi @1139 mir_wstrncmp @1140 mir_wstrncmpi @1141 +strdel @1142 +strdelw @1143 diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index c44c595634..07fe41af64 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -981,3 +981,5 @@ mir_strncmp @1138 mir_strncmpi @1139 mir_wstrncmp @1140 mir_wstrncmpi @1141 +strdel @1142 +strdelw @1143 diff --git a/src/mir_core/src/utils.cpp b/src/mir_core/src/utils.cpp index 5f4d0d063b..7ef78fd593 100644 --- a/src/mir_core/src/utils.cpp +++ b/src/mir_core/src/utils.cpp @@ -142,6 +142,28 @@ MIR_CORE_DLL(WCHAR*) ltrimpw(WCHAR *str) ///////////////////////////////////////////////////////////////////////////////////////// +MIR_CORE_DLL(char*) strdel(char *str, size_t len) +{ + char* p; + for (p = str + len; *p != 0; p++) + p[-len] = *p; + + p[-len] = '\0'; + return str; +} + +MIR_CORE_DLL(wchar_t*) strdelw(wchar_t *str, size_t len) +{ + wchar_t* p; + for (p = str + len; *p != 0; p++) + p[-len] = *p; + + p[-len] = '\0'; + return str; +} + +///////////////////////////////////////////////////////////////////////////////////////// + MIR_CORE_DLL(int) wildcmp(const char *name, const char *mask) { if (name == NULL || mask == NULL) -- cgit v1.2.3