diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-06-22 09:57:55 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-06-25 14:56:19 +0000 |
commit | e21d1d38564dde337ab60636e28bfe8d5b6e67df (patch) | |
tree | ef0ea0f4c87d4a34cc242cb26335bac237d7a69b /src/corelib | |
parent | 7c34e0a7b48572be1f9e3fb45911a13b01798e37 (diff) |
QtCore/QtNetwork/QTestlib: Fix build with MinGW/g++ 8.1 x64
Fix warnings about invalid function type casts (return types
conflicting with the FARPROC returned by GetProcAddress()) like:
corelib\global\qoperatingsystemversion_win.cpp:100:48: error: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'RtlGetVersionFunction' {aka 'long int (*)(_OSVERSIONINFOW*)'} [-Werror=cast-function-type]
io\qlockfile_win.cpp:158:85: error: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'GetModuleFileNameExFunc' {aka 'long unsigned int (*)(void*, HINSTANCE__*, wchar_t*, long unsigned int)'} [-Werror=cast-function-type]
by introducing nested casts.
Task-number: QTBUG-68742
Task-number: QTQAINFRA-2095
Change-Id: I3a5d2ea901bf5dc35963c589d61cf3dc7393377a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qoperatingsystemversion_win.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qlockfile_win.cpp | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/corelib/global/qoperatingsystemversion_win.cpp b/src/corelib/global/qoperatingsystemversion_win.cpp index f3662ae1f9..7659fb2550 100644 --- a/src/corelib/global/qoperatingsystemversion_win.cpp +++ b/src/corelib/global/qoperatingsystemversion_win.cpp @@ -97,7 +97,7 @@ static inline OSVERSIONINFOEX determineWinOsVersion() // because linking to it at load time will not pass the Windows App Certification Kit // https://msdn.microsoft.com/en-us/library/windows/hardware/ff561910.aspx RtlGetVersionFunction pRtlGetVersion = reinterpret_cast<RtlGetVersionFunction>( - GetProcAddressA(ntdll, "RtlGetVersion")); + reinterpret_cast<QFunctionPointer>(GetProcAddressA(ntdll, "RtlGetVersion"))); if (Q_UNLIKELY(!pRtlGetVersion)) return result; diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp index 6b8028460c..277f8d4230 100644 --- a/src/corelib/io/qlockfile_win.cpp +++ b/src/corelib/io/qlockfile_win.cpp @@ -153,9 +153,8 @@ QString QLockFilePrivate::processNameByPid(qint64 pid) HMODULE hPsapi = LoadLibraryA("psapi"); if (!hPsapi) return QString(); - - GetModuleFileNameExFunc qGetModuleFileNameEx - = (GetModuleFileNameExFunc)GetProcAddress(hPsapi, "GetModuleFileNameExW"); + GetModuleFileNameExFunc qGetModuleFileNameEx = reinterpret_cast<GetModuleFileNameExFunc>( + reinterpret_cast<QFunctionPointer>(GetProcAddress(hPsapi, "GetModuleFileNameExW"))); if (!qGetModuleFileNameEx) { FreeLibrary(hPsapi); return QString(); |