From 8937c49faab219b51b9863847406a21945d3a9cb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 4 Apr 2018 14:15:55 +0300 Subject: Windows lists: - fix for a 64-bit issue that could cause a crash; - code cleaning --- src/mir_app/src/clc.cpp | 2 +- src/mir_app/src/proto_utils.cpp | 2 +- src/mir_core/src/windowlist.cpp | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index d35e8478d2..d3c92eee22 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -254,7 +254,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam switch (uMsg) { case WM_CREATE: - WindowList_Add(hClcWindowList, hwnd, 0); + WindowList_Add(hClcWindowList, hwnd); cli.pfnRegisterFileDropping(hwnd); if (dat == nullptr) { dat = new ClcData(); diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index 787187f616..6fef3ccdab 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -229,7 +229,7 @@ void PROTO_INTERFACE::WindowSubscribe(HWND hwnd) if (m_hWindowList == nullptr) m_hWindowList = WindowList_Create(); - WindowList_Add(m_hWindowList, hwnd, 0); + WindowList_Add(m_hWindowList, hwnd); } void PROTO_INTERFACE::WindowUnsubscribe(HWND hwnd) diff --git a/src/mir_core/src/windowlist.cpp b/src/mir_core/src/windowlist.cpp index f997352fe9..8d150fda2c 100644 --- a/src/mir_core/src/windowlist.cpp +++ b/src/mir_core/src/windowlist.cpp @@ -26,12 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct TWindowListItem { - TWindowListItem(MCONTACT _contact, HWND _wnd) : - hContact(_contact), + TWindowListItem(UINT_PTR _param, HWND _wnd) : + param(_param), hWnd(_wnd) {} - MCONTACT hContact; + UINT_PTR param; HWND hWnd; }; @@ -53,12 +53,12 @@ MIR_CORE_DLL(void) WindowList_Destroy(MWindowList &hList) hList = nullptr; } -MIR_CORE_DLL(int) WindowList_Add(MWindowList hList, HWND hwnd, MCONTACT hContact) +MIR_CORE_DLL(int) WindowList_Add(MWindowList hList, HWND hwnd, UINT_PTR param) { if (hList == nullptr) return 1; - hList->insert(new TWindowListItem(hContact, hwnd)); + hList->insert(new TWindowListItem(param, hwnd)); return 0; } @@ -75,12 +75,12 @@ MIR_CORE_DLL(int) WindowList_Remove(MWindowList hList, HWND hwnd) return 1; } -MIR_CORE_DLL(HWND) WindowList_Find(MWindowList hList, MCONTACT hContact) +MIR_CORE_DLL(HWND) WindowList_Find(MWindowList hList, UINT_PTR param) { if (hList == nullptr) return nullptr; - TWindowListItem *p = hList->find((TWindowListItem*)&hContact); + TWindowListItem *p = hList->find((TWindowListItem*)¶m); return (p == nullptr) ? nullptr : p->hWnd; } -- cgit v1.2.3