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 | |
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
74 files changed, 133 insertions, 184 deletions
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp index 65fd3c2a45..e406e4a494 100644 --- a/plugins/AutoShutdown/src/frame.cpp +++ b/plugins/AutoShutdown/src/frame.cpp @@ -449,7 +449,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA HFONT hFontPrev=NULL;
TCHAR szOutput[256];
dat->flags&=~FWPDF_TIMEISCLIPPED;
- if (GetWindowText(dat->hwndTime,szOutput,SIZEOF(szOutput)-1))
+ if (GetWindowText(dat->hwndTime,szOutput,SIZEOF(szOutput)))
if (GetClientRect(dat->hwndTime,&rc)) {
hdc=GetDC(dat->hwndTime);
if (hdc != NULL) {
@@ -490,7 +490,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA case TTN_NEEDTEXT:
{ NMTTDISPINFO *ttdi=(NMTTDISPINFO*)lParam;
if (dat->flags&FWPDF_TIMEISCLIPPED && (HWND)wParam==dat->hwndTime) {
- if (GetWindowText(dat->hwndTime,ttdi->szText,SIZEOF(ttdi->szText)-1))
+ if (GetWindowText(dat->hwndTime,ttdi->szText,SIZEOF(ttdi->szText)))
ttdi->lpszText=ttdi->szText;
}
else if ((HWND)wParam==dat->hwndIcon)
diff --git a/plugins/BasicHistory/src/Searcher.cpp b/plugins/BasicHistory/src/Searcher.cpp index 1e78b2750e..5282df39d6 100644 --- a/plugins/BasicHistory/src/Searcher.cpp +++ b/plugins/BasicHistory/src/Searcher.cpp @@ -102,7 +102,7 @@ void Searcher::Find() return;
}
- GetWindowText(context->findWindow, str, 128);
+ GetWindowText(context->findWindow, str, SIZEOF(str));
if (!str[0]) {
TCHAR buf[256];
mir_sntprintf(buf, 256, TranslateT("\"%s\" not found"), str);
@@ -298,7 +298,7 @@ void Searcher::Find() lastFindSelection = -1;
if (isStart) {
TCHAR buf[256];
- GetWindowText(context->findWindow, str, 128);
+ GetWindowText(context->findWindow, str, SIZEOF(str));
mir_sntprintf(buf, 256, TranslateT("\"%s\" not found"), str);
MessageBox(context->hWnd, buf, TranslateT("Search"), MB_OK | MB_ICONINFORMATION);
}
diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index 209f5825f8..9de338aeb1 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -593,9 +593,9 @@ INT_PTR CALLBACK PounceSentDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP case IDOK:
{
TCHAR text[2048];
- GetWindowText(GetDlgItem(hwnd, IDOK), text, 16);
+ GetWindowText(GetDlgItem(hwnd, IDOK), text, SIZEOF(text));
if (!_tcscmp(text, TranslateT("Retry"))) {
- GetWindowText(GetDlgItem(hwnd,IDC_MESSAGE), text, 2048);
+ GetWindowText(GetDlgItem(hwnd,IDC_MESSAGE), text, SIZEOF(text));
SendPounce(text, hContact);
}
}
diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index de5baa57a5..95d699b330 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -630,7 +630,6 @@ void CSListView::addItem( StatusItem* item, int itemNumber ) { LVITEM lvi = { 0 }; lvi.mask = LVIF_IMAGE | LVIF_GROUPID | LVIF_PARAM; - lvi.cchTextMax = 256; lvi.iItem = ListView_GetItemCount( m_handle ); lvi.lParam = itemNumber; lvi.iGroupId = item->m_bFavourite ? 0 : 1; diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index a6611a96c8..2079a2d222 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -446,8 +446,8 @@ HTREEITEM FindChild( HWND hTree, HTREEITEM Parent, TCHAR * Caption, void * data TCHAR buf[255]; tvi.hItem = tmp; tvi.mask = TVIF_TEXT|TVIF_HANDLE; - tvi.pszText = (LPTSTR)&buf; - tvi.cchTextMax = 254; + tvi.pszText = buf; + tvi.cchTextMax = SIZEOF(buf); TreeView_GetItem( hTree, &tvi ); if ( _tcsicmp(Caption, tvi.pszText) == 0) { if (!data) diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index b9a9e2b949..d32a94710d 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -402,7 +402,7 @@ void SaveState() if (ListView_GetCheckState(hwndList, i)) {
item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = 255;
+ item.cchTextMax = SIZEOF(szTemp);
item.iItem = i;
SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item);
strncat(newProtoFilter, szTemp, SIZEOF(newProtoFilter));
@@ -423,7 +423,7 @@ void SaveState() if (ListView_GetCheckState(hwndList, i)) {
item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = 255;
+ item.cchTextMax = SIZEOF(szTemp);
item.iItem = i;
SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
_tcsncat(newGroupFilter, szTemp, SIZEOF(newGroupFilter));
@@ -549,7 +549,7 @@ static void UpdateFilters() item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = 255;
+ item.cchTextMax = SIZEOF(szTemp);
for (i=0; i < ListView_GetItemCount(hwndList); i++)
{
@@ -571,7 +571,7 @@ static void UpdateFilters() item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = 255;
+ item.cchTextMax = SIZEOF(szTemp);
ListView_SetCheckState(hwndList, 0, dwFlags & CLVM_INCLUDED_UNGROUPED ? TRUE : FALSE);
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 1d60f93b88..7cd3539ea2 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -342,7 +342,7 @@ void SaveState() if (ListView_GetCheckState(hwndList, i)) {
item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = 255;
+ item.cchTextMax = SIZEOF(szTemp);
item.iItem = i;
SendMessageA(hwndList, LVM_GETITEMA, 0, (LPARAM)&item);
strncat(newProtoFilter, szTemp, SIZEOF(newProtoFilter));
@@ -364,7 +364,7 @@ void SaveState() if (ListView_GetCheckState(hwndList, i)) {
item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = 255;
+ item.cchTextMax = SIZEOF(szTemp);
item.iItem = i;
SendMessage(hwndList, LVM_GETITEM, 0, (LPARAM)&item);
_tcsncat(newGroupFilter, szTemp, SIZEOF(newGroupFilter));
@@ -475,7 +475,7 @@ void UpdateFilters() item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = 255;
+ item.cchTextMax = SIZEOF(szTemp);
for (i = 0; i < ListView_GetItemCount(hwndList); i++) {
item.iItem = i;
@@ -497,7 +497,7 @@ void UpdateFilters() item.mask = LVIF_TEXT;
item.pszText = szTemp;
- item.cchTextMax = 255;
+ item.cchTextMax = SIZEOF(szTemp);
ListView_SetCheckState(hwndList, 0, dwFlags & CLVM_INCLUDED_UNGROUPED ? TRUE : FALSE);
diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index 4cefbb9d5f..8353a799fc 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -503,7 +503,7 @@ static INT_PTR CALLBACK LogDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARA while ((idx = ListView_GetNextItem(dat->hList, idx, flags)) > 0)
{
- ListView_GetItemText(dat->hList, idx, 0, szText, sizeof(szText)-1);
+ ListView_GetItemText(dat->hList, idx, 0, szText, SIZEOF(szText)-1);
src = szText;
while (*dst++ = *src++);
dst--;
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);
diff --git a/plugins/Exchange/src/dlg_handlers.cpp b/plugins/Exchange/src/dlg_handlers.cpp index ed10225453..e690c9d156 100644 --- a/plugins/Exchange/src/dlg_handlers.cpp +++ b/plugins/Exchange/src/dlg_handlers.cpp @@ -172,7 +172,7 @@ int CALLBACK ListSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) for (int i = 0; i < count; i++) {
if (ListView_GetItemState(hWnd, i, LVIS_SELECTED)) {
TCHAR emailID[4096]; //uhh
- ListView_GetItemText(hWnd, i, 2, emailID, sizeof(emailID));
+ ListView_GetItemText(hWnd, i, 2, emailID, SIZEOF(emailID));
exchangeServer.OpenMessage(emailID);
}
}
@@ -197,16 +197,13 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam col.mask = LVCF_TEXT | LVCF_WIDTH;
col.cx = 100;
col.pszText = TranslateT("Entry ID");
- col.cchTextMax = (int)_tcslen(col.pszText) + 1;
ListView_InsertColumn(hList, 0, &col);
col.pszText = TranslateT("Subject");
col.cx = 300;
- col.cchTextMax = (int)_tcslen(col.pszText) + 1;
ListView_InsertColumn(hList, 0, &col);
col.cx = 200;
col.iSubItem = 1;
col.pszText = TranslateT("Sender");
- col.cchTextMax = (int)_tcslen(col.pszText) + 1;
ListView_InsertColumn(hList, 0, &col);
}
return TRUE;
@@ -304,7 +301,7 @@ INT_PTR CALLBACK DlgProcEmails(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam item.iItem = i;
item.mask = LVIF_TEXT;
item.iSubItem = 2;
- item.cchTextMax = sizeof(emailID);
+ item.cchTextMax = SIZEOF(emailID);
item.pszText = emailID;
ListView_GetItem(hList, &item);
exchangeServer.MarkEmailAsRead(emailID);
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 6aa6fc1329..67d80af9de 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -284,7 +284,7 @@ UINT_PTR CALLBACK ShareNewFileDialogHook( HWND hFileName = GetDlgItem(hWndFileDlg, edt1);
char pszFileName[MAX_PATH];
- SendMessage(hFileName, WM_GETTEXT, MAX_PATH, (LPARAM)pszFileName);
+ SendMessage(hFileName, WM_GETTEXT, SIZEOF(pszFileName), (LPARAM)pszFileName);
if (strcmp(pstShare->pszSrvPath, szSelection) &&
strcmp(pszFileName, pszShareDirStr)) {
@@ -856,8 +856,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara LVITEM sItem = { 0 };
sItem.mask = LVIF_TEXT;
sItem.pszText = szTmp;
- sItem.cchTextMax = sizeof(szTmp);
-
+ sItem.cchTextMax = SIZEOF(szTmp);
switch (LOWORD(wParam)) {
case IDC_SHOWHIDDENSHARES: {
diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index c664bbcca1..8e0f815946 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -550,7 +550,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara count = 0; else { TCHAR buffer[1024]; - GetWindowText(GetDlgItem(hWnd, IDC_EVENTS_COUNT), buffer, sizeof(buffer)); + GetWindowText(GetDlgItem(hWnd, IDC_EVENTS_COUNT), buffer, SIZEOF(buffer)); count = _tstol(buffer); count = (count < 0) ? 0 : count; } diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index 63df423bd6..728b97e6d0 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -221,7 +221,6 @@ INT_PTR CALLBACK DlgProcProtoOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR // fill memset(&lvItem, 0, sizeof(lvItem)); lvItem.mask = LVIF_TEXT|LVIF_PARAM; - lvItem.cchTextMax = 256; lvItem.iItem = 0; lvItem.iSubItem = 0; for (int i=0; i < ProtoList.protoCount; i++) { diff --git a/plugins/MirOTR/MirOTR/src/options.cpp b/plugins/MirOTR/MirOTR/src/options.cpp index fd4a4ae2a6..e49c2bb7d2 100644 --- a/plugins/MirOTR/MirOTR/src/options.cpp +++ b/plugins/MirOTR/MirOTR/src/options.cpp @@ -411,7 +411,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsProto(HWND hwndDlg, UINT msg, WPARAM wP int sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS));
if (sel != -1) {
TCHAR buff_proto[128];
- ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, buff_proto, 128);
+ ListView_GetItemText(GetDlgItem(hwndDlg, IDC_LV_PROTO_PROTOS), sel, 0, buff_proto, SIZEOF(buff_proto));
TCHAR buff[512];
mir_sntprintf(buff, 512, TranslateT(LANG_OTR_ASK_REMOVEKEY), buff_proto);
if (IDYES == MessageBox(hwndDlg, buff, TranslateT(LANG_OTR_INFO), MB_ICONQUESTION|MB_YESNO))
diff --git a/plugins/ModernOpt/src/modernopt.cpp b/plugins/ModernOpt/src/modernopt.cpp index d1382fb30b..da85a22ad9 100644 --- a/plugins/ModernOpt/src/modernopt.cpp +++ b/plugins/ModernOpt/src/modernopt.cpp @@ -431,7 +431,6 @@ static void ModernOptUI_SelectSection(HWND hwndDlg, struct ModernOptionsData *da tvis.hInsertAfter = TVI_LAST;
tvis.item.mask = TVIF_IMAGE|TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE|TVIF_PARAM;
tvis.item.pszText = TranslateTS(obj->optObject.lptzSubsection);
- tvis.item.cchTextMax = lstrlen(tvis.item.pszText);
tvis.item.iImage = tvis.item.iSelectedImage = obj->iTreeImageIndex;
tvis.item.lParam = i;
TreeView_InsertItem(hwndTree, &tvis);
diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index 34f8f3b677..7c32b3fb5b 100755 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -1023,7 +1023,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, TCHAR szFormat[200];
TCHAR szTitle[200];
- if (GetWindowText(hwndDlg, szFormat, sizeof( szFormat))) {
+ if (GetWindowText(hwndDlg, szFormat, SIZEOF(szFormat))) {
const TCHAR *pszNick = NickFromHandle( pclDlg->hContact);
tstring sPath = pclDlg->sPath;
string::size_type n = sPath.find_last_of( '\\');
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 499e0c7f16..6d7ef44862 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -394,7 +394,7 @@ BOOL bApplyChanges( HWND hwndDlg ) sItem.iItem = nCur;
sItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
sItem.pszText = szTemp;
- sItem.cchTextMax = sizeof( szTemp);
+ sItem.cchTextMax = SIZEOF(szTemp);
if (ListView_GetItem( hMapUser, &sItem))
{
@@ -483,7 +483,7 @@ void AutoFindeFileNames(HWND hwndDlg) sItem.iItem = nCur;
sItem.iSubItem = 1;
sItem.pszText = szSearch;
- sItem.cchTextMax = sizeof( szSearch);
+ sItem.cchTextMax = SIZEOF(szSearch);
if ( !ListView_GetItem( hMapUser, &sItem))
{
@@ -502,7 +502,7 @@ void AutoFindeFileNames(HWND hwndDlg) sItem.iItem = nSubCur;
sItem.iSubItem = 1;
sItem.pszText = szSubCur;
- sItem.cchTextMax = sizeof( szSubCur);
+ sItem.cchTextMax = SIZEOF(szSubCur);
if (ListView_GetItem( hMapUser, &sItem))
{
size_t nLen = _tcslen( szSubCur);
@@ -521,13 +521,13 @@ void AutoFindeFileNames(HWND hwndDlg) {
tstring sFileName;
szSearch[0] = 0;
- ListView_GetItemText( hMapUser, nCur, 0, szSearch, sizeof( szSearch ));
+ ListView_GetItemText( hMapUser, nCur, 0, szSearch, SIZEOF( szSearch ));
bool bPriHasFileName = szSearch[0] != 0;
if (bPriHasFileName )
sFileName = szSearch;
szSearch[0] = 0;
- ListView_GetItemText( hMapUser, nStortestIndex, 0, szSearch, sizeof( szSearch ));
+ ListView_GetItemText( hMapUser, nStortestIndex, 0, szSearch, SIZEOF( szSearch ));
bool bSubHasFileName = szSearch[0] != 0;
if (bSubHasFileName )
sFileName = szSearch;
@@ -1188,7 +1188,7 @@ BOOL bApplyChanges2( HWND hwndDlg ) sItem.iItem = nCur;
sItem.mask = LVIF_TEXT | LVIF_IMAGE;
sItem.pszText = &szTemp[12];
- sItem.cchTextMax = sizeof( szTemp )-15;
+ sItem.cchTextMax = (SIZEOF(szTemp) - 15);
if (::SendMessage(hMapUser, LVM_GETITEMA, 0, (LPARAM)&sItem))
{
if (sItem.iImage )
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index 5d634e24f9..6f5af06b18 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -1811,7 +1811,6 @@ static void InitListView(HWND AHLV) lvTIt.iItem = I; lvTIt.iSubItem = 0; lvTIt.pszText = (pNote->CustomTitle && pNote->title) ? pNote->title : S1; - lvTIt.cchTextMax = (int)strlen(S1); ListView_InsertItem(AHLV,&lvTIt); if (pNote->Visible) @@ -1819,7 +1818,6 @@ static void InitListView(HWND AHLV) lvTIt.iItem = I; lvTIt.iSubItem = 1; lvTIt.pszText = V; - lvTIt.cchTextMax = (int)strlen(lvTIt.pszText); ListView_SetItem(AHLV,&lvTIt); } @@ -1828,7 +1826,6 @@ static void InitListView(HWND AHLV) lvTIt.iItem = I; lvTIt.iSubItem = 2; lvTIt.pszText = T; - lvTIt.cchTextMax = (int)strlen(lvTIt.pszText); ListView_SetItem(AHLV,&lvTIt); } @@ -1836,7 +1833,6 @@ static void InitListView(HWND AHLV) lvTIt.iItem = I; lvTIt.iSubItem = 3; lvTIt.pszText = S; - lvTIt.cchTextMax = (int)strlen(S); ListView_SetItem(AHLV,&lvTIt); I++; @@ -1956,28 +1952,24 @@ INT_PTR CALLBACK DlgProcViewNotes(HWND Dialog,UINT Message,WPARAM wParam,LPARAM S = TranslateT("Note text"); lvCol.pszText = S; - lvCol.cchTextMax = (int)_tcslen(S); lvCol.cx = g_notesListColGeom[3]; ListView_InsertColumn(H,0,&lvCol); lvCol.mask = LVCF_TEXT | LVCF_WIDTH; S = TranslateT("Top"); lvCol.pszText = S; - lvCol.cchTextMax = (int)_tcslen(S); lvCol.cx = g_notesListColGeom[2]; ListView_InsertColumn(H,0,&lvCol); lvCol.mask = LVCF_TEXT | LVCF_WIDTH; S = TranslateT("Visible"); lvCol.pszText = S; - lvCol.cchTextMax = (int)strlen(S); lvCol.cx = g_notesListColGeom[1]; ListView_InsertColumn(H,0,&lvCol); lvCol.mask = LVCF_TEXT | LVCF_WIDTH; S = TranslateT("Date/Title"); lvCol.pszText = S; - lvCol.cchTextMax = (int)_tcslen(S); lvCol.cx = g_notesListColGeom[0]; ListView_InsertColumn(H,0,&lvCol); diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index 2ea44ce8a8..2dbaec1fba 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -2247,14 +2247,12 @@ static void InitListView(HWND AHLV) lvTIt.iItem = I;
lvTIt.iSubItem = 0;
lvTIt.pszText = S1;
- lvTIt.cchTextMax = (int)strlen(S1);
ListView_InsertItem(AHLV,&lvTIt);
lvTIt.mask = LVIF_TEXT;
S = GetPreviewString(pReminder->Reminder);
lvTIt.iItem = I;
lvTIt.iSubItem = 1;
lvTIt.pszText = S;
- lvTIt.cchTextMax = (int)strlen(S);
ListView_SetItem(AHLV,&lvTIt);
I++;
@@ -2425,13 +2423,11 @@ INT_PTR CALLBACK DlgProcViewReminders(HWND Dialog,UINT Message,WPARAM wParam,LPA lvCol.mask = LVCF_TEXT | LVCF_WIDTH;
S = Translate("Reminder text");
lvCol.pszText = S;
- lvCol.cchTextMax = (int)strlen(S);
lvCol.cx = g_reminderListColGeom[1];
ListView_InsertColumn(H,0,&lvCol);
lvCol.mask = LVCF_TEXT | LVCF_WIDTH;
S = Translate("Date of activation");
lvCol.pszText = S;
- lvCol.cchTextMax = (int)strlen(S);
lvCol.cx = g_reminderListColGeom[0];
ListView_InsertColumn(H,0,&lvCol);
InitListView(H);
diff --git a/plugins/Popup/src/opttree.cpp b/plugins/Popup/src/opttree.cpp index 52ead4fe51..1c670e06b0 100644 --- a/plugins/Popup/src/opttree.cpp +++ b/plugins/Popup/src/opttree.cpp @@ -36,7 +36,6 @@ static void OptTree_TranslateItem(HWND hwndTree, HTREEITEM hItem) tvi.cchTextMax = SIZEOF(buf);
SendMessage(hwndTree, TVM_GETITEMW, 0, (LPARAM)&tvi);
tvi.pszText = TranslateTS(tvi.pszText);
- tvi.cchTextMax = lstrlen(tvi.pszText);
SendMessage(hwndTree, TVM_SETITEMW, 0, (LPARAM)&tvi);
}
@@ -81,7 +80,7 @@ HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHA tvi.mask = TVIF_TEXT;
tvi.pszText = str;
- tvi.cchTextMax = MAX_PATH;
+ tvi.cchTextMax = SIZEOF(str);
while (tvi.hItem) {
TreeView_GetItem(hwndTree, &tvi);
diff --git a/plugins/QuickMessages/src/options.cpp b/plugins/QuickMessages/src/options.cpp index 03c78fabff..88bfada40c 100644 --- a/plugins/QuickMessages/src/options.cpp +++ b/plugins/QuickMessages/src/options.cpp @@ -123,7 +123,7 @@ void SetMenuEntryProperties(HWND hdlg) {
ListData* ld = ( ListData* )tvi.lParam;
TCHAR szValue[256];
- GetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE), szValue, sizeof(szValue));
+ GetWindowText(GetDlgItem(hdlg,IDC_RCLICKVALUE), szValue, SIZEOF(szValue));
if(_tcslen(szValue))
{
if(ld->ptszOPQValue&&(ld->ptszOPQValue!=ld->ptszQValue))
@@ -144,7 +144,7 @@ void SetMenuEntryProperties(HWND hdlg) {
ButtonData* bd = ( ButtonData* )tvi.lParam;
TCHAR szValue[256];
- GetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE), szValue, sizeof(szValue));
+ GetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE), szValue, SIZEOF(szValue));
if(_tcslen(szValue))
{
if(_tcslen(bd->pszOpValue)&&(bd->pszOpValue!=bd->pszValue))
@@ -213,7 +213,7 @@ void SaveMenuTree(HWND hdlg) g_iButtonsCount=TreeView_GetCount(hButtonsList);
tvi.pszText = strbuf;
- tvi.cchTextMax = 256;
+ tvi.cchTextMax = SIZEOF(strbuf);
tvi.mask=TVIF_HANDLE|TVIF_TEXT ;
tvi.hItem=TreeView_GetRoot(hButtonsList);
@@ -492,7 +492,7 @@ void MoveItem( HTREEITEM hItem, HTREEITEM hInsertAfter, BOOLEAN bAsChild ) tvis.item.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT;
tvis.item.pszText=strbuf;
- tvis.item.cchTextMax=sizeof(strbuf);
+ tvis.item.cchTextMax=SIZEOF(strbuf);
tvis.item.hItem=hItem;
TreeView_GetItem(hMenuTree,&tvis.item);
}
@@ -768,12 +768,12 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) TCHAR szLabel[256];
tvi.pszText = strbuf;
- tvi.cchTextMax = sizeof(strbuf);
+ tvi.cchTextMax = SIZEOF(strbuf);
tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM;
tvi.hItem=TreeView_GetSelection(hMenuTree);
TreeView_GetItem(hMenuTree,&tvi);
- GetWindowText(hwndEdit, szLabel, sizeof(szLabel));
+ GetWindowText(hwndEdit, szLabel, SIZEOF(szLabel));
hwndEdit=NULL;
if (!_tcslen(szLabel)) break;
if (bd = (ButtonData*)tvi.lParam){
@@ -836,7 +836,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) bd = ( ButtonData* )tvi.lParam;
if (bd) {
TCHAR szValue[256];
- GetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE), szValue, sizeof(szValue));
+ GetWindowText(GetDlgItem(hdlg,IDC_MENUVALUE), szValue, SIZEOF(szValue));
if(_tcslen(szValue))
{
if(bd->pszOpValue&&(bd->pszOpValue!=bd->pszValue))
@@ -912,12 +912,12 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) TCHAR szLabel[128];
tvi.pszText = strbuf;
- tvi.cchTextMax = sizeof(strbuf);
+ tvi.cchTextMax = SIZEOF(strbuf);
tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM;
tvi.hItem=TreeView_GetSelection(hButtonsList);
TreeView_GetItem(hButtonsList,&tvi);
- GetWindowText(hwndEdit, szLabel, sizeof(szLabel));
+ GetWindowText(hwndEdit, szLabel, SIZEOF(szLabel));
hwndEdit=NULL;
if (!_tcslen(szLabel)) break;
@@ -1005,7 +1005,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) tvis.hParent = NULL;
tvis.hInsertAfter = TVI_LAST;
- GetWindowText(GetDlgItem(hdlg,IDC_BUTTONNAME),namebuff,MAX_PATH);
+ GetWindowText(GetDlgItem(hdlg,IDC_BUTTONNAME),namebuff,SIZEOF(namebuff));
tvis.item.mask=TVIF_PARAM|TVIF_TEXT;
tvis.item.pszText=(_tcslen(namebuff))?namebuff:TranslateT("New Button");
@@ -1055,7 +1055,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) bd = (ButtonData *)mir_alloc(sizeof(ButtonData));
memset(bd,0,sizeof(ButtonData));
- GetWindowText(GetDlgItem(hdlg,IDC_MENUNAME),namebuff,MAX_PATH);
+ GetWindowText(GetDlgItem(hdlg,IDC_MENUNAME),namebuff,SIZEOF(namebuff));
bd->dwOPPos=TreeView_GetCount(hMenuTree)-1;
bd->pszOpName=_tcslen(namebuff)?mir_tstrdup(namebuff):mir_tstrdup(TranslateT("New Menu Entry"));
@@ -1102,7 +1102,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) while(tvi.hItem){
tvis.hInsertAfter=hti;
tvi.pszText = strbuf;
- tvi.cchTextMax = sizeof(strbuf);
+ tvi.cchTextMax = SIZEOF(strbuf);
tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT;
TreeView_GetItem(hMenuTree,&tvi);
diff --git a/plugins/QuickReplies/src/options.cpp b/plugins/QuickReplies/src/options.cpp index ee3b0112f5..b622789864 100644 --- a/plugins/QuickReplies/src/options.cpp +++ b/plugins/QuickReplies/src/options.cpp @@ -43,7 +43,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam SendMessage(hwnd, EM_GETSEL, (WPARAM) & end, (LPARAM) (PDWORD) NULL);
SendMessage(hwnd, WM_KEYDOWN, VK_LEFT, 0);
SendMessage(hwnd, EM_GETSEL, (WPARAM) & start, (LPARAM) (PDWORD) NULL);
- GetWindowText(hwnd, text, 1024);
+ GetWindowText(hwnd, text, SIZEOF(text));
MoveMemory(text + start, text + end, sizeof(WCHAR) * (wcslen(text) + 1 - end));
SetWindowText(hwnd, text);
SendMessage(hwnd, EM_SETSEL, start, start);
diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp index a2b097ed54..a6c46e894f 100644 --- a/plugins/Quotes/src/ImportExport.cpp +++ b/plugins/Quotes/src/ImportExport.cpp @@ -171,7 +171,7 @@ namespace LPTSTR p = pszBuffer;
LPCTSTR pszXml = TranslateT("XML File (*.xml)");
lstrcpyn(p,pszXml, (int)cBuffer);
- size_t nLen = (int)lstrlen(pszXml)+1;
+ size_t nLen = lstrlen(pszXml)+1;
p+= nLen;
if(nLen < cBuffer)
{
diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index 709055160e..5ebd8cee85 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -728,7 +728,7 @@ void SendSMSWindowAsSentSet(HWND hWndDlg) // lvi.mask=LVIF_TEXT|LVIF_IMAGE;
// lvi.iItem=GetSendSMSWindowSMSSend(hWndDlg) - 1;
// lvi.iSubItem=0;
-// ListView_GetItemText(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),GetSendSMSWindowSMSSend(hWndDlg) - 1,0,szPhone,sizeof(szPhone));
+// ListView_GetItemText(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),GetSendSMSWindowSMSSend(hWndDlg) - 1,0,szPhone,SIZEOF(szPhone));
// lvi.pszText=szPhone;
// lvi.iImage=2;
// ListView_SetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&lvi);
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index e62b387d76..f2e1bc7c86 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -54,7 +54,7 @@ TCHAR* GetWindowTitle(MCONTACT hContact, const char *szProto) tokenLen[1] = lstrlen(tokens[1]);
tokens[2] = db_get_tsa(hContact, "CList", "StatusMsg");
if (tokens[2] != NULL) {
- tokenLen[2] = (int)lstrlen(tokens[2]);
+ tokenLen[2] = lstrlen(tokens[2]);
for (i = j = 0; i < tokenLen[2]; i++) {
if (tokens[2][i] == '\r')
continue;
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index fbf31470ed..05c01332d4 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -1414,7 +1414,7 @@ void setListViewStatus(HWND hLV, UINT iItem, UINT iStatus) UINT getListViewPSK(HWND hLV, UINT iItem)
{
char str[128];
- LV_GetItemTextA(hLV, iItem, 4, str, sizeof(str));
+ LV_GetItemTextA(hLV, iItem, 4, str, SIZEOF(str));
return strncmp(str, Translate(sim206), sizeof(str)) == 0;
}
@@ -1428,7 +1428,7 @@ void setListViewPSK(HWND hLV, UINT iItem, UINT iStatus) UINT getListViewPUB(HWND hLV, UINT iItem)
{
char str[128];
- LV_GetItemTextA(hLV, iItem, 4, str, sizeof(str));
+ LV_GetItemTextA(hLV, iItem, 4, str, SIZEOF(str));
return strncmp(str, Translate(sim233), sizeof(str)) == 0;
}
diff --git a/plugins/SendScreenshotPlus/src/ctrl_button.cpp b/plugins/SendScreenshotPlus/src/ctrl_button.cpp index 3e7a04beb8..83ab8907ca 100644 --- a/plugins/SendScreenshotPlus/src/ctrl_button.cpp +++ b/plugins/SendScreenshotPlus/src/ctrl_button.cpp @@ -550,7 +550,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case BUTTONTRANSLATE: { TCHAR szButton[MAX_PATH]; - GetWindowText(bct->hwnd, szButton, MAX_PATH); + GetWindowText(bct->hwnd, szButton, SIZEOF(szButton)); SetWindowText(bct->hwnd, TranslateTS(szButton)); } break; diff --git a/plugins/ShellExt/src/options.cpp b/plugins/ShellExt/src/options.cpp index e337117171..b8088416c3 100644 --- a/plugins/ShellExt/src/options.cpp +++ b/plugins/ShellExt/src/options.cpp @@ -8,7 +8,7 @@ static void AutoSize(HWND hwnd) HFONT hOldFont = (HFONT)SelectObject(hDC, hFont);
TCHAR szBuf[MAX_PATH];
- int i = GetWindowText(hwnd, szBuf, MAX_PATH);
+ int i = GetWindowText(hwnd, szBuf, SIZEOF(szBuf));
SIZE tS;
GetTextExtentPoint32(hDC, szBuf, i, &tS);
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index dd2c06f3b1..487d575ca8 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -121,7 +121,6 @@ HWND WINAPI CreateStatusComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) status_desc = (TCHAR *)TranslateT("<current>"); cbei.iItem = j; cbei.pszText = (LPTSTR)status_desc; - cbei.cchTextMax = sizeof(status_desc); if (data->m_szProto || data->m_iStatus == ID_STATUS_CURRENT) { if (data->m_bOnStartup) @@ -153,7 +152,6 @@ HWND WINAPI CreateStatusComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) status_desc = pcli->pfnGetStatusModeDescription(ID_STATUS_OFFLINE + i, 0); cbei.iItem = j; cbei.pszText = (LPTSTR)status_desc; - cbei.cchTextMax = sizeof(status_desc); if (data->m_iDlgFlags & DLG_SHOW_STATUS_ICONS) { cbei.iImage = j - 1; cbei.iSelectedImage = j - 1; @@ -179,7 +177,6 @@ HWND WINAPI CreateStatusComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) cbei.iItem = j; cbei.pszText = (LPTSTR)tszProfileName; - cbei.cchTextMax = SIZEOF(tszProfileName); if (data->m_iDlgFlags & DLG_SHOW_STATUS_ICONS) { int k = GetCurrentStatus(NULL) - ID_STATUS_OFFLINE; if (k < 0 || k > 9) @@ -248,7 +245,6 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) found = TRUE; cbei.iItem = -1; cbei.pszText = (LPTSTR)dbv.ptszVal; - cbei.cchTextMax = sizeof(dbv.ptszVal); if (data->m_iDlgFlags & DLG_SHOW_LIST_ICONS) { cbei.iImage = I_ICON_HIST; cbei.iSelectedImage = I_ICON_HIST; @@ -346,7 +342,6 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) cbei.iItem = -1; cbei.pszText = (LPTSTR)dbv.ptszVal; - cbei.cchTextMax = sizeof(dbv.ptszVal); if (data->m_iDlgFlags & DLG_SHOW_LIST_ICONS) { cbei.iImage = I_ICON_MSG; cbei.iSelectedImage = I_ICON_MSG; @@ -365,7 +360,6 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) if (db_get_b(NULL, "SimpleStatusMsg", "PutDefInList", 0)) { cbei.iItem = -1; cbei.pszText = (LPTSTR)GetDefaultMessage(data->m_iStatus); - cbei.cchTextMax = sizeof(GetDefaultMessage(data->m_iStatus)); if (data->m_iDlgFlags & DLG_SHOW_LIST_ICONS) { cbei.iImage = I_ICON_MSG; cbei.iSelectedImage = I_ICON_MSG; diff --git a/plugins/SpellChecker/src/RichEdit.cpp b/plugins/SpellChecker/src/RichEdit.cpp index c76391620a..7971b607fd 100644 --- a/plugins/SpellChecker/src/RichEdit.cpp +++ b/plugins/SpellChecker/src/RichEdit.cpp @@ -214,7 +214,7 @@ TCHAR *RichEdit::GetText(int start, int end) const return ret;
}
- int len = GetTextLength();
+ int len = (GetTextLength() + 1);
TCHAR *tmp = (TCHAR *)mir_alloc(len * sizeof(TCHAR));
GetWindowText(hwnd, tmp, len);
tmp[len] = 0;
diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index 0f26f5a3ef..cba883cb3a 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -310,7 +310,6 @@ static void LoadReplacements(HWND hwndDlg) item.iItem = i;
item.iSubItem = 0;
item.pszText = (TCHAR *) it->first.c_str();
- item.cchTextMax = (int)it->first.length();
item.lParam = i;
ListView_InsertItem(hList, &item);
@@ -394,11 +393,9 @@ static INT_PTR CALLBACK AutoreplaceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam col.fmt = LVCFMT_LEFT;
col.cx = 175;
col.pszText = TranslateT("Wrong word");
- col.cchTextMax = lstrlen(col.pszText);
ListView_InsertColumn(hList, 0, &col);
col.pszText = TranslateT("Correction");
- col.cchTextMax = lstrlen(col.pszText);
ListView_InsertColumn(hList, 1, &col);
LoadReplacements(hwndDlg);
diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp index 5be6b5b57a..1ebb02c105 100644 --- a/plugins/SplashScreen/src/options.cpp +++ b/plugins/SplashScreen/src/options.cpp @@ -307,25 +307,25 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
TCHAR tmp[MAX_PATH];
- GetWindowText(GetDlgItem(hwndDlg, IDC_SPLASHPATH), tmp, MAX_PATH);
+ GetWindowText(GetDlgItem(hwndDlg, IDC_SPLASHPATH), tmp, SIZEOF(tmp));
db_set_ts(NULL, MODNAME, "Path", tmp);
- GetWindowText(GetDlgItem(hwndDlg, IDC_SNDPATH), tmp, MAX_PATH);
+ GetWindowText(GetDlgItem(hwndDlg, IDC_SNDPATH), tmp, SIZEOF(tmp));
db_set_ts(NULL, MODNAME, "Sound", tmp);
- GetWindowText(GetDlgItem(hwndDlg, IDC_VERSIONPREFIX), tmp, MAX_PATH);
+ GetWindowText(GetDlgItem(hwndDlg, IDC_VERSIONPREFIX), tmp, SIZEOF(tmp));
db_set_ts(NULL, MODNAME, "VersionPrefix", tmp);
_tcscpy_s(szPrefix, tmp);
- GetWindowText(GetDlgItem(hwndDlg, IDC_SHOWTIME), tmp, MAX_PATH);
+ GetWindowText(GetDlgItem(hwndDlg, IDC_SHOWTIME), tmp, SIZEOF(tmp));
db_set_dw(NULL, MODNAME, "TimeToShow", _ttoi(tmp));
options.showtime = _ttoi(tmp);
- GetWindowText(GetDlgItem(hwndDlg, IDC_FISTEP), tmp, MAX_PATH);
+ GetWindowText(GetDlgItem(hwndDlg, IDC_FISTEP), tmp, SIZEOF(tmp));
db_set_dw(NULL, MODNAME, "FadeinSpeed", _ttoi(tmp));
options.fisteps = _ttoi(tmp);
- GetWindowText(GetDlgItem(hwndDlg, IDC_FOSTEP), tmp, MAX_PATH);
+ GetWindowText(GetDlgItem(hwndDlg, IDC_FOSTEP), tmp, SIZEOF(tmp));
db_set_dw(NULL, MODNAME, "FadeoutSpeed", _ttoi(tmp));
options.fosteps = _ttoi(tmp);
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp index be59461c0c..c4d58d1747 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/options.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/options.cpp @@ -181,7 +181,6 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM LVITEM lvItem = { 0 };
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
- lvItem.cchTextMax = 256;
lvItem.iItem = 0;
lvItem.iSubItem = 0;
for (int i = 0; i < SIZEOF(statusModeList); i++) {
diff --git a/plugins/StatusPlugins/confirmdialog.cpp b/plugins/StatusPlugins/confirmdialog.cpp index cb18098f54..04305df0b1 100644 --- a/plugins/StatusPlugins/confirmdialog.cpp +++ b/plugins/StatusPlugins/confirmdialog.cpp @@ -110,7 +110,6 @@ static int SetStatusList(HWND hwndDlg) // create items
LVITEM lvItem = { 0 };
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
- lvItem.cchTextMax = 256;
for ( int i=0; i < confirmSettings->getCount(); i++ ) {
lvItem.pszText = (*confirmSettings)[i].tszAccName;
diff --git a/plugins/StopSpamPlus/src/opt_proto.cpp b/plugins/StopSpamPlus/src/opt_proto.cpp index a3bedbe2ed..2b4d1d36dd 100644 --- a/plugins/StopSpamPlus/src/opt_proto.cpp +++ b/plugins/StopSpamPlus/src/opt_proto.cpp @@ -80,7 +80,6 @@ INT_PTR CALLBACK ProtoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) TVITEM tvi;
tvi.hItem = TreeView_GetRoot(hwndProto);
- tvi.cchTextMax = 32;
tvi.mask = TVIF_PARAM | TVIF_HANDLE;
while ( tvi.hItem != NULL ) {
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");
diff --git a/plugins/TipperYM/src/mir_smileys.cpp b/plugins/TipperYM/src/mir_smileys.cpp index f2ae1783dc..074df144f1 100644 --- a/plugins/TipperYM/src/mir_smileys.cpp +++ b/plugins/TipperYM/src/mir_smileys.cpp @@ -41,7 +41,7 @@ SMILEYPARSEINFO Smileys_PreParse(LPCTSTR lpString, int nCount, const char *proto return NULL;
if (nCount == -1)
- nCount = (int)lstrlen(lpString);
+ nCount = lstrlen(lpString);
SMILEYPARSEINFO info = (SMILEYPARSEINFO) mir_calloc(sizeof(tagSMILEYPARSEINFO));
info->pieces = ReplaceSmileys(lpString, nCount, protocol, &info->max_height);
@@ -72,7 +72,7 @@ void Smileys_FreeParse(SMILEYPARSEINFO parseInfo) int Smileys_DrawText(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRect, UINT uFormat, const char *protocol, SMILEYPARSEINFO parseInfo)
{
if (nCount == -1)
- nCount = (int)lstrlen(lpString);
+ nCount = lstrlen(lpString);
if (uFormat & DT_CALCRECT) {
SIZE text_size = GetTextSize(hDC, lpString, parseInfo, uFormat, parseInfo->max_height, (lpRect->right - lpRect->left));
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 5df05097e9..2f10a335e7 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -1075,7 +1075,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA item.stateMask = TVIS_STATEIMAGEMASK;
item.hItem = hItem;
item.pszText = buff;
- item.cchTextMax = 512;
+ item.cchTextMax = SIZEOF(buff);
if (TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_FIRST_ITEMS), &item))
{
tmpParam = item.lParam;
@@ -1794,7 +1794,7 @@ INT_PTR CALLBACK DlgProcOptsExtra(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM tvis.item.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
tvis.item.pszText = swzName;
- tvis.item.cchTextMax = 256;
+ tvis.item.cchTextMax = SIZEOF(swzName);
tvis.item.hItem = dat->hDragItem;
tvis.item.state = INDEXTOSTATEIMAGEMASK(((ICONSTATE *)item.lParam)->vis ? 2 : 1);
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE_EXTRAICONS), &tvis.item);
@@ -2215,7 +2215,7 @@ INT_PTR CALLBACK DlgProcOptsTraytip(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TVITEM item;
item.hItem = TreeView_GetRoot(GetDlgItem(hwndDlg, IDC_TREE_FIRST_PROTOS));
item.pszText = buff;
- item.cchTextMax = 256;
+ item.cchTextMax = SIZEOF(buff);
item.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_STATE;
item.stateMask = TVIS_STATEIMAGEMASK;
while (item.hItem != NULL)
diff --git a/plugins/TrafficCounter/src/options.cpp b/plugins/TrafficCounter/src/options.cpp index d01ac44276..4d58b94f98 100644 --- a/plugins/TrafficCounter/src/options.cpp +++ b/plugins/TrafficCounter/src/options.cpp @@ -310,9 +310,9 @@ static INT_PTR CALLBACK DlgProcTCOptions(HWND hwndDlg, UINT msg, WPARAM wParam, unOptions.ShowOverall = OptTree_GetOptions(hwndDlg, IDC_APPEARANCEOPTIONS, options, optionCount, "ShowOverall");
// Формат счётчиков
- GetWindowText(GetDlgItem(hwndDlg, IDC_EDIT_COUNTER_FORMAT), Traffic_CounterFormat, 512);
+ GetWindowText(GetDlgItem(hwndDlg, IDC_EDIT_COUNTER_FORMAT), Traffic_CounterFormat, SIZEOF(Traffic_CounterFormat));
// Формат всплывающей подсказки
- GetWindowText(GetDlgItem(hwndDlg, IDC_EDIT_TOOLTIP_FORMAT), Traffic_TooltipFormat, 512);
+ GetWindowText(GetDlgItem(hwndDlg, IDC_EDIT_TOOLTIP_FORMAT), Traffic_TooltipFormat, SIZEOF(Traffic_TooltipFormat));
// Ключевой цвет
UseKeyColor = db_get_b(NULL, "ModernSettings", "UseKeyColor", 1);
diff --git a/plugins/TrafficCounter/src/opttree.cpp b/plugins/TrafficCounter/src/opttree.cpp index e2b5569f62..34d7c9f418 100644 --- a/plugins/TrafficCounter/src/opttree.cpp +++ b/plugins/TrafficCounter/src/opttree.cpp @@ -39,7 +39,6 @@ static void OptTree_TranslateItem(HWND hwndTree, HTREEITEM hItem) // Проверим, надо ли переводить.
if ((tvi.lParam != -1) && (pOptions[tvi.lParam].dwFlag & OPTTREE_NOTRANSLATE)) return;
tvi.pszText = TranslateTS(tvi.pszText);
- tvi.cchTextMax = lstrlen(tvi.pszText);
SendMessage(hwndTree, TVM_SETITEM, 0, (LPARAM)&tvi);
}
@@ -88,7 +87,7 @@ HTREEITEM OptTree_FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHA tvi.mask = TVIF_TEXT;
tvi.pszText = str;
- tvi.cchTextMax = MAX_PATH;
+ tvi.cchTextMax = SIZEOF(str);
while (tvi.hItem)
{
diff --git a/plugins/TrafficCounter/src/statistics.cpp b/plugins/TrafficCounter/src/statistics.cpp index 67a43b225d..8d1e4025df 100644 --- a/plugins/TrafficCounter/src/statistics.cpp +++ b/plugins/TrafficCounter/src/statistics.cpp @@ -60,7 +60,6 @@ INT_PTR CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPA {
TCITEM tci;
tci.mask = TCIF_TEXT;
- tci.cchTextMax = 32;
tci.pszText = TranslateT("Hourly");
SendDlgItemMessage(hwndDlg, IDC_TAB_STATS, TCM_INSERTITEM, 0, (LPARAM)&tci);
tci.pszText = TranslateT("Daily");
@@ -84,7 +83,6 @@ INT_PTR CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPA lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
lvc.fmt = LVCFMT_LEFT;
- lvc.cchTextMax = 32;
lvc.pszText = TranslateT("Period");
lvc.cx = 135;
lvc.iSubItem = 0;
diff --git a/plugins/UserInfoEx/src/ctrl_button.cpp b/plugins/UserInfoEx/src/ctrl_button.cpp index 39b193a91c..aeb5477553 100644 --- a/plugins/UserInfoEx/src/ctrl_button.cpp +++ b/plugins/UserInfoEx/src/ctrl_button.cpp @@ -550,7 +550,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L case BUTTONTRANSLATE:
{
TCHAR szButton[MAX_PATH];
- GetWindowText(bct->hwnd, szButton, MAX_PATH);
+ GetWindowText(bct->hwnd, szButton, SIZEOF(szButton));
SetWindowText(bct->hwnd, TranslateTS(szButton));
}
break;
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index 110a40f80e..9c527acf06 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -171,11 +171,11 @@ static INT_PTR CALLBACK DlgProc_EMail(HWND hDlg, UINT msg, WPARAM wParam, LPARAM {
TCHAR szButton[MAX_PATH];
HWND hBtn = GetDlgItem(hDlg, IDOK);
- GetWindowText(hBtn, szButton, MAX_PATH);
+ GetWindowText(hBtn, szButton, SIZEOF(szButton));
SetWindowText(hBtn, TranslateTS(szButton));
hBtn = GetDlgItem(hDlg, IDCANCEL);
- GetWindowText(hBtn, szButton, MAX_PATH);
+ GetWindowText(hBtn, szButton, SIZEOF(szButton));
SetWindowText(hBtn, TranslateTS(szButton));
}
return TRUE;
@@ -253,10 +253,10 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam HWND hBtn;
hBtn = GetDlgItem(hDlg, IDOK);
- GetWindowText(hBtn, szButton, MAX_PATH);
+ GetWindowText(hBtn, szButton, SIZEOF(szButton));
SetWindowText(hBtn, TranslateTS(szButton));
hBtn = GetDlgItem(hDlg, IDCANCEL);
- GetWindowText(hBtn, szButton, MAX_PATH);
+ GetWindowText(hBtn, szButton, SIZEOF(szButton));
SetWindowText(hBtn, TranslateTS(szButton));
}
if (*cbi->pszVal) SetWindowText(hDlg, LPGENT("Edit phone number"));
@@ -844,7 +844,7 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L int errorPos;
TCHAR szEdit[MAXDATASIZE];
- if (ccVal = GetWindowText(cbex->hEdit, szEdit, MAXDATASIZE)) {
+ if (ccVal = GetWindowText(cbex->hEdit, szEdit, SIZEOF(szEdit))) {
if (!(ccVal = CheckPhoneSyntax(szEdit, szVal, MAXDATASIZE, errorPos)) || errorPos > -1) {
SetWindowText(cbex->hEdit, szVal);
SendMessage(cbex->hEdit, EM_SETSEL, errorPos, errorPos);
@@ -853,10 +853,10 @@ static LRESULT CALLBACK CtrlContactWndProc(HWND hwnd, UINT msg, WPARAM wParam, L break;
}
case EDIT_EMAIL:
- ccVal = GetWindowText(cbex->hEdit, szVal, MAXDATASIZE);
+ ccVal = GetWindowText(cbex->hEdit, szVal, SIZEOF(szVal));
break;
default:
- ccVal = GetWindowText(cbex->hEdit, szVal, MAXDATASIZE);
+ ccVal = GetWindowText(cbex->hEdit, szVal, SIZEOF(szVal));
break;
}
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp index 6a5b667b26..f26e726efe 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp @@ -54,7 +54,7 @@ void ExportTree_AppendModuleList(HWND hTree, HTREEITEM hParent, DB::CEnumList* p tvi.mask = TVIF_STATE|TVIF_TEXT;
tvi.stateMask = TVIS_STATEIMAGEMASK;
tvi.pszText = szModule;
- tvi.cchTextMax = MAXSETTING;
+ tvi.cchTextMax = SIZEOF(szModule);
do {
if (
@@ -225,7 +225,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar break;
}
TranslateDialogDefault(hDlg); //to translate oldTitle
- GetWindowText(hDlg, oldTitle, MAXSETTING);
+ GetWindowText(hDlg, oldTitle, SIZEOF(oldTitle));
mir_sntprintf(newTitle, MAXDATASIZE - 1, _T("%s - %s"), name, oldTitle);
SetWindowText(hDlg, newTitle);
}
@@ -394,7 +394,7 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar tvi.mask = TVIF_TEXT;
tvi.pszText = szText;
- tvi.cchTextMax = sizeof(szText);
+ tvi.cchTextMax = SIZEOF(szText);
// search the tree item of optional items
for (tvi.hItem = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_ROOT, NULL);
diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp index af4d83fd29..e9d8944e13 100644 --- a/plugins/UserInfoEx/src/psp_profile.cpp +++ b/plugins/UserInfoEx/src/psp_profile.cpp @@ -913,7 +913,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa if (!PtrIsValid(pList = (LPLISTCTRL)GetUserData(hwnd)))
break;
- GetWindowText(pList->labelEdit.hEdit, szEdit, MAX_PATH);
+ GetWindowText(pList->labelEdit.hEdit, szEdit, SIZEOF(szEdit));
// need to create the dropdown list?
if (pList->labelEdit.dropDown.hDrop == NULL) {
@@ -1193,7 +1193,7 @@ INT_PTR CALLBACK PSPProcContactProfile(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR *szGroup = 0;
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.pszText = szGroup;
- lvi.cchTextMax = MAX_PATH;
+ lvi.cchTextMax = SIZEOF(szGroup);
for (iItem = lvi.iItem = lvi.iSubItem = 0; ListView_GetItem(hList, &lvi); lvi.iItem++) {
if (!PtrIsValid(pItem = (LPLCITEM)lvi.lParam)) {
diff --git a/plugins/Variables/src/parse_external.cpp b/plugins/Variables/src/parse_external.cpp index dbdf91eb6c..07fc3643b6 100644 --- a/plugins/Variables/src/parse_external.cpp +++ b/plugins/Variables/src/parse_external.cpp @@ -28,11 +28,12 @@ static TCHAR *getFullWinampTitleText() if (hwndWinamp == NULL)
return NULL;
- TCHAR *szWinText = (TCHAR*)mir_alloc((GetWindowTextLength(hwndWinamp) + 1)*sizeof(TCHAR));
+ SIZE_T dwWinTextLength = (GetWindowTextLength(hwndWinamp) + 1);
+ TCHAR *szWinText = (TCHAR*)mir_alloc(dwWinTextLength * sizeof(TCHAR));
if (szWinText == NULL)
return NULL;
- if (GetWindowText(hwndWinamp, szWinText, GetWindowTextLength(hwndWinamp) + 1) == 0) {
+ if (GetWindowText(hwndWinamp, szWinText, dwWinTextLength) == 0) {
mir_free(szWinText);
return NULL;
}
diff --git a/plugins/Variables/src/parse_regexp.cpp b/plugins/Variables/src/parse_regexp.cpp index 0510464c97..acb4a1c642 100644 --- a/plugins/Variables/src/parse_regexp.cpp +++ b/plugins/Variables/src/parse_regexp.cpp @@ -39,7 +39,7 @@ static TCHAR *parseRegExpCheck(ARGUMENTSINFO *ai) return NULL;
pcre16_extra *extra = pcre16_study(ppat, 0, &err);
- int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)lstrlen(ai->targv[2]), 0, 0, offsets, 99);
+ int nmat = pcre16_exec(ppat, extra, ai->targv[2], lstrlen(ai->targv[2]), 0, 0, offsets, 99);
if (nmat > 0) {
ai->flags &= ~AIF_FALSE;
_ltoa(nmat, szVal, 10);
@@ -72,7 +72,7 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) return NULL;
pcre16_extra *extra = pcre16_study(ppat, 0, &err);
- int nmat = pcre16_exec(ppat, extra, ai->targv[2], (int)lstrlen(ai->targv[2]), 0, 0, offsets, 99);
+ int nmat = pcre16_exec(ppat, extra, ai->targv[2], lstrlen(ai->targv[2]), 0, 0, offsets, 99);
if (nmat >= 0)
ai->flags &= ~AIF_FALSE;
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index 7331cf93f7..ea306c9e1e 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -123,7 +123,7 @@ SIZE GetControlTextSize(HWND hCtrl) const size_t maxSize = 2048;
TCHAR buffer[maxSize];
SIZE size;
- GetWindowText(hCtrl, buffer, maxSize);
+ GetWindowText(hCtrl, buffer, SIZEOF(buffer));
GetTextExtentPoint32(hDC, buffer, (int) _tcslen(buffer), &size);
SelectObject(hDC, oldFont);
ReleaseDC(hCtrl, hDC);
@@ -306,22 +306,22 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara const int maxSize = 1024;
TCHAR buffer[maxSize];
- GetWindowText(GetDlgItem(hWnd, IDC_DAYS_IN_ADVANCE), buffer, maxSize);
+ GetWindowText(GetDlgItem(hWnd, IDC_DAYS_IN_ADVANCE), buffer, SIZEOF(buffer));
TCHAR *stop = NULL;
commonData.daysInAdvance = _tcstol(buffer, &stop, 10);
if (*stop) { commonData.daysInAdvance = DAYS_TO_NOTIFY; }
- GetWindowText(GetDlgItem(hWnd, IDC_DAYS_AFTER), buffer, maxSize);
+ GetWindowText(GetDlgItem(hWnd, IDC_DAYS_AFTER), buffer, SIZEOF(buffer));
commonData.daysAfter = _tcstol(buffer, &stop, 10);
if (*stop) { commonData.daysAfter = DAYS_TO_NOTIFY_AFTER; }
- GetWindowText(GetDlgItem(hWnd, IDC_CHECK_INTERVAL), buffer, maxSize);
+ GetWindowText(GetDlgItem(hWnd, IDC_CHECK_INTERVAL), buffer, SIZEOF(buffer));
commonData.checkInterval = _ttol(buffer);
if ( !commonData.checkInterval) { commonData.checkInterval = CHECK_INTERVAL; }
- GetWindowText(GetDlgItem(hWnd, IDC_POPUP_TIMEOUT), buffer, maxSize);
+ GetWindowText(GetDlgItem(hWnd, IDC_POPUP_TIMEOUT), buffer, SIZEOF(buffer));
TCHAR *pos;
pos = _tcschr(buffer, _T('|'));
if (pos) {
@@ -338,12 +338,12 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara }
else commonData.popupTimeout = commonData.popupTimeoutToday = _ttol(buffer);
- GetWindowText(GetDlgItem(hWnd, IDC_SOUND_NEAR_DAYS_EDIT), buffer, maxSize);
+ GetWindowText(GetDlgItem(hWnd, IDC_SOUND_NEAR_DAYS_EDIT), buffer, SIZEOF(buffer));
//cSoundNearDays = _ttol(buffer);
commonData.cSoundNearDays = _tcstol(buffer, &stop, 10);
if (*stop) { commonData.cSoundNearDays = BIRTHDAY_NEAR_DEFAULT_DAYS; }
- GetWindowText(GetDlgItem(hWnd, IDC_DLG_TIMEOUT), buffer, maxSize);
+ GetWindowText(GetDlgItem(hWnd, IDC_DLG_TIMEOUT), buffer, SIZEOF(buffer));
commonData.cDlgTimeout = _tcstol(buffer, &stop, 10);
if (*stop) { commonData.cDlgTimeout = POPUP_TIMEOUT; }
diff --git a/plugins/WhoUsesMyFiles/src/wumf.cpp b/plugins/WhoUsesMyFiles/src/wumf.cpp index fb81312f5d..5e194414b7 100644 --- a/plugins/WhoUsesMyFiles/src/wumf.cpp +++ b/plugins/WhoUsesMyFiles/src/wumf.cpp @@ -28,7 +28,6 @@ void AddToList(HWND hList, PWumf w) lvi.iItem = ListView_GetItemCount(hList)+1;
lvi.mask = LVIF_PARAM|LVIF_TEXT;
lvi.pszText = w->szID;
- lvi.cchTextMax = (int)_tcslen(w->szID);
lvi.lParam = (LPARAM)w;
ListView_InsertItem(hList,&lvi);
}
diff --git a/plugins/WinterSpeak/src/DialogConfigEngine.cpp b/plugins/WinterSpeak/src/DialogConfigEngine.cpp index 9c5be8dfe9..2e285c0d05 100644 --- a/plugins/WinterSpeak/src/DialogConfigEngine.cpp +++ b/plugins/WinterSpeak/src/DialogConfigEngine.cpp @@ -172,7 +172,7 @@ void DialogConfigEngine::updateVoices(HWND window) else
{
// select the saved voice
- SendDlgItemMessage(window, IDC_SELECT_VOICE, CB_SELECTSTRING, 0, (long)voice.c_str());
+ SendDlgItemMessage(window, IDC_SELECT_VOICE, CB_SELECTSTRING, 0, (LPARAM)voice.c_str());
}
}
diff --git a/plugins/YAPP/src/yapp_history_dlg.cpp b/plugins/YAPP/src/yapp_history_dlg.cpp index d6e25c41e4..1ab052a9fd 100644 --- a/plugins/YAPP/src/yapp_history_dlg.cpp +++ b/plugins/YAPP/src/yapp_history_dlg.cpp @@ -438,7 +438,7 @@ void RefreshPopupHistory(HWND hWnd, int renderer) TCHAR filter[MAX_FILTER_SIZE];
DeleteOldEvents(hWnd, renderer); //delete events
- GetWindowText(GetDlgItem(hWnd, IDC_HISTORY_FILTER), filter, MAX_FILTER_SIZE); //get filter text
+ GetWindowText(GetDlgItem(hWnd, IDC_HISTORY_FILTER), filter, SIZEOF(filter)); //get filter text
AddEvents(hWnd, renderer, filter, MatchesFilter);
@@ -479,7 +479,7 @@ void CopyPopupDataToClipboard(HWND hList, int selection) {
if (ListView_GetItemState(hList, i, LVIS_SELECTED))
{
- ListView_GetItemText(hList, i, selection - 100, buffer, 2048);
+ ListView_GetItemText(hList, i, selection - 100, buffer, SIZEOF(buffer));
found = 1;
break;
}
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)
{
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));
|