clang-tidy: enable modernize-deprecated-headers and modernize-use-nullptr

This commit is contained in:
Albert Astals Cid 2020-02-12 17:14:33 +01:00
parent c0ac498159
commit e2029649b9
62 changed files with 624 additions and 624 deletions

View File

@ -23,4 +23,4 @@ build_clazy_clang_tidy:
script:
- srcdir=`pwd` && mkdir -p /tmp/qca_build && cd /tmp/qca_build && CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja $srcdir && cat compile_commands.json | jq '[.[] | select(.file | contains("'"$srcdir"'"))]' > compile_commands.aux.json && mv compile_commands.aux.json compile_commands.json
- CLAZY_CHECKS="level0,level1,level2,no-copyable-polymorphic,no-ctor-missing-parent-argument,no-qstring-allocations,isempty-vs-count,qhash-with-char-pointer-key,qproperty-type-mismatch,qrequiredresult-candidates,signal-with-return-value,thread-with-slots,tr-non-literal,unneeded-cast" ninja
- "run-clang-tidy -header-filter='.*/qca/.*' -checks='-*,performance-*,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-use-bool-literals,modernize-redundant-void-arg,modernize-loop-convert' -config=\"{WarningsAsErrors: '*'}\""
- "run-clang-tidy -header-filter='.*/qca/.*' -checks='-*,performance-*,modernize-deprecated-headers,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-use-bool-literals,modernize-redundant-void-arg,modernize-loop-convert,modernize-use-nullptr' -config=\"{WarningsAsErrors: '*'}\""

View File

@ -223,7 +223,7 @@ public:
// else if (type == some other feature)
// return some other context.
else
return 0;
return nullptr;
}
};

View File

@ -22,7 +22,7 @@
// QtCrypto has the declarations for all of QCA
#include <QtCrypto>
#include <stdio.h>
#include <cstdio>
#include <QCoreApplication>

View File

@ -140,7 +140,7 @@ void asker_procedure()
{
QCA::PasswordAsker pwAsker;
pwAsker.ask( QCA::Event::StylePassword, "foo.tmp", 0 );
pwAsker.ask( QCA::Event::StylePassword, "foo.tmp", nullptr );
pwAsker.waitForResponse();
@ -150,7 +150,7 @@ void asker_procedure()
QCA::TokenAsker tokenAsker;
tokenAsker.ask( QCA::KeyStoreInfo( QCA::KeyStore::SmartCard, "Token Id", "Token Name" ), QCA::KeyStoreEntry(), 0 );
tokenAsker.ask( QCA::KeyStoreInfo( QCA::KeyStore::SmartCard, "Token Id", "Token Name" ), QCA::KeyStoreEntry(), nullptr );
tokenAsker.waitForResponse();

View File

@ -24,7 +24,7 @@
#include <QCoreApplication>
#include <stdio.h>
#include <cstdio>
#ifdef QT_STATICPLUGIN
#include "import_plugins.h"

View File

@ -25,7 +25,7 @@
#include <QCoreApplication>
#include <QTimer>
#include <stdio.h>
#include <cstdio>
#ifdef QT_STATICPLUGIN
#include "import_plugins.h"

View File

@ -26,7 +26,7 @@
#include <QDebug>
// needed for printf
#include<stdio.h>
#include<cstdio>
#ifdef QT_STATICPLUGIN
#include "import_plugins.h"

View File

@ -25,10 +25,10 @@
(http://www-128.ibm.com/developerworks/linux/library/l-md5crypt/)
*/
#include <QtCrypto>
#include <QCoreApplication>
#include <QtCrypto>
#include <QtDebug>
#include <stdio.h>
#include <cstdio>
#ifdef QT_STATICPLUGIN
#include "import_plugins.h"

View File

@ -21,10 +21,10 @@
*/
#include <QCoreApplication>
#include <QTimer>
#include <QTcpSocket>
#include <QTcpServer>
#include <stdio.h>
#include <QTcpSocket>
#include <QTimer>
#include <cstdio>
// QtCrypto has the declarations for all of QCA
#include <QtCrypto>

View File

@ -21,10 +21,10 @@
*/
#include <QCoreApplication>
#include <QTimer>
#include <QTcpSocket>
#include <QTcpServer>
#include <stdio.h>
#include <QTcpSocket>
#include <QTimer>
#include <cstdio>
// QtCrypto has the declarations for all of QCA
#include <QtCrypto>

View File

@ -1263,7 +1263,7 @@ public:
\sa validate
*/
inline CertificateChain complete(const QList<Certificate> &issuers = QList<Certificate>(), Validity *result = 0) const;
inline CertificateChain complete(const QList<Certificate> &issuers = QList<Certificate>(), Validity *result = nullptr) const;
};
inline Validity CertificateChain::validate(const CertificateCollection &trusted, const QList<CRL> &untrusted_crls, UsageMode u, ValidateFlags vf) const

View File

@ -176,7 +176,7 @@ public:
\param plainBytes the number of bytes that were read.
*/
virtual QByteArray readOutgoing(int *plainBytes = 0) = 0;
virtual QByteArray readOutgoing(int *plainBytes = nullptr) = 0;
/**
This allows you to read data without having it
@ -688,7 +688,7 @@ foreach(const CertificateInfoOrdered &info, tls->issuerList())
void write(const QByteArray &a) override;
QByteArray read() override;
void writeIncoming(const QByteArray &a) override;
QByteArray readOutgoing(int *plainBytes = 0) override;
QByteArray readOutgoing(int *plainBytes = nullptr) override;
QByteArray readUnprocessed() override;
int convertBytesWritten(qint64 encryptedBytes) override;
@ -1174,7 +1174,7 @@ public:
void write(const QByteArray &a) override;
QByteArray read() override;
void writeIncoming(const QByteArray &a) override;
QByteArray readOutgoing(int *plainBytes = 0) override;
QByteArray readOutgoing(int *plainBytes = nullptr) override;
int convertBytesWritten(qint64 encryptedBytes) override;
Q_SIGNALS:

View File

@ -319,7 +319,7 @@ public:
\param ok if not 0, true is stored here if the call succeeds,
otherwise false is stored here.
*/
QVariant call(QObject *obj, const QByteArray &method, const QVariantList &args = QVariantList(), bool *ok = 0);
QVariant call(QObject *obj, const QByteArray &method, const QVariantList &args = QVariantList(), bool *ok = nullptr);
protected:
/**

View File

@ -33,7 +33,7 @@
#include <botan/hkdf.h>
#include <botan/stream_cipher.h>
#include <stdlib.h>
#include <cstdlib>
#include <iostream>
//-----------------------------------------------------------
@ -155,7 +155,7 @@ public:
{
const QString hashName = qcaHmacToBotanHmac(type);
m_hashObj = new Botan::HMAC(Botan::HashFunction::create_or_throw(hashName.toStdString()).release());
if (0 == m_hashObj) {
if (nullptr == m_hashObj) {
std::cout << "null context object" << std::endl;
}
}
@ -266,7 +266,7 @@ public:
int msecInterval,
unsigned int *iterationCount) override
{
Q_ASSERT(iterationCount != NULL);
Q_ASSERT(iterationCount != nullptr);
Botan::OctetString key;
QElapsedTimer timer;
std::string secretString(secret.data(), secret.size() );

View File

@ -263,12 +263,12 @@ private:
{
if(con) {
sasl_dispose(&con);
con = 0;
con = nullptr;
}
need = 0;
need = nullptr;
if(callbacks) {
delete callbacks;
callbacks = 0;
callbacks = nullptr;
}
localAddr = "";
@ -302,8 +302,8 @@ private:
secprops.min_ssf = ssf_min;
secprops.max_ssf = ssf_max;
secprops.maxbufsize = SASL_BUFSIZE;
secprops.property_names = NULL;
secprops.property_values = NULL;
secprops.property_names = nullptr;
secprops.property_values = nullptr;
secprops.security_flags = secflags;
int r = sasl_setprop(con, SASL_SEC_PROPS, &secprops);
if(r != SASL_OK)
@ -379,7 +379,7 @@ private:
const char *clientout, *m;
unsigned int clientoutlen;
need = 0;
need = nullptr;
QString list = result_mechlist.join(" ");
int r;
while(true) {
@ -388,7 +388,7 @@ private:
if(in_sendFirst)
r = sasl_client_start(con, list.toLatin1().data(), &need, &clientout, &clientoutlen, &m);
else
r = sasl_client_start(con, list.toLatin1().data(), &need, NULL, NULL, &m);
r = sasl_client_start(con, list.toLatin1().data(), &need, nullptr, nullptr, &m);
if(r != SASL_INTERACT)
break;
@ -460,7 +460,7 @@ private:
{
if(step == 0) {
if(!ca_skip) {
const char *clientin = 0;
const char *clientin = nullptr;
unsigned int clientinlen = 0;
if(in_useClientInit) {
clientin = in_clientInit.data();
@ -572,8 +572,8 @@ public:
{
result_result = Success;
g = _g;
con = 0;
callbacks = 0;
con = nullptr;
callbacks = nullptr;
reset();
}
@ -585,7 +585,7 @@ public:
Provider::Context *clone() const override
{
return 0;
return nullptr;
}
Result result() const override
@ -621,35 +621,35 @@ public:
in_sendFirst = allowClientSendFirst;
if(!g->client_init) {
sasl_client_init(NULL);
sasl_client_init(nullptr);
g->client_init = true;
}
callbacks = new sasl_callback_t[5];
callbacks[0].id = SASL_CB_GETREALM;
callbacks[0].proc = 0;
callbacks[0].context = 0;
callbacks[0].proc = nullptr;
callbacks[0].context = nullptr;
callbacks[1].id = SASL_CB_USER;
callbacks[1].proc = 0;
callbacks[1].context = 0;
callbacks[1].proc = nullptr;
callbacks[1].context = nullptr;
callbacks[2].id = SASL_CB_AUTHNAME;
callbacks[2].proc = 0;
callbacks[2].context = 0;
callbacks[2].proc = nullptr;
callbacks[2].context = nullptr;
callbacks[3].id = SASL_CB_PASS;
callbacks[3].proc = 0;
callbacks[3].context = 0;
callbacks[3].proc = nullptr;
callbacks[3].context = nullptr;
callbacks[4].id = SASL_CB_LIST_END;
callbacks[4].proc = 0;
callbacks[4].context = 0;
callbacks[4].proc = nullptr;
callbacks[4].context = nullptr;
result_result = Error;
int r = sasl_client_new(service.toLatin1().data(), host.toLatin1().data(), localAddr.isEmpty() ? 0 : localAddr.toLatin1().data(), remoteAddr.isEmpty() ? 0 : remoteAddr.toLatin1().data(), callbacks, 0, &con);
int r = sasl_client_new(service.toLatin1().data(), host.toLatin1().data(), localAddr.isEmpty() ? nullptr : localAddr.toLatin1().data(), remoteAddr.isEmpty() ? nullptr : remoteAddr.toLatin1().data(), callbacks, 0, &con);
if(r != SASL_OK) {
setAuthCondition(r);
doResultsReady();
@ -679,7 +679,7 @@ public:
g->appname = SASL_APP;
if(!g->server_init) {
sasl_server_init(NULL, QFile::encodeName(g->appname).constData());
sasl_server_init(nullptr, QFile::encodeName(g->appname).constData());
g->server_init = true;
}
@ -690,12 +690,12 @@ public:
callbacks[0].context = this;
callbacks[1].id = SASL_CB_LIST_END;
callbacks[1].proc = 0;
callbacks[1].context = 0;
callbacks[1].proc = nullptr;
callbacks[1].context = nullptr;
result_result = Error;
int r = sasl_server_new(service.toLatin1().data(), host.toLatin1().data(), !realm.isEmpty() ? realm.toLatin1().data() : 0, localAddr.isEmpty() ? 0 : localAddr.toLatin1().data(), remoteAddr.isEmpty() ? 0 : remoteAddr.toLatin1().data(), callbacks, 0, &con);
int r = sasl_server_new(service.toLatin1().data(), host.toLatin1().data(), !realm.isEmpty() ? realm.toLatin1().data() : nullptr, localAddr.isEmpty() ? nullptr : localAddr.toLatin1().data(), remoteAddr.isEmpty() ? nullptr : remoteAddr.toLatin1().data(), callbacks, 0, &con);
if(r != SASL_OK) {
setAuthCondition(r);
doResultsReady();
@ -709,7 +709,7 @@ public:
}
const char *ml;
r = sasl_listmech(con, 0, 0, " ", 0, &ml, 0, 0);
r = sasl_listmech(con, nullptr, nullptr, " ", nullptr, &ml, nullptr, nullptr);
if(r != SASL_OK)
return;
result_mechlist = QString::fromUtf8(ml).split(' ');
@ -925,7 +925,7 @@ Provider::Context *saslProvider::createContext(const QString &type)
if ( type == "sasl" )
return new saslContext( this );
return 0;
return nullptr;
}
} // namespace saslQCAPlugin

View File

@ -176,7 +176,7 @@ gcry_pbkdf2 (int PRF, const char *P, size_t Plen, const char *S,
gcry_md_write (prf, U, hLen);
p = gcry_md_read (prf, PRF);
if (p == NULL)
if (p == nullptr)
{
rc = GPG_ERR_CONFIGURATION;
goto done;

View File

@ -196,7 +196,7 @@ public:
int blockSize() const override
{
size_t blockSize;
gcry_cipher_algo_info( m_cryptoAlgorithm, GCRYCTL_GET_BLKLEN, 0, &blockSize );
gcry_cipher_algo_info( m_cryptoAlgorithm, GCRYCTL_GET_BLKLEN, nullptr, &blockSize );
return blockSize;
}
@ -226,9 +226,9 @@ public:
if (m_pad) {
result.resize( blockSize() );
if (QCA::Encode == m_direction) {
err = gcry_cipher_encrypt( context, (unsigned char*)result.data(), result.size(), NULL, 0 );
err = gcry_cipher_encrypt( context, (unsigned char*)result.data(), result.size(), nullptr, 0 );
} else {
err = gcry_cipher_decrypt( context, (unsigned char*)result.data(), result.size(), NULL, 0 );
err = gcry_cipher_decrypt( context, (unsigned char*)result.data(), result.size(), nullptr, 0 );
}
check_error( "final cipher encrypt/decrypt", err );
} else {
@ -353,7 +353,7 @@ public:
int msecInterval,
unsigned int *iterationCount) override
{
Q_ASSERT(iterationCount != NULL);
Q_ASSERT(iterationCount != nullptr);
QElapsedTimer timer;
/*
@ -452,7 +452,7 @@ public:
int msecInterval,
unsigned int *iterationCount) override
{
Q_ASSERT(iterationCount != NULL);
Q_ASSERT(iterationCount != nullptr);
QCA::SymmetricKey result(keyLength);
QElapsedTimer timer;
@ -520,7 +520,7 @@ public:
if (!gcry_check_version (GCRYPT_VERSION) )
{
std::cout << "libgcrypt is too old (need " << GCRYPT_VERSION;
std::cout << ", have " << gcry_check_version(NULL) << ")" << std::endl;
std::cout << ", have " << gcry_check_version(nullptr) << ")" << std::endl;
}
gcry_set_allocation_handler (qca_func_malloc,
qca_func_secure_malloc,
@ -560,7 +560,7 @@ public:
list += "hmac(sha224)";
#endif
list += "hmac(sha256)";
if ( ! ( NULL == gcry_check_version("1.3.0") ) ) {
if ( ! ( nullptr == gcry_check_version("1.3.0") ) ) {
// 1.2 and earlier have broken implementation
list += "hmac(sha384)";
list += "hmac(sha512)";
@ -582,7 +582,7 @@ public:
// list += "des-ecb";
list += "des-cbc";
list += "des-cfb";
if ( ! ( NULL == gcry_check_version("1.3.0") ) ) {
if ( ! ( nullptr == gcry_check_version("1.3.0") ) ) {
// 1.2 branch and earlier doesn't support OFB mode
list += "aes128-ofb";
list += "aes192-ofb";
@ -682,7 +682,7 @@ public:
else if ( type == "pbkdf2(sha1)" )
return new gcryptQCAPlugin::pbkdf2Context( GCRY_MD_SHA1, this, type );
else
return 0;
return nullptr;
}
};

View File

@ -101,7 +101,7 @@ private:
void submitCommand(const QByteArray &a);
// since str is taken as a value, it is ok to use the same variable for 'rest'
QString nextArg(QString str, QString *rest = 0);
QString nextArg(QString str, QString *rest = nullptr);
void processStatusLine(const QString &line);
void processResult(int code);
void ensureDTextEmit();

View File

@ -30,7 +30,7 @@ GpgOp::Private::Private(GpgOp *_q)
: QObject(_q)
, sync(_q)
, q(_q)
, act(0)
, act(nullptr)
, waiting(false)
{
reset(ResetAll);
@ -46,10 +46,10 @@ void GpgOp::Private::reset(ResetMode mode)
if(act)
{
act->disconnect(this);
act->setParent(0);
act->setParent(nullptr);
act->deleteLater();
act = 0;
act = nullptr;
}
if(mode >= ResetSessionAndData)

View File

@ -31,7 +31,7 @@ namespace gpgQCAPlugin {
void releaseAndDeleteLater(QObject *owner, QObject *obj)
{
obj->disconnect(owner);
obj->setParent(0);
obj->setParent(nullptr);
obj->deleteLater();
}
@ -47,8 +47,8 @@ GPGProc::Private::Private(GPGProc *_q)
{
qRegisterMetaType<gpgQCAPlugin::GPGProc::Error>("gpgQCAPlugin::GPGProc::Error");
proc = 0;
proc_relay = 0;
proc = nullptr;
proc_relay = nullptr;
startTrigger.setSingleShot(true);
doneTrigger.setSingleShot(true);
@ -102,11 +102,11 @@ void GPGProc::Private::reset(ResetMode mode)
proc->terminate();
}
proc->setParent(0);
proc->setParent(nullptr);
releaseAndDeleteLater(this, proc_relay);
proc_relay = 0;
proc_relay = nullptr;
delete proc; // should be safe to do thanks to relay
proc = 0;
proc = nullptr;
}
#ifdef QT_PIPE_HACK

View File

@ -29,7 +29,7 @@ namespace gpgQCAPlugin
Q_GLOBAL_STATIC(QMutex, ksl_mutex)
static MyKeyStoreList *keyStoreList = 0;
static MyKeyStoreList *keyStoreList = nullptr;
MyKeyStoreList::MyKeyStoreList(Provider *p)
: KeyStoreListContext(p)
, initialized(false)
@ -48,12 +48,12 @@ MyKeyStoreList::MyKeyStoreList(Provider *p)
MyKeyStoreList::~MyKeyStoreList()
{
QMutexLocker locker(ksl_mutex());
keyStoreList = 0;
keyStoreList = nullptr;
}
Provider::Context *MyKeyStoreList::clone() const
{
return 0;
return nullptr;
}
QString MyKeyStoreList::name(int) const
@ -139,7 +139,7 @@ KeyStoreEntryContext *MyKeyStoreList::entry(int, const QString &entryId)
PGPKey pub = getPubKey(entryId);
if(pub.isNull())
return 0;
return nullptr;
// optional
PGPKey sec = getSecKey(entryId, static_cast<MyPGPKeyContext *>(pub.context())->_props.userIds);
@ -156,17 +156,17 @@ KeyStoreEntryContext *MyKeyStoreList::entryPassive(const QString &serialized)
QStringList parts = serialized.split(':');
if(parts.count() < 2)
return 0;
return nullptr;
if(unescape_string(parts[0]) != "qca-gnupg-1")
return 0;
return nullptr;
QString entryId = unescape_string(parts[1]);
if(entryId.isEmpty())
return 0;
return nullptr;
PGPKey pub = getPubKey(entryId);
if(pub.isNull())
return 0;
return nullptr;
// optional
PGPKey sec = getSecKey(entryId, static_cast<MyPGPKeyContext *>(pub.context())->_props.userIds);

View File

@ -50,7 +50,7 @@ MyMessageContext::MyMessageContext(MyOpenPGPContext *_sms, Provider *p)
Provider::Context *MyMessageContext::clone() const
{
return 0;
return nullptr;
}
bool MyMessageContext::canSignMultiple() const
@ -266,7 +266,7 @@ bool MyMessageContext::waitForFinished(int msecs)
if(c)
kse.change(c);
asker.ask(Event::StylePassphrase, KeyStoreInfo(KeyStore::PGPKeyring, keyStoreList->storeId(0), keyStoreList->name(0)), kse, 0);
asker.ask(Event::StylePassphrase, KeyStoreInfo(KeyStore::PGPKeyring, keyStoreList->storeId(0), keyStoreList->name(0)), kse, nullptr);
asker.waitForResponse();
if(!asker.accepted())
@ -279,7 +279,7 @@ bool MyMessageContext::waitForFinished(int msecs)
}
else if(e.type == GpgOp::Event::NeedCard)
{
tokenAsker.ask(KeyStoreInfo(KeyStore::PGPKeyring, keyStoreList->storeId(0), keyStoreList->name(0)), KeyStoreEntry(), 0);
tokenAsker.ask(KeyStoreInfo(KeyStore::PGPKeyring, keyStoreList->storeId(0), keyStoreList->name(0)), KeyStoreEntry(), nullptr);
if(!tokenAsker.accepted())
{
@ -394,13 +394,13 @@ void MyMessageContext::gpg_needPassphrase(const QString &in_keyId)
if(c)
kse.change(c);
asker.ask(Event::StylePassphrase, KeyStoreInfo(KeyStore::PGPKeyring, keyStoreList->storeId(0), keyStoreList->name(0)), kse, 0);
asker.ask(Event::StylePassphrase, KeyStoreInfo(KeyStore::PGPKeyring, keyStoreList->storeId(0), keyStoreList->name(0)), kse, nullptr);
}
void MyMessageContext::gpg_needCard()
{
MyKeyStoreList *keyStoreList = MyKeyStoreList::instance();
tokenAsker.ask(KeyStoreInfo(KeyStore::PGPKeyring, keyStoreList->storeId(0), keyStoreList->name(0)), KeyStoreEntry(), 0);
tokenAsker.ask(KeyStoreInfo(KeyStore::PGPKeyring, keyStoreList->storeId(0), keyStoreList->name(0)), KeyStoreEntry(), nullptr);
}
void MyMessageContext::gpg_readyReadDiagnosticText()

View File

@ -32,7 +32,7 @@ MyOpenPGPContext::MyOpenPGPContext(QCA::Provider *p)
Provider::Context *MyOpenPGPContext::clone() const
{
return 0;
return nullptr;
}
MessageContext *MyOpenPGPContext::createMessage()

View File

@ -59,7 +59,7 @@ public:
else if(type == "keystorelist")
return new MyKeyStoreList(this);
else
return 0;
return nullptr;
}
};

View File

@ -54,7 +54,7 @@ void RingWatch::add(const QString &filePath)
path = fi.absolutePath();
// watching this path already?
DirWatch *dirWatch = 0;
DirWatch *dirWatch = nullptr;
foreach(const DirItem &di, dirs)
{
if(di.dirWatch->dirName() == path)

View File

@ -23,7 +23,7 @@
#include <QTextStream>
#include <QFile>
#include <stdlib.h>
#include <cstdlib>
using namespace QCA;
@ -103,7 +103,7 @@ private:
public:
loggerProvider () {
_externalConfig = false;
_streamLogger = NULL;
_streamLogger = nullptr;
QByteArray level = qgetenv ("QCALOGGER_LEVEL");
QByteArray file = qgetenv ("QCALOGGER_FILE");
@ -120,7 +120,7 @@ public:
~loggerProvider () override {
delete _streamLogger;
_streamLogger = NULL;
_streamLogger = nullptr;
}
public:
@ -149,7 +149,7 @@ public:
const QString &type
) override {
Q_UNUSED(type);
return NULL;
return nullptr;
}
QVariantMap
@ -168,7 +168,7 @@ public:
configChanged (const QVariantMap &config) override {
if (!_externalConfig) {
delete _streamLogger;
_streamLogger = NULL;
_streamLogger = nullptr;
if (config["enabled"].toBool ()) {
createLogger (

View File

@ -146,7 +146,7 @@ public:
{
NSS_NoDB_Init(".");
m_context = 0;
m_context = nullptr;
m_status = 0;
/* Get a slot to use for the crypto operations */
@ -200,7 +200,7 @@ public:
PK11_DestroyContext(m_context, PR_TRUE);
SECItem noParams;
noParams.data = 0;
noParams.data = nullptr;
noParams.len = 0;
m_context = PK11_CreateContextBySymKey(m_macAlgo, CKA_SIGN, m_nssKey, &noParams);
@ -228,10 +228,10 @@ public:
keyItem.data = (unsigned char*) key.data();
keyItem.len = key.size();
m_nssKey = PK11_ImportSymKey(m_slot, m_macAlgo, PK11_OriginUnwrap, CKA_SIGN, &keyItem, NULL);
m_nssKey = PK11_ImportSymKey(m_slot, m_macAlgo, PK11_OriginUnwrap, CKA_SIGN, &keyItem, nullptr);
SECItem noParams;
noParams.data = 0;
noParams.data = nullptr;
noParams.len = 0;
m_context = PK11_CreateContextBySymKey(m_macAlgo, CKA_SIGN, m_nssKey, &noParams);
@ -316,7 +316,7 @@ public:
{
Q_UNUSED(tag);
/* Get a slot to use for the crypto operations */
m_slot = PK11_GetBestSlot( m_cipherMechanism, NULL );
m_slot = PK11_GetBestSlot( m_cipherMechanism, nullptr );
if (!m_slot)
{
qDebug() << "GetBestSlot failed";
@ -331,12 +331,12 @@ public:
if (QCA::Encode == dir) {
m_nssKey = PK11_ImportSymKey(m_slot, m_cipherMechanism,
PK11_OriginUnwrap, CKA_ENCRYPT,
&keyItem, NULL);
&keyItem, nullptr);
} else {
// decryption
m_nssKey = PK11_ImportSymKey(m_slot, m_cipherMechanism,
PK11_OriginUnwrap, CKA_DECRYPT,
&keyItem, NULL);
&keyItem, nullptr);
}
SECItem ivItem;
@ -534,7 +534,7 @@ public:
if ( type == "tripledes-ecb" )
return new nssCipherContext( this, type);
else
return 0;
return nullptr;
}
};

File diff suppressed because it is too large Load Diff

View File

@ -191,7 +191,7 @@ private:
}
~pkcs11KeyStoreItem () {
if (_token_id != NULL) {
if (_token_id != nullptr) {
pkcs11h_token_freeTokenId (_token_id);
}
}
@ -354,7 +354,7 @@ private:
) const;
};
static pkcs11KeyStoreListContext *s_keyStoreList = NULL;
static pkcs11KeyStoreListContext *s_keyStoreList = nullptr;
//----------------------------------------------------------------------------
// pkcs11Exception
@ -405,7 +405,7 @@ private:
QByteArray raw;
_sign_data_s() {
hash = NULL;
hash = nullptr;
}
} _sign_data;
@ -424,8 +424,8 @@ public:
);
_has_privateKeyRole = true;
_pkcs11h_certificate_id = NULL;
_pkcs11h_certificate = NULL;
_pkcs11h_certificate_id = nullptr;
_pkcs11h_certificate = nullptr;
_pubkey = pubkey;
_serialized = serialized;
_clearSign ();
@ -454,11 +454,11 @@ public:
);
_has_privateKeyRole = from._has_privateKeyRole;
_pkcs11h_certificate_id = NULL;
_pkcs11h_certificate = NULL;
_pkcs11h_certificate_id = nullptr;
_pkcs11h_certificate = nullptr;
_pubkey = from._pubkey;
_serialized = from._serialized;
_sign_data.hash = NULL;
_sign_data.hash = nullptr;
_clearSign ();
if (
@ -484,14 +484,14 @@ public:
_clearSign ();
if (_pkcs11h_certificate != NULL) {
if (_pkcs11h_certificate != nullptr) {
pkcs11h_certificate_freeCertificate (_pkcs11h_certificate);
_pkcs11h_certificate = NULL;
_pkcs11h_certificate = nullptr;
}
if (_pkcs11h_certificate_id != NULL) {
if (_pkcs11h_certificate_id != nullptr) {
pkcs11h_certificate_freeCertificateId (_pkcs11h_certificate_id);
_pkcs11h_certificate_id = NULL;
_pkcs11h_certificate_id = nullptr;
}
QCA_logTextMessage (
@ -534,9 +534,9 @@ public:
);
if (_has_privateKeyRole) {
if (_pkcs11h_certificate != NULL) {
if (_pkcs11h_certificate != nullptr) {
pkcs11h_certificate_freeCertificate (_pkcs11h_certificate);
_pkcs11h_certificate = NULL;
_pkcs11h_certificate = nullptr;
}
_has_privateKeyRole = false;
}
@ -619,7 +619,7 @@ public:
mech,
(const unsigned char *)in.constData (),
in.size (),
NULL,
nullptr,
&my_size
)) != CKR_OK
) {
@ -662,7 +662,7 @@ public:
session_locked = false;
}
if (s_keyStoreList != NULL) {
if (s_keyStoreList != nullptr) {
s_keyStoreList->_emit_diagnosticText (
QString::asprintf (
"PKCS#11: Cannot decrypt: %lu-'%s'.\n",
@ -733,7 +733,7 @@ public:
const MemoryRegion &in
) override {
if (_has_privateKeyRole) {
if (_sign_data.hash != NULL) {
if (_sign_data.hash != nullptr) {
_sign_data.hash->update (in);
}
else {
@ -762,7 +762,7 @@ public:
// from some strange reason I got 2047... (for some) <---- BUG?!?!?!
int myrsa_size=(_pubkey.bitSize () + 7) / 8;
if (_sign_data.hash != NULL) {
if (_sign_data.hash != nullptr) {
final = emsa3Encode (
_sign_data.hash->type (),
_sign_data.hash->final ().toByteArray (),
@ -796,7 +796,7 @@ public:
CKM_RSA_PKCS,
(const unsigned char *)final.constData (),
(size_t)final.size (),
NULL,
nullptr,
&my_size
)) != CKR_OK
) {
@ -840,7 +840,7 @@ public:
session_locked = false;
}
if (s_keyStoreList != NULL) {
if (s_keyStoreList != nullptr) {
s_keyStoreList->_emit_diagnosticText (
QString::asprintf (
"PKCS#11: Cannot sign: %lu-'%s'.\n",
@ -949,7 +949,7 @@ public:
ret = pkcs11h_token_ensureAccess (
_pkcs11h_certificate_id->token_id,
NULL,
nullptr,
0
) == CKR_OK;
@ -975,7 +975,7 @@ public:
ret = pkcs11h_token_ensureAccess (
_pkcs11h_certificate_id->token_id,
NULL,
nullptr,
PKCS11H_PROMPT_MASK_ALLOW_ALL
) == CKR_OK;
@ -996,7 +996,7 @@ private:
_sign_data.raw.clear ();
_sign_data.alg = SignatureUnknown;
delete _sign_data.hash;
_sign_data.hash = NULL;
_sign_data.hash = nullptr;
}
void
@ -1008,7 +1008,7 @@ private:
Logger::Debug
);
if (_pkcs11h_certificate == NULL) {
if (_pkcs11h_certificate == nullptr) {
if (
(rv = pkcs11h_certificate_create (
_pkcs11h_certificate_id,
@ -1041,12 +1041,12 @@ private:
public:
pkcs11PKeyContext (Provider *p) : PKeyContext (p) {
_k = NULL;
_k = nullptr;
}
~pkcs11PKeyContext () override {
delete _k;
_k = NULL;
_k = nullptr;
}
Provider::Context *
@ -1412,7 +1412,7 @@ public:
};
pkcs11h_engine_crypto_t pkcs11QCACrypto::crypto = {
NULL,
nullptr,
_pkcs11h_crypto_qca_initialize,
_pkcs11h_crypto_qca_uninitialize,
_pkcs11h_crypto_qca_certificate_get_expiration,
@ -1447,7 +1447,7 @@ pkcs11KeyStoreListContext::~pkcs11KeyStoreListContext () {
Logger::Debug
);
s_keyStoreList = NULL;
s_keyStoreList = nullptr;
_clearStores ();
QCA_logTextMessage (
@ -1462,7 +1462,7 @@ pkcs11KeyStoreListContext::clone () const {
"pkcs11KeyStoreListContext::clone - entry/return",
Logger::Debug
);
return NULL;
return nullptr;
}
void
@ -1531,15 +1531,15 @@ pkcs11KeyStoreListContext::entry (
Q_UNUSED(id);
Q_UNUSED(entryId);
return NULL;
return nullptr;
}
KeyStoreEntryContext *
pkcs11KeyStoreListContext::entryPassive (
const QString &serialized
) {
KeyStoreEntryContext *entry = NULL;
pkcs11h_certificate_id_t certificate_id = NULL;
KeyStoreEntryContext *entry = nullptr;
pkcs11h_certificate_id_t certificate_id = nullptr;
QCA_logTextMessage (
QString::asprintf (
@ -1577,9 +1577,9 @@ pkcs11KeyStoreListContext::entryPassive (
);
}
if (certificate_id != NULL) {
if (certificate_id != nullptr) {
pkcs11h_certificate_freeCertificateId (certificate_id);
certificate_id = NULL;
certificate_id = nullptr;
}
QCA_logTextMessage (
@ -1684,7 +1684,7 @@ pkcs11KeyStoreListContext::entryTypes (int id) const {
QList<int>
pkcs11KeyStoreListContext::keyStores () {
pkcs11h_token_id_list_t tokens = NULL;
pkcs11h_token_id_list_t tokens = nullptr;
QList<int> out;
QCA_logTextMessage (
@ -1714,7 +1714,7 @@ pkcs11KeyStoreListContext::keyStores () {
QList<int> to_remove = _storesById.keys ();
for (
pkcs11h_token_id_list_t entry = tokens;
entry != NULL;
entry != nullptr;
entry = entry->next
) {
pkcs11KeyStoreItem *item = _registerTokenId (entry->token_id);
@ -1736,7 +1736,7 @@ pkcs11KeyStoreListContext::keyStores () {
_stores.removeAll (item);
delete item;
item = NULL;
item = nullptr;
}
}
}
@ -1750,7 +1750,7 @@ pkcs11KeyStoreListContext::keyStores () {
);
}
if (tokens != NULL) {
if (tokens != nullptr) {
pkcs11h_token_freeTokenIdList (tokens);
}
@ -1767,7 +1767,7 @@ pkcs11KeyStoreListContext::keyStores () {
QList<KeyStoreEntryContext*>
pkcs11KeyStoreListContext::entryList (int id) {
pkcs11h_certificate_id_list_t certs = NULL;
pkcs11h_certificate_id_list_t certs = nullptr;
QList<KeyStoreEntryContext*> out;
QCA_logTextMessage (
@ -1784,8 +1784,8 @@ pkcs11KeyStoreListContext::entryList (int id) {
if (_storesById.contains (id)) {
pkcs11KeyStoreItem *entry = _storesById[id];
pkcs11h_certificate_id_list_t issuers = NULL;
pkcs11h_certificate_id_list_t current = NULL;
pkcs11h_certificate_id_list_t issuers = nullptr;
pkcs11h_certificate_id_list_t current = nullptr;
QList<Certificate> listCerts;
QList<Certificate> listIssuers;
int i = 0;
@ -1794,7 +1794,7 @@ pkcs11KeyStoreListContext::entryList (int id) {
(rv = pkcs11h_certificate_enumTokenCertificateIds (
entry->tokenId (),
PKCS11H_ENUM_METHOD_CACHE,
NULL,
nullptr,
PKCS11H_PROMPT_MASK_ALLOW_ALL,
&issuers,
&certs
@ -1805,7 +1805,7 @@ pkcs11KeyStoreListContext::entryList (int id) {
for (
current=certs;
current!=NULL;
current!=nullptr;
current=current->next
) {
if (current->certificate_id->certificate_blob_size > 0) {
@ -1820,7 +1820,7 @@ pkcs11KeyStoreListContext::entryList (int id) {
for (
current=issuers;
current!=NULL;
current!=nullptr;
current=current->next
) {
if (current->certificate_id->certificate_blob_size > 0) {
@ -1850,7 +1850,7 @@ pkcs11KeyStoreListContext::entryList (int id) {
for (
i=0, current=issuers;
current!=NULL;
current!=nullptr;
i++, current=current->next
) {
try {
@ -1884,7 +1884,7 @@ pkcs11KeyStoreListContext::entryList (int id) {
for (
i=0, current=certs;
current!=NULL;
current!=nullptr;
i++, current=current->next
) {
try {
@ -1922,7 +1922,7 @@ pkcs11KeyStoreListContext::entryList (int id) {
);
}
if (certs != NULL) {
if (certs != nullptr) {
pkcs11h_certificate_freeCertificateIdList (certs);
}
@ -1943,7 +1943,7 @@ pkcs11KeyStoreListContext::_tokenPrompt (
const pkcs11h_token_id_t token_id
) {
KeyStoreEntry entry;
KeyStoreEntryContext *context = NULL;
KeyStoreEntryContext *context = nullptr;
QString storeId, storeName;
bool ret = false;
@ -1956,7 +1956,7 @@ pkcs11KeyStoreListContext::_tokenPrompt (
Logger::Debug
);
if (user_data != NULL) {
if (user_data != nullptr) {
QString *serialized = (QString *)user_data;
context = entryPassive (*serialized);
storeId = context->storeId ();
@ -1998,7 +1998,7 @@ pkcs11KeyStoreListContext::_pinPrompt (
SecureArray &pin
) {
KeyStoreEntry entry;
KeyStoreEntryContext *context = NULL;
KeyStoreEntryContext *context = nullptr;
QString storeId, storeName;
bool ret = false;
@ -2013,7 +2013,7 @@ pkcs11KeyStoreListContext::_pinPrompt (
pin = SecureArray();
if (user_data != NULL) {
if (user_data != nullptr) {
QString *serialized = (QString *)user_data;
context = entryPassive (*serialized);
storeId = context->storeId ();
@ -2128,7 +2128,7 @@ pkcs11KeyStoreListContext::_registerTokenId (
i++;
}
pkcs11KeyStoreItem *entry = NULL;
pkcs11KeyStoreItem *entry = nullptr;
if (i == _stores.end ()) {
/*
@ -2185,7 +2185,7 @@ pkcs11KeyStoreListContext::_keyStoreEntryByCertificateId (
const CertificateChain &chain,
const QString &_description
) const {
pkcs11KeyStoreEntryContext *entry = NULL;
pkcs11KeyStoreEntryContext *entry = nullptr;
QCA_logTextMessage (
QString::asprintf (
@ -2197,7 +2197,7 @@ pkcs11KeyStoreListContext::_keyStoreEntryByCertificateId (
Logger::Debug
);
if (certificate_id == NULL) {
if (certificate_id == nullptr) {
throw pkcs11Exception (CKR_ARGUMENTS_BAD, "Missing certificate object");
}
@ -2279,7 +2279,7 @@ pkcs11KeyStoreListContext::_tokenId2storeId (
if (
pkcs11h_token_serializeTokenId (
NULL,
nullptr,
&len,
token_id
) != CKR_OK
@ -2335,7 +2335,7 @@ pkcs11KeyStoreListContext::_serializeCertificate (
if (
pkcs11h_certificate_serializeCertificateId (
NULL,
nullptr,
&len,
certificate_id
) != CKR_OK
@ -2389,7 +2389,7 @@ pkcs11KeyStoreListContext::_deserializeCertificate (
bool * const p_has_private,
CertificateChain &chain
) const {
pkcs11h_certificate_id_t certificate_id = NULL;
pkcs11h_certificate_id_t certificate_id = nullptr;
chain.clear ();
QCA_logTextMessage (
@ -2406,7 +2406,7 @@ pkcs11KeyStoreListContext::_deserializeCertificate (
int n = 0;
CK_RV rv;
*p_certificate_id = NULL;
*p_certificate_id = nullptr;
*p_has_private = false;
QStringList list = from.split ("/");
@ -2463,12 +2463,12 @@ pkcs11KeyStoreListContext::_deserializeCertificate (
}
*p_certificate_id = certificate_id;
certificate_id = NULL;
certificate_id = nullptr;
}
catch (...) {
if (certificate_id != NULL) {
if (certificate_id != nullptr) {
pkcs11h_certificate_freeCertificateId (certificate_id);
certificate_id = NULL;
certificate_id = nullptr;
}
throw;
}
@ -2511,7 +2511,7 @@ pkcs11KeyStoreListContext::_unescapeString (
QChar c = from[i];
if (c == '\\') {
to += QChar ((ushort)from.midRef (i+2, 4).toInt (0, 16));
to += QChar ((ushort)from.midRef (i+2, 4).toInt (nullptr, 16));
i+=5;
}
else {
@ -2641,7 +2641,7 @@ void pkcs11Provider::deinit () {
);
delete s_keyStoreList;
s_keyStoreList = NULL;
s_keyStoreList = nullptr;
pkcs11h_terminate ();
@ -2678,7 +2678,7 @@ pkcs11Provider::features() const {
Provider::Context *
pkcs11Provider::createContext (const QString &type) {
Provider::Context *context = NULL;
Provider::Context *context = nullptr;
QCA_logTextMessage (
QString::asprintf (
@ -2690,7 +2690,7 @@ pkcs11Provider::createContext (const QString &type) {
if (_lowLevelInitialized) {
if (type == "keystorelist") {
if (s_keyStoreList == NULL) {
if (s_keyStoreList == nullptr) {
s_keyStoreList = new pkcs11KeyStoreListContext (this);
}
context = s_keyStoreList;
@ -2978,7 +2978,7 @@ pkcs11Provider::_slotEventHook () {
* This is called from a separate
* thread.
*/
if (s_keyStoreList != NULL && _slotEventsActive) {
if (s_keyStoreList != nullptr && _slotEventsActive) {
QMetaObject::invokeMethod(s_keyStoreList, "doUpdated", Qt::QueuedConnection);
}
}
@ -2988,7 +2988,7 @@ pkcs11Provider::_tokenPromptHook (
void * const user_data,
const pkcs11h_token_id_t token
) {
if (s_keyStoreList != NULL) {
if (s_keyStoreList != nullptr) {
return s_keyStoreList->_tokenPrompt (user_data, token) ? TRUE : FALSE; //krazy:exclude=captruefalse
}
@ -3004,7 +3004,7 @@ pkcs11Provider::_pinPromptHook (
) {
PKCS11H_BOOL ret = FALSE; //krazy:exclude=captruefalse
if (s_keyStoreList != NULL) {
if (s_keyStoreList != nullptr) {
SecureArray qpin;
if (s_keyStoreList->_pinPrompt (user_data, token, qpin)) {

View File

@ -30,7 +30,7 @@ using namespace QCA;
namespace softstoreQCAPlugin {
class softstoreKeyStoreListContext;
static softstoreKeyStoreListContext *s_keyStoreList = NULL;
static softstoreKeyStoreListContext *s_keyStoreList = nullptr;
enum KeyType {
keyTypeInvalid,
@ -328,7 +328,7 @@ public:
}
else {
KeyStoreEntry entry;
KeyStoreEntryContext *context = NULL;
KeyStoreEntryContext *context = nullptr;
QString storeId, storeName;
ConvertResult cresult;
@ -339,7 +339,7 @@ public:
// too lazy to create scope
context = reinterpret_cast<KeyStoreListContext *> (s_keyStoreList)->entryPassive (_serialized);
if (context != NULL) {
if (context != nullptr) {
storeId = context->storeId ();
storeName = context->storeName ();
entry.change (context);
@ -482,12 +482,12 @@ private:
public:
softstorePKeyContext (Provider *p) : PKeyContext (p) {
_k = NULL;
_k = nullptr;
}
~softstorePKeyContext () override {
delete _k;
_k = NULL;
_k = nullptr;
}
Provider::Context *
@ -739,7 +739,7 @@ public:
Logger::Debug
);
s_keyStoreList = NULL;
s_keyStoreList = nullptr;
QCA_logTextMessage (
"softstoreKeyStoreListContext::~softstoreKeyStoreListContext - return",
@ -753,7 +753,7 @@ public:
"softstoreKeyStoreListContext::clone - entry/return",
Logger::Debug
);
return NULL;
return nullptr;
}
public:
@ -799,14 +799,14 @@ public:
Q_UNUSED(id);
Q_UNUSED(entryId);
return NULL;
return nullptr;
}
KeyStoreEntryContext *
entryPassive (
const QString &serialized
) override {
KeyStoreEntryContext *entry = NULL;
KeyStoreEntryContext *entry = nullptr;
QCA_logTextMessage (
QString::asprintf (
@ -1232,7 +1232,7 @@ private:
_keyStoreEntryBySoftStoreEntry (
const SoftStoreEntry &sentry
) const {
softstoreKeyStoreEntryContext *entry = NULL;
softstoreKeyStoreEntryContext *entry = nullptr;
QCA_logTextMessage (
QString::asprintf (
@ -1306,7 +1306,7 @@ private:
QChar c = from[i];
if (c == '\\') {
to += QChar ((ushort)from.midRef (i+2, 4).toInt (0, 16));
to += QChar ((ushort)from.midRef (i+2, 4).toInt (nullptr, 16));
i+=5;
}
else {
@ -1368,7 +1368,7 @@ public:
createContext (
const QString &type
) override {
Provider::Context *context = NULL;
Provider::Context *context = nullptr;
QCA_logTextMessage (
QString::asprintf (
@ -1379,7 +1379,7 @@ public:
);
if (type == "keystorelist") {
if (s_keyStoreList == NULL) {
if (s_keyStoreList == nullptr) {
s_keyStoreList = new softstoreKeyStoreListContext (this);
s_keyStoreList->_updateConfig (_config, _CONFIG_MAX_ENTRIES);
}
@ -1431,7 +1431,7 @@ public:
_config = config;
if (s_keyStoreList != NULL) {
if (s_keyStoreList != nullptr) {
s_keyStoreList->_updateConfig (_config, _CONFIG_MAX_ENTRIES);
}

View File

@ -58,7 +58,7 @@ namespace QCA { // WRAPNS_LINE
#include <unistd.h>
namespace QCA { // WRAPNS_LINE
} // WRAPNS_LINE
#include <stdlib.h>
#include <cstdlib>
namespace QCA { // WRAPNS_LINE
} // WRAPNS_LINE
#include <fcntl.h>
@ -133,7 +133,7 @@ void* MemoryMapping_Allocator::alloc_block(u32bit n)
if(write(file.get_fd(), "\0", 1) != 1)
throw MemoryMapping_Failed("Could not write to file");
void* ptr = mmap(0, n, PROT_READ | PROT_WRITE, MAP_SHARED,
void* ptr = mmap(nullptr, n, PROT_READ | PROT_WRITE, MAP_SHARED,
file.get_fd(), 0);
if(ptr == (void*)MAP_FAILED)
@ -147,7 +147,7 @@ void* MemoryMapping_Allocator::alloc_block(u32bit n)
*************************************************/
void MemoryMapping_Allocator::dealloc_block(void* ptr, u32bit n)
{
if(ptr == 0) return;
if(ptr == nullptr) return;
#ifdef MLOCK_NOT_VOID_PTR
# define MLOCK_TYPE_CAST (char *)
#else

View File

@ -40,7 +40,7 @@ namespace QCA { // WRAPNS_LINE
#include <cstring>
namespace QCA { // WRAPNS_LINE
} // WRAPNS_LINE
#include <string.h>
#include <cstring>
namespace QCA { // WRAPNS_LINE
namespace Botan {

View File

@ -97,10 +97,10 @@ class MemoryRegion
~MemoryRegion() { deallocate(buf, allocated); }
protected:
MemoryRegion() { buf = 0; alloc = 0; used = allocated = 0; }
MemoryRegion() { buf = nullptr; alloc = nullptr; used = allocated = 0; }
MemoryRegion(const MemoryRegion<T>& copy)
{
buf = 0;
buf = nullptr;
used = allocated = 0;
alloc = copy.alloc;
set(copy.buf, copy.used);

View File

@ -52,7 +52,7 @@ namespace QCA { // WRAPNS_LINE
#include <cctype>
namespace QCA { // WRAPNS_LINE
} // WRAPNS_LINE
#include <ctype.h>
#include <cctype>
namespace QCA { // WRAPNS_LINE
namespace Botan {

View File

@ -46,10 +46,10 @@ namespace QCA { // WRAPNS_LINE
#include <cstring>
namespace QCA { // WRAPNS_LINE
} // WRAPNS_LINE
#include <stdlib.h>
#include <cstdlib>
namespace QCA { // WRAPNS_LINE
} // WRAPNS_LINE
#include <string.h>
#include <cstring>
namespace QCA { // WRAPNS_LINE
namespace Botan {
@ -64,7 +64,7 @@ void* do_malloc(u32bit n, bool do_lock)
void* ptr = malloc(n);
if(!ptr)
return 0;
return nullptr;
if(do_lock)
lock_mem(ptr, n);

View File

@ -74,7 +74,7 @@ namespace Botan {
*************************************************/
namespace {
Library_State* global_lib_state = 0;
Library_State* global_lib_state = nullptr;
}
@ -194,7 +194,7 @@ void Library_State::set_default_allocator(const std::string& type) const
#else
config().set("conf", "base/default_allocator", type);
#endif
cached_default_allocator = 0;
cached_default_allocator = nullptr;
}
#ifndef BOTAN_TOOLS_ONLY
@ -440,7 +440,7 @@ Library_State::Library_State(Mutex_Factory* mutex_factory)
locks["engine"] = get_mutex();
rng = 0;
#endif
cached_default_allocator = 0;
cached_default_allocator = nullptr;
#ifndef BOTAN_TOOLS_ONLY
x509_state_obj = 0;
ui = 0;
@ -470,7 +470,7 @@ Library_State::~Library_State()
std::for_each(engines.begin(), engines.end(), del_fun<Engine>());
#endif
cached_default_allocator = 0;
cached_default_allocator = nullptr;
for(u32bit j = 0; j != allocators.size(); j++)
{

View File

@ -106,12 +106,12 @@ bool Pooling_Allocator::Memory_Block::contains(void* ptr,
byte* Pooling_Allocator::Memory_Block::alloc(u32bit n) throw()
{
if(n == 0 || n > BITMAP_SIZE)
return 0;
return nullptr;
if(n == BITMAP_SIZE)
{
if(bitmap)
return 0;
return nullptr;
else
{
bitmap = ~bitmap;
@ -134,7 +134,7 @@ byte* Pooling_Allocator::Memory_Block::alloc(u32bit n) throw()
}
if(bitmap & mask)
return 0;
return nullptr;
bitmap |= mask;
return buffer + offset * BLOCK_SIZE;
@ -234,7 +234,7 @@ void Pooling_Allocator::deallocate(void* ptr, u32bit n)
const u32bit BITMAP_SIZE = Memory_Block::bitmap_size();
const u32bit BLOCK_SIZE = Memory_Block::block_size();
if(ptr == 0 || n == 0)
if(ptr == nullptr || n == 0)
return;
Mutex_Holder lock(mutex);
@ -261,7 +261,7 @@ void Pooling_Allocator::deallocate(void* ptr, u32bit n)
byte* Pooling_Allocator::allocate_blocks(u32bit n)
{
if(blocks.empty())
return 0;
return nullptr;
std::vector<Memory_Block>::iterator i = last_used;
@ -280,7 +280,7 @@ byte* Pooling_Allocator::allocate_blocks(u32bit n)
}
while(i != last_used);
return 0;
return nullptr;
}
/*************************************************
@ -297,7 +297,7 @@ void Pooling_Allocator::get_more_core(u32bit in_bytes)
const u32bit to_allocate = in_blocks * TOTAL_BLOCK_SIZE;
void* ptr = alloc_block(to_allocate);
if(ptr == 0)
if(ptr == nullptr)
throw Memory_Exhaustion();
allocated.emplace_back(ptr, to_allocate);

View File

@ -31,7 +31,7 @@ namespace QCA { // WRAPNS_LINE
*************************************************/
} // WRAPNS_LINE
#include <stdlib.h>
#include <cstdlib>
namespace QCA { // WRAPNS_LINE
} // WRAPNS_LINE
#include <botan/mutex.h>

View File

@ -28,7 +28,7 @@
#include <QFile>
#include <QUrl>
#include <stdlib.h>
#include <cstdlib>
namespace QCA {
@ -50,7 +50,7 @@ static bool get_pkcs12_der(const QByteArray &der, const QString &fileName, void
{
QString _name;
QList<CertContext*> list;
PKeyContext *kc = 0;
PKeyContext *kc = nullptr;
PKCS12Context *pix = static_cast<PKCS12Context *>(getContext("pkcs12", provider));
ConvertResult r = pix->fromPKCS12(der, passphrase, &_name, &list, &kc);
@ -199,7 +199,7 @@ static const char OCSPSigning_id[] = "1.3.6.1.5.5.7.3.9";
static QString knownToId(CertificateInfoTypeKnown k)
{
const char *out = 0;
const char *out = nullptr;
switch(k)
{
case CommonName: out = CommonName_id; break;
@ -294,12 +294,12 @@ static const char *knownToShortName(CertificateInfoTypeKnown k)
case EmailLegacy: return "emailAddress";
default: break;
}
return 0;
return nullptr;
}
static QString constraintKnownToId(ConstraintTypeKnown k)
{
const char *out = 0;
const char *out = nullptr;
switch(k)
{
case DigitalSignature: out = DigitalSignature_id; break;
@ -529,7 +529,7 @@ static const char *constraintToString(const ConstraintType &type)
case TimeStamping: return "TimeStamping";
case OCSPSigning: return "OCSPSigning";
}
return 0;
return nullptr;
}
static QString uniqueConstraintValue(const ConstraintType &type, const QList<int> &items, const QList<Certificate> &certs, int i)
@ -1430,7 +1430,7 @@ Certificate::Certificate()
Certificate::Certificate(const QString &fileName)
:d(new Private)
{
*this = fromPEMFile(fileName, 0, QString());
*this = fromPEMFile(fileName, nullptr, QString());
}
Certificate::Certificate(const CertificateOptions &opts, const PrivateKey &key, const QString &provider)
@ -1813,7 +1813,7 @@ CertificateRequest::CertificateRequest()
CertificateRequest::CertificateRequest(const QString &fileName)
:d(new Private)
{
*this = fromPEMFile(fileName, 0, QString());
*this = fromPEMFile(fileName, nullptr, QString());
}
CertificateRequest::CertificateRequest(const CertificateOptions &opts, const PrivateKey &key, const QString &provider)
@ -2436,13 +2436,13 @@ CertificateCollection CertificateCollection::fromFlatTextFile(const QString &fil
break;
if(isCRL)
{
CRL c = CRL::fromPEM(pem, 0, provider);
CRL c = CRL::fromPEM(pem, nullptr, provider);
if(!c.isNull())
certs.addCRL(c);
}
else
{
Certificate c = Certificate::fromPEM(pem, 0, provider);
Certificate c = Certificate::fromPEM(pem, nullptr, provider);
if(!c.isNull())
certs.addCertificate(c);
}
@ -2570,7 +2570,7 @@ KeyBundle::KeyBundle()
KeyBundle::KeyBundle(const QString &fileName, const SecureArray &passphrase)
:d(new Private)
{
*this = fromFile(fileName, passphrase, 0, QString());
*this = fromFile(fileName, passphrase, nullptr, QString());
}
KeyBundle::KeyBundle(const KeyBundle &from)
@ -2655,7 +2655,7 @@ KeyBundle KeyBundle::fromFile(const QString &fileName, const SecureArray &passph
}
KeyBundle bundle;
get_pkcs12_der(der, fileName, 0, passphrase, result, provider, &bundle.d->name, &bundle.d->chain, &bundle.d->key);
get_pkcs12_der(der, fileName, nullptr, passphrase, result, provider, &bundle.d->name, &bundle.d->chain, &bundle.d->key);
return bundle;
}
@ -2668,7 +2668,7 @@ PGPKey::PGPKey()
PGPKey::PGPKey(const QString &fileName)
{
*this = fromFile(fileName, 0, QString());
*this = fromFile(fileName, nullptr, QString());
}
PGPKey::PGPKey(const PGPKey &from)
@ -2877,7 +2877,7 @@ private Q_SLOTS:
{
out = thread->out;
delete thread;
thread = 0;
thread = nullptr;
active = false;
emit q->finished();

View File

@ -104,8 +104,8 @@ public:
secmem = false;
loaded = false;
first_scan = false;
rng = 0;
logger = 0;
rng = nullptr;
logger = nullptr;
manager = new ProviderManager;
}
@ -113,11 +113,11 @@ public:
{
KeyStoreManager::shutdown();
delete rng;
rng = 0;
rng = nullptr;
delete manager;
manager = 0;
manager = nullptr;
delete logger;
logger = 0;
logger = nullptr;
}
void ensure_loaded()
@ -167,7 +167,7 @@ public:
// needed so deinit may delete the logger regardless
// of what thread the logger was created from
logger->moveToThread(0);
logger->moveToThread(nullptr);
}
return logger;
}
@ -181,7 +181,7 @@ public:
if(rng && (rng->provider() != manager->find("default")))
{
delete rng;
rng = 0;
rng = nullptr;
}
rng_mutex.unlock();
@ -190,7 +190,7 @@ public:
};
Q_GLOBAL_STATIC(QMutex, global_mutex)
static Global *global = 0;
static Global *global = nullptr;
static bool features_have(const QStringList &have, const QStringList &want)
{
@ -273,7 +273,7 @@ void deinit()
qRemovePostRoutine(deinit);
delete global;
global = 0;
global = nullptr;
botan_deinit();
}
}
@ -439,7 +439,7 @@ int providerPriority(const QString &name)
Provider *findProvider(const QString &name)
{
if(!global_check_load())
return 0;
return nullptr;
global->ensure_first_scan();
@ -449,7 +449,7 @@ Provider *findProvider(const QString &name)
Provider *defaultProvider()
{
if(!global_check_load())
return 0;
return nullptr;
return global->manager->find("default");
}
@ -825,7 +825,7 @@ QByteArray base64ToArray(const QString &base64String)
static Provider *getProviderForType(const QString &type, const QString &provider)
{
Provider *p = 0;
Provider *p = nullptr;
bool scanned = global->ensure_first_scan();
if(!provider.isEmpty())
{
@ -874,13 +874,13 @@ static inline Provider::Context *doCreateContext(Provider *p, const QString &typ
Provider::Context *getContext(const QString &type, const QString &provider)
{
if(!global_check_load())
return 0;
return nullptr;
Provider *p;
{
p = getProviderForType(type, provider);
if(!p)
return 0;
return nullptr;
}
return doCreateContext(p, type);
@ -889,13 +889,13 @@ Provider::Context *getContext(const QString &type, const QString &provider)
Provider::Context *getContext(const QString &type, Provider *_p)
{
if(!global_check_load())
return 0;
return nullptr;
Provider *p;
{
p = global->manager->find(_p);
if(!p)
return 0;
return nullptr;
}
return doCreateContext(p, type);
@ -987,13 +987,13 @@ bool Provider::Context::sameProvider(const Context *c) const
BasicContext::BasicContext(Provider *parent, const QString &type)
:Context(parent, type)
{
moveToThread(0); // no thread association
moveToThread(nullptr); // no thread association
}
BasicContext::BasicContext(const BasicContext &from)
:Context(from)
{
moveToThread(0); // no thread association
moveToThread(nullptr); // no thread association
}
BasicContext::~BasicContext()
@ -1168,7 +1168,7 @@ bool KeyStoreListContext::isReadOnly(int) const
KeyStoreEntryContext *KeyStoreListContext::entry(int id, const QString &entryId)
{
KeyStoreEntryContext *out = 0;
KeyStoreEntryContext *out = nullptr;
QList<KeyStoreEntryContext*> list = entryList(id);
for(int n = 0; n < list.count(); ++n)
{
@ -1185,7 +1185,7 @@ KeyStoreEntryContext *KeyStoreListContext::entry(int id, const QString &entryId)
KeyStoreEntryContext *KeyStoreListContext::entryPassive(const QString &serialized)
{
Q_UNUSED(serialized);
return 0;
return nullptr;
}
QString KeyStoreListContext::writeEntry(int, const KeyBundle &)
@ -1343,7 +1343,7 @@ Provider *Algorithm::provider() const
if(d)
return d->c->provider();
else
return 0;
return nullptr;
}
Provider::Context *Algorithm::context()
@ -1351,7 +1351,7 @@ Provider::Context *Algorithm::context()
if(d)
return d->c;
else
return 0;
return nullptr;
}
const Provider::Context *Algorithm::context() const
@ -1359,7 +1359,7 @@ const Provider::Context *Algorithm::context() const
if(d)
return d->c;
else
return 0;
return nullptr;
}
void Algorithm::change(Provider::Context *c)
@ -1367,7 +1367,7 @@ void Algorithm::change(Provider::Context *c)
if(c)
d = new Private(c);
else
d = 0;
d = nullptr;
}
void Algorithm::change(const QString &type, const QString &provider)
@ -1375,7 +1375,7 @@ void Algorithm::change(const QString &type, const QString &provider)
if(!type.isEmpty())
change(getContext(type, provider));
else
change(0);
change(nullptr);
}
Provider::Context *Algorithm::takeContext()
@ -1383,12 +1383,12 @@ Provider::Context *Algorithm::takeContext()
if(d)
{
Provider::Context *c = d->c; // should cause a detach
d->c = 0;
d = 0;
d->c = nullptr;
d = nullptr;
return c;
}
else
return 0;
return nullptr;
}
//----------------------------------------------------------------------------
@ -1693,7 +1693,7 @@ static void asker_cancel(AskerBase *a);
Q_GLOBAL_STATIC(QMutex, g_event_mutex)
class EventGlobal;
static EventGlobal *g_event = 0;
static EventGlobal *g_event = nullptr;
class EventGlobal
{
@ -1857,7 +1857,7 @@ void handler_remove(HandlerBase *h)
if(g_event->handlers.isEmpty())
{
delete g_event;
g_event = 0;
g_event = nullptr;
}
}
@ -2049,7 +2049,7 @@ public:
AskerPrivate(PasswordAsker *parent) : AskerBase(parent)
{
passwordAsker = parent;
tokenAsker = 0;
tokenAsker = nullptr;
type = Password;
accepted = false;
waiting = false;
@ -2058,7 +2058,7 @@ public:
AskerPrivate(TokenAsker *parent) : AskerBase(parent)
{
passwordAsker = 0;
passwordAsker = nullptr;
tokenAsker = parent;
type = Token;
accepted = false;

View File

@ -301,7 +301,7 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
* data without copying it. On arm do copying always
*/
#ifndef Q_PROCESSOR_ARM
if (!((data - static_cast<const md5_byte_t*>(0)) & 3)) {
if (!((data - static_cast<const md5_byte_t*>(nullptr)) & 3)) {
/* data are properly aligned */
X = reinterpret_cast<const md5_word_t*>(data);
} else
@ -987,25 +987,25 @@ public:
{
Certificate cert = Certificate::fromDER(data);
if(cert.isNull())
return 0;
return nullptr;
c = new DefaultKeyStoreEntry(cert, storeId, storeName, provider);
}
else if(typestr == "crl")
{
CRL crl = CRL::fromDER(data);
if(crl.isNull())
return 0;
return nullptr;
c = new DefaultKeyStoreEntry(crl, storeId, storeName, provider);
}
else
return 0;
return nullptr;
c->_id = id;
c->_name = name;
c->_serialized = in;
return c;
}
return 0;
return nullptr;
}
QString simpleId() const
@ -1051,7 +1051,7 @@ public:
Provider::Context *clone() const override
{
return 0;
return nullptr;
}
void start() override
@ -1234,7 +1234,7 @@ public:
else if(type == "keystorelist")
return new DefaultKeyStoreList(this, &shared);
else
return 0;
return nullptr;
}
QVariantMap defaultConfig() const override

View File

@ -28,8 +28,8 @@
#include <QMutex>
#include <QWaitCondition>
#include <stdlib.h> // abort
#include <stdio.h> // fprintf
#include <cstdio> // fprintf
#include <cstdlib> // abort
#include "qcaprovider.h"
@ -109,7 +109,7 @@ public:
Item()
: trackerId(-1)
, updateCount(0)
, owner(0)
, owner(nullptr)
, storeContextId(-1)
, storeId("")
, name("")
@ -150,7 +150,7 @@ public:
~KeyStoreTracker() override
{
qDeleteAll(sources);
self = 0;
self = nullptr;
}
static KeyStoreTracker *instance()
@ -224,7 +224,7 @@ public Q_SLOTS:
ProviderList list = providers();
list.append(defaultProvider());
Provider *p = 0;
Provider *p = nullptr;
for(int n = 0; n < list.count(); ++n)
{
if(list[n]->name() == provider)
@ -274,7 +274,7 @@ public Q_SLOTS:
// hack with void *
void *entry(const QString &storeId, const QString &entryId)
{
KeyStoreListContext *c = 0;
KeyStoreListContext *c = nullptr;
int contextId = -1;
m.lock();
foreach(const Item &i, items)
@ -288,7 +288,7 @@ public Q_SLOTS:
}
m.unlock();
if(!c)
return 0;
return nullptr;
return c->entry(contextId, entryId);
}
@ -303,7 +303,7 @@ public Q_SLOTS:
if(e)
return e;
}
return 0;
return nullptr;
}
QString writeEntry(int trackerId, const QVariant &v)
@ -584,7 +584,7 @@ private Q_SLOTS:
}
};
KeyStoreTracker *KeyStoreTracker::self = 0;
KeyStoreTracker *KeyStoreTracker::self = nullptr;
//----------------------------------------------------------------------------
// KeyStoreThread
@ -622,7 +622,7 @@ public:
class KeyStoreManagerGlobal;
Q_GLOBAL_STATIC(QMutex, ksm_mutex)
static KeyStoreManagerGlobal *g_ksm = 0;
static KeyStoreManagerGlobal *g_ksm = nullptr;
class KeyStoreManagerGlobal
{
@ -824,7 +824,7 @@ public:
Private(KeyStoreEntryWatcher *_q) : QObject(_q), q(_q), ksm(this)
{
ks = 0;
ks = nullptr;
avail = false;
connect(&ksm, &KeyStoreManager::keyStoreAvailable, this, &KeyStoreEntryWatcher::Private::ksm_available);
}
@ -883,7 +883,7 @@ private Q_SLOTS:
void ks_unavailable()
{
delete ks;
ks = 0;
ks = nullptr;
if(avail)
{
@ -1374,7 +1374,7 @@ void KeyStoreManager::shutdown()
{
QMutexLocker locker(ksm_mutex());
delete g_ksm;
g_ksm = 0;
g_ksm = nullptr;
}
// object
@ -1440,7 +1440,7 @@ public:
if(i->storeId == storeId)
return i;
}
return 0;
return nullptr;
}
KeyStoreTracker::Item *getItem(int trackerId)
@ -1451,7 +1451,7 @@ public:
if(i->trackerId == trackerId)
return i;
}
return 0;
return nullptr;
}
void do_update()

View File

@ -75,7 +75,7 @@ QString truncate_log(const QString &in, int size)
return in.mid(at);
}
static ProviderManager *g_pluginman = 0;
static ProviderManager *g_pluginman = nullptr;
static void logDebug(const QString &str)
{
@ -104,7 +104,7 @@ private:
}
public:
static PluginInstance *fromFile(const QString &fname, QString *errstr = 0)
static PluginInstance *fromFile(const QString &fname, QString *errstr = nullptr)
{
QPluginLoader *loader = new QPluginLoader(fname);
if(!loader->load())
@ -112,7 +112,7 @@ public:
if(errstr)
*errstr = QString("failed to load: %1").arg(loader->errorString());
delete loader;
return 0;
return nullptr;
}
QObject *obj = loader->instance();
if(!obj)
@ -121,7 +121,7 @@ public:
*errstr = "failed to get instance";
loader->unload();
delete loader;
return 0;
return nullptr;
}
PluginInstance *i = new PluginInstance;
i->_loader = loader;
@ -133,7 +133,7 @@ public:
static PluginInstance *fromStatic(QObject *obj)
{
PluginInstance *i = new PluginInstance;
i->_loader = 0;
i->_loader = nullptr;
i->_instance = obj;
i->_ownInstance = false;
return i;
@ -142,7 +142,7 @@ public:
static PluginInstance *fromInstance(QObject *obj)
{
PluginInstance *i = new PluginInstance;
i->_loader = 0;
i->_loader = nullptr;
i->_instance = obj;
i->_ownInstance = true;
return i;
@ -166,9 +166,9 @@ public:
void claim()
{
if(_loader)
_loader->moveToThread(0);
_loader->moveToThread(nullptr);
if(_ownInstance)
_instance->moveToThread(0);
_instance->moveToThread(nullptr);
}
QObject *instance()
@ -185,7 +185,7 @@ public:
int priority;
QMutex m;
static ProviderItem *load(const QString &fname, QString *out_errstr = 0)
static ProviderItem *load(const QString &fname, QString *out_errstr = nullptr)
{
QString errstr;
PluginInstance *i = PluginInstance::fromFile(fname, &errstr);
@ -193,7 +193,7 @@ public:
{
if(out_errstr)
*out_errstr = errstr;
return 0;
return nullptr;
}
QCAPlugin *plugin = qobject_cast<QCAPlugin*>(i->instance());
if(!plugin)
@ -201,7 +201,7 @@ public:
if(out_errstr)
*out_errstr = "does not offer QCAPlugin interface";
delete i;
return 0;
return nullptr;
}
Provider *p = plugin->createProvider();
@ -210,7 +210,7 @@ public:
if(out_errstr)
*out_errstr = "unable to create provider";
delete i;
return 0;
return nullptr;
}
ProviderItem *pi = new ProviderItem(i, p);
@ -218,7 +218,7 @@ public:
return pi;
}
static ProviderItem *loadStatic(QObject *instance, QString *errstr = 0)
static ProviderItem *loadStatic(QObject *instance, QString *errstr = nullptr)
{
PluginInstance *i = PluginInstance::fromStatic(instance);
QCAPlugin *plugin = qobject_cast<QCAPlugin*>(i->instance());
@ -227,7 +227,7 @@ public:
if(errstr)
*errstr = "does not offer QCAPlugin interface";
delete i;
return 0;
return nullptr;
}
Provider *p = plugin->createProvider();
@ -236,7 +236,7 @@ public:
if(errstr)
*errstr = "unable to create provider";
delete i;
return 0;
return nullptr;
}
ProviderItem *pi = new ProviderItem(i, p);
@ -245,7 +245,7 @@ public:
static ProviderItem *fromClass(Provider *p)
{
ProviderItem *pi = new ProviderItem(0, p);
ProviderItem *pi = new ProviderItem(nullptr, p);
return pi;
}
@ -281,7 +281,7 @@ public:
if(instance)
return instance->instance();
else
return 0;
return nullptr;
}
private:
@ -303,7 +303,7 @@ private:
ProviderManager::ProviderManager()
{
g_pluginman = this;
def = 0;
def = nullptr;
scanned_static = false;
}
@ -313,7 +313,7 @@ ProviderManager::~ProviderManager()
def->deinit();
unloadAll();
delete def;
g_pluginman = 0;
g_pluginman = nullptr;
}
void ProviderManager::scan()
@ -549,8 +549,8 @@ void ProviderManager::setDefault(Provider *p)
Provider *ProviderManager::find(Provider *_p) const
{
ProviderItem *i = 0;
Provider *p = 0;
ProviderItem *i = nullptr;
Provider *p = nullptr;
providerMutex.lock();
if(_p == def)
@ -579,8 +579,8 @@ Provider *ProviderManager::find(Provider *_p) const
Provider *ProviderManager::find(const QString &name) const
{
ProviderItem *i = 0;
Provider *p = 0;
ProviderItem *i = nullptr;
Provider *p = nullptr;
providerMutex.lock();
if(def && name == def->name())
@ -631,14 +631,14 @@ Provider *ProviderManager::findFor(const QString &name, const QString &type) con
if(p && p->features().contains(type))
return p;
return 0;
return nullptr;
}
else
{
Provider *p = find(name);
if(p && p->features().contains(type))
return p;
return 0;
return nullptr;
}
}
@ -646,7 +646,7 @@ void ProviderManager::changePriority(const QString &name, int priority)
{
QMutexLocker locker(&providerMutex);
ProviderItem *i = 0;
ProviderItem *i = nullptr;
int n = 0;
for(; n < providerItemList.count(); ++n)
{
@ -670,7 +670,7 @@ int ProviderManager::getPriority(const QString &name)
{
QMutexLocker locker(&providerMutex);
ProviderItem *i = 0;
ProviderItem *i = nullptr;
for(int n = 0; n < providerItemList.count(); ++n)
{
ProviderItem *pi = providerItemList[n];

View File

@ -95,7 +95,7 @@ Provider *providerForName(const QString &name)
if(pl[n]->name() == name)
return pl[n];
}
return 0;
return nullptr;
}
bool use_asker_fallback(ConvertResult r)
@ -249,12 +249,12 @@ Provider *providerForGroupSet(DLGroupSet set)
if(Getter_GroupSet::getList(pl[n]).contains(set))
return pl[n];
}
return 0;
return nullptr;
}
Provider *providerForPBE(PBEAlgorithm alg, PKey::Type ioType, const PKeyContext *prefer = 0)
Provider *providerForPBE(PBEAlgorithm alg, PKey::Type ioType, const PKeyContext *prefer = nullptr)
{
Provider *preferProvider = 0;
Provider *preferProvider = nullptr;
if(prefer)
{
preferProvider = prefer->provider();
@ -271,12 +271,12 @@ Provider *providerForPBE(PBEAlgorithm alg, PKey::Type ioType, const PKeyContext
if(Getter_PBE::getList(pl[n]).contains(alg) && Getter_IOType::getList(pl[n]).contains(ioType))
return pl[n];
}
return 0;
return nullptr;
}
Provider *providerForIOType(PKey::Type type, const PKeyContext *prefer = 0)
Provider *providerForIOType(PKey::Type type, const PKeyContext *prefer = nullptr)
{
Provider *preferProvider = 0;
Provider *preferProvider = nullptr;
if(prefer)
{
preferProvider = prefer->provider();
@ -293,7 +293,7 @@ Provider *providerForIOType(PKey::Type type, const PKeyContext *prefer = 0)
if(Getter_IOType::getList(pl[n]).contains(type))
return pl[n];
}
return 0;
return nullptr;
}
template <typename T, typename G>
@ -484,7 +484,7 @@ public:
DLGroup::DLGroup()
{
d = 0;
d = nullptr;
}
DLGroup::DLGroup(const BigInteger &p, const BigInteger &q, const BigInteger &g)
@ -499,7 +499,7 @@ DLGroup::DLGroup(const BigInteger &p, const BigInteger &g)
DLGroup::DLGroup(const DLGroup &from)
{
d = 0;
d = nullptr;
*this = from;
}
@ -511,7 +511,7 @@ DLGroup::~DLGroup()
DLGroup & DLGroup::operator=(const DLGroup &from)
{
delete d;
d = 0;
d = nullptr;
if(from.d)
d = new Private(*from.d);
@ -769,7 +769,7 @@ PublicKey::PublicKey(const PrivateKey &k)
PublicKey::PublicKey(const QString &fileName)
{
*this = fromPEMFile(fileName, 0, QString());
*this = fromPEMFile(fileName, nullptr, QString());
}
PublicKey::PublicKey(const PublicKey &from)
@ -962,7 +962,7 @@ PrivateKey::PrivateKey(const QString &type, const QString &provider)
PrivateKey::PrivateKey(const QString &fileName, const SecureArray &passphrase)
{
*this = fromPEMFile(fileName, passphrase, 0, QString());
*this = fromPEMFile(fileName, passphrase, nullptr, QString());
}
PrivateKey::PrivateKey(const PrivateKey &from)
@ -1130,7 +1130,7 @@ PrivateKey PrivateKey::fromPEMFile(const QString &fileName, const SecureArray &p
*result = ErrorFile;
return PrivateKey();
}
return get_privatekey_pem(pem, fileName, 0, passphrase, result, provider);
return get_privatekey_pem(pem, fileName, nullptr, passphrase, result, provider);
}
//----------------------------------------------------------------------------
@ -1151,9 +1151,9 @@ public:
Private(KeyGenerator *_parent) : QObject(_parent), parent(_parent)
{
k = 0;
dest = 0;
dc = 0;
k = nullptr;
dest = nullptr;
dc = nullptr;
}
~Private() override
@ -1170,21 +1170,21 @@ public Q_SLOTS:
{
if(!wasBlocking)
{
k->setParent(0);
k->moveToThread(0);
k->setParent(nullptr);
k->moveToThread(nullptr);
}
dest->setKey(k);
k = 0;
k = nullptr;
key.change(dest);
dest = 0;
dest = nullptr;
}
else
{
delete k;
k = 0;
k = nullptr;
delete dest;
dest = 0;
dest = nullptr;
}
if(!wasBlocking)
@ -1200,7 +1200,7 @@ public Q_SLOTS:
group = DLGroup(p, q, g);
}
delete dc;
dc = 0;
dc = nullptr;
if(!wasBlocking)
emit parent->finished();

View File

@ -30,7 +30,7 @@ namespace QCA {
inline void releaseAndDeleteLater(QObject *owner, QObject *obj)
{
obj->disconnect(owner);
obj->setParent(0);
obj->setParent(nullptr);
obj->deleteLater();
}

View File

@ -25,7 +25,7 @@
// NOTE: this API is private to QCA
#include <QSocketNotifier>
#include <stdio.h>
#include <cstdio>
namespace QCA {

View File

@ -257,7 +257,7 @@ public:
Private(TLS *_q, TLS::Mode _mode) : QObject(_q), q(_q), mode(_mode), actionTrigger(this)
{
// c is 0 during initial reset, so we don't redundantly reset it
c = 0;
c = nullptr;
connect_hostNameReceived = false;
connect_certificateRequested = false;
connect_peerCertificateAvailable = false;
@ -281,7 +281,7 @@ public:
~Private() override
{
// context is owned by Algorithm, unparent so we don't double-delete
c->setParent(0);
c->setParent(nullptr);
}
void reset(ResetMode mode)
@ -1357,7 +1357,7 @@ public:
Private(SASL *_q) : QObject(_q), q(_q), actionTrigger(this)
{
c = 0;
c = nullptr;
set_username = false;
set_authzid = false;
set_password = false;
@ -1379,7 +1379,7 @@ public:
~Private() override
{
// context is owned by Algorithm, unparent so we don't double-delete
c->setParent(0);
c->setParent(nullptr);
}
void reset(ResetMode mode)
@ -1439,13 +1439,13 @@ public:
void setup(const QString &service, const QString &host)
{
c->setup(service, host, localSet ? &local : 0, remoteSet ? &remote : 0, ext_authid, ext_ssf);
c->setup(service, host, localSet ? &local : nullptr, remoteSet ? &remote : nullptr, ext_authid, ext_ssf);
c->setConstraints(auth_flags, ssfmin, ssfmax);
QString *p_username = 0;
QString *p_authzid = 0;
SecureArray *p_password = 0;
QString *p_realm = 0;
QString *p_username = nullptr;
QString *p_authzid = nullptr;
SecureArray *p_password = nullptr;
QString *p_realm = nullptr;
if(set_username)
p_username = &username;
@ -1869,7 +1869,7 @@ void SASL::startServer(const QString &service, const QString &host, const QStrin
void SASL::putServerFirstStep(const QString &mech)
{
d->putServerFirstStep(mech, 0);
d->putServerFirstStep(mech, nullptr);
}
void SASL::putServerFirstStep(const QString &mech, const QByteArray &clientInit)
@ -1886,28 +1886,28 @@ void SASL::setUsername(const QString &user)
{
d->set_username = true;
d->username = user;
d->c->setClientParams(&user, 0, 0, 0);
d->c->setClientParams(&user, nullptr, nullptr, nullptr);
}
void SASL::setAuthzid(const QString &authzid)
{
d->set_authzid = true;
d->authzid = authzid;
d->c->setClientParams(0, &authzid, 0, 0);
d->c->setClientParams(nullptr, &authzid, nullptr, nullptr);
}
void SASL::setPassword(const SecureArray &pass)
{
d->set_password = true;
d->password = pass;
d->c->setClientParams(0, 0, &pass, 0);
d->c->setClientParams(nullptr, nullptr, &pass, nullptr);
}
void SASL::setRealm(const QString &realm)
{
d->set_realm = true;
d->realm = realm;
d->c->setClientParams(0, 0, 0, &realm);
d->c->setClientParams(nullptr, nullptr, nullptr, &realm);
}
void SASL::continueAfterParams()

View File

@ -270,8 +270,8 @@ public:
Private(SecureMessage *_q) : readyReadTrigger(this), bytesWrittenTrigger(this), finishedTrigger(this)
{
q = _q;
c = 0;
system = 0;
c = nullptr;
system = nullptr;
readyReadTrigger.setSingleShot(true);
bytesWrittenTrigger.setSingleShot(true);

View File

@ -32,7 +32,7 @@ bool qca_have_systemstore()
CertificateCollection qca_get_systemstore(const QString &provider)
{
return CertificateCollection::fromFlatTextFile(QCA_SYSTEMSTORE_PATH, 0, provider);
return CertificateCollection::fromFlatTextFile(QCA_SYSTEMSTORE_PATH, nullptr, provider);
}
}

View File

@ -24,7 +24,7 @@
#include "qdebug.h"
#ifdef Q_OS_UNIX
# include <stdlib.h>
# include <cstdlib>
# include <sys/mman.h>
#endif
#include "botantools/botantools.h"
@ -58,7 +58,7 @@ static bool can_lock()
// Botan shouldn't throw any exceptions in our init/deinit.
static Botan::Allocator *alloc = 0;
static Botan::Allocator *alloc = nullptr;
void botan_throw_abort()
{
@ -107,8 +107,8 @@ void botan_deinit()
{
try
{
alloc = 0;
Botan::set_global_state(0);
alloc = nullptr;
Botan::set_global_state(nullptr);
}
catch(std::exception &)
{
@ -126,7 +126,7 @@ void *botan_secure_alloc(int bytes)
{
botan_throw_abort();
}
return 0; // never get here
return nullptr; // never get here
}
void botan_secure_free(void *p, int bytes)
@ -174,7 +174,7 @@ void *qca_secure_realloc(void *p, int bytes)
// alloc the new chunk
char *new_p = (char *)qca_secure_alloc(bytes);
if(!new_p)
return 0;
return nullptr;
// move over the memory from the original block
memmove(new_p, p, qMin(oldsize, bytes));
@ -230,9 +230,9 @@ bool ai_new(alloc_info *ai, int size, bool sec)
if(size == 0)
{
ai->sbuf = 0;
ai->qbuf = 0;
ai->data = 0;
ai->sbuf = nullptr;
ai->qbuf = nullptr;
ai->data = nullptr;
return true;
}
@ -249,13 +249,13 @@ bool ai_new(alloc_info *ai, int size, bool sec)
}
(*(ai->sbuf))[size] = 0;
ai->qbuf = 0;
ai->qbuf = nullptr;
Botan::byte *bp = (Botan::byte *)(*(ai->sbuf));
ai->data = (char *)bp;
}
else
{
ai->sbuf = 0;
ai->sbuf = nullptr;
ai->qbuf = new QByteArray(size, 0);
ai->data = ai->qbuf->data();
}
@ -270,9 +270,9 @@ bool ai_copy(alloc_info *ai, const alloc_info *from)
if(ai->size == 0)
{
ai->sbuf = 0;
ai->qbuf = 0;
ai->data = 0;
ai->sbuf = nullptr;
ai->qbuf = nullptr;
ai->data = nullptr;
return true;
}
@ -288,13 +288,13 @@ bool ai_copy(alloc_info *ai, const alloc_info *from)
return false; // never get here
}
ai->qbuf = 0;
ai->qbuf = nullptr;
Botan::byte *bp = (Botan::byte *)(*(ai->sbuf));
ai->data = (char *)bp;
}
else
{
ai->sbuf = 0;
ai->sbuf = nullptr;
ai->qbuf = new QByteArray(*(from->qbuf));
ai->data = ai->qbuf->data();
}
@ -316,16 +316,16 @@ bool ai_resize(alloc_info *ai, int new_size)
if(ai->sec)
{
delete ai->sbuf;
ai->sbuf = 0;
ai->sbuf = nullptr;
}
else
{
delete ai->qbuf;
ai->qbuf = 0;
ai->qbuf = nullptr;
}
ai->size = 0;
ai->data = 0;
ai->data = nullptr;
}
return true;
@ -432,7 +432,7 @@ public:
};
MemoryRegion::MemoryRegion()
:_secure(false), d(0)
:_secure(false), d(nullptr)
{
}
@ -499,7 +499,7 @@ QByteArray MemoryRegion::toByteArray() const
}
MemoryRegion::MemoryRegion(bool secure)
:_secure(secure), d(0)
:_secure(secure), d(nullptr)
{
}

View File

@ -39,8 +39,8 @@
# include <fcntl.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#define CONSOLEPROMPT_INPUT_MAX 56
@ -378,7 +378,7 @@ public:
started = false;
mode = Console::Default;
thread = new ConsoleThread(this);
ref = 0;
ref = nullptr;
}
~ConsolePrivate() override
@ -427,19 +427,19 @@ public:
}
};
static Console *g_tty_console = 0, *g_stdio_console = 0;
static Console *g_tty_console = nullptr, *g_stdio_console = nullptr;
Console::Console(Type type, ChannelMode cmode, TerminalMode tmode, QObject *parent)
:QObject(parent)
{
if(type == Tty)
{
Q_ASSERT(g_tty_console == 0);
Q_ASSERT(g_tty_console == nullptr);
g_tty_console = this;
}
else
{
Q_ASSERT(g_stdio_console == 0);
Q_ASSERT(g_stdio_console == nullptr);
g_stdio_console = this;
}
@ -508,9 +508,9 @@ Console::~Console()
Console::Type type = d->type;
delete d;
if(type == Tty)
g_tty_console = 0;
g_tty_console = nullptr;
else
g_stdio_console = 0;
g_stdio_console = nullptr;
}
Console::Type Console::type() const
@ -596,8 +596,8 @@ public:
ConsoleReferencePrivate(ConsoleReference *_q) : QObject(_q), q(_q), lateTrigger(this)
{
console = 0;
thread = 0;
console = nullptr;
thread = nullptr;
connect(&lateTrigger, &SafeTimer::timeout, this, &ConsoleReferencePrivate::doLate);
lateTrigger.setSingleShot(true);
}
@ -633,7 +633,7 @@ bool ConsoleReference::start(Console *console, SecurityMode mode)
Q_ASSERT(!d->console);
// one console reference at a time
Q_ASSERT(console->d->ref == 0);
Q_ASSERT(console->d->ref == nullptr);
// let's take it
d->console = console;
@ -646,9 +646,9 @@ bool ConsoleReference::start(Console *console, SecurityMode mode)
// pipe already closed and no data? consider this an error
if(!valid && avail == 0)
{
d->console->d->ref = 0;
d->thread = 0;
d->console = 0;
d->console->d->ref = nullptr;
d->thread = nullptr;
d->console = nullptr;
return false;
}
@ -684,14 +684,14 @@ void ConsoleReference::stop()
d->lateTrigger.stop();
disconnect(d->thread, 0, this, 0);
disconnect(d->thread, nullptr, this, nullptr);
// automatically disable security when we go inactive
d->thread->setSecurityEnabled(false);
d->console->d->ref = 0;
d->thread = 0;
d->console = 0;
d->console->d->ref = nullptr;
d->thread = nullptr;
d->console = nullptr;
}
Console *ConsoleReference::console() const
@ -766,7 +766,7 @@ public:
connect(&console, &ConsoleReference::readyRead, this, &Private::con_readyRead);
connect(&console, &ConsoleReference::inputClosed, this, &Private::con_inputClosed);
con = 0;
con = nullptr;
own_con = false;
waiting = false;
@ -775,8 +775,8 @@ public:
#else
codec = QTextCodec::codecForLocale();
#endif
encstate = 0;
decstate = 0;
encstate = nullptr;
decstate = nullptr;
}
~Private() override
@ -787,15 +787,15 @@ public:
void reset()
{
delete encstate;
encstate = 0;
encstate = nullptr;
delete decstate;
decstate = 0;
decstate = nullptr;
console.stop();
if(own_con)
{
delete con;
con = 0;
con = nullptr;
own_con = false;
}
}

View File

@ -61,7 +61,7 @@ public:
QFileSystemWatcherRelay *watcher_relay;
QString dirName;
Private(DirWatch *_q) : QObject(_q), q(_q), watcher(0), watcher_relay(0)
Private(DirWatch *_q) : QObject(_q), q(_q), watcher(nullptr), watcher_relay(nullptr)
{
}
@ -96,8 +96,8 @@ void DirWatch::setDirName(const QString &dir)
{
delete d->watcher;
delete d->watcher_relay;
d->watcher = 0;
d->watcher_relay = 0;
d->watcher = nullptr;
d->watcher_relay = nullptr;
}
d->dirName = dir;
@ -127,7 +127,7 @@ public:
QString filePath; // absolute path of file, calculated by us
bool fileExisted;
Private(FileWatch *_q) : QObject(_q), q(_q), watcher(0), watcher_relay(0)
Private(FileWatch *_q) : QObject(_q), q(_q), watcher(nullptr), watcher_relay(nullptr)
{
}
@ -182,8 +182,8 @@ public:
{
delete watcher;
delete watcher_relay;
watcher = 0;
watcher_relay = 0;
watcher = nullptr;
watcher_relay = nullptr;
}
fileName.clear();

View File

@ -27,8 +27,8 @@
#include "qpipe.h"
#include <stdlib.h>
#include <limits.h>
#include <climits>
#include <cstdlib>
// sorry, i've added this dependency for now, but it's easy enough to take
// with you if you want qpipe independent of qca
@ -46,11 +46,11 @@
#endif
#ifdef Q_OS_UNIX
# include <unistd.h>
# include <cerrno>
# include <csignal>
# include <fcntl.h>
# include <errno.h>
# include <sys/ioctl.h>
# include <signal.h>
# include <unistd.h>
# ifdef HAVE_SYS_FILIO_H
# include <sys/filio.h>
# endif
@ -83,7 +83,7 @@ static void ignore_sigpipe()
struct sigaction noaction;
memset(&noaction, 0, sizeof(noaction));
noaction.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &noaction, 0);
sigaction(SIGPIPE, &noaction, nullptr);
}
}
#endif
@ -139,7 +139,7 @@ static bool pipe_set_blocking(Q_PIPE_ID pipe, bool b)
}
// on windows, the pipe is closed and the new pipe is returned in newPipe
static bool pipe_set_inheritable(Q_PIPE_ID pipe, bool b, Q_PIPE_ID *newPipe = 0)
static bool pipe_set_inheritable(Q_PIPE_ID pipe, bool b, Q_PIPE_ID *newPipe = nullptr)
{
#ifdef Q_OS_WIN
// windows is required to accept a new pipe id
@ -932,8 +932,8 @@ public:
dec = 0;
#endif
#ifdef Q_OS_UNIX
sn_read = 0;
sn_write = 0;
sn_read = nullptr;
sn_write = nullptr;
#endif
}
@ -961,9 +961,9 @@ public:
#endif
#ifdef Q_OS_UNIX
delete sn_read;
sn_read = 0;
sn_read = nullptr;
delete sn_write;
sn_write = 0;
sn_write = nullptr;
#endif
if(pipe != INVALID_Q_PIPE_ID)
{
@ -1212,7 +1212,7 @@ bool QPipeDevice::setInheritable(bool enabled)
return true;
#endif
#ifdef Q_OS_UNIX
return pipe_set_inheritable(d->pipe, enabled, 0);
return pipe_set_inheritable(d->pipe, enabled, nullptr);
#endif
}
@ -2093,8 +2093,8 @@ bool QPipe::create()
int p[2];
if(pipe(p) == -1)
return false;
if(!pipe_set_inheritable(p[0], false, 0) ||
!pipe_set_inheritable(p[1], false, 0))
if(!pipe_set_inheritable(p[0], false, nullptr) ||
!pipe_set_inheritable(p[1], false, nullptr))
{
close(p[0]);
close(p[1]);

View File

@ -66,9 +66,9 @@ public:
return obj->findChild<TimerFixer *>() ? true : false;
}
TimerFixer(QObject *_target, TimerFixer *_fp = 0) : QObject(_target)
TimerFixer(QObject *_target, TimerFixer *_fp = nullptr) : QObject(_target)
{
ed = 0;
ed = nullptr;
target = _target;
fixerParent = _fp;
@ -160,7 +160,7 @@ private Q_SLOTS:
if(ed)
{
disconnect(ed, &QAbstractEventDispatcher::aboutToBlock, this, &TimerFixer::ed_aboutToBlock);
ed = 0;
ed = nullptr;
}
}
@ -206,7 +206,7 @@ private:
void unhook(QObject *obj)
{
TimerFixer *t = 0;
TimerFixer *t = nullptr;
for(int n = 0; n < fixerChildren.count(); ++n)
{
if(fixerChildren[n]->target == obj)
@ -351,12 +351,12 @@ public:
, do_quit(false)
, cond_met(false)
, obj(_obj)
, loop(0)
, agent(0)
, fixer(0)
, loop(nullptr)
, agent(nullptr)
, fixer(nullptr)
, m(QMutex::NonRecursive)
, w()
, orig_thread(0)
, orig_thread(nullptr)
{
// SafeTimer has own method to fix timers, skip it too
if (!qobject_cast<SafeTimer*>(obj))
@ -404,9 +404,9 @@ public:
// move object to the worker thread
cond_met = false;
orig_thread = QThread::currentThread();
q->setParent(0); // don't follow the object
q->setParent(nullptr); // don't follow the object
QObject *orig_parent = obj->parent();
obj->setParent(0); // unparent the target or the move will fail
obj->setParent(nullptr); // unparent the target or the move will fail
obj->moveToThread(this);
// tell the worker thread to start, wait for completion
@ -465,17 +465,17 @@ protected:
eventLoop.exec();
delete agent;
agent = 0;
agent = nullptr;
// eventloop done, flush pending events
QCoreApplication::instance()->sendPostedEvents();
QCoreApplication::instance()->sendPostedEvents(0, QEvent::DeferredDelete);
QCoreApplication::instance()->sendPostedEvents(nullptr, QEvent::DeferredDelete);
// and move the object back
obj->moveToThread(orig_thread);
m.lock();
loop = 0;
loop = nullptr;
w.wakeOne();
}
}

View File

@ -76,7 +76,7 @@ bool invokeMethodWithVariants(QObject *obj, const QByteArray &method, const QVar
if(metatype != QMetaType::Void)
{
retval = QVariant(metatype, (const void *)0);
retval = QVariant(metatype, (const void *)nullptr);
retarg = QGenericReturnArgument(retval.typeName(), retval.data());
}
@ -107,8 +107,8 @@ public:
Private(SyncThread *_q) : QObject(_q), q(_q)
{
loop = 0;
agent = 0;
loop = nullptr;
agent = nullptr;
}
public Q_SLOTS:
@ -199,8 +199,8 @@ void SyncThread::run()
atEnd();
delete d->agent;
delete d->loop;
d->agent = 0;
d->loop = 0;
d->agent = nullptr;
d->loop = nullptr;
d->w.wakeOne();
d->m.unlock();
}

View File

@ -92,7 +92,7 @@ int main(int argc, char **argv)
while((pos = rx.indexIn(line, pos)) != -1)
{
QString str = rx.capturedTexts().at(1);
uchar c = str.toInt(0, 8);
uchar c = str.toInt(nullptr, 8);
buf.append(c);
pos += rx.matchedLength();
}

View File

@ -368,7 +368,7 @@ public:
have_pass = false;
auto_accept = false;
prompt = 0;
prompt = nullptr;
connect(&handler, &QCA::EventHandler::eventReady, this, &PassphrasePrompt::ph_eventReady);
handler.start();
@ -499,7 +499,7 @@ private Q_SLOTS:
{
QCA::KeyStoreEntry kse = e.keyStoreEntry();
QCA::KeyStore *ks = 0;
QCA::KeyStore *ks = nullptr;
foreach(QCA::KeyStore *i, keyStores)
{
if(i->id() == e.keyStoreInfo().id())
@ -610,7 +610,7 @@ private Q_SLOTS:
else
{
delete prompt;
prompt = 0;
prompt = nullptr;
}
}

View File

@ -71,12 +71,12 @@ public:
{
if(type == "testClientSideProviderFeature1")
// return new Feature1Context(this);
return 0;
return nullptr;
else if (type == "testClientSideProviderFeature2")
// return new Feature2Context(this);
return 0;
return nullptr;
else
return 0;
return nullptr;
}
};
@ -89,7 +89,7 @@ void ClientPlugin::testInsertRemovePlugin()
QCOMPARE(QCA::providerPriority(providerName), 10);
QVERIFY(QCA::unloadProvider(providerName));
QCOMPARE(QCA::findProvider(providerName), static_cast<QCA::Provider *>(0));
QCOMPARE(QCA::findProvider(providerName), static_cast<QCA::Provider *>(nullptr));
QVERIFY(provider.isNull());
}

View File

@ -83,7 +83,7 @@ void CMSut::xcrypt()
else if( !QCA::isSupported( "cms", provider ) )
QWARN( QString( "CMS not supported for "+provider).toLocal8Bit().constData() );
else {
QCA::Certificate pubCert = QCA::Certificate::fromPEMFile( "QcaTestClientCert.pem",0, provider );
QCA::Certificate pubCert = QCA::Certificate::fromPEMFile( "QcaTestClientCert.pem",nullptr, provider );
QCOMPARE( pubCert.isNull(), false );
QCA::SecureMessageKey secMsgKey;

View File

@ -38,7 +38,7 @@ class TestClass1 : public QObject
public:
TestClass1() { };
TestClass1(const TestClass1 & ):QObject( 0 ) { };
TestClass1(const TestClass1 & ):QObject( nullptr ) { };
public Q_SLOTS:
void voidMethod() { };
@ -123,10 +123,10 @@ void MetaTypeUnitTest::invokeMethodTest()
QVariantList args;
bool ret;
ret = QCA::invokeMethodWithVariants( testClass1, QByteArray( "voidMethod" ), args, 0 );
ret = QCA::invokeMethodWithVariants( testClass1, QByteArray( "voidMethod" ), args, nullptr );
QVERIFY( ret );
ret = QCA::invokeMethodWithVariants( testClass1, QByteArray( "noSuchMethod" ), args, 0 );
ret = QCA::invokeMethodWithVariants( testClass1, QByteArray( "noSuchMethod" ), args, nullptr );
QVERIFY( ret == false );
QVariant stringRes;

View File

@ -26,7 +26,7 @@
#include <QtCrypto>
#include <QtTest/QtTest>
#include <stdlib.h>
#include <cstdlib>
#ifdef QT_STATICPLUGIN
#include "import_plugins.h"

View File

@ -57,7 +57,7 @@ void TLSUnitTest::testCipherList()
if(!QCA::isSupported("tls", "qca-ossl"))
QWARN("TLS not supported for qca-ossl");
else {
QCA::TLS *tls = new QCA::TLS(QCA::TLS::Stream, 0, "qca-ossl");
QCA::TLS *tls = new QCA::TLS(QCA::TLS::Stream, nullptr, "qca-ossl");
QStringList cipherList = tls->supportedCipherSuites(QCA::TLS::TLS_v1);
QVERIFY( cipherList.contains("TLS_DHE_RSA_WITH_AES_256_CBC_SHA") );
QVERIFY( cipherList.contains("TLS_RSA_WITH_AES_256_CBC_SHA") );