diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-06-22 10:01:42 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-06-22 08:10:30 +0000 |
commit | d88e0fd5126404113b49e8893bf4729537552371 (patch) | |
tree | 0cff88c88809a7959d6cc4456be5e96e1b63ee3c /src/network | |
parent | db3c1cb230e1f2ca9053590d72ecb22a2582c439 (diff) |
QtNetwork/SSL: 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]
by introducing nested casts.
Task-number: QTBUG-68742
Task-number: QTQAINFRA-2095
Change-Id: I8ba6a74e6347dada486ca40c98aa8999957c4281
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/ssl/qsslsocket_openssl11.cpp | 9 | ||||
-rw-r--r-- | src/network/ssl/qsslsocket_opensslpre11.cpp | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/network/ssl/qsslsocket_openssl11.cpp b/src/network/ssl/qsslsocket_openssl11.cpp index 96626b6a0f..d028f5fc00 100644 --- a/src/network/ssl/qsslsocket_openssl11.cpp +++ b/src/network/ssl/qsslsocket_openssl11.cpp @@ -125,9 +125,12 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded() #if defined(Q_OS_WIN) HINSTANCE hLib = LoadLibraryW(L"Crypt32"); if (hLib) { - ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, "CertOpenSystemStoreW"); - ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, "CertFindCertificateInStore"); - ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, "CertCloseStore"); + ptrCertOpenSystemStoreW = reinterpret_cast<PtrCertOpenSystemStoreW>( + reinterpret_cast<QFunctionPointer>(GetProcAddress(hLib, "CertOpenSystemStoreW"))); + ptrCertFindCertificateInStore = reinterpret_cast<PtrCertFindCertificateInStore>( + reinterpret_cast<QFunctionPointer>(GetProcAddress(hLib, "CertFindCertificateInStore"))); + ptrCertCloseStore = reinterpret_cast<PtrCertCloseStore>( + reinterpret_cast<QFunctionPointer>(GetProcAddress(hLib, "CertCloseStore"))); if (!ptrCertOpenSystemStoreW || !ptrCertFindCertificateInStore || !ptrCertCloseStore) qCWarning(lcSsl, "could not resolve symbols in crypt32 library"); // should never happen } else { diff --git a/src/network/ssl/qsslsocket_opensslpre11.cpp b/src/network/ssl/qsslsocket_opensslpre11.cpp index 5782df65cc..062e03f4e6 100644 --- a/src/network/ssl/qsslsocket_opensslpre11.cpp +++ b/src/network/ssl/qsslsocket_opensslpre11.cpp @@ -254,9 +254,12 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded() #if defined(Q_OS_WIN) HINSTANCE hLib = LoadLibraryW(L"Crypt32"); if (hLib) { - ptrCertOpenSystemStoreW = (PtrCertOpenSystemStoreW)GetProcAddress(hLib, "CertOpenSystemStoreW"); - ptrCertFindCertificateInStore = (PtrCertFindCertificateInStore)GetProcAddress(hLib, "CertFindCertificateInStore"); - ptrCertCloseStore = (PtrCertCloseStore)GetProcAddress(hLib, "CertCloseStore"); + ptrCertOpenSystemStoreW = reinterpret_cast<PtrCertOpenSystemStoreW>( + reinterpret_cast<QFunctionPointer>(GetProcAddress(hLib, "CertOpenSystemStoreW"))); + ptrCertFindCertificateInStore = reinterpret_cast<PtrCertFindCertificateInStore>( + reinterpret_cast<QFunctionPointer>(GetProcAddress(hLib, "CertFindCertificateInStore"))); + ptrCertCloseStore = reinterpret_cast<PtrCertCloseStore>( + reinterpret_cast<QFunctionPointer>(GetProcAddress(hLib, "CertCloseStore"))); if (!ptrCertOpenSystemStoreW || !ptrCertFindCertificateInStore || !ptrCertCloseStore) qCWarning(lcSsl, "could not resolve symbols in crypt32 library"); // should never happen } else { |