summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdbx/src/dbcontacts.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-01-22 22:26:18 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-01-22 22:26:25 +0300
commit23f676163a595018346050eccb5cc8b2571381e6 (patch)
tree09107aede495a3bebea5bed64a4483ffb3d148e5 /plugins/Dbx_mdbx/src/dbcontacts.cpp
parent36b876e544afe74ce5f7463cdf9502d3b23f3ed6 (diff)
code cleaning
Diffstat (limited to 'plugins/Dbx_mdbx/src/dbcontacts.cpp')
-rw-r--r--plugins/Dbx_mdbx/src/dbcontacts.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/Dbx_mdbx/src/dbcontacts.cpp b/plugins/Dbx_mdbx/src/dbcontacts.cpp
index e639ae1de3..39d5c2ed27 100644
--- a/plugins/Dbx_mdbx/src/dbcontacts.cpp
+++ b/plugins/Dbx_mdbx/src/dbcontacts.cpp
@@ -103,7 +103,7 @@ STDMETHODIMP_(MCONTACT) CDbxMDBX::AddContact()
STDMETHODIMP_(BOOL) CDbxMDBX::IsDbContact(MCONTACT contactID)
{
DBCachedContact *cc = m_cache->GetCachedContact(contactID);
- return (cc != NULL);
+ return (cc != nullptr);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -134,11 +134,12 @@ BOOL CDbxMDBX::MetaMergeHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub)
EventItem *EI = list[i];
{
txn_ptr trnlck(m_env);
+
DBEventSortingKey insVal = { ccMeta->contactID, EI->eventId, EI->ts };
MDBX_val key = { &insVal, sizeof(insVal) }, data = { (void*)"", 1 };
-
if (mdbx_put(trnlck, m_dbEventsSort, &key, &data, 0) != MDBX_SUCCESS)
return 1;
+
if (trnlck.commit() != MDBX_SUCCESS)
return 1;
}
@@ -179,7 +180,7 @@ BOOL CDbxMDBX::MetaSplitHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub)
txn_ptr trnlck(m_env);
MDBX_val keyc = { &ccMeta->contactID, sizeof(MCONTACT) }, datac = { &ccMeta->dbc, sizeof(ccMeta->dbc) };
- if(mdbx_put(trnlck, m_dbContacts, &keyc, &datac, 0) != MDBX_SUCCESS)
+ if (mdbx_put(trnlck, m_dbContacts, &keyc, &datac, 0) != MDBX_SUCCESS)
return 1;
if (trnlck.commit() != MDBX_SUCCESS)
return 1;
@@ -237,10 +238,10 @@ void CDbxMDBX::FillContacts()
for (int k = 0; k < cc->nSubs; k++) {
char setting[100];
mir_snprintf(setting, _countof(setting), "Handle%d", k);
- cc->pSubs[k] = (0 != GetContactSetting(cc->contactID, META_PROTO, setting, &dbv)) ? NULL : dbv.dVal;
+ cc->pSubs[k] = (0 != GetContactSetting(cc->contactID, META_PROTO, setting, &dbv)) ? 0 : dbv.dVal;
}
}
cc->nDefault = (0 != GetContactSetting(cc->contactID, META_PROTO, "Default", &dbv)) ? -1 : dbv.dVal;
- cc->parentID = (0 != GetContactSetting(cc->contactID, META_PROTO, "ParentMeta", &dbv)) ? NULL : dbv.dVal;
+ cc->parentID = (0 != GetContactSetting(cc->contactID, META_PROTO, "ParentMeta", &dbv)) ? 0 : dbv.dVal;
}
}