From db915e4f76078302d66cff79ed9a3eb63024a261 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 4 Apr 2020 14:31:19 +0300 Subject: code cleaning --- plugins/NewStory/src/utils.cpp | 46 ++++++------------------------------------ 1 file changed, 6 insertions(+), 40 deletions(-) (limited to 'plugins/NewStory/src/utils.cpp') diff --git a/plugins/NewStory/src/utils.cpp b/plugins/NewStory/src/utils.cpp index fc73af9a17..e3bea2beeb 100644 --- a/plugins/NewStory/src/utils.cpp +++ b/plugins/NewStory/src/utils.cpp @@ -7,23 +7,23 @@ DWORD toggleBit(DWORD dw, DWORD bit) return dw | bit; } -bool CheckFilter(wchar_t* buf, wchar_t* filter) +bool CheckFilter(wchar_t *buf, wchar_t *filter) { // MessageBox(0, buf, filter, MB_OK); - int l1 = mir_wstrlen(buf); - int l2 = mir_wstrlen(filter); + int l1 = (int)mir_wstrlen(buf); + int l2 = (int)mir_wstrlen(filter); for (int i = 0; i < l1 - l2 + 1; i++) if (CompareString(LOCALE_USER_DEFAULT, NORM_IGNORECASE, buf + i, l2, filter, l2) == CSTR_EQUAL) return true; return false; } -void CopyText(HWND hwnd, wchar_t* text) +void CopyText(HWND hwnd, const wchar_t *text) { OpenClipboard(hwnd); EmptyClipboard(); - HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t) * (mir_wstrlen(text) + 1)); - wchar_t* s = (wchar_t*)GlobalLock(hMem); + HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t) * (int)(mir_wstrlen(text) + 1)); + wchar_t *s = (wchar_t *)GlobalLock(hMem); mir_wstrcpy(s, text); GlobalUnlock(hMem); #ifdef UNICODE @@ -204,37 +204,3 @@ void CopyText(HWND hwnd, wchar_t* text) free(tEnd); }*/ - -char* appendString(char* s1, char* s2) -{ - if (s1) { - int l1 = mir_strlen(s1); - int l2 = mir_strlen(s2); - char* buf = (char*)mir_alloc(l1 + l2 + 1); - mir_snprintf(buf, l1 + l2 + 1, "%s%s", s1, s2); - mir_free(s1); - return buf; - } - else { - char* buf = (char*)mir_alloc(mir_strlen(s2) + 1); - mir_strcpy(buf, s2); - return buf; - } -} - -wchar_t* appendString(wchar_t* s1, wchar_t* s2) -{ - if (s1) { - int l1 = mir_wstrlen(s1); - int l2 = mir_wstrlen(s2); - wchar_t* buf = (wchar_t*)mir_alloc(sizeof(wchar_t) * (l1 + l2 + 1)); - mir_snwprintf(buf, l1 + l2 + 1, L"%s%s", s1, s2); - mir_free(s1); - return buf; - } - else { - wchar_t* buf = (wchar_t*)mir_alloc(sizeof(wchar_t) * (mir_wstrlen(s2) + 1)); - mir_wstrcpy(buf, s2); - return buf; - } -} -- cgit v1.2.3