From 0769aa40dd28fd616de393c6f14b85f762e515c2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 11 Feb 2014 19:30:58 +0000 Subject: shameful death of another 'HANDLE' git-svn-id: http://svn.miranda-ng.org/main/trunk@8103 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/hdr/modern_clc.h | 2 +- .../Clist_modern/src/hdr/modern_commonprototypes.h | 2 +- plugins/Clist_modern/src/modern_clc.cpp | 10 +++++----- plugins/Clist_modern/src/modern_clcidents.cpp | 19 ++++++++----------- plugins/Clist_modern/src/modern_clcitems.cpp | 4 ++-- plugins/Clist_modern/src/modern_clcmsgs.cpp | 6 +++--- 6 files changed, 20 insertions(+), 23 deletions(-) (limited to 'plugins/Clist_modern') diff --git a/plugins/Clist_modern/src/hdr/modern_clc.h b/plugins/Clist_modern/src/hdr/modern_clc.h index c9cc59fd75..e84b1f1779 100644 --- a/plugins/Clist_modern/src/hdr/modern_clc.h +++ b/plugins/Clist_modern/src/hdr/modern_clc.h @@ -396,7 +396,7 @@ void ClcOptionsChanged(void); //clcidents.c int cliGetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex); -int FindItem(HWND hwnd, ClcData *dat, MCONTACT hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible, BOOL isIgnoreSubcontacts); +int FindItem(HWND hwnd, ClcData *dat, DWORD hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible, BOOL isIgnoreSubcontacts); int cliGetRowByIndex(ClcData *dat,int testindex,ClcContact **contact,ClcGroup **subgroup); HANDLE ContactToHItem(ClcContact *contact); HANDLE ContactToItemHandle(ClcContact *contact,DWORD *nmFlags); diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index 4d2c7d4cb7..65b08b6443 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -297,7 +297,7 @@ LRESULT CALLBACK cli_ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wPara int cliShowHide(WPARAM wParam, LPARAM lParam); BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect,BOOL bErase ); int cliCompareContacts(const ClcContact *contact1,const ClcContact *contact2); -int cliFindItem(HWND hwnd, ClcData *dat, HANDLE hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible); +int cliFindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible); int cliTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount); int cliTrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam); void cliCluiProtocolStatusChanged(int status,const char * proto); diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 74817ffe3f..94553b3c8a 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1470,7 +1470,7 @@ static LRESULT clcOnIntmGroupChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM w BYTE flags = 0; ClcContact *contact; - if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) memset(iExtraImage, 0xFF, sizeof(iExtraImage)); else { memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); @@ -1480,7 +1480,7 @@ static LRESULT clcOnIntmGroupChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM w if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !db_get_b(wParam, "CList", "Hidden", 0)) { NMCLISTCONTROL nm; pcli->pfnAddContactToTree(hwnd, dat, wParam, 1, 1); - if (pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { + if (pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) { memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); if (flags & CONTACTF_CHECKED) contact->flags |= CONTACTF_CHECKED; @@ -1528,14 +1528,14 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP // XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown - if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) { + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, &group, NULL)) { if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact); pcli->pfnAddContactToTree(hwnd, dat, wParam, (style & CLS_CONTACTLIST) == 0, 0); recalcScrollBar = 1; needRepaint = TRUE; - pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL); + pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL); if (contact) { contact->iImage = lParam; contact->image_is_special = image_is_special; @@ -1577,7 +1577,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP if (hSelItem) { ClcGroup *selgroup; - if (pcli->pfnFindItem(hwnd, dat, (HANDLE)hSelItem, &selcontact, &selgroup, NULL)) + if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf(( SortedList* )&selgroup->cl, selcontact)); else dat->selection = -1; diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index 93c5c3a9eb..e59870b5f3 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -104,12 +104,12 @@ int cliGetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex) return -1; } -int cliFindItem(HWND hwnd, ClcData *dat, HANDLE hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible) +int cliFindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible) { - return FindItem(hwnd, dat, (MCONTACT)hItem, contact, subgroup, isVisible, FALSE); + return FindItem(hwnd, dat, dwItem, contact, subgroup, isVisible, FALSE); } -int FindItem(HWND hwnd, ClcData *dat, MCONTACT hItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible, BOOL isIgnoreSubcontacts) +int FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible, BOOL isIgnoreSubcontacts) { int index = 0, i; int nowVisible = 1; @@ -138,9 +138,9 @@ int FindItem(HWND hwnd, ClcData *dat, MCONTACT hItem, ClcContact **contact, ClcG continue; } if (nowVisible) index++; - if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR)hItem&~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || - (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == hItem) || - (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (MCONTACT)((UINT_PTR)hItem&~HCONTACT_ISINFO))) + if ((IsHContactGroup(dwItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (dwItem & ~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || + (IsHContactContact(dwItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == dwItem) || + (IsHContactInfo(dwItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (dwItem & ~HCONTACT_ISINFO))) { if (isVisible) { if (!nowVisible) *isVisible = 0; @@ -161,14 +161,11 @@ int FindItem(HWND hwnd, ClcData *dat, MCONTACT hItem, ClcContact **contact, ClcG return 1; } - if (!isIgnoreSubcontacts && - IsHContactContact(hItem) && - group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && - group->cl.items[group->scanIndex]->SubAllocated > 0) + if (!isIgnoreSubcontacts && IsHContactContact(dwItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->SubAllocated > 0) { for (i=0; i < group->cl.items[group->scanIndex]->SubAllocated; i++) { - if (group->cl.items[group->scanIndex]->subcontacts[i].hContact == hItem) + if (group->cl.items[group->scanIndex]->subcontacts[i].hContact == dwItem) { #ifdef _DEBUG if (IsBadWritePtr(&group->cl.items[group->scanIndex]->subcontacts[i], sizeof(ClcContact))) diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 782ac49787..66c970a140 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -314,7 +314,7 @@ int RestoreSelection(ClcData *dat, MCONTACT hSelected) ClcContact *selcontact = NULL; ClcGroup *selgroup = NULL; - if (!hSelected || !pcli->pfnFindItem(dat->hWnd, dat, (HANDLE)hSelected, &selcontact, &selgroup, NULL)) { + if (!hSelected || !pcli->pfnFindItem(dat->hWnd, dat, hSelected, &selcontact, &selgroup, NULL)) { dat->selection = -1; return dat->selection; } @@ -579,7 +579,7 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) if (savedInfo[i].parentId == -1) group = &dat->list; else { - if (!pcli->pfnFindItem(hwnd, dat, HANDLE(savedInfo[i].parentId | HCONTACT_ISGROUP), &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, savedInfo[i].parentId | HCONTACT_ISGROUP, &contact, NULL, NULL)) continue; group = contact->group; } diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index 910776628d..5a65694d73 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -108,7 +108,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara { int i; if (wParam != CLGN_ROOT) { - if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)lParam, &contact, &group, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, lParam, &contact, &group, NULL)) return NULL; i = List_IndexOf((SortedList*)&group->cl,contact); if (i < 0) return 0; @@ -183,7 +183,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara ClcGroup *tgroup; int index = -1; int mainindex = -1; - if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, &group, NULL)) break; for (tgroup = group; tgroup; tgroup = tgroup->parent) pcli->pfnSetGroupExpand(hwnd, dat, tgroup, 1); @@ -217,7 +217,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara if (LOWORD(lParam) >= dat->extraColumnsCount) return 0; - if (!pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) return 0; contact->iExtraImage[LOWORD(lParam)] = HIWORD(lParam); -- cgit v1.2.3