summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/utils.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-04-04 14:31:19 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-04-04 14:31:19 +0300
commitdb915e4f76078302d66cff79ed9a3eb63024a261 (patch)
tree44e432ab17bb3a25682c5190e31d55cb09fb7952 /plugins/NewStory/src/utils.cpp
parent40269f18dd845b95093877f479f179f1c59a101a (diff)
code cleaning
Diffstat (limited to 'plugins/NewStory/src/utils.cpp')
-rw-r--r--plugins/NewStory/src/utils.cpp46
1 files changed, 6 insertions, 40 deletions
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;
- }
-}