From 64e6441d9c017663df134b1b02324295e0450baf Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 29 Aug 2018 08:31:08 +0200 Subject: Windows code: Fix clang-tidy warnings about C-style casts Replace by reinterpret_cast or const_cast, respectively. Use auto when initializing a variable to fix Clang warnings about repeating the type name, do minor tidying along the way, and a few conversions of 0 or NULL to nullptr. Change-Id: Ieb271a87ddcf064f536e1ff05d23b1e688b1b56a Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- src/corelib/kernel/qeventdispatcher_win.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/corelib/kernel/qeventdispatcher_win.cpp') diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index f1a4088d98..2862f42b2b 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -120,7 +120,7 @@ void WINAPI QT_WIN_CALLBACK qt_fast_timer_proc(uint timerId, uint /*reserved*/, { if (!timerId) // sanity check return; - WinTimerInfo *t = (WinTimerInfo*)user; + auto t = reinterpret_cast(user); Q_ASSERT(t); QCoreApplication::postEvent(t->dispatcher, new QTimerEvent(t->timerId)); } @@ -146,9 +146,9 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA } #ifdef GWLP_USERDATA - QEventDispatcherWin32 *q = (QEventDispatcherWin32 *) GetWindowLongPtr(hwnd, GWLP_USERDATA); + auto q = reinterpret_cast(GetWindowLongPtr(hwnd, GWLP_USERDATA)); #else - QEventDispatcherWin32 *q = (QEventDispatcherWin32 *) GetWindowLong(hwnd, GWL_USERDATA); + auto q = reinterpret_cast(GetWindowLong(hwnd, GWL_USERDATA)); #endif QEventDispatcherWin32Private *d = 0; if (q != 0) @@ -369,9 +369,9 @@ static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatch } #ifdef GWLP_USERDATA - SetWindowLongPtr(wnd, GWLP_USERDATA, (LONG_PTR)eventDispatcher); + SetWindowLongPtr(wnd, GWLP_USERDATA, reinterpret_cast(eventDispatcher)); #else - SetWindowLong(wnd, GWL_USERDATA, (LONG)eventDispatcher); + SetWindowLong(wnd, GWL_USERDATA, reinterpret_cast(eventDispatcher)); #endif return wnd; @@ -603,7 +603,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) if (haveMessage) { // WinCE doesn't support hooks at all, so we have to call this by hand :( if (!d->getMessageHook) - (void) qt_GetMessageHook(0, PM_REMOVE, (LPARAM) &msg); + (void) qt_GetMessageHook(0, PM_REMOVE, reinterpret_cast(&msg)); if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) { if (seenWM_QT_SENDPOSTEDEVENTS) { -- cgit v1.2.3