diff options
author | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-11-30 04:29:19 +0000 |
---|---|---|
committer | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-11-30 04:29:19 +0000 |
commit | a8a11e811c3c0cc3f6d74c18c89841e9e0e87237 (patch) | |
tree | 775e65659d26870bba82b84fb584a5301606ff62 /plugins/TabSRMM | |
parent | 79041310665c9b0b93c368bb1f7cef5f669a419e (diff) |
Multiple fixes buff size for GetText and SetText.
git-svn-id: http://svn.miranda-ng.org/main/trunk@11165 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/TSButton.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/buttonsbar.cpp | 8 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/window.cpp | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/container.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/selectcontainer.cpp | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/sendlater.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/templates.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/userprefs.cpp | 1 |
11 files changed, 13 insertions, 16 deletions
diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp index 25c3e4188b..58fe1c4301 100644 --- a/plugins/TabSRMM/src/TSButton.cpp +++ b/plugins/TabSRMM/src/TSButton.cpp @@ -279,7 +279,7 @@ nonflat_themed: CopyRect(&rcText, &rcClient);
TCHAR szText[MAX_PATH];
- GetWindowText(ctl->hwnd, szText, MAX_PATH - 1);
+ GetWindowText(ctl->hwnd, szText, SIZEOF(szText));
SetBkMode(hdcMem, TRANSPARENT);
HFONT hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
if (ctl->pContainer && CSkin::m_skinEnabled)
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 2f21dfed4e..fa7186ed31 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -984,7 +984,7 @@ static int SaveTree(HWND hToolBarTree) tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_HANDLE; tvi.hItem = TreeView_GetRoot(hToolBarTree); tvi.pszText = strbuf; - tvi.cchTextMax = sizeof(strbuf); + tvi.cchTextMax = SIZEOF(strbuf); { mir_cslock lck(ToolBarCS); @@ -1188,7 +1188,7 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE; tvis.item.stateMask = 0xFFFFFFFF; tvis.item.pszText = strbuf; - tvis.item.cchTextMax = sizeof(strbuf); + tvis.item.cchTextMax = SIZEOF(strbuf); tvis.item.hItem = (HTREEITEM)hDragItem; TreeView_GetItem(hToolBarTree, &tvis.item); TreeView_DeleteItem(hToolBarTree, hDragItem); @@ -1329,7 +1329,7 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l TVITEM tvi; tvi.hItem = hti; tvi.pszText = strbuf; - tvi.cchTextMax = sizeof(strbuf); + tvi.cchTextMax = SIZEOF(strbuf); tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_PARAM; TreeView_GetItem(hToolBarTree, &tvi); @@ -1357,7 +1357,7 @@ INT_PTR CALLBACK DlgProcToolBar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l TVITEM tvi; tvi.pszText = strbuf; - tvi.cchTextMax = sizeof(strbuf); + tvi.cchTextMax = SIZEOF(strbuf); tvi.mask = TVIF_TEXT | TVIF_HANDLE | TVIF_PARAM; tvi.hItem = hti; TreeView_GetItem(hToolBarTree, &tvi); diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index b47732335c..23489fd0c9 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -2041,7 +2041,6 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar TCITEM item = { 0 }; item.mask = TCIF_TEXT; item.pszText = dat->newtitle; - item.cchTextMax = 120; TabCtrl_SetItem(hwndTab, dat->iTabID, &item); } SetWindowText(hwndDlg, szTemp); diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index e2539763d2..929308b88d 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -240,7 +240,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, CSkin::DrawItem(dcMem, &rcWindow, item); - GetWindowText(hwndDlg, szWindowText, 512); + GetWindowText(hwndDlg, szWindowText, SIZEOF(szWindowText)); szWindowText[511] = 0; hOldFont = (HFONT)SelectObject(dcMem, PluginConfig.hFontCaption); GetTextMetrics(dcMem, &tm); diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 4daa1700f3..a36fb66943 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1799,7 +1799,6 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) item.pszText = newtitle; _tcsncpy(dat->newtitle, newtitle, SIZEOF(dat->newtitle)); dat->newtitle[127] = 0; - item.cchTextMax = 127; if (dat->pWnd) dat->pWnd->updateTitle(dat->cache->getNick()); } diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 9a1948f25d..85bad73929 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -84,7 +84,7 @@ void TSAPI RearrangeTab(HWND hwndDlg, const TWindowData *dat, int iMode, BOOL fS TCITEM item = { 0 };
item.mask = TCIF_IMAGE | TCIF_TEXT | TCIF_PARAM;
item.pszText = oldText;
- item.cchTextMax = 500;
+ item.cchTextMax = SIZEOF(oldText);
TabCtrl_GetItem(hwndTab, dat->iTabID, &item);
int newIndex = LOWORD(iMode);
@@ -1648,7 +1648,7 @@ int TSAPI MsgWindowDrawHandler(WPARAM wParam, LPARAM lParam, TWindowData *dat) SetTextColor(dis->hDC, GetSysColor(COLOR_BTNTEXT));
CSkin::FillBack(dis->hDC, &dis->rcItem);
}
- GetWindowText(dis->hwndItem, szWindowText, 255);
+ GetWindowText(dis->hwndItem, szWindowText, SIZEOF(szWindowText));
szWindowText[255] = 0;
SetBkMode(dis->hDC, TRANSPARENT);
DrawText(dis->hDC, szWindowText, -1, &dis->rcItem, DT_SINGLELINE | DT_VCENTER | DT_NOCLIP | DT_END_ELLIPSIS);
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index bb6f28db47..8356b7f1fd 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -584,7 +584,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, newData.item.pszText = tabtitle; newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM; newData.item.iImage = 0; - newData.item.cchTextMax = 255; + newData.item.cchTextMax = SIZEOF(tabtitle); HWND hwndTab = GetDlgItem(pContainer->hwnd, IDC_MSGTABS); // hide the active tab diff --git a/plugins/TabSRMM/src/selectcontainer.cpp b/plugins/TabSRMM/src/selectcontainer.cpp index c04016ae29..4cc465c702 100644 --- a/plugins/TabSRMM/src/selectcontainer.cpp +++ b/plugins/TabSRMM/src/selectcontainer.cpp @@ -107,7 +107,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L TCHAR szNewName[CONTAINER_NAMELEN], szName[CONTAINER_NAMELEN + 1];
int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_NEWCONTAINERNAME));
if (iLen) {
- GetWindowText(GetDlgItem(hwndDlg, IDC_NEWCONTAINERNAME), szNewName, CONTAINER_NAMELEN);
+ GetWindowText(GetDlgItem(hwndDlg, IDC_NEWCONTAINERNAME), szNewName, SIZEOF(szNewName));
if (!_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN) || !_tcsncmp(szNewName, TranslateT("Default container"), CONTAINER_NAMELEN)) {
MessageBox(hwndDlg, TranslateT("You cannot rename the default container"), TranslateT("Error"), MB_OK | MB_ICONERROR);
break;
@@ -149,7 +149,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_NEWCONTAINER));
if (iLen) {
- GetWindowText(GetDlgItem(hwndDlg, IDC_NEWCONTAINER), szNewName, CONTAINER_NAMELEN);
+ GetWindowText(GetDlgItem(hwndDlg, IDC_NEWCONTAINER), szNewName, SIZEOF(szNewName));
int iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_FINDSTRING, (WPARAM)- 1, (LPARAM)szNewName);
if (iItem != LB_ERR || !_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 4b064cd43c..6dd8cbb01c 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -532,7 +532,6 @@ void CSendLater::qMgrFillList(bool fClear) ::SendMessage(m_hwndFilter, CB_SETITEMDATA, 0, 0);
LVITEM lvItem = { 0 };
- lvItem.cchTextMax = 255;
BYTE bCode = '-';
unsigned uIndex = 0;
@@ -550,6 +549,7 @@ void CSendLater::qMgrFillList(bool fClear) TCHAR tszBuf[255];
mir_sntprintf(tszBuf, 255, _T("%s [%s]"), tszNick, c->getRealAccount());
lvItem.pszText = tszBuf;
+ lvItem.cchTextMax = SIZEOF(tszBuf);
lvItem.iItem = uIndex++;
lvItem.iSubItem = 0;
lvItem.lParam = LPARAM(p);
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index d03e5c81f8..dfe11df618 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -259,7 +259,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP { TCHAR newTemplate[TEMPLATE_LENGTH + 2]; - GetWindowText(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), newTemplate, TEMPLATE_LENGTH); + GetWindowText(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE), newTemplate, SIZEOF(newTemplate)); CopyMemory(tSet->szTemplates[teInfo->inEdit], newTemplate, sizeof(TCHAR) * TEMPLATE_LENGTH); teInfo->changed = FALSE; teInfo->updateInfo[teInfo->inEdit] = FALSE; diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index f2cdb16b86..ab9cca1b70 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -470,7 +470,6 @@ INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetWindowText(hwndDlg, szBuffer);
memset(&tci, 0, sizeof(tci));
- tci.cchTextMax = 100;
tci.mask = TCIF_PARAM | TCIF_TEXT;
tci.lParam = (LPARAM)CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_USERPREFS), hwndDlg, DlgProcUserPrefs, hContact);
tci.pszText = TranslateT("General");
|