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/thread | |
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/thread')
-rw-r--r-- | src/corelib/thread/qthread_win.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 57ae671897..5714f5236c 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -318,7 +318,8 @@ void qt_set_thread_name(HANDLE threadId, LPCSTR threadName) __try { - RaiseException(0x406D1388, 0, sizeof(info)/sizeof(DWORD), (const ULONG_PTR*)&info); + RaiseException(0x406D1388, 0, sizeof(info)/sizeof(DWORD), + reinterpret_cast<const ULONG_PTR*>(&info)); } __except (EXCEPTION_CONTINUE_EXECUTION) { @@ -365,7 +366,7 @@ unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(voi #if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINRT) // sets the name of the current thread. QByteArray objectName = thr->objectName().toLocal8Bit(); - qt_set_thread_name((HANDLE)-1, + qt_set_thread_name(HANDLE(-1), objectName.isEmpty() ? thr->metaObject()->className() : objectName.constData()); #endif @@ -508,8 +509,9 @@ void QThread::start(Priority priority) this, CREATE_SUSPENDED, &(d->id)); #else // MSVC -MD or -MDd or MinGW build - d->handle = (Qt::HANDLE) CreateThread(NULL, d->stackSize, (LPTHREAD_START_ROUTINE)QThreadPrivate::start, - this, CREATE_SUSPENDED, reinterpret_cast<LPDWORD>(&d->id)); + d->handle = CreateThread(nullptr, d->stackSize, + reinterpret_cast<LPTHREAD_START_ROUTINE>(QThreadPrivate::start), + this, CREATE_SUSPENDED, reinterpret_cast<LPDWORD>(&d->id)); #endif // Q_OS_WINRT if (!d->handle) { |