From a8a11e811c3c0cc3f6d74c18c89841e9e0e87237 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Sun, 30 Nov 2014 04:29:19 +0000 Subject: Multiple fixes buff size for GetText and SetText. git-svn-id: http://svn.miranda-ng.org/main/trunk@11165 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/genmenuopt.cpp | 4 ++-- src/modules/fonts/FontOptions.cpp | 2 +- src/modules/icolib/skin2opts.cpp | 2 +- src/modules/metacontacts/meta_edit.cpp | 1 - src/modules/netlib/netliblog.cpp | 6 +++--- 5 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index 80853a9f63..ddf6ffcc4d 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -78,7 +78,7 @@ static int SaveTree(HWND hwndDlg) TVITEM tvi; tvi.hItem = TreeView_GetRoot(hTree); - tvi.cchTextMax = 99; + tvi.cchTextMax = SIZEOF(idstr); tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_HANDLE; tvi.pszText = idstr; @@ -360,7 +360,7 @@ static HTREEITEM MoveItemAbove(HWND hTreeWnd, HTREEITEM hItem, HTREEITEM hInsert tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvis.item.stateMask = 0xFFFFFFFF; tvis.item.pszText = name; - tvis.item.cchTextMax = sizeof(name); + tvis.item.cchTextMax = SIZEOF(name); tvis.item.hItem = hItem; tvis.item.iImage = tvis.item.iSelectedImage = ((MenuItemOptData*)tvi.lParam)->bShow; if (!SendMessage(hTreeWnd, TVM_GETITEM, 0, (LPARAM)&tvis.item)) diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index 4d72a7d8bb..e90f2cac8f 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -326,7 +326,7 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TC tvi.mask = TVIF_TEXT; tvi.pszText = str; - tvi.cchTextMax = MAX_PATH; + tvi.cchTextMax = SIZEOF(str); while (tvi.hItem) { diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index e61a8783d8..c914501951 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -348,7 +348,7 @@ static HTREEITEM FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR tvi.mask = TVIF_TEXT; tvi.pszText = str; - tvi.cchTextMax = MAX_PATH; + tvi.cchTextMax = SIZEOF(str); while (tvi.hItem) { diff --git a/src/modules/metacontacts/meta_edit.cpp b/src/modules/metacontacts/meta_edit.cpp index 245ca22fde..12f5fdd7b3 100644 --- a/src/modules/metacontacts/meta_edit.cpp +++ b/src/modules/metacontacts/meta_edit.cpp @@ -48,7 +48,6 @@ static void FillContactList(HWND hList) LVITEM LvItem = { 0 }; LvItem.mask = LVIF_TEXT; // Text Style - LvItem.cchTextMax = 256; // Max size of test for (int i = 0; i < g_data.num_contacts; i++) { LvItem.iItem = i; diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index b05b0b3107..e48a4e408c 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -148,7 +148,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa CheckDlgButton(hwndDlg, IDC_TOFILE, BST_CHECKED); TCHAR path[MAX_PATH]; - GetWindowText((HWND)lParam, path, MAX_PATH); + GetWindowText((HWND)lParam, path, SIZEOF(path)); PathToAbsoluteT(VARST(path), path); SetDlgItemText(hwndDlg, IDC_PATH, path); @@ -209,11 +209,11 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa db_set_ts(NULL, "Netlib", "RunAtStart", str); db_set_b(NULL, "Netlib", "ShowLogOptsAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTHISDLGATSTART)); - GetWindowText(GetDlgItem(hwndDlg, IDC_FILENAME), str, MAX_PATH); + GetWindowText(GetDlgItem(hwndDlg, IDC_FILENAME), str, SIZEOF(str)); logOptions.tszUserFile = rtrimt(str); db_set_ts(NULL, "Netlib", "File", str); - GetWindowText(GetDlgItem(hwndDlg, IDC_PATH), str, MAX_PATH); + GetWindowText(GetDlgItem(hwndDlg, IDC_PATH), str, SIZEOF(str)); logOptions.tszFile = rtrimt(str); db_set_b(NULL, "Netlib", "DumpRecv", logOptions.dumpRecv = IsDlgButtonChecked(hwndDlg, IDC_DUMPRECV)); -- cgit v1.2.3