diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-08-29 08:31:08 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-08-30 06:26:44 +0000 |
commit | 64e6441d9c017663df134b1b02324295e0450baf (patch) | |
tree | d89cb4bed3fcfddacdc6896c36e0d1bfddc35034 /src/corelib/kernel/qeventdispatcher_win.cpp | |
parent | f9431f5632ca577a099bd4063f1412cff81f5f8d (diff) |
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 <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qeventdispatcher_win.cpp')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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<WinTimerInfo*>(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<QEventDispatcherWin32 *>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); #else - QEventDispatcherWin32 *q = (QEventDispatcherWin32 *) GetWindowLong(hwnd, GWL_USERDATA); + auto q = reinterpret_cast<QEventDispatcherWin32 *>(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<LONG_PTR>(eventDispatcher)); #else - SetWindowLong(wnd, GWL_USERDATA, (LONG)eventDispatcher); + SetWindowLong(wnd, GWL_USERDATA, reinterpret_cast<LONG>(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<LPARAM>(&msg)); if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) { if (seenWM_QT_SENDPOSTEDEVENTS) { |