From 70406170f5313e9138fc458c5bac6c9f54d9faec Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sun, 19 Jan 2020 17:57:35 +0100 Subject: [PATCH] Cleanup Qt version checks --- include/QtCrypto/qca_securelayer.h | 8 -- plugins/qca-botan/qca-botan.cpp | 6 -- plugins/qca-cyrus-sasl/qca-cyrus-sasl.cpp | 5 -- plugins/qca-gcrypt/qca-gcrypt.cpp | 6 -- plugins/qca-gnupg/qca-gnupg.cpp | 5 -- plugins/qca-logger/qca-logger.cpp | 5 -- plugins/qca-nss/qca-nss.cpp | 6 -- plugins/qca-ossl/qca-ossl.cpp | 5 -- plugins/qca-pkcs11/qca-pkcs11.cpp | 6 -- plugins/qca-softstore/qca-softstore.cpp | 6 -- plugins/qca-test/qca-test.cpp | 5 -- plugins/qca-wincrypto/qca-wincrypto.cpp | 6 -- plugins/qca-wingss/qca-wingss.cpp | 94 ---------------------- src/botantools/botan/mux_qt/mux_qt.cpp | 4 - src/qca_keystore.cpp | 46 ----------- src/qca_securelayer.cpp | 28 ------- src/support/console.cpp | 4 - src/support/qpipe.cpp | 57 ------------- src/support/synchronizer.cpp | 20 ----- src/support/syncthread.cpp | 12 --- tools/qcatool/main.cpp | 12 --- unittest/dsaunittest/dsaunittest.cpp | 8 -- unittest/hashunittest/hashunittest.cpp | 4 - unittest/keygenunittest/keygenunittest.cpp | 12 --- unittest/metatype/metatype.cpp | 4 - unittest/rsaunittest/rsaunittest.cpp | 4 - 26 files changed, 378 deletions(-) diff --git a/include/QtCrypto/qca_securelayer.h b/include/QtCrypto/qca_securelayer.h index 14caad26..1858e19a 100644 --- a/include/QtCrypto/qca_securelayer.h +++ b/include/QtCrypto/qca_securelayer.h @@ -783,11 +783,7 @@ protected: \param signal the name of the signal that has been connected to. */ -#if QT_VERSION >= 0x050000 void connectNotify(const QMetaMethod &signal) override; -#else - void connectNotify(const char *signal); -#endif /** Called when a connection is removed from a particular signal @@ -795,11 +791,7 @@ protected: \param signal the name of the signal that has been disconnected from. */ -#if QT_VERSION >= 0x050000 void disconnectNotify(const QMetaMethod &signal) override; -#else - void disconnectNotify(const char *signal); -#endif private: Q_DISABLE_COPY(TLS) diff --git a/plugins/qca-botan/qca-botan.cpp b/plugins/qca-botan/qca-botan.cpp index bc7db6e2..c608f7f4 100644 --- a/plugins/qca-botan/qca-botan.cpp +++ b/plugins/qca-botan/qca-botan.cpp @@ -595,16 +595,10 @@ private: class botanPlugin : public QObject, public QCAPlugin { Q_OBJECT -#if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "com.affinix.qca.Plugin/1.0") -#endif Q_INTERFACES(QCAPlugin) public: QCA::Provider *createProvider() override { return new botanProvider; } }; #include "qca-botan.moc" - -#if QT_VERSION < 0x050000 -Q_EXPORT_PLUGIN2(qca_botan, botanPlugin); -#endif diff --git a/plugins/qca-cyrus-sasl/qca-cyrus-sasl.cpp b/plugins/qca-cyrus-sasl/qca-cyrus-sasl.cpp index 385d46ea..8aa6c294 100644 --- a/plugins/qca-cyrus-sasl/qca-cyrus-sasl.cpp +++ b/plugins/qca-cyrus-sasl/qca-cyrus-sasl.cpp @@ -937,9 +937,7 @@ using namespace saslQCAPlugin; class saslPlugin : public QObject, public QCAPlugin { Q_OBJECT -#if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "com.affinix.qca.Plugin/1.0") -#endif Q_INTERFACES(QCAPlugin) public: Provider *createProvider() override { return new saslProvider; } @@ -947,6 +945,3 @@ public: #include "qca-cyrus-sasl.moc" -#if QT_VERSION < 0x050000 -Q_EXPORT_PLUGIN2(qca_cyrus_sasl, saslPlugin) -#endif diff --git a/plugins/qca-gcrypt/qca-gcrypt.cpp b/plugins/qca-gcrypt/qca-gcrypt.cpp index 5a7ef510..f7242541 100644 --- a/plugins/qca-gcrypt/qca-gcrypt.cpp +++ b/plugins/qca-gcrypt/qca-gcrypt.cpp @@ -684,16 +684,10 @@ public: class gcryptPlugin : public QObject, public QCAPlugin { Q_OBJECT -#if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "com.affinix.qca.Plugin/1.0") -#endif Q_INTERFACES(QCAPlugin) public: QCA::Provider *createProvider() override { return new gcryptProvider; } }; #include "qca-gcrypt.moc" - -#if QT_VERSION < 0x050000 -Q_EXPORT_PLUGIN2(qca_gcrypt, gcryptPlugin) -#endif diff --git a/plugins/qca-gnupg/qca-gnupg.cpp b/plugins/qca-gnupg/qca-gnupg.cpp index 330bb5d2..d8ad943d 100644 --- a/plugins/qca-gnupg/qca-gnupg.cpp +++ b/plugins/qca-gnupg/qca-gnupg.cpp @@ -66,15 +66,10 @@ public: class gnupgPlugin : public QObject, public QCAPlugin { Q_OBJECT -#if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "com.affinix.qca.Plugin/1.0") -#endif Q_INTERFACES(QCAPlugin) public: QCA::Provider *createProvider() override { return new gnupgProvider; } }; #include "qca-gnupg.moc" -#if QT_VERSION < 0x050000 -Q_EXPORT_PLUGIN2(qca_gnupg, gnupgPlugin) -#endif diff --git a/plugins/qca-logger/qca-logger.cpp b/plugins/qca-logger/qca-logger.cpp index 59c1a690..d7170abb 100644 --- a/plugins/qca-logger/qca-logger.cpp +++ b/plugins/qca-logger/qca-logger.cpp @@ -204,9 +204,7 @@ private: class loggerPlugin : public QObject, public QCAPlugin { Q_OBJECT -#if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "com.affinix.qca.Plugin/1.0") -#endif Q_INTERFACES(QCAPlugin) public: @@ -215,6 +213,3 @@ public: #include "qca-logger.moc" -#if QT_VERSION < 0x050000 -Q_EXPORT_PLUGIN2(qca_logger, loggerPlugin) -#endif diff --git a/plugins/qca-nss/qca-nss.cpp b/plugins/qca-nss/qca-nss.cpp index 0fd74e8e..b7de2e75 100644 --- a/plugins/qca-nss/qca-nss.cpp +++ b/plugins/qca-nss/qca-nss.cpp @@ -536,16 +536,10 @@ public: class nssPlugin : public QObject, public QCAPlugin { Q_OBJECT -#if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "com.affinix.qca.Plugin/1.0") -#endif Q_INTERFACES( QCAPlugin ) public: QCA::Provider *createProvider() override { return new nssProvider; } }; #include "qca-nss.moc" - -#if QT_VERSION < 0x050000 -Q_EXPORT_PLUGIN2(qca_nss, nssPlugin) -#endif diff --git a/plugins/qca-ossl/qca-ossl.cpp b/plugins/qca-ossl/qca-ossl.cpp index b498af48..a5754225 100644 --- a/plugins/qca-ossl/qca-ossl.cpp +++ b/plugins/qca-ossl/qca-ossl.cpp @@ -7650,9 +7650,7 @@ public: class opensslPlugin : public QObject, public QCAPlugin { Q_OBJECT -#if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "com.affinix.qca.Plugin/1.0") -#endif Q_INTERFACES(QCAPlugin) public: Provider *createProvider() override { return new opensslProvider; } @@ -7660,6 +7658,3 @@ public: #include "qca-ossl.moc" -#if QT_VERSION < 0x050000 -Q_EXPORT_PLUGIN2(qca_ossl, opensslPlugin) -#endif diff --git a/plugins/qca-pkcs11/qca-pkcs11.cpp b/plugins/qca-pkcs11/qca-pkcs11.cpp index bb037043..be5ef3cd 100644 --- a/plugins/qca-pkcs11/qca-pkcs11.cpp +++ b/plugins/qca-pkcs11/qca-pkcs11.cpp @@ -3029,9 +3029,7 @@ pkcs11Provider::_pinPromptHook ( class pkcs11Plugin : public QObject, public QCAPlugin { Q_OBJECT -#if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "com.affinix.qca.Plugin/1.0") -#endif Q_INTERFACES(QCAPlugin) public: @@ -3039,7 +3037,3 @@ public: }; #include "qca-pkcs11.moc" - -#if QT_VERSION < 0x050000 -Q_EXPORT_PLUGIN2(qca_pkcs11, pkcs11Plugin) -#endif diff --git a/plugins/qca-softstore/qca-softstore.cpp b/plugins/qca-softstore/qca-softstore.cpp index c7f0bf15..11955e8c 100644 --- a/plugins/qca-softstore/qca-softstore.cpp +++ b/plugins/qca-softstore/qca-softstore.cpp @@ -1445,9 +1445,7 @@ const int softstoreProvider::_CONFIG_MAX_ENTRIES = 50; class softstorePlugin : public QObject, public QCAPlugin { Q_OBJECT -#if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "com.affinix.qca.Plugin/1.0") -#endif Q_INTERFACES(QCAPlugin) public: @@ -1455,7 +1453,3 @@ public: }; #include "qca-softstore.moc" - -#if QT_VERSION < 0x050000 -Q_EXPORT_PLUGIN2(qca_softstore, softstorePlugin) -#endif diff --git a/plugins/qca-test/qca-test.cpp b/plugins/qca-test/qca-test.cpp index 6023f6ab..017bf740 100644 --- a/plugins/qca-test/qca-test.cpp +++ b/plugins/qca-test/qca-test.cpp @@ -807,9 +807,7 @@ Provider::Context *TestProvider::createContext(const QString &type) class TestPlugin : public QObject, public QCAPlugin { Q_OBJECT -#if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "com.affinix.qca.Plugin/1.0") -#endif Q_INTERFACES(QCAPlugin) public: virtual Provider *createProvider() { return new TestProvider; } @@ -817,6 +815,3 @@ public: #include "qca-test.moc" -#if QT_VERSION < 0x050000 -Q_EXPORT_PLUGIN2(qca_test, TestPlugin); -#endif diff --git a/plugins/qca-wincrypto/qca-wincrypto.cpp b/plugins/qca-wincrypto/qca-wincrypto.cpp index 1aa87e17..9da21d6b 100644 --- a/plugins/qca-wincrypto/qca-wincrypto.cpp +++ b/plugins/qca-wincrypto/qca-wincrypto.cpp @@ -102,19 +102,13 @@ public: class WinCryptoPlugin : public QObject, public QCAPlugin { Q_OBJECT -#if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "com.affinix.qca.Plugin/1.0") -#endif Q_INTERFACES(QCAPlugin) public: virtual QCA::Provider *createProvider() { return new WinCryptoProvider; } }; -#if QT_VERSION < 0x050000 -#include "qca-wincrypto.moc" -#endif - Q_EXPORT_PLUGIN2(qca_wincrypto, WinCryptoPlugin); #endif // Q_OS_WIN32 diff --git a/plugins/qca-wingss/qca-wingss.cpp b/plugins/qca-wingss/qca-wingss.cpp index fde55a3f..b8b3e7f5 100644 --- a/plugins/qca-wingss/qca-wingss.cpp +++ b/plugins/qca-wingss/qca-wingss.cpp @@ -290,18 +290,8 @@ bool sspi_load() pInitSecurityInterface.ptr = 0; QString securityEntrypoint; -#if QT_VERSION >= 0x050000 securityEntrypoint = QString::fromUtf16((const ushort *)SECURITY_ENTRYPOINTW); pInitSecurityInterface.W = (INIT_SECURITY_INTERFACE_W)(sspi_lib->resolve(securityEntrypoint.toLatin1().data())); -#else - QT_WA( - securityEntrypoint = QString::fromUtf16((const ushort *)SECURITY_ENTRYPOINTW); - pInitSecurityInterface.W = (INIT_SECURITY_INTERFACE_W)(sspi_lib->resolve(securityEntrypoint.toLatin1().data())); - , - securityEntrypoint = QString::fromLatin1(SECURITY_ENTRYPOINT_ANSIA); - pInitSecurityInterface.A = (INIT_SECURITY_INTERFACE_A)(sspi_lib->resolve(securityEntrypoint.toLatin1().data())); - ) -#endif if(!pInitSecurityInterface.ptr) { sspi_lib->unload(); @@ -318,15 +308,7 @@ bool sspi_load() } funcs; funcs.ptr = 0; -#if QT_VERSION >= 0x050000 funcs.W = (PMySecurityFunctionTableW)pInitSecurityInterface.W(); -#else - QT_WA( - funcs.W = (PMySecurityFunctionTableW)pInitSecurityInterface.W(); - , - funcs.A = pInitSecurityInterface.A(); - ) -#endif sspi_log(QString("%1() = %2\n").arg(securityEntrypoint, ptr_toString(funcs.ptr))); if(!funcs.ptr) @@ -337,15 +319,7 @@ bool sspi_load() return false; } -#if QT_VERSION >= 0x050000 sspi.W = funcs.W; -#else - QT_WA( - sspi.W = funcs.W; - , - sspi.A = funcs.A; - ) -#endif return true; } @@ -364,7 +338,6 @@ static QList sspi_get_packagelist_direct() { QList out; -#if QT_VERSION >= 0x050000 ULONG cPackages; SecPkgInfoW *pPackageInfo; SECURITY_STATUS ret = sspi.W->EnumerateSecurityPackagesW(&cPackages, &pPackageInfo); @@ -387,55 +360,6 @@ static QList sspi_get_packagelist_direct() ret = sspi.W->FreeContextBuffer(&pPackageInfo); sspi_log(QString("FreeContextBuffer() = %1\n").arg(SECURITY_STATUS_toString(ret))); -#else - QT_WA( - ULONG cPackages; - SecPkgInfoW *pPackageInfo; - SECURITY_STATUS ret = sspi.W->EnumerateSecurityPackagesW(&cPackages, &pPackageInfo); - sspi_log(QString("EnumerateSecurityPackages() = %1\n").arg(SECURITY_STATUS_toString(ret))); - if(ret != SEC_E_OK) - return out; - - for(int n = 0; n < (int)cPackages; ++n) - { - SecPkgInfoW *p = &pPackageInfo[n]; - SspiPackage i; - i.name = QString::fromUtf16((const ushort *)p->Name); - i.caps = p->fCapabilities; - i.version = p->wVersion; - i.rpcid = p->wRPCID; - i.maxtok = p->cbMaxToken; - i.comment = QString::fromUtf16((const ushort *)p->Comment); - out += i; - } - - ret = sspi.W->FreeContextBuffer(&pPackageInfo); - sspi_log(QString("FreeContextBuffer() = %1\n").arg(SECURITY_STATUS_toString(ret))); - , - ULONG cPackages; - SecPkgInfoA *pPackageInfo; - SECURITY_STATUS ret = sspi.A->EnumerateSecurityPackagesA(&cPackages, &pPackageInfo); - sspi_log(QString("EnumerateSecurityPackages() = %1\n").arg(SECURITY_STATUS_toString(ret))); - if(ret != SEC_E_OK) - return out; - - for(int n = 0; n < (int)cPackages; ++n) - { - SecPkgInfoA *p = &pPackageInfo[n]; - SspiPackage i; - i.name = QString::fromLocal8Bit(p->Name); - i.caps = p->fCapabilities; - i.version = p->wVersion; - i.rpcid = p->wRPCID; - i.maxtok = p->cbMaxToken; - i.comment = QString::fromLocal8Bit(p->Comment); - out += i; - } - - ret = sspi.A->FreeContextBuffer(&pPackageInfo); - sspi_log(QString("FreeContextBuffer() = %1\n").arg(SECURITY_STATUS_toString(ret))); - ) -#endif return out; } @@ -534,19 +458,6 @@ public: ReturnCode init(const QString &_spn) { - // kerberos only works on unicode-based systems. we do this - // check so we can lazily use the W api from here on out. -#if QT_VERSION < 0x050000 - bool validSystem; - QT_WA( - validSystem = true; - , - validSystem = false; - ) - if(!validSystem) - return ErrorInvalidSystem; -#endif - // ensure kerberos is available bool found = false; quint32 _maxtok = 0; @@ -2289,9 +2200,7 @@ using namespace wingssQCAPlugin; class wingssPlugin : public QObject, public QCAPlugin { Q_OBJECT -#if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "com.affinix.qca.Plugin/1.0") -#endif Q_INTERFACES(QCAPlugin) public: @@ -2300,6 +2209,3 @@ public: #include "qca-wingss.moc" -#if QT_VERSION < 0x050000 -Q_EXPORT_PLUGIN2(qca_wingss, wingssPlugin) -#endif diff --git a/src/botantools/botan/mux_qt/mux_qt.cpp b/src/botantools/botan/mux_qt/mux_qt.cpp index 813e97f3..c8d7a81b 100644 --- a/src/botantools/botan/mux_qt/mux_qt.cpp +++ b/src/botantools/botan/mux_qt/mux_qt.cpp @@ -37,10 +37,6 @@ namespace QCA { // WRAPNS_LINE #include namespace QCA { // WRAPNS_LINE -#if QT_VERSION <= 0x040000 && !defined(QT_THREAD_SUPPORT) - #error Your version of Qt does not support threads or mutexes -#endif - namespace Botan { /************************************************* diff --git a/src/qca_keystore.cpp b/src/qca_keystore.cpp index f284c53c..fae63099 100644 --- a/src/qca_keystore.cpp +++ b/src/qca_keystore.cpp @@ -316,7 +316,6 @@ public slots: if(at == -1) return QString(); Item &i = items[at]; -#if QT_VERSION >= 0x050000 if(v.canConvert()) return i.owner->writeEntry(i.storeContextId, v.value()); else if(v.canConvert()) @@ -325,16 +324,6 @@ public slots: return i.owner->writeEntry(i.storeContextId, v.value()); else if(v.canConvert()) return i.owner->writeEntry(i.storeContextId, v.value()); -#else - if(qVariantCanConvert(v)) - return i.owner->writeEntry(i.storeContextId, qVariantValue(v)); - else if(qVariantCanConvert(v)) - return i.owner->writeEntry(i.storeContextId, qVariantValue(v)); - else if(qVariantCanConvert(v)) - return i.owner->writeEntry(i.storeContextId, qVariantValue(v)); - else if(qVariantCanConvert(v)) - return i.owner->writeEntry(i.storeContextId, qVariantValue(v)); -#endif else return QString(); } @@ -802,11 +791,7 @@ bool KeyStoreEntry::ensureAvailable() { QString storeId = this->storeId(); QString entryId = id(); -#if QT_VERSION >= 0x050000 KeyStoreEntryContext *c = (KeyStoreEntryContext *)trackercall("entry", QVariantList() << storeId << entryId).value(); -#else - KeyStoreEntryContext *c = (KeyStoreEntryContext *)qVariantValue(trackercall("entry", QVariantList() << storeId << entryId)); -#endif if(c) change(c); return isAvailable(); @@ -1000,15 +985,10 @@ protected: void run() override { if(type == EntryList) -#if QT_VERSION >= 0x050000 entryList = trackercall("entryList", QVariantList() << trackerId).value< QList >(); -#else - entryList = qVariantValue< QList >(trackercall("entryList", QVariantList() << trackerId)); -#endif else if(type == WriteEntry) { QVariant arg; -#if QT_VERSION >= 0x050000 if(wentry.type == KeyStoreWriteEntry::TypeKeyBundle) arg.setValue(wentry.keyBundle); else if(wentry.type == KeyStoreWriteEntry::TypeCertificate) @@ -1017,16 +997,6 @@ protected: arg.setValue(wentry.crl); else if(wentry.type == KeyStoreWriteEntry::TypePGPKey) arg.setValue(wentry.pgpKey); -#else - if(wentry.type == KeyStoreWriteEntry::TypeKeyBundle) - qVariantSetValue(arg, wentry.keyBundle); - else if(wentry.type == KeyStoreWriteEntry::TypeCertificate) - qVariantSetValue(arg, wentry.cert); - else if(wentry.type == KeyStoreWriteEntry::TypeCRL) - qVariantSetValue(arg, wentry.crl); - else if(wentry.type == KeyStoreWriteEntry::TypePGPKey) - qVariantSetValue(arg, wentry.pgpKey); -#endif // note: each variant in the argument list is resolved // to its native type. so even though it looks like @@ -1243,11 +1213,7 @@ QList KeyStore::entryList() const if(d->trackerId == -1) return QList(); -#if QT_VERSION >= 0x050000 return trackercall("entryList", QVariantList() << d->trackerId).value< QList >(); -#else - return qVariantValue< QList >(trackercall("entryList", QVariantList() << d->trackerId)); -#endif } bool KeyStore::holdsTrustedCertificates() const @@ -1255,11 +1221,7 @@ bool KeyStore::holdsTrustedCertificates() const QList list; if(d->trackerId == -1) return false; -#if QT_VERSION >= 0x050000 list = trackercall("entryTypes", QVariantList() << d->trackerId).value< QList >(); -#else - list = qVariantValue< QList >(trackercall("entryTypes", QVariantList() << d->trackerId)); -#endif if(list.contains(KeyStoreEntry::TypeCertificate) || list.contains(KeyStoreEntry::TypeCRL)) return true; return false; @@ -1270,11 +1232,7 @@ bool KeyStore::holdsIdentities() const QList list; if(d->trackerId == -1) return false; -#if QT_VERSION >= 0x050000 list = trackercall("entryTypes", QVariantList() << d->trackerId).value< QList >(); -#else - list = qVariantValue< QList >(trackercall("entryTypes", QVariantList() << d->trackerId)); -#endif if(list.contains(KeyStoreEntry::TypeKeyBundle) || list.contains(KeyStoreEntry::TypePGPSecretKey)) return true; return false; @@ -1285,11 +1243,7 @@ bool KeyStore::holdsPGPPublicKeys() const QList list; if(d->trackerId == -1) return false; -#if QT_VERSION >= 0x050000 list = trackercall("entryTypes", QVariantList() << d->trackerId).value< QList >(); -#else - list = qVariantValue< QList >(trackercall("entryTypes", QVariantList() << d->trackerId)); -#endif if(list.contains(KeyStoreEntry::TypePGPPublicKey)) return true; return false; diff --git a/src/qca_securelayer.cpp b/src/qca_securelayer.cpp index 5408b5b8..685ace2b 100644 --- a/src/qca_securelayer.cpp +++ b/src/qca_securelayer.cpp @@ -26,9 +26,7 @@ #include "qca_safetimer.h" #include -#if QT_VERSION >= 0x050000 #include -#endif namespace QCA { @@ -1177,7 +1175,6 @@ void TLS::setPacketMTU(int size) const d->c->setMTU(size); } -#if QT_VERSION >= 0x050000 void TLS::connectNotify(const QMetaMethod &signal) { if(signal == QMetaMethod::fromSignal(&TLS::hostNameReceived)) @@ -1201,31 +1198,6 @@ void TLS::disconnectNotify(const QMetaMethod &signal) else if(signal == QMetaMethod::fromSignal(&TLS::handshaken)) d->connect_handshaken = false; } -#else -void TLS::connectNotify(const char *signal) -{ - if(signal == QMetaObject::normalizedSignature(SIGNAL(hostNameReceived()))) - d->connect_hostNameReceived = true; - else if(signal == QMetaObject::normalizedSignature(SIGNAL(certificateRequested()))) - d->connect_certificateRequested = true; - else if(signal == QMetaObject::normalizedSignature(SIGNAL(peerCertificateAvailable()))) - d->connect_peerCertificateAvailable = true; - else if(signal == QMetaObject::normalizedSignature(SIGNAL(handshaken()))) - d->connect_handshaken = true; -} - -void TLS::disconnectNotify(const char *signal) -{ - if(signal == QMetaObject::normalizedSignature(SIGNAL(hostNameReceived()))) - d->connect_hostNameReceived = false; - else if(signal == QMetaObject::normalizedSignature(SIGNAL(certificateRequested()))) - d->connect_certificateRequested = false; - else if(signal == QMetaObject::normalizedSignature(SIGNAL(peerCertificateAvailable()))) - d->connect_peerCertificateAvailable = false; - else if(signal == QMetaObject::normalizedSignature(SIGNAL(handshaken()))) - d->connect_handshaken = false; -} -#endif //---------------------------------------------------------------------------- // SASL::Params diff --git a/src/support/console.cpp b/src/support/console.cpp index 7f7ab056..277cf4e6 100644 --- a/src/support/console.cpp +++ b/src/support/console.cpp @@ -282,11 +282,7 @@ public: SecureArray readSecure(int bytes = -1) { -#if QT_VERSION >= 0x050000 return mycall(worker, "readSecure", QVariantList() << bytes).value(); -#else - return qVariantValue(mycall(worker, "readSecure", QVariantList() << bytes)); -#endif } void writeSecure(const SecureArray &a) diff --git a/src/support/qpipe.cpp b/src/support/qpipe.cpp index 0fe89f56..afeff9c8 100644 --- a/src/support/qpipe.cpp +++ b/src/support/qpipe.cpp @@ -76,16 +76,10 @@ static bool ign_sigpipe = false; static void ignore_sigpipe() { // Set to ignore SIGPIPE once only. -//#if QT_VERSION < 0x040400 QMutexLocker locker(ign_mutex()); if(!ign_sigpipe) { ign_sigpipe = true; -//#else -// static QBasicAtomicInt atom = Q_BASIC_ATOMIC_INITIALIZER(0); -// if(atom.testAndSetRelaxed(0, 1)) -// { -//#endif struct sigaction noaction; memset(&noaction, 0, sizeof(noaction)); noaction.sa_handler = SIG_IGN; @@ -293,15 +287,7 @@ static int pipe_read_avail_console(Q_PIPE_ID pipe) // peek them all rec = (INPUT_RECORD *)malloc(count * sizeof(INPUT_RECORD)); BOOL ret; -#if QT_VERSION >= 0x050000 ret = PeekConsoleInputW(pipe, rec, count, &i); -#else - QT_WA( - ret = PeekConsoleInputW(pipe, rec, count, &i); - , - ret = PeekConsoleInputA(pipe, rec, count, &i); - ) -#endif if(!ret) { free(rec); @@ -349,15 +335,7 @@ static int pipe_read_console(Q_PIPE_ID pipe, ushort *data, int max, bool *eof, Q } else { -#if QT_VERSION >= 0x050000 dec = 0; -#else - QT_WA( - dec = 0; - , - dec = QTextCodec::codecForLocale()->makeDecoder(); - ) -#endif own_decoder = true; } @@ -370,16 +348,7 @@ static int pipe_read_console(Q_PIPE_ID pipe, ushort *data, int max, bool *eof, Q BOOL ret; DWORD i; -#if QT_VERSION >= 0x050000 ret = ReadConsoleW(pipe, &uni, 1, &i, NULL); -#else - QT_WA( - ret = ReadConsoleW(pipe, &uni, 1, &i, NULL); - , - ret = ReadConsoleA(pipe, &ansi, 1, &i, NULL); - use_uni = false; - ) -#endif if(!ret) { // if the first read is an error, then report error @@ -422,25 +391,7 @@ static int pipe_write_console(Q_PIPE_ID pipe, const ushort *data, int size) { DWORD i; BOOL ret; -#if QT_VERSION >= 0x050000 ret = WriteConsoleW(pipe, data, size, &i, NULL); -#else - QT_WA( - ret = WriteConsoleW(pipe, data, size, &i, NULL); - , - // Note: we lose security by converting to QString here, but - // who really cares if we're writing to a *display* ? :) - QByteArray out = QString::fromUtf16(data, size).toLocal8Bit(); - ret = WriteConsoleA(pipe, out.data(), out.size(), &i, NULL); - if(ret) - { - // convert number of bytes to number of unicode chars - i = (DWORD)QString::fromLocal8Bit(out.mid(0, i)).length(); - if(pipe_dword_overflows_int(i)) - return -1; - } - ) -#endif if(!ret) return -1; return (int)i; // safe to cast since 'size' is signed @@ -1052,15 +1003,7 @@ public: // console might need a decoder if(consoleMode) { -#if QT_VERSION >= 0x050000 dec = 0; -#else - QT_WA( - dec = 0; - , - dec = QTextCodec::codecForLocale()->makeDecoder(); - ) -#endif } // pipe reader diff --git a/src/support/synchronizer.cpp b/src/support/synchronizer.cpp index 1ab9ba0f..34bd671d 100644 --- a/src/support/synchronizer.cpp +++ b/src/support/synchronizer.cpp @@ -185,11 +185,7 @@ private slots: int timeLeft = qMax(info.interval - static_cast(info.time.elapsed()), 0); info.fixInterval = true; ed->unregisterTimer(info.id); -#if QT_VERSION >= 0x050000 info.id = ed->registerTimer(timeLeft, Qt::CoarseTimer, target); -#else - info.id = ed->registerTimer(timeLeft, target); -#endif #ifdef TIMERFIXER_DEBUG printf("TimerFixer[%p] adjusting [%d] to %d\n", this, info.id, timeLeft); @@ -249,11 +245,7 @@ private: #endif info.fixInterval = false; ed->unregisterTimer(info.id); -#if QT_VERSION >= 0x050000 info.id = ed->registerTimer(info.interval, Qt::CoarseTimer, target); -#else - info.id = ed->registerTimer(info.interval, target); -#endif } info.time.start(); @@ -272,11 +264,7 @@ private: int id = timers[n].id; for(int i = 0; i < edtimers.count(); ++i) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) if(edtimers[i].timerId == id) -#else - if(edtimers[i].first == id) -#endif { found = true; break; @@ -296,11 +284,7 @@ private: // added? for(int n = 0; n < edtimers.count(); ++n) { -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) int id = edtimers[n].timerId; -#else - int id = edtimers[n].first; -#endif bool found = false; for(int i = 0; i < timers.count(); ++i) { @@ -315,11 +299,7 @@ private: { TimerInfo info; info.id = id; -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) info.interval = edtimers[n].interval; -#else - info.interval = edtimers[n].second; -#endif info.time.start(); timers += info; #ifdef TIMERFIXER_DEBUG diff --git a/src/support/syncthread.cpp b/src/support/syncthread.cpp index 98a06dda..2f964f8d 100644 --- a/src/support/syncthread.cpp +++ b/src/support/syncthread.cpp @@ -32,11 +32,7 @@ QByteArray methodReturnType(const QMetaObject *obj, const QByteArray &method, co for(int n = 0; n < obj->methodCount(); ++n) { QMetaMethod m = obj->method(n); -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) QByteArray sig = m.methodSignature(); -#else - QByteArray sig = m.signature(); -#endif int offset = sig.indexOf('('); if(offset == -1) continue; @@ -64,18 +60,10 @@ bool invokeMethodWithVariants(QObject *obj, const QByteArray &method, const QVar // get return type int metatype = QMetaType::Void; QByteArray retTypeName = methodReturnType(obj->metaObject(), method, argTypes); -#if QT_VERSION >= 0x050000 if(!retTypeName.isEmpty() && retTypeName != "void") -#else - if(!retTypeName.isEmpty()) -#endif { metatype = QMetaType::type(retTypeName.data()); -#if QT_VERSION >= 0x050000 if(metatype == QMetaType::UnknownType) // lookup failed -#else - if(metatype == QMetaType::Void) // lookup failed -#endif return false; } diff --git a/tools/qcatool/main.cpp b/tools/qcatool/main.cpp index c2c5fcb6..4af01868 100644 --- a/tools/qcatool/main.cpp +++ b/tools/qcatool/main.cpp @@ -1306,22 +1306,14 @@ static bool string_is_int(const QString &in) static bool variant_is_bool(const QVariant &in) { -#if QT_VERSION >= 0x050000 if(in.canConvert() && string_is_bool(in.toString())) -#else - if(qVariantCanConvert(in) && string_is_bool(in.toString())) -#endif return true; return false; } static bool variant_is_int(const QVariant &in) { -#if QT_VERSION >= 0x050000 if(in.canConvert() && string_is_int(in.toString())) -#else - if(qVariantCanConvert(in) && string_is_int(in.toString())) -#endif return true; return false; } @@ -1431,11 +1423,7 @@ static QVariantMap provider_config_edit_generic(const QVariantMap &in) newval = prompt_for_bool(QString("bool ") + prompt, val.toBool()); else if(variant_is_int(val)) newval = prompt_for_int(QString("int ") + prompt, val.toInt()); -#if QT_VERSION >= 0x050000 else if(val.canConvert()) -#else - else if(qVariantCanConvert(val)) -#endif newval = prompt_for_string(QString("string ") + prompt, val.toString()); else continue; // skip bogus fields diff --git a/unittest/dsaunittest/dsaunittest.cpp b/unittest/dsaunittest/dsaunittest.cpp index b5965076..5a4546a3 100644 --- a/unittest/dsaunittest/dsaunittest.cpp +++ b/unittest/dsaunittest/dsaunittest.cpp @@ -60,20 +60,12 @@ void DSAUnitTest::testdsa() !QCA::PKey::supportedTypes().contains(QCA::PKey::DSA) || !QCA::PKey::supportedIOTypes().contains(QCA::PKey::DSA)) { -#if QT_VERSION >= 0x050000 QSKIP("DSA not supported!"); -#else - QSKIP("DSA not supported!", SkipAll); -#endif } if (!QCA::DLGroup::supportedGroupSets().contains(QCA::DSA_1024)) { -#if QT_VERSION >= 0x050000 QSKIP("DSA_1024 discrete logarithm group sets not supported!"); -#else - QSKIP("DSA_1024 discrete logarithm group sets not supported!", SkipAll); -#endif } QCA::KeyGenerator keygen; diff --git a/unittest/hashunittest/hashunittest.cpp b/unittest/hashunittest/hashunittest.cpp index 0dd5330e..51251aa8 100644 --- a/unittest/hashunittest/hashunittest.cpp +++ b/unittest/hashunittest/hashunittest.cpp @@ -117,11 +117,7 @@ void HashUnitTest::md2test() foreach(QString provider, providersToTest) { if(!QCA::isSupported("md2", provider)) -#if QT_VERSION >= 0x050000 QSKIP(QString("MD2 not supported for "+provider).toLocal8Bit()); -#else - QSKIP(QString("MD2 not supported for "+provider).toLocal8Bit(), SkipSingle); -#endif QString hashResult = QCA::Hash("md2", provider).hashToString(input); QCOMPARE( hashResult, expectedHash ); } diff --git a/unittest/keygenunittest/keygenunittest.cpp b/unittest/keygenunittest/keygenunittest.cpp index 8e249514..f24d1159 100644 --- a/unittest/keygenunittest/keygenunittest.cpp +++ b/unittest/keygenunittest/keygenunittest.cpp @@ -64,11 +64,7 @@ void KeyGenUnitTest::testRSA() if(!QCA::isSupported("pkey") || !QCA::PKey::supportedTypes().contains(QCA::PKey::RSA) || !QCA::PKey::supportedIOTypes().contains(QCA::PKey::RSA)) -#if QT_VERSION >= 0x050000 QSKIP("RSA not supported!"); -#else - QSKIP("RSA not supported!", SkipAll); -#endif QCA::PrivateKey priv1 = keygen.createRSA( 1024, 65537 ); QCA::RSAPrivateKey rsa1 = priv1.toRSA(); @@ -98,11 +94,7 @@ void KeyGenUnitTest::testDSA() if(!QCA::isSupported("pkey") || !QCA::PKey::supportedTypes().contains(QCA::PKey::DSA) || !QCA::PKey::supportedIOTypes().contains(QCA::PKey::DSA)) -#if QT_VERSION >= 0x050000 QSKIP("DSA not supported!"); -#else - QSKIP("DSA not supported!", SkipAll); -#endif QCA::DLGroup group; QCA::PrivateKey priv2; @@ -145,11 +137,7 @@ void KeyGenUnitTest::testDH() if(!QCA::isSupported("pkey") || !QCA::PKey::supportedTypes().contains(QCA::PKey::DH) || !QCA::PKey::supportedIOTypes().contains(QCA::PKey::DH)) -#if QT_VERSION >= 0x050000 QSKIP("DH not supported!"); -#else - QSKIP("DH not supported!", SkipAll); -#endif QCA::DLGroup group = keygen.createDLGroup( QCA::IETF_1024 ); QCA::PrivateKey priv3 = keygen.createDH( group ); diff --git a/unittest/metatype/metatype.cpp b/unittest/metatype/metatype.cpp index f21e1f9d..481d7193 100644 --- a/unittest/metatype/metatype.cpp +++ b/unittest/metatype/metatype.cpp @@ -90,11 +90,7 @@ void MetaTypeUnitTest::returnTypeTest() QList args; // returns a null type name because that is what void does... -#if QT_VERSION >= 0x050000 QCOMPARE( QByteArray( "void" ), QCA::methodReturnType( testClass1.metaObject(), QByteArray( "voidMethod" ), args ) ); -#else - QCOMPARE( QByteArray(), QCA::methodReturnType( testClass1.metaObject(), QByteArray( "voidMethod" ), args ) ); -#endif QCOMPARE( QByteArray( "QString" ), QCA::methodReturnType( testClass1.metaObject(), QByteArray( "qstringMethod" ), args ) ); // returns a null type, because args don't match diff --git a/unittest/rsaunittest/rsaunittest.cpp b/unittest/rsaunittest/rsaunittest.cpp index 3c86b068..2a847b55 100644 --- a/unittest/rsaunittest/rsaunittest.cpp +++ b/unittest/rsaunittest/rsaunittest.cpp @@ -155,11 +155,7 @@ void RSAUnitTest::testAsymmetricEncryption() !QCA::PKey::supportedTypes("qca-ossl").contains(QCA::PKey::RSA) || !QCA::PKey::supportedIOTypes("qca-ossl").contains(QCA::PKey::RSA)) { QWARN(QString("RSA not supported").toLocal8Bit()); -#if QT_VERSION >= 0x050000 QSKIP("RSA not supported. skipping"); -#else - QSKIP("RSA not supported. skipping",SkipAll); -#endif } QCA::RSAPrivateKey rsaPrivKey1 = QCA::KeyGenerator().createRSA(512, 65537, "qca-ossl").toRSA(); QCA::RSAPublicKey rsaPubKey1 = rsaPrivKey1.toPublicKey().toRSA();