Commit 411515c6 authored by Martin Straka's avatar Martin Straka

Minor code and NULL refactoring

parent caf8f24c
......@@ -521,10 +521,9 @@ void IsdsWrapper::sendMessage(const QString &userName, qint64 dmID,
msg.setDmType(dmType);
int totalAttachmentSizeKBs = 0;
FileDb *fDb = NULL;
fDb = globFileDbsPtr->accessFileDb(globSet.dbsLocation, userName,
AccountListModel::globAccounts[userName].storeToDisk());
if (fDb == NULL) {
FileDb *fDb = globFileDbsPtr->accessFileDb(globSet.dbsLocation,
userName, AccountListModel::globAccounts[userName].storeToDisk());
if (fDb == Q_NULLPTR) {
qCritical() << "ERROR: File database cannot open!" << userName;
Dialogues::errorMessage(Dialogues::CRITICAL,
tr("Error"), tr("Cannot access file database."),
......@@ -720,7 +719,7 @@ bool IsdsWrapper::isdsLogoutOTP(const QString &userName)
m_isdsSession.isdsCtxMap[userName].url.setUrl(url);
if (m_netLayer.sendSoapRequest(m_isdsSession.isdsCtxMap[userName],
LOGIN_SERVICE, NULL, xmlDataOut)) {
LOGIN_SERVICE, QByteArray(), xmlDataOut)) {
return m_isdsSession.removeIsdsCtx(userName);
}
......
......@@ -105,7 +105,8 @@ bool NetLayer::createLoginRequest(IsdsSession::IsdsContext &ctx,
if (success) {
/* Run second phase of HOTP login if first phase is success*/
if (ctx.login_method == USERNAME_PWD_HOTP && success) {
success = sendSoapRequest(ctx, NULL, xmlDataIn, xmlDataOut);
success = sendSoapRequest(ctx, QString(), xmlDataIn,
xmlDataOut);
if (success) {
QString endPointUrl = ctx.url.toString();
ctx.url = endPointUrl.remove(LOGIN_SERVICE,
......@@ -133,7 +134,7 @@ bool NetLayer::secondTotpLoginRequest(IsdsSession::IsdsContext &ctx,
success = sendRequest(ctx, request, xmlDataIn, xmlDataOut);
if (success && !ctx.pass_phrase.isEmpty()) {
success = sendSoapRequest(ctx, NULL, xmlDataIn, xmlDataOut);
success = sendSoapRequest(ctx, QString(), xmlDataIn, xmlDataOut);
if (success) {
QString endPointUrl = ctx.url.toString();
ctx.url = endPointUrl.remove(LOGIN_SERVICE,
......
......@@ -45,7 +45,7 @@ FileDbContainer::~FileDbContainer(void)
FileDb *FileDbContainer::accessFileDb(const QString &locDir,
const QString &userName, bool storeLocally)
{
FileDb *db = NULL;
FileDb *db = Q_NULLPTR;
bool open_ret;
QString dbFileName = constructDbFileName(userName);
......@@ -56,9 +56,9 @@ FileDb *FileDbContainer::accessFileDb(const QString &locDir,
}
db = new(std::nothrow) FileDb(dbFileName);
if (NULL == db) {
if (Q_NULLPTR == db) {
Q_ASSERT(0);
return NULL;
return Q_NULLPTR;
}
QString location = locDir + QDir::separator() +
......@@ -67,7 +67,7 @@ FileDb *FileDbContainer::accessFileDb(const QString &locDir,
open_ret = db->openDb(location, storeLocally);
if (!open_ret) {
delete db;
return NULL;
return Q_NULLPTR;
}
this->insert(dbFileName, db);
......
......@@ -46,7 +46,7 @@ MsgDbContainer::~MsgDbContainer(void)
MessageDb *MsgDbContainer::accessMessageDb(const QString &locDir,
const QString &userName, bool storeLocally)
{
MessageDb *db = NULL;
MessageDb *db = Q_NULLPTR;
bool open_ret;
QString dbFileName = constructDbFileName(userName);
......@@ -57,9 +57,9 @@ MessageDb *MsgDbContainer::accessMessageDb(const QString &locDir,
}
db = new(std::nothrow) MessageDb(dbFileName);
if (NULL == db) {
if (Q_NULLPTR == db) {
Q_ASSERT(0);
return NULL;
return Q_NULLPTR;
}
QString location = locDir + QDir::separator() +
......@@ -68,7 +68,7 @@ MessageDb *MsgDbContainer::accessMessageDb(const QString &locDir,
open_ret = db->openDb(location, storeLocally);
if (!open_ret) {
delete db;
return NULL;
return Q_NULLPTR;
}
this->insert(dbFileName, db);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment