Cleanup Qt version checks

This commit is contained in:
Albert Astals Cid 2020-01-19 17:57:35 +01:00
parent 4ad7e911d9
commit 70406170f5
26 changed files with 0 additions and 378 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<SspiPackage> sspi_get_packagelist_direct()
{
QList<SspiPackage> out;
#if QT_VERSION >= 0x050000
ULONG cPackages;
SecPkgInfoW *pPackageInfo;
SECURITY_STATUS ret = sspi.W->EnumerateSecurityPackagesW(&cPackages, &pPackageInfo);
@ -387,55 +360,6 @@ static QList<SspiPackage> 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

View File

@ -37,10 +37,6 @@ namespace QCA { // WRAPNS_LINE
#include <qmutex.h>
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 {
/*************************************************

View File

@ -316,7 +316,6 @@ public slots:
if(at == -1)
return QString();
Item &i = items[at];
#if QT_VERSION >= 0x050000
if(v.canConvert<KeyBundle>())
return i.owner->writeEntry(i.storeContextId, v.value<KeyBundle>());
else if(v.canConvert<Certificate>())
@ -325,16 +324,6 @@ public slots:
return i.owner->writeEntry(i.storeContextId, v.value<CRL>());
else if(v.canConvert<PGPKey>())
return i.owner->writeEntry(i.storeContextId, v.value<PGPKey>());
#else
if(qVariantCanConvert<KeyBundle>(v))
return i.owner->writeEntry(i.storeContextId, qVariantValue<KeyBundle>(v));
else if(qVariantCanConvert<Certificate>(v))
return i.owner->writeEntry(i.storeContextId, qVariantValue<Certificate>(v));
else if(qVariantCanConvert<CRL>(v))
return i.owner->writeEntry(i.storeContextId, qVariantValue<CRL>(v));
else if(qVariantCanConvert<PGPKey>(v))
return i.owner->writeEntry(i.storeContextId, qVariantValue<PGPKey>(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<void*>();
#else
KeyStoreEntryContext *c = (KeyStoreEntryContext *)qVariantValue<void*>(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<KeyStoreEntry> >();
#else
entryList = qVariantValue< QList<KeyStoreEntry> >(trackercall("entryList", QVariantList() << trackerId));
#endif
else if(type == WriteEntry)
{
QVariant arg;
#if QT_VERSION >= 0x050000
if(wentry.type == KeyStoreWriteEntry::TypeKeyBundle)
arg.setValue<KeyBundle>(wentry.keyBundle);
else if(wentry.type == KeyStoreWriteEntry::TypeCertificate)
@ -1017,16 +997,6 @@ protected:
arg.setValue<CRL>(wentry.crl);
else if(wentry.type == KeyStoreWriteEntry::TypePGPKey)
arg.setValue<PGPKey>(wentry.pgpKey);
#else
if(wentry.type == KeyStoreWriteEntry::TypeKeyBundle)
qVariantSetValue<KeyBundle>(arg, wentry.keyBundle);
else if(wentry.type == KeyStoreWriteEntry::TypeCertificate)
qVariantSetValue<Certificate>(arg, wentry.cert);
else if(wentry.type == KeyStoreWriteEntry::TypeCRL)
qVariantSetValue<CRL>(arg, wentry.crl);
else if(wentry.type == KeyStoreWriteEntry::TypePGPKey)
qVariantSetValue<PGPKey>(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<KeyStoreEntry> KeyStore::entryList() const
if(d->trackerId == -1)
return QList<KeyStoreEntry>();
#if QT_VERSION >= 0x050000
return trackercall("entryList", QVariantList() << d->trackerId).value< QList<KeyStoreEntry> >();
#else
return qVariantValue< QList<KeyStoreEntry> >(trackercall("entryList", QVariantList() << d->trackerId));
#endif
}
bool KeyStore::holdsTrustedCertificates() const
@ -1255,11 +1221,7 @@ bool KeyStore::holdsTrustedCertificates() const
QList<KeyStoreEntry::Type> list;
if(d->trackerId == -1)
return false;
#if QT_VERSION >= 0x050000
list = trackercall("entryTypes", QVariantList() << d->trackerId).value< QList<KeyStoreEntry::Type> >();
#else
list = qVariantValue< QList<KeyStoreEntry::Type> >(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<KeyStoreEntry::Type> list;
if(d->trackerId == -1)
return false;
#if QT_VERSION >= 0x050000
list = trackercall("entryTypes", QVariantList() << d->trackerId).value< QList<KeyStoreEntry::Type> >();
#else
list = qVariantValue< QList<KeyStoreEntry::Type> >(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<KeyStoreEntry::Type> list;
if(d->trackerId == -1)
return false;
#if QT_VERSION >= 0x050000
list = trackercall("entryTypes", QVariantList() << d->trackerId).value< QList<KeyStoreEntry::Type> >();
#else
list = qVariantValue< QList<KeyStoreEntry::Type> >(trackercall("entryTypes", QVariantList() << d->trackerId));
#endif
if(list.contains(KeyStoreEntry::TypePGPPublicKey))
return true;
return false;

View File

@ -26,9 +26,7 @@
#include "qca_safetimer.h"
#include <QPointer>
#if QT_VERSION >= 0x050000
#include <QMetaMethod>
#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

View File

@ -282,11 +282,7 @@ public:
SecureArray readSecure(int bytes = -1)
{
#if QT_VERSION >= 0x050000
return mycall(worker, "readSecure", QVariantList() << bytes).value<SecureArray>();
#else
return qVariantValue<SecureArray>(mycall(worker, "readSecure", QVariantList() << bytes));
#endif
}
void writeSecure(const SecureArray &a)

View File

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

View File

@ -185,11 +185,7 @@ private slots:
int timeLeft = qMax(info.interval - static_cast<int>(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

View File

@ -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;
}

View File

@ -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<QString>() && string_is_bool(in.toString()))
#else
if(qVariantCanConvert<QString>(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<QString>() && string_is_int(in.toString()))
#else
if(qVariantCanConvert<QString>(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<QString>())
#else
else if(qVariantCanConvert<QString>(val))
#endif
newval = prompt_for_string(QString("string ") + prompt, val.toString());
else
continue; // skip bogus fields

View File

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

View File

@ -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 );
}

View File

@ -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 );

View File

@ -90,11 +90,7 @@ void MetaTypeUnitTest::returnTypeTest()
QList<QByteArray> 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

View File

@ -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();