From 2149b650ea1f4efb174a8559a4621c467492e4a0 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 30 Apr 2012 16:09:05 +1000 Subject: [PATCH] Fixed compile of QSslSocket with -qtnamespace on Windows. Q_DECLARE_METATYPE must be outside of the qt namespace. System headers must be included outside of the qt namespace. Change-Id: I2f48b1df87e5edae2baee6ce813af08d3e011dc0 Reviewed-by: Sergio Ahumada Reviewed-by: Toby Tomkins Reviewed-by: Shane Kearns --- src/network/ssl/qsslsocket_openssl.cpp | 6 ++++-- src/network/ssl/qsslsocket_p.h | 18 +++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 2247148d31..bac837e62f 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -60,6 +60,10 @@ #include #include // for loading the security lib for the CA store +#ifdef Q_OS_WIN +Q_DECLARE_METATYPE(QSslCertificate); +#endif + QT_BEGIN_NAMESPACE #if defined(Q_OS_MAC) && !defined(Q_OS_IOS) @@ -1340,8 +1344,6 @@ void QSslSocketBackendPrivate::_q_caRootLoaded(QSslCertificate cert, QSslCertifi continueHandshake(); } -Q_DECLARE_METATYPE(QSslCertificate); - class QWindowsCaRootFetcherThread : public QThread { public: diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index 3b97b5da6d..5e3148d1b7 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -64,22 +64,26 @@ #include -QT_BEGIN_NAMESPACE - #if defined(Q_OS_MAC) #include #include -#ifndef Q_OS_IOS - typedef OSStatus (*PtrSecCertificateGetData)(SecCertificateRef, CSSM_DATA_PTR); - typedef OSStatus (*PtrSecTrustSettingsCopyCertificates)(int, CFArrayRef*); - typedef OSStatus (*PtrSecTrustCopyAnchorCertificates)(CFArrayRef*); -#endif #elif defined(Q_OS_WIN) #include #include #ifndef HCRYPTPROV_LEGACY #define HCRYPTPROV_LEGACY HCRYPTPROV #endif +#endif + +QT_BEGIN_NAMESPACE + +#if defined(Q_OS_MAC) && !defined(Q_OS_IOS) + typedef OSStatus (*PtrSecCertificateGetData)(SecCertificateRef, CSSM_DATA_PTR); + typedef OSStatus (*PtrSecTrustSettingsCopyCertificates)(int, CFArrayRef*); + typedef OSStatus (*PtrSecTrustCopyAnchorCertificates)(CFArrayRef*); +#endif + +#if defined(Q_OS_WIN) #if defined(Q_OS_WINCE) typedef HCERTSTORE (WINAPI *PtrCertOpenSystemStoreW)(LPCSTR, DWORD, HCRYPTPROV_LEGACY, DWORD, const void*); #else