From 94119478207034b767c1d0a4fa5d8950f7b07b02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 4 Aug 2022 18:18:37 +0200 Subject: Use C++ casts, nullptr. --- c/listview.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'c/listview.cpp') diff --git a/c/listview.cpp b/c/listview.cpp index 82c6df6..0392941 100644 --- a/c/listview.cpp +++ b/c/listview.cpp @@ -20,12 +20,13 @@ ListView::ListView(const HWND hWndParent, const HMENU hMenu, const DWORD dwStyle L"", dwStyle|WS_CHILD|WS_VISIBLE|WS_VSCROLL|WS_TABSTOP|LVS_REPORT|LVS_SHOWSELALWAYS, 0, 0, 0, 0, - hWndParent, hMenu, GetModuleHandle(NULL), this)); - m_proc0 = (WNDPROC)SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)::WndProc); + hWndParent, hMenu, GetModuleHandle(nullptr), this)); + m_proc0 = reinterpret_cast(SetWindowLongPtr( + hWnd, GWLP_WNDPROC, reinterpret_cast(::WndProc))); - Require(SetProp(hWnd, L"this", (HANDLE)this)); + Require(SetProp(hWnd, L"this", reinterpret_cast(this))); ListView_SetExtendedListViewStyle(hWnd, LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER); - SendMessage(hWnd, WM_SETFONT, (WPARAM)g_hfNormal, MAKELPARAM(FALSE, 0)); + SendMessage(hWnd, WM_SETFONT, reinterpret_cast(g_hfNormal), MAKELPARAM(FALSE, 0)); } int ListView::Height() @@ -47,12 +48,12 @@ void ListView::UpdateTheme(const BOOL bThemeActive) theme = L"Explorer"; action = UIS_SET; } else { - theme = NULL; + theme = nullptr; action = UIS_CLEAR; } /* Use modern "Explorer" theme. */ - SetWindowTheme(hWnd, theme, NULL); + SetWindowTheme(hWnd, theme, nullptr); /* Hide focus rectangles. */ SendMessage(hWnd, WM_UPDATEUISTATE, MAKEWPARAM(action, UISF_HIDEFOCUS), 0); @@ -64,7 +65,7 @@ LRESULT CALLBACK ListView::WndProc(const HWND hWnd, const UINT uMsg, extern DlvDragger g_dragDlv; switch (uMsg) { case WM_NOTIFY: - switch (((NMHDR*)lParam)->code) { + switch (reinterpret_cast(lParam)->code) { case HDN_ENDTRACK: UpdateLayout(); return TRUE; @@ -83,7 +84,7 @@ LRESULT CALLBACK ListView::WndProc(const HWND hWnd, const UINT uMsg, LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, const LPARAM lParam) { - ListView* const lv = (ListView*)GetProp(hWnd, L"this"); + ListView* const lv = reinterpret_cast(GetProp(hWnd, L"this")); if (uMsg == WM_DESTROY) RemoveProp(hWnd, L"this"); -- cgit v1.2.3