summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-12-13 19:01:54 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-12-13 19:01:54 +0000
commitf55574591e8f66adc24fd62f25b4dc7f299e87a0 (patch)
treeed54a82c8d2ca5be748aa69fcb24e2d0d551fde1 /plugins/TabSRMM
parenteedc182bb90afb9f809aec8ecfce8526ad3ab0e2 (diff)
Utils::FormatTitleBar: wrong function's return type
git-svn-id: http://svn.miranda-ng.org/main/trunk@11374 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r--plugins/TabSRMM/src/container.cpp30
-rw-r--r--plugins/TabSRMM/src/containeroptions.cpp4
-rw-r--r--plugins/TabSRMM/src/utils.cpp12
-rw-r--r--plugins/TabSRMM/src/utils.h2
4 files changed, 18 insertions, 30 deletions
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp
index 6aa6bd4478..8c5425d422 100644
--- a/plugins/TabSRMM/src/container.cpp
+++ b/plugins/TabSRMM/src/container.cpp
@@ -537,7 +537,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
int iItem = 0;
TCITEM item;
- TContainerData *pContainer = (TContainerData*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ TContainerData *pContainer = (TContainerData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
BOOL bSkinned = CSkin::m_skinEnabled ? TRUE : FALSE;
HWND hwndTab = GetDlgItem(hwndDlg, IDC_MSGTABS);
@@ -815,11 +815,9 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam,
switch (((LPNMHDR)lParam)->code) {
case NM_CLICK:
case NM_RCLICK:
- unsigned int nParts, nPanel;
- NMMOUSE *nm = (NMMOUSE*)lParam;
RECT rc;
-
- nParts = SendMessage(pContainer->hwndStatus, SB_GETPARTS, 0, 0);
+ NMMOUSE *nm = (NMMOUSE*)lParam;
+ int nPanel, nParts = SendMessage(pContainer->hwndStatus, SB_GETPARTS, 0, 0);
if (nm->dwItemSpec == 0xFFFFFFFE) {
nPanel = 2;
SendMessage(pContainer->hwndStatus, SB_GETRECT, nPanel, (LPARAM)&rc);
@@ -861,10 +859,10 @@ panel_found:
iItem = TabCtrl_GetCurSel(hwndTab);
item.mask = TCIF_PARAM;
if (TabCtrl_GetItem(hwndTab, iItem, &item)) {
- if ((HWND)item.lParam != pContainer->hwndActive) {
+ if ((HWND)item.lParam != pContainer->hwndActive)
if (pContainer->hwndActive && IsWindow(pContainer->hwndActive))
ShowWindow(pContainer->hwndActive, SW_HIDE);
- }
+
pContainer->hwndActive = (HWND)item.lParam;
SendMessage((HWND)item.lParam, DM_SAVESIZE, 0, 1);
ShowWindow((HWND)item.lParam, SW_SHOW);
@@ -1161,10 +1159,10 @@ panel_found:
}
if (dat) {
SendMessage(hwndDlg, DM_SETICON, (WPARAM)dat, (LPARAM)(dat->hXStatusIcon ? dat->hXStatusIcon : dat->hTabStatusIcon));
- const TCHAR *szNewTitle = Utils::FormatTitleBar(dat, pContainer->settings->szTitleFormat);
+ TCHAR *szNewTitle = Utils::FormatTitleBar(dat, pContainer->settings->szTitleFormat);
if (szNewTitle) {
SetWindowText(hwndDlg, szNewTitle);
- mir_free((void*)szNewTitle);
+ mir_free(szNewTitle);
}
}
}
@@ -1172,7 +1170,6 @@ panel_found:
case WM_TIMER:
if (wParam == TIMERID_HEARTBEAT) {
- TWindowData *dat = 0;
if (GetForegroundWindow() != hwndDlg && (pContainer->settings->autoCloseSeconds > 0) && !pContainer->fHidden) {
BOOL fResult = TRUE;
BroadCastContainer(pContainer, DM_CHECKAUTOHIDE, (WPARAM)pContainer->settings->autoCloseSeconds, (LPARAM)&fResult);
@@ -1180,7 +1177,8 @@ panel_found:
if (fResult && 0 == pContainer->hWndOptions)
PostMessage(hwndDlg, WM_CLOSE, 1, 0);
}
- dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
+
+ TWindowData *dat = (TWindowData*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA);
if (dat && dat->bType == SESSIONTYPE_IM) {
if (dat->idle && pContainer->hwndActive && IsWindow(pContainer->hwndActive))
dat->Panel->Invalidate(TRUE);
@@ -1224,7 +1222,6 @@ panel_found:
case SC_MINIMIZE:
TWindowData *dat = reinterpret_cast<TWindowData *>(GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA));
if (dat) {
- //GetWindowRect(GetDlgItem(pContainer->hwndActive, dat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG), &pContainer->rcLogSaved);
GetWindowRect(pContainer->hwndActive, &pContainer->rcLogSaved);
pContainer->ptLogSaved.x = pContainer->rcLogSaved.left;
pContainer->ptLogSaved.y = pContainer->rcLogSaved.top;
@@ -1235,8 +1232,6 @@ panel_found:
case DM_SELECTTAB:
switch (wParam) {
- int iItems, iCurrent, iNewTab;
-
case DM_SELECT_BY_HWND:
ActivateTabFromHWND(hwndTab, (HWND)lParam);
break;
@@ -1244,11 +1239,12 @@ panel_found:
case DM_SELECT_NEXT:
case DM_SELECT_PREV:
case DM_SELECT_BY_INDEX:
- iItems = TabCtrl_GetItemCount(hwndTab);
- iCurrent = TabCtrl_GetCurSel(hwndTab);
-
+ int iItems = TabCtrl_GetItemCount(hwndTab);
if (iItems == 1)
break;
+
+ int iCurrent = TabCtrl_GetCurSel(hwndTab), iNewTab;
+
if (wParam == DM_SELECT_PREV)
iNewTab = iCurrent ? iCurrent - 1 : iItems - 1; // cycle if current is already the leftmost tab..
else if (wParam == DM_SELECT_NEXT)
diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp
index be0caeb815..032dde2b0e 100644
--- a/plugins/TabSRMM/src/containeroptions.cpp
+++ b/plugins/TabSRMM/src/containeroptions.cpp
@@ -139,7 +139,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
{
TContainerData *pContainer = 0;
HWND hwndTree = GetDlgItem(hwndDlg, IDC_SECTIONTREE);
- pContainer = (TContainerData*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ pContainer = (TContainerData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG: {
@@ -152,7 +152,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
const TSideBarLayout* sblayouts = CSideBar::getLayouts(nr_layouts);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) lParam);
- pContainer = (TContainerData*) lParam;
+ pContainer = (TContainerData*)lParam;
pContainer->hWndOptions = hwndDlg;
TranslateDialogDefault(hwndDlg);
SetWindowText(hwndDlg, TranslateT("Container options"));
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index 24f98cda06..960def80c4 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -261,10 +261,8 @@ ok:
// format the title bar string for IM chat sessions using placeholders.
// the caller must mir_free() the returned string
-const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat)
+TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat)
{
- TCHAR *szResult = 0;
- INT_PTR length = 0;
INT_PTR tempmark = 0;
TCHAR szTemp[512];
@@ -401,14 +399,8 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat
break;
}
}
- length = title.length();
- szResult = (TCHAR*)mir_alloc((length + 2) * sizeof(TCHAR));
- if (szResult) {
- _tcsncpy(szResult, title.c_str(), length);
- szResult[length] = 0;
- }
- return szResult;
+ return mir_tstrndup(title.c_str(), title.length());
}
char* Utils::FilterEventMarkers(char *szText)
diff --git a/plugins/TabSRMM/src/utils.h b/plugins/TabSRMM/src/utils.h
index 473659713e..34b4c5039d 100644
--- a/plugins/TabSRMM/src/utils.h
+++ b/plugins/TabSRMM/src/utils.h
@@ -69,7 +69,7 @@ public:
static TCHAR* GetPreviewWithEllipsis(TCHAR *szText, size_t iMaxLen);
static TCHAR* FilterEventMarkers(TCHAR *wszText);
static LPCTSTR FormatRaw(TWindowData *dat, const TCHAR *msg, int flags, BOOL isSent);
- static LPCTSTR FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat);
+ static LPTSTR FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat);
static char* FilterEventMarkers(char *szText);
static LPCTSTR DoubleAmpersands(TCHAR *pszText);
static void RTF_CTableInit();