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💯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>
bb10
Friedemann Kleint 2018-06-22 10:01:42 +02:00
parent db3c1cb230
commit d88e0fd512
2 changed files with 12 additions and 6 deletions

View File

@ -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 {

View File

@ -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 {