From c2cb7db85cbd67c5b95c2735d9b917eb0ac1d234 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 12 Aug 2013 15:30:21 +0000 Subject: - fix for a rare crash on tabsrmm tooltips; - toolbar buttons added to a log git-svn-id: http://svn.miranda-ng.org/main/trunk@5659 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/TSButton.cpp | 629 ++++++++++++++-------------- plugins/TabSRMM/src/chat/log.cpp | 8 +- plugins/TabSRMM/src/chat/manager.cpp | 5 +- plugins/TabSRMM/src/chat/muchighlight.cpp | 2 +- plugins/TabSRMM/src/chat/options.cpp | 4 +- plugins/TabSRMM/src/chat/window.cpp | 66 +-- plugins/TabSRMM/src/contactcache.cpp | 8 +- plugins/TabSRMM/src/container.cpp | 2 +- plugins/TabSRMM/src/eventpopups.cpp | 4 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 8 +- plugins/TabSRMM/src/globals.cpp | 14 +- plugins/TabSRMM/src/modplus.cpp | 12 +- plugins/TabSRMM/src/msgdialog.cpp | 18 +- plugins/TabSRMM/src/msgdlgutils.cpp | 2 +- plugins/TabSRMM/src/msgoptions.cpp | 12 +- plugins/TabSRMM/src/msgs.cpp | 6 +- plugins/TabSRMM/src/themes.cpp | 6 +- plugins/TabSRMM/src/themes.h | 35 +- plugins/TabSRMM/src/trayicon.cpp | 4 +- plugins/TabSRMM/src/utils.cpp | 10 +- 20 files changed, 435 insertions(+), 420 deletions(-) diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp index 55f5e781cc..06c3ff0d70 100644 --- a/plugins/TabSRMM/src/TSButton.cpp +++ b/plugins/TabSRMM/src/TSButton.cpp @@ -371,111 +371,110 @@ nonflat_themed: static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - MButtonCtrl* bct = (MButtonCtrl *)GetWindowLongPtr(hwndDlg, 0); + MButtonCtrl* bct = (MButtonCtrl*)GetWindowLongPtr(hwndDlg, 0); switch (msg) { - case WM_NCCREATE: { - SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) | BS_OWNERDRAW); - bct = (MButtonCtrl *)malloc(sizeof(MButtonCtrl)); - if (bct == NULL) - return FALSE; - ZeroMemory(bct, sizeof(MButtonCtrl)); - bct->hwnd = hwndDlg; - bct->stateId = PBS_NORMAL; - bct->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); - LoadTheme(bct); - SetWindowLongPtr(hwndDlg, 0, (LONG_PTR)bct); - if (((CREATESTRUCT *)lParam)->lpszName) - SetWindowText(hwndDlg, ((CREATESTRUCT *)lParam)->lpszName); - return TRUE; + case WM_NCCREATE: + SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE) | BS_OWNERDRAW); + bct = (MButtonCtrl*)malloc(sizeof(MButtonCtrl)); + if (bct == NULL) + return FALSE; + { + char *p = (char*)bct ; + _DebugTraceA("SESSION_INFO allocated: crashes at %lp", p + offsetof(MButtonCtrl, cHot)); } - case WM_DESTROY: { - if (bct) { - EnterCriticalSection(&csTips); - if (hwndToolTips) { - TOOLINFO ti; - - ZeroMemory(&ti, sizeof(ti)); - ti.cbSize = sizeof(ti); - ti.uFlags = TTF_IDISHWND; - ti.hwnd = bct->hwnd; - ti.uId = (UINT_PTR)bct->hwnd; - if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM)&ti)) { - SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM)&ti); - } - if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0) { - DestroyWindow(hwndToolTips); - hwndToolTips = NULL; - } + ZeroMemory(bct, sizeof(MButtonCtrl)); + bct->hwnd = hwndDlg; + bct->stateId = PBS_NORMAL; + bct->hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); + LoadTheme(bct); + SetWindowLongPtr(hwndDlg, 0, (LONG_PTR)bct); + if (((CREATESTRUCT *)lParam)->lpszName) + SetWindowText(hwndDlg, ((CREATESTRUCT *)lParam)->lpszName); + return TRUE; + + case WM_DESTROY: + if (bct) { + mir_cslock lck(csTips); + if (hwndToolTips) { + TOOLINFO ti = { sizeof(ti) }; + ti.uFlags = TTF_IDISHWND; + ti.hwnd = bct->hwnd; + ti.uId = (UINT_PTR)bct->hwnd; + if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM)&ti)) + SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM)&ti); + + if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0) { + DestroyWindow(hwndToolTips); + hwndToolTips = NULL; } - if (bct->hIconPrivate) - DestroyIcon(bct->hIconPrivate); - LeaveCriticalSection(&csTips); - DestroyTheme(bct); } - break; // DONT! fall thru + if (bct->hIconPrivate) + DestroyIcon(bct->hIconPrivate); + DestroyTheme(bct); } - - case WM_NCDESTROY: - free(bct); - SetWindowLongPtr(hwndDlg, 0, (LONG_PTR)NULL); - break; - - case WM_SETTEXT: { - bct->cHot = 0; - if ((TCHAR *)lParam) { - TCHAR *tmp = (TCHAR *)lParam; - while (*tmp) { - if (*tmp == (TCHAR)'&' && *(tmp + 1)) { - bct->cHot = _totlower(*(tmp + 1)); - break; - } - tmp++; + break; // DONT! fall thru + + case WM_NCDESTROY: + free(bct); + SetWindowLongPtr(hwndDlg, 0, (LONG_PTR)NULL); + break; + + case WM_SETTEXT: + bct->cHot = 0; + if ((TCHAR*)lParam) { + TCHAR *tmp = (TCHAR*)lParam; + while (*tmp) { + if (*tmp == (TCHAR)'&' && *(tmp + 1)) { + bct->cHot = _totlower(*(tmp + 1)); + break; } - InvalidateRect(bct->hwnd, NULL, TRUE); + tmp++; } - break; + InvalidateRect(bct->hwnd, NULL, TRUE); } - case WM_KEYUP: - if (bct->stateId != PBS_DISABLED && wParam == VK_SPACE && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000)) { - if (bct->pushBtn) { - if (bct->pbState) bct->pbState = 0; - else bct->pbState = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); - } - SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg); - return 0; - } - break; - case WM_SYSKEYUP: - if (bct->stateId != PBS_DISABLED && bct->cHot && bct->cHot == tolower((int)wParam)) { - if (bct->pushBtn) { - if (bct->pbState) bct->pbState = 0; - else bct->pbState = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); - } - SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg); - return 0; + break; + + case WM_KEYUP: + if (bct->stateId != PBS_DISABLED && wParam == VK_SPACE && !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_SHIFT) & 0x8000)) { + if (bct->pushBtn) { + if (bct->pbState) bct->pbState = 0; + else bct->pbState = 1; + InvalidateRect(bct->hwnd, NULL, TRUE); } - break; - case WM_THEMECHANGED: { - // themed changed, reload theme object - if (bct->bThemed) - LoadTheme(bct); - InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it - break; - } - case WM_SETFONT: { // remember the font so we can use it later - bct->hFont = (HFONT)wParam; // maybe we should redraw? - break; + SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg); + return 0; } - case WM_NCPAINT: + break; + + case WM_SYSKEYUP: + if (bct->stateId != PBS_DISABLED && bct->cHot && bct->cHot == tolower((int)wParam)) { + if (bct->pushBtn) { + if (bct->pbState) bct->pbState = 0; + else bct->pbState = 1; + InvalidateRect(bct->hwnd, NULL, TRUE); + } + SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg); return 0; + } + break; - case WM_PAINT: { - PAINTSTRUCT ps; - HDC hdcPaint; + case WM_THEMECHANGED: // themed changed, reload theme object + if (bct->bThemed) + LoadTheme(bct); + InvalidateRect(bct->hwnd, NULL, TRUE); // repaint it + break; + + case WM_SETFONT: // remember the font so we can use it later + bct->hFont = (HFONT)wParam; // maybe we should redraw? + break; + + case WM_NCPAINT: + return 0; - hdcPaint = BeginPaint(hwndDlg, &ps); + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hdcPaint = BeginPaint(hwndDlg, &ps); if (hdcPaint) { if (bct->sitem) bct->sitem->RenderThis(hdcPaint); @@ -483,255 +482,271 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, PaintWorker(bct, hdcPaint); EndPaint(hwndDlg, &ps); } - return 0; } - case BM_SETIMAGE: - if (wParam == IMAGE_ICON) { - ICONINFO ii; - BITMAP bm; - - if (bct->hIconPrivate) - DestroyIcon(bct->hIconPrivate); - - GetIconInfo((HICON)lParam, &ii); - GetObject(ii.hbmColor, sizeof(bm), &bm); - if (bm.bmWidth != PluginConfig.m_smcxicon || bm.bmHeight != PluginConfig.m_smcyicon) { - HIMAGELIST hImageList; - hImageList = ImageList_Create(PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, PluginConfig.m_bIsXP ? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0); - ImageList_AddIcon(hImageList, (HICON)lParam); - bct->hIconPrivate = ImageList_GetIcon(hImageList, 0, ILD_NORMAL); - ImageList_RemoveAll(hImageList); - ImageList_Destroy(hImageList); - bct->hIcon = 0; - } else { - bct->hIcon = (HICON)lParam; - bct->hIconPrivate = 0; - } - - DeleteObject(ii.hbmMask); - DeleteObject(ii.hbmColor); - bct->hBitmap = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); - } else if (wParam == IMAGE_BITMAP) { - bct->hBitmap = (HBITMAP)lParam; - if (bct->hIconPrivate) - DestroyIcon(bct->hIconPrivate); - bct->hIcon = bct->hIconPrivate = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); - } - break; - case BM_SETCHECK: - if (!bct->pushBtn) break; - if (wParam == BST_CHECKED) { - bct->pbState = 1; - bct->stateId = PBS_PRESSED; - } else if (wParam == BST_UNCHECKED) { - bct->pbState = 0; - bct->stateId = PBS_NORMAL; - } - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case BM_GETCHECK: - if (bct->pushBtn) { - return bct->pbState ? BST_CHECKED : BST_UNCHECKED; + return 0; + + case BM_SETIMAGE: + if (wParam == IMAGE_ICON) { + if (bct->hIconPrivate) + DestroyIcon(bct->hIconPrivate); + + ICONINFO ii; + GetIconInfo((HICON)lParam, &ii); + + BITMAP bm; + GetObject(ii.hbmColor, sizeof(bm), &bm); + if (bm.bmWidth != PluginConfig.m_smcxicon || bm.bmHeight != PluginConfig.m_smcyicon) { + HIMAGELIST hImageList; + hImageList = ImageList_Create(PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, PluginConfig.m_bIsXP ? ILC_COLOR32 | ILC_MASK : ILC_COLOR16 | ILC_MASK, 1, 0); + ImageList_AddIcon(hImageList, (HICON)lParam); + bct->hIconPrivate = ImageList_GetIcon(hImageList, 0, ILD_NORMAL); + ImageList_RemoveAll(hImageList); + ImageList_Destroy(hImageList); + bct->hIcon = 0; + } else { + bct->hIcon = (HICON)lParam; + bct->hIconPrivate = 0; } - return 0; - case BUTTONSETARROW: // turn arrow on/off - bct->arrow = (HICON)wParam; - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case BUTTONSETDEFAULT: - bct->defbutton = (wParam != 0); - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case BUTTONSETASPUSHBTN: - bct->pushBtn = (wParam != 0); + + DeleteObject(ii.hbmMask); + DeleteObject(ii.hbmColor); + bct->hBitmap = NULL; InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case BUTTONSETASFLATBTN: - bct->flatBtn = (wParam != 0); + } + else if (wParam == IMAGE_BITMAP) { + bct->hBitmap = (HBITMAP)lParam; + if (bct->hIconPrivate) + DestroyIcon(bct->hIconPrivate); + bct->hIcon = bct->hIconPrivate = NULL; InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case BUTTONSETASTHEMEDBTN: - bct->bThemed = (wParam != 0); - break; - case BUTTONSETASDIMMED: - bct->dimmed = (wParam != 0); - break; - case BUTTONSETCONTAINER: - bct->pContainer = (TContainerData *)wParam; - break; - case BUTTONSETASTITLE: - bct->bTitleButton = TRUE; - break; - case BUTTONSETASNORMAL: - bct->stateId = (wParam) ? PBS_NORMAL : PBS_DISABLED; - InvalidateRect(bct->hwnd, NULL, FALSE); - break; - case BUTTONGETSTATEID: - return bct->stateId; - case BUTTONSETASTOOLBARBUTTON: - bct->bToolbarButton = wParam; - break; - case BUTTONSETASSIDEBARBUTTON: - bct->sitem = reinterpret_cast(wParam); - break; - case BUTTONSETOVERLAYICON: - bct->overlay = (HICON)wParam; - break; - case BUTTONADDTOOLTIP: { - TOOLINFO ti; - - if (!(char*)wParam) - break; - EnterCriticalSection(&csTips); - if (!hwndToolTips) { + } + break; + + case BM_SETCHECK: + if (!bct->pushBtn) break; + if (wParam == BST_CHECKED) { + bct->pbState = 1; + bct->stateId = PBS_PRESSED; + } + else if (wParam == BST_UNCHECKED) { + bct->pbState = 0; + bct->stateId = PBS_NORMAL; + } + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case BM_GETCHECK: + if (bct->pushBtn) + return bct->pbState ? BST_CHECKED : BST_UNCHECKED; + + return 0; + + case BUTTONSETARROW: // turn arrow on/off + bct->arrow = (HICON)wParam; + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case BUTTONSETDEFAULT: + bct->defbutton = (wParam != 0); + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case BUTTONSETASPUSHBTN: + bct->pushBtn = (wParam != 0); + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case BUTTONSETASFLATBTN: + bct->flatBtn = (wParam != 0); + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case BUTTONSETASTHEMEDBTN: + bct->bThemed = (wParam != 0); + break; + + case BUTTONSETASDIMMED: + bct->dimmed = (wParam != 0); + break; + + case BUTTONSETCONTAINER: + bct->pContainer = (TContainerData *)wParam; + break; + + case BUTTONSETASTITLE: + bct->bTitleButton = TRUE; + break; + + case BUTTONSETASNORMAL: + bct->stateId = (wParam) ? PBS_NORMAL : PBS_DISABLED; + InvalidateRect(bct->hwnd, NULL, FALSE); + break; + + case BUTTONGETSTATEID: + return bct->stateId; + + case BUTTONSETASTOOLBARBUTTON: + bct->bToolbarButton = wParam; + break; + + case BUTTONSETASSIDEBARBUTTON: + bct->sitem = reinterpret_cast(wParam); + break; + + case BUTTONSETOVERLAYICON: + bct->overlay = (HICON)wParam; + break; + + case BUTTONADDTOOLTIP: + if (wParam) { + mir_cslock lck(csTips); + if (!hwndToolTips) hwndToolTips = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, _T(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), NULL); - } - ZeroMemory(&ti, sizeof(ti)); - ti.cbSize = sizeof(ti); + + TOOLINFO ti = { sizeof(ti) }; ti.uFlags = TTF_IDISHWND; ti.hwnd = bct->hwnd; ti.uId = (UINT_PTR)bct->hwnd; - if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM)&ti)) { + if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM)&ti)) SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM)&ti); - } + ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; ti.uId = (UINT_PTR)bct->hwnd; - ti.lpszText = (TCHAR *)wParam; + ti.lpszText = (TCHAR*)wParam; SendMessage(hwndToolTips, TTM_ADDTOOL, 0, (LPARAM)&ti); SendMessage(hwndToolTips, TTM_SETMAXTIPWIDTH, 0, 300); - LeaveCriticalSection(&csTips); - break; } - case WM_SETFOCUS: // set keybord focus and redraw - bct->focus = 1; - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case WM_KILLFOCUS: // kill focus and redraw - bct->focus = 0; - InvalidateRect(bct->hwnd, NULL, TRUE); - break; - case WM_ENABLE: { // windows tells us to enable/disable - bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED; + break; + + case WM_SETFOCUS: // set keybord focus and redraw + bct->focus = 1; + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case WM_KILLFOCUS: // kill focus and redraw + bct->focus = 0; + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case WM_ENABLE: // windows tells us to enable/disable + bct->stateId = wParam ? PBS_NORMAL : PBS_DISABLED; + InvalidateRect(bct->hwnd, NULL, TRUE); + break; + + case WM_MOUSELEAVE: // faked by the WM_TIMER + if (bct->stateId != PBS_DISABLED) { // don't change states if disabled + bct->stateId = PBS_NORMAL; InvalidateRect(bct->hwnd, NULL, TRUE); - break; } - case WM_MOUSELEAVE: { // faked by the WM_TIMER - if (bct->stateId != PBS_DISABLED) { // don't change states if disabled - bct->stateId = PBS_NORMAL; - InvalidateRect(bct->hwnd, NULL, TRUE); - } - break; + break; + + case WM_CONTEXTMENU: + if (bct->sitem) + bct->sitem->invokeContextMenu(); + break; + + case WM_MBUTTONUP: + if (bct->sitem) + if (bct->sitem->getDat()) + SendMessage(bct->sitem->getDat()->hwnd, WM_CLOSE, 1, 0); + break; + + case WM_LBUTTONDOWN: + if (bct->sitem) { + if (bct->sitem->testCloseButton() != -1) + return TRUE; + bct->stateId = PBS_PRESSED; + InvalidateRect(bct->hwnd, NULL, TRUE); + bct->sitem->activateSession(); } - case WM_CONTEXTMENU: - if (bct->sitem) - bct->sitem->invokeContextMenu(); - break; - - case WM_MBUTTONUP: - if (bct->sitem) { - if (bct->sitem->getDat()) - SendMessage(bct->sitem->getDat()->hwnd, WM_CLOSE, 1, 0); - } - break; - - case WM_LBUTTONDOWN: { + if (bct->arrow) { RECT rc; - - if (bct->sitem) { - if (bct->sitem->testCloseButton() != -1) - return TRUE; + GetClientRect(bct->hwnd, &rc); + if (LOWORD(lParam) < rc.right - 12 && bct->stateId != PBS_DISABLED) bct->stateId = PBS_PRESSED; - InvalidateRect(bct->hwnd, NULL, TRUE); - bct->sitem->activateSession(); + else if (LOWORD(lParam) > rc.right - 12) { + if (GetDlgCtrlID(hwndDlg) == IDOK || bct->stateId != PBS_DISABLED) { + WORD w = (WORD)((int)bct->arrow & 0x0000ffff); + SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(w, BN_CLICKED), (LPARAM)hwndDlg); + } } + InvalidateRect(bct->hwnd, NULL, TRUE); + } + else if (bct->stateId != PBS_DISABLED) { + bct->stateId = PBS_PRESSED; + InvalidateRect(bct->hwnd, NULL, TRUE); + } + break; - if (bct->arrow) { - GetClientRect(bct->hwnd, &rc); - if (LOWORD(lParam) < rc.right - 12 && bct->stateId != PBS_DISABLED) - bct->stateId = PBS_PRESSED; - else if (LOWORD(lParam) > rc.right - 12) { - if (GetDlgCtrlID(hwndDlg) == IDOK || bct->stateId != PBS_DISABLED) { - WORD w = (WORD)((int)bct->arrow & 0x0000ffff); - SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(w, BN_CLICKED), (LPARAM)hwndDlg); - } - } - InvalidateRect(bct->hwnd, NULL, TRUE); - } else if (bct->stateId != PBS_DISABLED) { - bct->stateId = PBS_PRESSED; - InvalidateRect(bct->hwnd, NULL, TRUE); + case WM_LBUTTONUP: { + int showClick = 0; + + if (bct->sitem) { + if (bct->sitem->testCloseButton() != -1) { + SendMessage(bct->sitem->getDat()->hwnd, WM_CLOSE, 1, 0); + return TRUE; } - break; } - case WM_LBUTTONUP: { - int showClick = 0; + if (bct->pushBtn) { + if (bct->pbState) bct->pbState = 0; + else bct->pbState = 1; + } + if (bct->stateId != PBS_DISABLED) { // don't change states if disabled + if (bct->stateId == PBS_PRESSED) + showClick = 1; + if (msg == WM_LBUTTONUP) + bct->stateId = PBS_HOT; + else + bct->stateId = PBS_NORMAL; + InvalidateRect(bct->hwnd, NULL, TRUE); + } + if (showClick) + SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg); + break; + } + case WM_MOUSEMOVE: + if (bct->stateId == PBS_NORMAL) { + bct->stateId = PBS_HOT; + InvalidateRect(bct->hwnd, NULL, TRUE); + } + else if (bct->arrow && bct->stateId == PBS_HOT) + InvalidateRect(bct->hwnd, NULL, TRUE); - if (bct->sitem) { - if (bct->sitem->testCloseButton() != -1) { - SendMessage(bct->sitem->getDat()->hwnd, WM_CLOSE, 1, 0); - return TRUE; + // Call timer, used to start cheesy TrackMouseEvent faker + SetTimer(hwndDlg, BUTTON_POLLID, BUTTON_POLLDELAY, NULL); + if (bct->sitem) { + if (bct->sitem->testCloseButton() != -1) { + if (bct->sitem->m_sideBar->getHoveredClose() != bct->sitem) { + bct->sitem->m_sideBar->setHoveredClose(bct->sitem); + InvalidateRect(hwndDlg, 0, FALSE); } } - if (bct->pushBtn) { - if (bct->pbState) bct->pbState = 0; - else bct->pbState = 1; - } - if (bct->stateId != PBS_DISABLED) { // don't change states if disabled - if (bct->stateId == PBS_PRESSED) - showClick = 1; - if (msg == WM_LBUTTONUP) - bct->stateId = PBS_HOT; - else - bct->stateId = PBS_NORMAL; - InvalidateRect(bct->hwnd, NULL, TRUE); + else { + bct->sitem->m_sideBar->setHoveredClose(0); + InvalidateRect(hwndDlg, 0, FALSE); } - if (showClick) - SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(GetDlgCtrlID(hwndDlg), BN_CLICKED), (LPARAM)hwndDlg); - break; } - case WM_MOUSEMOVE: - if (bct->stateId == PBS_NORMAL) { - bct->stateId = PBS_HOT; - InvalidateRect(bct->hwnd, NULL, TRUE); - } else if (bct->arrow && bct->stateId == PBS_HOT) { - InvalidateRect(bct->hwnd, NULL, TRUE); - } - // Call timer, used to start cheesy TrackMouseEvent faker - SetTimer(hwndDlg, BUTTON_POLLID, BUTTON_POLLDELAY, NULL); - if (bct->sitem) { - if (bct->sitem->testCloseButton() != -1) { - if (bct->sitem->m_sideBar->getHoveredClose() != bct->sitem) { - bct->sitem->m_sideBar->setHoveredClose(bct->sitem); - InvalidateRect(hwndDlg, 0, FALSE); - } - } - else { + break; + case WM_TIMER: // use a timer to check if they have did a mouseout + if (wParam == BUTTON_POLLID) { + RECT rc; + POINT pt; + GetWindowRect(hwndDlg, &rc); + GetCursorPos(&pt); + if (!PtInRect(&rc, pt)) { // mouse must be gone, trigger mouse leave + PostMessage(hwndDlg, WM_MOUSELEAVE, 0, 0L); + KillTimer(hwndDlg, BUTTON_POLLID); + if (bct->sitem) { bct->sitem->m_sideBar->setHoveredClose(0); InvalidateRect(hwndDlg, 0, FALSE); } } - break; - case WM_TIMER: { // use a timer to check if they have did a mouseout - if (wParam == BUTTON_POLLID) { - RECT rc; - POINT pt; - GetWindowRect(hwndDlg, &rc); - GetCursorPos(&pt); - if (!PtInRect(&rc, pt)) { // mouse must be gone, trigger mouse leave - PostMessage(hwndDlg, WM_MOUSELEAVE, 0, 0L); - KillTimer(hwndDlg, BUTTON_POLLID); - if (bct->sitem) { - bct->sitem->m_sideBar->setHoveredClose(0); - InvalidateRect(hwndDlg, 0, FALSE); - } - } - } - break; } - case WM_ERASEBKGND: - return 1; + break; + + case WM_ERASEBKGND: + return 1; } return DefWindowProc(hwndDlg, msg, wParam, lParam); } diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index 25ff4df187..ee7830c91d 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -100,7 +100,7 @@ static int Log_AppendIEView(LOGSTREAMDATA* streamData, BOOL simpleMode, TCHAR ** lineLen = lineLen*9 + 8; if (*cbBufferEnd + lineLen > *cbBufferAlloced) { cbBufferAlloced[0] += (lineLen + 1024 - lineLen % 1024); - *buffer = (TCHAR *) mir_realloc(*buffer, *cbBufferAlloced * sizeof(TCHAR)); + *buffer = (TCHAR*) mir_realloc(*buffer, *cbBufferAlloced * sizeof(TCHAR)); } d = *buffer + *cbBufferEnd; @@ -444,9 +444,9 @@ static TCHAR * _tcsrplc(TCHAR **src, const TCHAR *ptrn, const TCHAR *rplc) lRplc = lstrlen(rplc); if (lPtrn && lSrc && lSrc >= lPtrn && (tszFound = _tcsstr(*src, ptrn)) != NULL) { if (lRplc > lPtrn) - *src = (TCHAR *) realloc((void*) * src, + *src = (TCHAR*) realloc((void*) * src, sizeof(TCHAR) * (lSrc + lRplc - lPtrn + 1)); - if (tszTail = (TCHAR *) malloc(sizeof(TCHAR) * + if (tszTail = (TCHAR*) malloc(sizeof(TCHAR) * (lSrc - (tszFound - *src) - lPtrn + 1))) { /* save tail */ _tcscpy(tszTail, tszFound + lPtrn); @@ -476,7 +476,7 @@ static TCHAR * _tcsnrplc(TCHAR *src, size_t n, const TCHAR *ptrn, const TCHAR *r if (lPtrn && lSrc && lSrc >= lPtrn && /* lengths are ok */ (tszFound = _tcsstr(src, ptrn)) != NULL && /* pattern was found in string */ (n < 0 || lSrc - lPtrn + lRplc < n) && /* there is enough room in the string */ - (tszTail = (TCHAR *) malloc(sizeof(TCHAR) * + (tszTail = (TCHAR*) malloc(sizeof(TCHAR) * (lSrc - (tszFound - src) - lPtrn + 1))) != NULL) { /* save tail */ _tcscpy(tszTail, tszFound + lPtrn); diff --git a/plugins/TabSRMM/src/chat/manager.cpp b/plugins/TabSRMM/src/chat/manager.cpp index 651c7945ef..3458ae87c3 100644 --- a/plugins/TabSRMM/src/chat/manager.cpp +++ b/plugins/TabSRMM/src/chat/manager.cpp @@ -657,7 +657,8 @@ void SM_AddCommand(const TCHAR* pszID, const char* pszModule, const char* lpNewC if (si->lpCommands == NULL) { node->next = NULL; si->lpCommands = node; - } else { + } + else { node->next = si->lpCommands; si->lpCommands->last = node; // hmm, weird si->lpCommands = node; @@ -1189,7 +1190,7 @@ BOOL UM_SetStatusEx(USERINFO* pUserList, const TCHAR* pszText, int flags) if (pszText == NULL) continue; - TCHAR* s = (TCHAR *)_tcsstr(pszText, p->pszUID); + TCHAR* s = (TCHAR*)_tcsstr(pszText, p->pszUID); if (s == NULL) continue; diff --git a/plugins/TabSRMM/src/chat/muchighlight.cpp b/plugins/TabSRMM/src/chat/muchighlight.cpp index c0d11ae716..1777657801 100644 --- a/plugins/TabSRMM/src/chat/muchighlight.cpp +++ b/plugins/TabSRMM/src/chat/muchighlight.cpp @@ -105,7 +105,7 @@ void CMUCHighlight::tokenize(TCHAR *tszString, TCHAR**& patterns, UINT& nr) } p++; } - patterns = (TCHAR **)mir_alloc(nr * sizeof(TCHAR *)); + patterns = (TCHAR **)mir_alloc(nr * sizeof(TCHAR*)); p = tszString; nr = 0; diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 2f042a249e..bcbea06b5c 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -580,7 +580,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP)); if (iLen > 0) { - pszText = (TCHAR *)realloc(pszText, (iLen + 2) * sizeof(TCHAR)); + pszText = (TCHAR*)realloc(pszText, (iLen + 2) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1); db_set_ts(NULL, "Chat", "AddToGroup", pszText); } else @@ -1029,7 +1029,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (PluginConfig.m_chat_enabled) { int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY)); if (iLen > 0) { - TCHAR *pszText1 = (TCHAR *)malloc(iLen*sizeof(TCHAR) + 2); + TCHAR *pszText1 = (TCHAR*)malloc(iLen*sizeof(TCHAR) + 2); GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText1, iLen + 1); db_set_ts(NULL, "Chat", "LogDirectory", pszText1); free(pszText1); diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index a835a40098..20a0eb9d54 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -233,9 +233,12 @@ static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) if (dat == NULL) return; + SESSION_INFO *si = dat->si; + if (si == NULL) + return; + HWND hwndDlg = dat->hwnd; HWND hwndTab = GetParent(hwndDlg); - SESSION_INFO *si = dat->si; if (msg == WM_ACTIVATE) { if (dat->pContainer->dwFlags & CNT_TRANSPARENCY && CMimAPI::m_pSetLayeredWindowAttributes != NULL) { @@ -246,8 +249,9 @@ static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) if (si->hwndFilter) { POINT pt; - RECT rcFilter; GetCursorPos(&pt); + + RECT rcFilter; GetWindowRect(si->hwndFilter, &rcFilter); if (!PtInRect(&rcFilter, pt)) { SendMessage(si->hwndFilter, WM_CLOSE, 1, 1); @@ -1860,14 +1864,12 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar case WM_INITDIALOG: { TNewWindowData *newData = (TNewWindowData*)lParam; - SESSION_INFO *psi = (SESSION_INFO*)newData->hdbEvent; - RECT rc; + si = (SESSION_INFO*)newData->hdbEvent; TWindowData *dat = (TWindowData*)calloc( sizeof(TWindowData), 1); - si = psi; - dat->si = psi; - dat->hContact = psi->hContact; - dat->szProto = GetContactProto(psi->hContact); + dat->si = si; + dat->hContact = si->hContact; + dat->szProto = GetContactProto(si->hContact); dat->bType = SESSIONTYPE_CHAT; dat->Panel = new CInfoPanel(dat); @@ -1879,25 +1881,25 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar TabCtrl_SetItem(hwndTab, newData->iTabID, &newData->item); dat->iTabID = newData->iTabID; dat->pContainer = newData->pContainer; - psi->pContainer = newData->pContainer; + si->pContainer = newData->pContainer; dat->hwnd = hwndDlg; - psi->hWnd = hwndDlg; - psi->dat = dat; + si->hWnd = hwndDlg; + si->dat = dat; dat->fIsAutosizingInput = IsAutoSplitEnabled(dat); dat->fLimitedUpdate = false; dat->iInputAreaHeight = -1; if (!dat->pContainer->settings->fPrivate) - psi->iSplitterY = g_Settings.iSplitterY; + si->iSplitterY = g_Settings.iSplitterY; else { if (M.GetByte("Chat", "SyncSplitter", 0)) - psi->iSplitterY = dat->pContainer->settings->splitterPos - DPISCALEY_S(23); + si->iSplitterY = dat->pContainer->settings->splitterPos - DPISCALEY_S(23); else - psi->iSplitterY = g_Settings.iSplitterY; + si->iSplitterY = g_Settings.iSplitterY; } -#if defined(__FEAT_EXP_AUTOSPLITTER) - if (dat->fIsAutosizingInput) - psi->iSplitterY = GetDefaultMinimumInputHeight(dat); -#endif + #if defined(__FEAT_EXP_AUTOSPLITTER) + if (dat->fIsAutosizingInput) + si->iSplitterY = GetDefaultMinimumInputHeight(dat); + #endif dat->pWnd = 0; CProxyWindow::add(dat); @@ -1933,11 +1935,11 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar int mask = (int)SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_GETEVENTMASK, 0, 0); SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS | ENM_KEYEVENTS); -#if defined(__FEAT_EXP_AUTOSPLITTER) - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETEVENTMASK, 0, ENM_REQUESTRESIZE | ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE); -#else - SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE); -#endif + #if defined(__FEAT_EXP_AUTOSPLITTER) + SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETEVENTMASK, 0, ENM_REQUESTRESIZE | ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE); + #else + SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_SCROLL | ENM_KEYEVENTS | ENM_CHANGE); + #endif SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, (WPARAM)0x7FFFFFFF, 0); SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(3, 3)); @@ -1967,6 +1969,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SendMessage(hwndDlg, GC_SETWNDPROPS, 0, 0); SendMessage(hwndDlg, GC_UPDATESTATUSBAR, 0, 0); SendMessage(hwndDlg, GC_UPDATETITLE, 0, 1); + + RECT rc; SendMessage(dat->pContainer->hwnd, DM_QUERYCLIENTAREA, 0, (LPARAM)&rc); SetWindowPos(hwndDlg, HWND_TOP, rc.left, rc.top, (rc.right - rc.left), (rc.bottom - rc.top), 0); ShowWindow(hwndDlg, SW_SHOW); @@ -2002,10 +2006,10 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar DM_InitRichEdit(dat); SendDlgItemMessage(hwndDlg, IDOK, BUTTONSETASNORMAL, TRUE, 0); - { - SendMessage(GetDlgItem(hwndDlg, IDC_LIST), LB_SETITEMHEIGHT, 0, (LPARAM)g_Settings.iNickListFontHeight); - InvalidateRect(GetDlgItem(hwndDlg, IDC_LIST), NULL, TRUE); - } + + SendMessage(GetDlgItem(hwndDlg, IDC_LIST), LB_SETITEMHEIGHT, 0, (LPARAM)g_Settings.iNickListFontHeight); + InvalidateRect(GetDlgItem(hwndDlg, IDC_LIST), NULL, TRUE); + SendDlgItemMessage(hwndDlg, IDC_FILTER, BUTTONSETOVERLAYICON, (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0); SendMessage(hwndDlg, WM_SIZE, 0, 0); @@ -2065,7 +2069,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar TCITEM item = { 0 }; item.mask = TCIF_TEXT; - lstrcpyn(dat->szStatus, (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)dat->wStatus, GSMDF_TCHAR), 50); + lstrcpyn(dat->szStatus, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)dat->wStatus, GSMDF_TCHAR), 50); dat->szStatus[49] = 0; item.pszText = dat->newtitle; item.cchTextMax = 120; @@ -2680,7 +2684,7 @@ LABEL_SHOWWINDOW: TEXTRANGE tr = { 0 }; tr.chrg = cr; - tr.lpstrText = (TCHAR *)pszWord; + tr.lpstrText = (TCHAR*)pszWord; int iRes = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_GETTEXTRANGE, 0, (LPARAM)&tr); if (iRes > 0) { @@ -2786,7 +2790,7 @@ LABEL_SHOWWINDOW: TEXTRANGE tr; tr.lpstrText = NULL; tr.chrg = ((ENLINK *) lParam)->chrg; - tr.lpstrText = (TCHAR *)mir_alloc(sizeof(TCHAR) * (tr.chrg.cpMax - tr.chrg.cpMin + 2)); + tr.lpstrText = (TCHAR*)mir_alloc(sizeof(TCHAR) * (tr.chrg.cpMax - tr.chrg.cpMin + 2)); SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr); BOOL isLink = IsStringValidLink(tr.lpstrText); @@ -3350,7 +3354,7 @@ LABEL_SHOWWINDOW: case DM_CONTAINERSELECTED: { TContainerData *pNewContainer = 0; - TCHAR *szNewName = (TCHAR *)lParam; + TCHAR *szNewName = (TCHAR*)lParam; if (!_tcscmp(szNewName, TranslateT("Default container"))) szNewName = CGlobals::m_default_container_name; int iOldItems = TabCtrl_GetItemCount(hwndTab); diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 634fa76176..8dc00e2830 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -308,11 +308,11 @@ void CContactCache::saveHistory(WPARAM wParam, LPARAM lParam) if (m_history[m_iHistoryTop].szText == NULL) { if (iLength < HISTORY_INITIAL_ALLOCSIZE) iLength = HISTORY_INITIAL_ALLOCSIZE; - m_history[m_iHistoryTop].szText = (TCHAR *)malloc(iLength); + m_history[m_iHistoryTop].szText = (TCHAR*)malloc(iLength); m_history[m_iHistoryTop].lLen = iLength; } else { if (iLength > m_history[m_iHistoryTop].lLen) { - m_history[m_iHistoryTop].szText = (TCHAR *)realloc(m_history[m_iHistoryTop].szText, iLength); + m_history[m_iHistoryTop].szText = (TCHAR*)realloc(m_history[m_iHistoryTop].szText, iLength); m_history[m_iHistoryTop].lLen = iLength; } } @@ -399,7 +399,7 @@ void CContactCache::allocHistory() m_iHistoryTop = 0; if (m_history) ZeroMemory(m_history, sizeof(TInputHistory) * m_iHistorySize); - m_history[m_iHistorySize].szText = (TCHAR *)malloc((HISTORY_INITIAL_ALLOCSIZE + 1) * sizeof(TCHAR)); + m_history[m_iHistorySize].szText = (TCHAR*)malloc((HISTORY_INITIAL_ALLOCSIZE + 1) * sizeof(TCHAR)); m_history[m_iHistorySize].lLen = HISTORY_INITIAL_ALLOCSIZE; } @@ -583,7 +583,7 @@ TCHAR* CContactCache::getNormalizedStatusMsg(const TCHAR *src, bool fStripAll) } if (i) { - tszResult = (TCHAR *)mir_alloc((dest.length() + 1) * sizeof(TCHAR)); + tszResult = (TCHAR*)mir_alloc((dest.length() + 1) * sizeof(TCHAR)); _tcscpy(tszResult, dest.c_str()); tszResult[dest.length()] = 0; } diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 62a25e84cb..5246a123c8 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -2519,7 +2519,7 @@ HMENU TSAPI BuildMCProtocolMenu(HWND hwndDlg) nick = pcli->pfnGetContactDisplayName(hContact, 0); mir_snprintf(szTemp, sizeof(szTemp), "Status%d", i); WORD wStatus = (WORD)db_get_w(dat->hContact, PluginConfig.szMetaName, szTemp, 0); - szStatusText = (TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, wStatus, GSMDF_TCHAR); + szStatusText = (TCHAR*) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, wStatus, GSMDF_TCHAR); } TCHAR szMenuLine[128]; diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 5ce262af33..3786788f74 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -528,7 +528,7 @@ static TCHAR *ShortenPreview(DBEVENTINFO* dbe) buf[iIndex] = 0; } if (fAddEllipsis) { - buf = (TCHAR *)mir_realloc(buf, (lstrlen(buf) + 5) * sizeof(TCHAR)); + buf = (TCHAR*)mir_realloc(buf, (lstrlen(buf) + 5) * sizeof(TCHAR)); _tcscat(buf, _T("...")); } return buf; @@ -810,7 +810,7 @@ int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szPro return 0; // should also NOT happen wMyStatus = (wStatus == 0) ? db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) : wStatus; - szMyStatus = (szStatus == NULL) ? (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)wMyStatus, GSMDF_TCHAR) : szStatus; + szMyStatus = (szStatus == NULL) ? (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)wMyStatus, GSMDF_TCHAR) : szStatus; mii.wID = (UINT)hContact; mii.hbmpItem = HBMMENU_CALLBACK; diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index bb4be75475..0ef7069e3c 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -553,7 +553,7 @@ LRESULT TSAPI DM_MsgWindowCmdHandler(HWND hwndDlg, TContainerData *m_pContainer, else { int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)); - TCHAR *buf = (TCHAR *)mir_alloc((iLen + 2) * sizeof(TCHAR)); + TCHAR *buf = (TCHAR*)mir_alloc((iLen + 2) * sizeof(TCHAR)); GetDlgItemText(hwndDlg, IDC_MESSAGE, buf, iLen + 1); db_set_ts(dat->hContact, "UserInfo", "MyNotes", buf); SetDlgItemText(hwndDlg, IDC_MESSAGE, _T("")); @@ -1099,14 +1099,14 @@ LRESULT TSAPI DM_WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT msg, WPARAM w if (hClip) { HGLOBAL hgbl; TCHAR *tszLocked; - TCHAR *tszText = (TCHAR *)malloc((lstrlen((TCHAR *)hClip) + 2) * sizeof(TCHAR)); + TCHAR *tszText = (TCHAR*)malloc((lstrlen((TCHAR*)hClip) + 2) * sizeof(TCHAR)); - lstrcpy(tszText, (TCHAR *)hClip); + lstrcpy(tszText, (TCHAR*)hClip); Utils::FilterEventMarkers(tszText); EmptyClipboard(); hgbl = GlobalAlloc(GMEM_MOVEABLE, (lstrlen(tszText) + 1) * sizeof(TCHAR)); - tszLocked = (TCHAR *)GlobalLock(hgbl); + tszLocked = (TCHAR*)GlobalLock(hgbl); lstrcpy(tszLocked, tszText); GlobalUnlock(hgbl); SetClipboardData(CF_UNICODETEXT, hgbl); diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index b44b52423e..acd02d5f53 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -684,19 +684,15 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) if (CallProtoService(c->getProto(), PS_GETSTATUS, 0, 0) == ID_STATUS_OFFLINE) return; - WORD wStatus, wOldStatus; - - wStatus = LOWORD(wParam); - wOldStatus = HIWORD(wParam); - + WORD wStatus = LOWORD(wParam); + WORD wOldStatus = HIWORD(wParam); if (wStatus == wOldStatus) return; - TCHAR buffer[450]; - - TCHAR *szOldStatus = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)wOldStatus, GSMDF_TCHAR); - TCHAR *szNewStatus = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)wStatus, GSMDF_TCHAR); + TCHAR buffer[450]; + TCHAR *szOldStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)wOldStatus, GSMDF_TCHAR); + TCHAR *szNewStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)wStatus, GSMDF_TCHAR); if (szOldStatus == 0 || szNewStatus == 0) return; diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp index 3165d1bb53..6f46ca8d01 100644 --- a/plugins/TabSRMM/src/modplus.cpp +++ b/plugins/TabSRMM/src/modplus.cpp @@ -87,7 +87,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) CHARRANGE cr; TCHAR* pszMenu[256]={0};//=NULL; int i=0; - TCHAR* pszText = (TCHAR *)_T(""); + TCHAR* pszText = (TCHAR*)_T(""); TCHAR* pszFormatedText=NULL; UINT textlenght=0; BBButton bbd={0}; @@ -105,7 +105,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) SendDlgItemMessage(cbcd->hwndFrom,IDC_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&cr); textlenght=cr.cpMax-cr.cpMin; if ( textlenght ) { - pszText = (TCHAR *)mir_alloc((textlenght+1)*sizeof(TCHAR)); + pszText = (TCHAR*)mir_alloc((textlenght+1)*sizeof(TCHAR)); ZeroMemory(pszText,(textlenght+1)*sizeof(TCHAR)); SendDlgItemMessage(cbcd->hwndFrom, IDC_MESSAGE,EM_GETSELTEXT, 0, (LPARAM)pszText); } @@ -139,7 +139,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) res = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, NULL); if ( res==0 ) break; - pszFormatedText = (TCHAR *)mir_alloc((textlenght+lstrlen(pszMenu[res-1])+2)*sizeof(TCHAR)); + pszFormatedText = (TCHAR*)mir_alloc((textlenght+lstrlen(pszMenu[res-1])+2)*sizeof(TCHAR)); ZeroMemory(pszFormatedText,(textlenght+lstrlen(pszMenu[res-1])+2)*sizeof(TCHAR)); mir_sntprintf(pszFormatedText,(textlenght+lstrlen(pszMenu[res-1])+2)*sizeof(TCHAR),pszMenu[res-1],pszText); @@ -147,7 +147,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) }break; case 2: { - pszFormatedText = (TCHAR *)mir_alloc((textlenght+12)*sizeof(TCHAR)); + pszFormatedText = (TCHAR*)mir_alloc((textlenght+12)*sizeof(TCHAR)); ZeroMemory(pszFormatedText,(textlenght+12)*sizeof(TCHAR)); SendDlgItemMessage(cbcd->hwndFrom, IDC_MESSAGE,EM_GETSELTEXT, 0, (LPARAM)pszText); @@ -161,7 +161,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) case 3: { - pszFormatedText = (TCHAR *)mir_alloc(6*sizeof(TCHAR)); + pszFormatedText = (TCHAR*)mir_alloc(6*sizeof(TCHAR)); ZeroMemory(pszFormatedText,6*sizeof(TCHAR)); mir_sntprintf(pszFormatedText,6*sizeof(TCHAR),_T("%s"),_T("[img]")); @@ -173,7 +173,7 @@ static int CustomButtonPressed(WPARAM wParam,LPARAM lParam) case 4: { - pszFormatedText = (TCHAR *)mir_alloc(7*sizeof(TCHAR)); + pszFormatedText = (TCHAR*)mir_alloc(7*sizeof(TCHAR)); ZeroMemory(pszFormatedText,7*sizeof(TCHAR)); mir_sntprintf(pszFormatedText,7*sizeof(TCHAR),_T("%s"),_T("[/img]")); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 0901618a18..3dade62354 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1518,7 +1518,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (newData->szInitialText) { int len; if (newData->isWchar) - SetDlgItemTextW(hwndDlg, IDC_MESSAGE, (TCHAR *)newData->szInitialText); + SetDlgItemTextW(hwndDlg, IDC_MESSAGE, (TCHAR*)newData->szInitialText); else SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText); len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)); @@ -3065,11 +3065,11 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (dat->hwndIEView) { event.hwnd = dat->hwndIEView; - selected = (TCHAR *)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event); + selected = (TCHAR*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event); } else { event.hwnd = dat->hwndHPP; - selected = (TCHAR *)CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&event); + selected = (TCHAR*)CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&event); } if (selected != NULL) { @@ -3094,7 +3094,7 @@ quote_from_last: if (sel.cpMin == sel.cpMax) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.cbBlob = db_event_getBlobSize(hDBEvent); - szText = (TCHAR *)malloc((dbei.cbBlob + 1) * sizeof(TCHAR)); //URLs are made one char bigger for crlf + szText = (TCHAR*)malloc((dbei.cbBlob + 1) * sizeof(TCHAR)); //URLs are made one char bigger for crlf dbei.pBlob = (BYTE *)szText; db_event_get(hDBEvent, &dbei); iSize = (int)(strlen((char *)dbei.pBlob)) + 1; @@ -3104,9 +3104,9 @@ quote_from_last: } else { if (iSize != dbei.cbBlob) - szConverted = (TCHAR *) & dbei.pBlob[iSize]; + szConverted = (TCHAR*) & dbei.pBlob[iSize]; else { - szConverted = (TCHAR *)malloc(sizeof(TCHAR) * iSize); + szConverted = (TCHAR*)malloc(sizeof(TCHAR) * iSize); iAlloced = TRUE; MultiByteToWideChar(CP_ACP, 0, (char *) dbei.pBlob, -1, szConverted, iSize); } @@ -3117,7 +3117,7 @@ quote_from_last: MoveMemory(szText + iDescr + 2, szText + sizeof(DWORD) + iDescr, dbei.cbBlob - iDescr - sizeof(DWORD) - 1); szText[iDescr] = '\r'; szText[iDescr+1] = '\n'; - szConverted = (TCHAR *)malloc(sizeof(TCHAR) * (1 + lstrlenA((char *)szText))); + szConverted = (TCHAR*)malloc(sizeof(TCHAR) * (1 + lstrlenA((char *)szText))); MultiByteToWideChar(CP_ACP, 0, (char *) szText, -1, szConverted, 1 + lstrlenA((char *)szText)); iAlloced = TRUE; } @@ -3257,11 +3257,11 @@ quote_from_last: return 0; /* * sent by the select container dialog box when a container was selected... - * lParam = (TCHAR *)selected name... + * lParam = (TCHAR*)selected name... */ case DM_CONTAINERSELECTED: { - TCHAR *szNewName = (TCHAR *)lParam; + TCHAR *szNewName = (TCHAR*)lParam; if (!_tcscmp(szNewName, TranslateT("Default container"))) szNewName = CGlobals::m_default_container_name; diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index ef0416e3bd..0c359630a9 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -758,7 +758,7 @@ TCHAR* TSAPI QuoteText(const TCHAR *text, int charsPerLine, int removeExistingQu for (outChar = 0, lineChar = 0;text[inChar];) { if (outChar >= bufSize - 8) { bufSize += 20; - strout = (TCHAR *)realloc(strout, bufSize * sizeof(TCHAR)); + strout = (TCHAR*)realloc(strout, bufSize * sizeof(TCHAR)); } if (justDoneLineBreak && text[inChar] != '\r' && text[inChar] != '\n') { if (removeExistingQuotes) diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index ca2427dc0a..220fa49018 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -140,7 +140,7 @@ static int TSAPI ScanSkinDir(const TCHAR* tszFolder, HWND hwndCombobox) M.pathToRelative(tszFinalName, tszRel, M.getSkinPath()); if ((lr = SendMessage(hwndCombobox, CB_INSERTSTRING, -1, (LPARAM)szBuf)) != CB_ERR) { - TCHAR *idata = (TCHAR *)malloc((lstrlen(tszRel) + 1) * sizeof(TCHAR)); + TCHAR *idata = (TCHAR*)malloc((lstrlen(tszRel) + 1) * sizeof(TCHAR)); _tcscpy(idata, tszRel); SendMessage(hwndCombobox, CB_SETITEMDATA, lr, (LPARAM)idata); @@ -192,8 +192,8 @@ static int TSAPI RescanSkins(HWND hwndCombobox) LRESULT lr = SendMessage(hwndCombobox, CB_GETCOUNT, 0, 0); for (int i = 1; i < lr; i++) { - TCHAR* idata = (TCHAR *)SendMessage(hwndCombobox, CB_GETITEMDATA, i, 0); - if (idata && idata != (TCHAR *)CB_ERR) { + TCHAR* idata = (TCHAR*)SendMessage(hwndCombobox, CB_GETITEMDATA, i, 0); + if (idata && idata != (TCHAR*)CB_ERR) { if (!_tcsicmp(dbv.ptszVal, idata)) { SendMessage(hwndCombobox, CB_SETCURSEL, i, 0); break; @@ -373,8 +373,8 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L if (HIWORD(wParam) == CBN_SELCHANGE) { LRESULT lr = SendDlgItemMessage(hwndDlg, IDC_SKINNAME, CB_GETCURSEL, 0 ,0); if (lr != CB_ERR && lr > 0) { - TCHAR *tszRelPath = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_SKINNAME, CB_GETITEMDATA, lr, 0); - if (tszRelPath && tszRelPath != (TCHAR *)CB_ERR) + TCHAR *tszRelPath = (TCHAR*)SendDlgItemMessage(hwndDlg, IDC_SKINNAME, CB_GETITEMDATA, lr, 0); + if (tszRelPath && tszRelPath != (TCHAR*)CB_ERR) db_set_ts(0, SRMSGMOD_T, "ContainerSkin", tszRelPath); SendMessage(hwndDlg, WM_COMMAND, IDC_RELOADSKIN, 0); } @@ -1663,7 +1663,7 @@ INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, SetWindowText(hwndDlg, TranslateT("Choose status modes")); { for (int i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++) { - SetWindowText(GetDlgItem(hwndDlg, i), (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)i, GSMDF_TCHAR)); + SetWindowText(GetDlgItem(hwndDlg, i), (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)i, GSMDF_TCHAR)); if (dwStatusMask != -1 && (dwStatusMask & (1 << (i - ID_STATUS_ONLINE)))) CheckDlgButton(hwndDlg, i, TRUE); Utils::enableDlgControl(hwndDlg, i, dwStatusMask != -1); diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 80cf9d1eda..d4459839bb 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -150,7 +150,7 @@ static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) return 0; } - _tcsncpy(dat->szStatusBar, (TCHAR *)lParam, SIZEOF(dat->szStatusBar)); + _tcsncpy(dat->szStatusBar, (TCHAR*)lParam, SIZEOF(dat->szStatusBar)); if (pContainer->hwndActive != dat->hwnd) return 1; @@ -338,7 +338,7 @@ INT_PTR SendMessageCommand_W(WPARAM wParam, LPARAM lParam) if (lParam) { HWND hEdit = GetDlgItem(hwnd, IDC_MESSAGE); SendMessage(hEdit, EM_SETSEL, -1, SendMessage(hEdit, WM_GETTEXTLENGTH, 0, 0)); - SendMessage(hEdit, EM_REPLACESEL, FALSE, (LPARAM)(TCHAR *) lParam); + SendMessage(hEdit, EM_REPLACESEL, FALSE, (LPARAM)(TCHAR*) lParam); } SendMessage(hwnd, DM_ACTIVATEME, 0, 0); } else { @@ -730,7 +730,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, HANDLE hContact, i lstrcpyn(newcontactname, _T("_U_"), SIZEOF(newcontactname)); WORD wStatus = (szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(newData.hContact, szProto, "Status", ID_STATUS_OFFLINE)); - TCHAR *szStatus = (TCHAR *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), GSMDF_TCHAR); + TCHAR *szStatus = (TCHAR*) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), GSMDF_TCHAR); if (M.GetByte("tabstatus", 1)) mir_sntprintf(tabtitle, SIZEOF(tabtitle), _T("%s (%s) "), newcontactname, szStatus); diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index bb5323d822..8cbcbca575 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -1406,7 +1406,7 @@ void CSkin::Load(void) return; TCHAR *p; - TCHAR *szSections = (TCHAR *)malloc(6004); + TCHAR *szSections = (TCHAR*)malloc(6004); int i = 1, j = 0; UINT data; TCHAR buffer[500]; @@ -1573,7 +1573,7 @@ void CSkin::LoadItems() m_nrSkinIcons = 0; - szSections = (TCHAR *)malloc((SECT_BUFFER_SIZE + 2) * sizeof(TCHAR)); + szSections = (TCHAR*)malloc((SECT_BUFFER_SIZE + 2) * sizeof(TCHAR)); ZeroMemory(szSections, (SECT_BUFFER_SIZE + 2) * sizeof(TCHAR)); GetPrivateProfileSection(_T("Icons"), szSections, SECT_BUFFER_SIZE, m_tszFileName); @@ -1590,7 +1590,7 @@ void CSkin::LoadItems() ZeroMemory(&m_skinIcons[m_nrSkinIcons], sizeof(TIconDesc)); m_skinIcons[m_nrSkinIcons].uId = tmpIconDesc.uId; m_skinIcons[m_nrSkinIcons].phIcon = (HICON *)(&m_skinIcons[m_nrSkinIcons].uId); - m_skinIcons[m_nrSkinIcons].szName = (TCHAR *)malloc(sizeof(TCHAR) * (lstrlen(p) + 1)); + m_skinIcons[m_nrSkinIcons].szName = (TCHAR*)malloc(sizeof(TCHAR) * (lstrlen(p) + 1)); lstrcpy(m_skinIcons[m_nrSkinIcons].szName, p); m_nrSkinIcons++; } diff --git a/plugins/TabSRMM/src/themes.h b/plugins/TabSRMM/src/themes.h index f7f2ad8a57..afd29288fa 100644 --- a/plugins/TabSRMM/src/themes.h +++ b/plugins/TabSRMM/src/themes.h @@ -77,19 +77,18 @@ struct MButtonCtrl struct AeroEffect { - TCHAR tszName[40]; - DWORD m_baseColor; - DWORD m_gradientColor; - BYTE m_baseAlpha; - BYTE m_finalAlpha; - BYTE m_cornerType; - BYTE m_gradientType; - DWORD m_cornerRadius; - DWORD m_glowSize; - COLORREF m_clrBack; - COLORREF m_clrToolbar; - COLORREF m_clrToolbar2; - void (TSAPI *pfnEffectRenderer)(const HDC hdc, const RECT *rc, int iEffectArea); + TCHAR tszName[40]; + DWORD m_baseColor; + DWORD m_gradientColor; + BYTE m_baseAlpha; + BYTE m_finalAlpha; + BYTE m_cornerType; + BYTE m_gradientType; + DWORD m_cornerRadius; + DWORD m_glowSize; + COLORREF m_clrBack, m_clrToolbar, m_clrToolbar2; + + void (TSAPI *pfnEffectRenderer)(const HDC hdc, const RECT *rc, int iEffectArea); }; /** * CImageItem implementes image-based skin items. These items are loaded @@ -180,14 +179,14 @@ public: const BLENDFUNCTION &bf = m_bf; return(bf); } - const TCHAR* getName() const { return (m_szName); } - TCHAR* Read(const TCHAR *szFilename); - void Create(const TCHAR *szImageFile); - void __fastcall Render(const HDC hdc, const RECT *rc, bool fIgnoreGlyph) const; + const TCHAR* getName() const { return (m_szName); } + TCHAR* Read(const TCHAR *szFilename); + void Create(const TCHAR *szImageFile); + void __fastcall Render(const HDC hdc, const RECT *rc, bool fIgnoreGlyph) const; static void TSAPI PreMultiply(HBITMAP hBitmap, int mode); static void TSAPI SetBitmap32Alpha(HBITMAP hBitmap, BYTE bAlpha = 255); static void TSAPI Colorize(HBITMAP hBitmap, BYTE dr, BYTE dg, BYTE db, BYTE alpha = 0); - static HBITMAP TSAPI LoadPNG(const TCHAR *szFilename); + static HBITMAP TSAPI LoadPNG(const TCHAR *szFilename); public: bool m_fValid; // verified item, indicates that all parameters are valid diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp index 66e5e8dd92..13c54498c2 100644 --- a/plugins/TabSRMM/src/trayicon.cpp +++ b/plugins/TabSRMM/src/trayicon.cpp @@ -250,7 +250,7 @@ void TSAPI AddContactToFavorites(HANDLE hContact, const TCHAR *szNickname, const if (wStatus == 0) wStatus = db_get_w((HANDLE)hContact, szProto, "Status", ID_STATUS_OFFLINE); if (szStatus == NULL) - szStatus = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, wStatus, GSMDF_TCHAR); + szStatus = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, wStatus, GSMDF_TCHAR); } else return; @@ -296,7 +296,7 @@ void TSAPI AddContactToFavorites(HANDLE hContact, const TCHAR *szNickname, const mii2.cch++; mii2.dwTypeData = szBuffer; GetMenuItemInfo(PluginConfig.g_hMenuFavorites, i, TRUE, &mii2); - if (_tcsncmp((TCHAR *)mii2.dwTypeData, szMenuEntry, 140) > 0 || i == c) { + if (_tcsncmp((TCHAR*)mii2.dwTypeData, szMenuEntry, 140) > 0 || i == c) { InsertMenu(PluginConfig.g_hMenuFavorites, i, MF_BYPOSITION, (UINT_PTR)hContact, szMenuEntry); break; } diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 4f3c52e99b..b31fa03c94 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -197,7 +197,7 @@ search_again: int ii = 0; TCHAR szTemp[5]; for (ii = 0; ii < rtf_ctable_size; ii++) { - if (!_tcsnicmp((TCHAR *)colorname.c_str(), rtf_ctable[ii].szName, lstrlen(rtf_ctable[ii].szName))) { + if (!_tcsnicmp((TCHAR*)colorname.c_str(), rtf_ctable[ii].szName, lstrlen(rtf_ctable[ii].szName))) { closing = beginmark + 7 + lstrlen(rtf_ctable[ii].szName); if (endmark != message.npos) { message.erase(endmark, 4); @@ -307,7 +307,7 @@ ok: smbp.cbSize = sizeof(smbp); smbp.Protocolname = dat->cache->getActiveProto(); smbp.flag = SAFL_TCHAR | SAFL_PATH | (isSent ? SAFL_OUTGOING : 0); - smbp.str = (TCHAR *)smcode.c_str(); + smbp.str = (TCHAR*)smcode.c_str(); smbp.hContact = dat->hContact; smbpr = (SMADD_BATCHPARSERES *)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&smbp); if (smbpr) { @@ -436,7 +436,7 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat } else szFinalStatus = xStatusDescr[xStatus - 1]; } else - szFinalStatus = (TCHAR *)(dat->szStatus && dat->szStatus[0] ? dat->szStatus : _T("(undef)")); + szFinalStatus = (TCHAR*)(dat->szStatus && dat->szStatus[0] ? dat->szStatus : _T("(undef)")); if (szFinalStatus) { title.insert(tempmark + 2, szFinalStatus); @@ -475,7 +475,7 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat } length = title.length(); - szResult = (TCHAR *)malloc((length + 2) * sizeof(TCHAR)); + szResult = (TCHAR*)malloc((length + 2) * sizeof(TCHAR)); if (szResult) { _tcsncpy(szResult, title.c_str(), length); szResult[length] = 0; @@ -1006,7 +1006,7 @@ void TSAPI Utils::showDlgControl(const HWND hwnd, UINT id, int showCmd) DWORD CALLBACK Utils::StreamOut(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb) { HANDLE hFile; - TCHAR *szFilename = (TCHAR *)dwCookie; + TCHAR *szFilename = (TCHAR*)dwCookie; if ((hFile = CreateFile(szFilename, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) != INVALID_HANDLE_VALUE) { SetFilePointer(hFile, 0, NULL, FILE_END); FilterEventMarkers(reinterpret_cast(pbBuff)); -- cgit v1.2.3