summaryrefslogtreecommitdiff
path: root/plugins/DbEditorPP/src
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 /plugins/DbEditorPP/src
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 'plugins/DbEditorPP/src')
-rw-r--r--plugins/DbEditorPP/src/main_window.cpp8
-rw-r--r--plugins/DbEditorPP/src/moduletree.cpp12
-rw-r--r--plugins/DbEditorPP/src/settinglist.cpp7
3 files changed, 13 insertions, 14 deletions
diff --git a/plugins/DbEditorPP/src/main_window.cpp b/plugins/DbEditorPP/src/main_window.cpp
index 96acfc7daf..6248aeac86 100644
--- a/plugins/DbEditorPP/src/main_window.cpp
+++ b/plugins/DbEditorPP/src/main_window.cpp
@@ -109,7 +109,7 @@ LRESULT CALLBACK ModuleTreeSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = TreeView_GetSelection(hwnd);
tvi.pszText = module;
- tvi.cchTextMax = 255;
+ tvi.cchTextMax = SIZEOF(module);
if (TreeView_GetItem(hwnd, &tvi) && tvi.lParam) {
ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
MCONTACT hContact = mtis->hContact;
@@ -166,7 +166,7 @@ static LRESULT CALLBACK SettingListSubclassProc(HWND hwnd, UINT msg, WPARAM wPar
break;
hContact = sli->hContact;
module = sli->module;
- ListView_GetItemText(hwnd, ListView_GetSelectionMark(hwnd), 0, setting, 256);
+ ListView_GetItemText(hwnd, ListView_GetSelectionMark(hwnd), 0, setting, SIZEOF(setting));
if (wParam == VK_F2)
editSetting(hContact, module, setting);
@@ -373,7 +373,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
TVITEM tvi = { 0 };
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.pszText = module;
- tvi.cchTextMax = 255;
+ tvi.cchTextMax = SIZEOF(module);
tvi.hItem = item;
if (TreeView_GetItem(hwnd2Tree, &tvi)) {
MCONTACT hContact = 0;
@@ -452,7 +452,7 @@ INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = TreeView_GetSelection(GetDlgItem(hwnd, IDC_MODULES));
tvi.pszText = module;
- tvi.cchTextMax = 255;
+ tvi.cchTextMax = SIZEOF(module);
if (!TreeView_GetItem(GetDlgItem(hwnd, IDC_MODULES), &tvi)) break;
if (tvi.lParam) {
mtis = (ModuleTreeInfoStruct *)tvi.lParam;
diff --git a/plugins/DbEditorPP/src/moduletree.cpp b/plugins/DbEditorPP/src/moduletree.cpp
index 55e69821ce..7903ea7848 100644
--- a/plugins/DbEditorPP/src/moduletree.cpp
+++ b/plugins/DbEditorPP/src/moduletree.cpp
@@ -193,7 +193,7 @@ int findItemInTree(HWND hwnd2Tree, MCONTACT hContact, char *module)
item.mask = TVIF_STATE | TVIF_PARAM | TVIF_TEXT;
item.hItem = TVI_ROOT;
item.pszText = text;
- item.cchTextMax = 264;
+ item.cchTextMax = SIZEOF(text);
do {
do {
lastItem = item.hItem;
@@ -268,7 +268,7 @@ BOOL findAndRemoveDuplicates(HWND hwnd2Tree, MCONTACT hContact, char *module)
item.mask = TVIF_STATE | TVIF_PARAM | TVIF_TEXT;
item.hItem = TVI_ROOT;
item.pszText = text;
- item.cchTextMax = 264;
+ item.cchTextMax = SIZEOF(text);
prelastItem = item.hItem;
do {
@@ -383,7 +383,7 @@ void __cdecl PopulateModuleTreeThreadFunc(LPVOID di)
TVITEM tvi = {0};
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.pszText = SelectedModule;
- tvi.cchTextMax = 255;
+ tvi.cchTextMax = SIZEOF(SelectedModule);
tvi.hItem = item;
TreeView_GetItem(hwnd2Tree, &tvi);
@@ -595,7 +595,7 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)// hw
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = pnmtv->itemNew.hItem;
tvi.pszText = text;
- tvi.cchTextMax = 264;
+ tvi.cchTextMax = SIZEOF(text);
TreeView_GetItem(pnmtv->hdr.hwndFrom, &tvi);
if (tvi.lParam) {
@@ -706,7 +706,7 @@ void moduleListWM_NOTIFY(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)// hw
tvi.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_PARAM;
tvi.hItem = ptvdi->item.hItem;
tvi.pszText = text;
- tvi.cchTextMax = 264;
+ tvi.cchTextMax = SIZEOF(text);
TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
mtis = (ModuleTreeInfoStruct *)ptvdi->item.lParam;
@@ -756,7 +756,7 @@ void moduleListRightClick(HWND hwnd, WPARAM wParam, LPARAM lParam) // hwnd here
tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
tvi.hItem = hti.hItem;
tvi.pszText = module;
- tvi.cchTextMax = 255;
+ tvi.cchTextMax = SIZEOF(module);
TreeView_GetItem(((LPNMHDR)lParam)->hwndFrom, &tvi);
if (tvi.lParam) {
ModuleTreeInfoStruct *mtis = (ModuleTreeInfoStruct *)tvi.lParam;
diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp
index c9d655c698..ee91870904 100644
--- a/plugins/DbEditorPP/src/settinglist.cpp
+++ b/plugins/DbEditorPP/src/settinglist.cpp
@@ -83,7 +83,7 @@ void DeleteSettingsFromList(HWND hSettings, MCONTACT hContact, char *module, cha
char text[265];
item.mask = TVIF_PARAM | TVIF_TEXT;
item.pszText = text;
- item.cchTextMax = 264;
+ item.cchTextMax = SIZEOF(text);
item.hItem = (HTREEITEM)findItemInTree(hModules, hContact, module);
if ((int)item.hItem != -1)
if (TreeView_GetItem(hModules, &item) && item.lParam) {
@@ -286,7 +286,6 @@ void settingChanged(HWND hwnd2Settings, MCONTACT hContact, char* module, char* s
if (lvItem.iItem == -1) {
lvItem.iItem = 0;
lvItem.pszText = setting;
- lvItem.cchTextMax = mir_strlen(setting);
lvItem.iItem = ListView_InsertItem(hwnd2Settings, &lvItem);
}
additem(hwnd2Settings, hContact, module, setting, lvItem.iItem);
@@ -557,7 +556,7 @@ void EditLabel(HWND hwnd2List, int item, int subitem)
lvi.iItem = item;
lvi.iSubItem = 0;
lvi.pszText = setting;
- lvi.cchTextMax = 256;
+ lvi.cchTextMax = SIZEOF(setting);
if (!ListView_GetItem(hwnd2List, &lvi) ||
!ListView_GetSubItemRect
(hwnd2List, item, subitem, LVIR_LABEL, &rc) ||
@@ -837,7 +836,7 @@ void SettingsListRightClick(HWND hwnd, WPARAM wParam, LPARAM lParam) // hwnd her
lvi.iItem = hti.iItem;
lvi.iSubItem = 0;
lvi.pszText = setting;
- lvi.cchTextMax = 256;
+ lvi.cchTextMax = SIZEOF(setting);
ListView_GetItem(hSettings, &lvi);
ListView_GetItemText(hSettings, hti.iItem, 2, type, 8);