summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorRozhuk Ivan <rozhuk.im@gmail.com>2014-11-30 04:29:19 +0000
committerRozhuk Ivan <rozhuk.im@gmail.com>2014-11-30 04:29:19 +0000
commita8a11e811c3c0cc3f6d74c18c89841e9e0e87237 (patch)
tree775e65659d26870bba82b84fb584a5301606ff62 /protocols
parent79041310665c9b0b93c368bb1f7cef5f669a419e (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 'protocols')
-rw-r--r--protocols/AimOscar/src/ui.cpp4
-rw-r--r--protocols/IRCG/src/ui_utils.cpp1
-rw-r--r--protocols/IRCG/src/windows.cpp13
-rw-r--r--protocols/JabberG/src/jabber_iqid_muc.cpp2
-rw-r--r--protocols/JabberG/src/ui_utils.cpp1
-rw-r--r--protocols/Xfire/src/userdetails.cpp2
6 files changed, 6 insertions, 17 deletions
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp
index a802460379..382d51b00c 100644
--- a/protocols/AimOscar/src/ui.cpp
+++ b/protocols/AimOscar/src/ui.cpp
@@ -1034,13 +1034,13 @@ static INT_PTR CALLBACK privacy_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (LOWORD(wParam) == IDC_ALLOWADD)
{
char nick[80];
- SendDlgItemMessageA(hwndDlg, IDC_ALLOWEDIT, WM_GETTEXT, 80, (LPARAM)nick);
+ SendDlgItemMessageA(hwndDlg, IDC_ALLOWEDIT, WM_GETTEXT, SIZEOF(nick), (LPARAM)nick);
SendDlgItemMessageA(hwndDlg, IDC_ALLOWLIST, LB_ADDSTRING, 0, (LPARAM)trim_str(nick));
}
else if (LOWORD(wParam) == IDC_BLOCKADD)
{
char nick[80];
- SendDlgItemMessageA(hwndDlg, IDC_BLOCKEDIT, WM_GETTEXT, 80, (LPARAM)nick);
+ SendDlgItemMessageA(hwndDlg, IDC_BLOCKEDIT, WM_GETTEXT, SIZEOF(nick), (LPARAM)nick);
SendDlgItemMessageA(hwndDlg, IDC_BLOCKLIST, LB_ADDSTRING, 0, (LPARAM)trim_str(nick));
}
else if (LOWORD(wParam) == IDC_ALLOWREMOVE)
diff --git a/protocols/IRCG/src/ui_utils.cpp b/protocols/IRCG/src/ui_utils.cpp
index fa1f5dea2d..e02ab4ed5f 100644
--- a/protocols/IRCG/src/ui_utils.cpp
+++ b/protocols/IRCG/src/ui_utils.cpp
@@ -1290,7 +1290,6 @@ void CCtrlTreeView::TranslateItem(HTREEITEM hItem)
GetItem(hItem, &tvi, buf, SIZEOF(buf));
tvi.pszText = TranslateTS(tvi.pszText);
- tvi.cchTextMax = lstrlen(tvi.pszText);
SetItem(&tvi);
}
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp
index bb1f6d889c..bfd6fb58e6 100644
--- a/protocols/IRCG/src/windows.cpp
+++ b/protocols/IRCG/src/windows.cpp
@@ -322,7 +322,7 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
LVITEM lvm;
TCHAR text[255];
lvm.pszText = text; // Set buffer for texts
- lvm.cchTextMax = 128;
+ lvm.cchTextMax = SIZEOF(text);
lvm.mask = LVIF_TEXT;
for (int i = 0; i < j; i++) {
lvm.iSubItem = 0; // First column
@@ -332,13 +332,6 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
// Match the text?
TCHAR* t = _tcsstr(lvm.pszText, strFilterText);
if (t == NULL) { // If no, then Check if in the topics
- LVITEM lvm2; // To avoid to overwrite the external lvm
- TCHAR text[300];
- lvm2.pszText = text; // Set buffer for texts
- lvm2.cchTextMax = SIZEOF(text);
- lvm2.mask = LVIF_TEXT;
- lvm2.iSubItem = 3; // Topic column
- lvm2.iItem = i;
m_list.GetItem(&lvm);
// Match the text?
@@ -434,7 +427,7 @@ static int CALLBACK ListViewSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
lvm.iItem = lParam1;
lvm.iSubItem = param->iSubItem;
lvm.pszText = temp1;
- lvm.cchTextMax = 511;
+ lvm.cchTextMax = SIZEOF(temp1);
param->pList->GetItem(&lvm);
lvm.iItem = lParam2;
lvm.pszText = temp2;
@@ -643,7 +636,7 @@ void CQuickDlg::OnOk(CCtrlButton*)
}
TCHAR windowname[20];
- GetWindowText(m_hwnd, windowname, 20);
+ GetWindowText(m_hwnd, windowname, SIZEOF(windowname));
if (lstrcmpi(windowname, _T("Miranda IRC")) == 0) {
m_proto->m_serverComboSelection = m_serverCombo.GetCurSel() - 1;
m_proto->setDword("ServerComboSelection", m_proto->m_serverComboSelection);
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp
index 91187d0715..3776b525be 100644
--- a/protocols/JabberG/src/jabber_iqid_muc.cpp
+++ b/protocols/JabberG/src/jabber_iqid_muc.cpp
@@ -333,7 +333,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w
lvi.iItem = hti.iItem;
lvi.iSubItem = 0;
lvi.pszText = text;
- lvi.cchTextMax = sizeof(text);
+ lvi.cchTextMax = SIZEOF(text);
ListView_GetItem(nm->hdr.hwndFrom, &lvi);
if (lvi.lParam == (LPARAM)(-1)) {
CMString szBuffer(dat->type2str());
diff --git a/protocols/JabberG/src/ui_utils.cpp b/protocols/JabberG/src/ui_utils.cpp
index 4a5e052d84..56db0d4827 100644
--- a/protocols/JabberG/src/ui_utils.cpp
+++ b/protocols/JabberG/src/ui_utils.cpp
@@ -1586,7 +1586,6 @@ void CCtrlTreeView::TranslateItem(HTREEITEM hItem)
TCHAR buf[128];
GetItem(hItem, &tvi, buf, SIZEOF(buf));
tvi.pszText = TranslateTS(tvi.pszText);
- tvi.cchTextMax = lstrlen(tvi.pszText);
SetItem(&tvi);
}
diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp
index c5881af8e6..5134172a2c 100644
--- a/protocols/Xfire/src/userdetails.cpp
+++ b/protocols/Xfire/src/userdetails.cpp
@@ -119,7 +119,6 @@ void addToList(HWND listbox, MCONTACT hContact, char*key, char*val)
if (!db_get_s(hContact, protocolname, val, &dbv)) {
LVITEMA lvitem = { 0 };
lvitem.mask = LVIF_TEXT;
- lvitem.cchTextMax = 255;
lvitem.pszText = key;
SendMessageA(listbox, LVM_INSERTITEM, 0, (LPARAM)&lvitem);
@@ -140,7 +139,6 @@ void setGameInfo(HWND listbox, char *mbuf)
LVITEMA lvitem;
memset(&lvitem, 0, sizeof(lvitem));
lvitem.mask = LVIF_TEXT;
- lvitem.cchTextMax = 255;
while (*mbuf2 != 0)
{