diff options
author | George Hazan <ghazan@miranda.im> | 2018-01-22 19:18:14 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-01-22 19:18:14 +0300 |
commit | 4ea2523ec747335c4c915a38f2f73b5782711d24 (patch) | |
tree | bf4d022c24e966399a45d4a5da127e4b952deb35 /plugins | |
parent | 7177ca3a70807f06746b5f753e786811cd98f90e (diff) |
fix for broken contacts in mdbx
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Dbx_mdbx/src/dbcontacts.cpp | 18 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/stdafx.h | 10 |
2 files changed, 15 insertions, 13 deletions
diff --git a/plugins/Dbx_mdbx/src/dbcontacts.cpp b/plugins/Dbx_mdbx/src/dbcontacts.cpp index 1b8a269026..e639ae1de3 100644 --- a/plugins/Dbx_mdbx/src/dbcontacts.cpp +++ b/plugins/Dbx_mdbx/src/dbcontacts.cpp @@ -216,16 +216,18 @@ void DBCachedContact::Revert() void CDbxMDBX::FillContacts()
{
- LIST<DBCachedContact> arContacts(m_contactCount);
-
- txn_ptr_ro trnlck(m_txn);
- cursor_ptr_ro cursor(m_curContacts);
+ {
+ txn_ptr_ro trnlck(m_txn);
+ cursor_ptr_ro cursor(m_curContacts);
- MDBX_val key, data;
- while (mdbx_cursor_get(cursor, &key, &data, MDBX_NEXT) == MDBX_SUCCESS) {
- DBCachedContact *cc = m_cache->AddContactToCache(*(MCONTACT*)key.iov_base);
- cc->dbc = *(DBContact*)data.iov_base;
+ MDBX_val key, data;
+ while (mdbx_cursor_get(cursor, &key, &data, MDBX_NEXT) == MDBX_SUCCESS) {
+ DBCachedContact *cc = m_cache->AddContactToCache(*(MCONTACT*)key.iov_base);
+ cc->dbc = *(DBContact*)data.iov_base;
+ }
+ }
+ for (DBCachedContact *cc = m_cache->GetFirstContact(); cc; cc = m_cache->GetNextContact(cc->contactID)) {
CheckProto(cc, "");
DBVARIANT dbv; dbv.type = DBVT_DWORD;
diff --git a/plugins/Dbx_mdbx/src/stdafx.h b/plugins/Dbx_mdbx/src/stdafx.h index 5a14b7ab6f..caa3ea2725 100644 --- a/plugins/Dbx_mdbx/src/stdafx.h +++ b/plugins/Dbx_mdbx/src/stdafx.h @@ -59,7 +59,7 @@ public: {
int rc = mdbx_txn_begin(pEnv, NULL, 0, &m_txn);
/* FIXME: throw an exception */
- assert(rc == MDBX_SUCCESS);
+ _ASSERT(rc == MDBX_SUCCESS);
UNREFERENCED_PARAMETER(rc);
}
@@ -89,7 +89,7 @@ public: {
int rc = mdbx_txn_abort(m_txn);
/* FIXME: throw an exception */
- assert(rc == MDBX_SUCCESS);
+ _ASSERT(rc == MDBX_SUCCESS);
UNREFERENCED_PARAMETER(rc);
m_txn = nullptr;
}
@@ -114,14 +114,14 @@ public: {
int rc = mdbx_txn_renew(m_txn);
/* FIXME: throw an exception */
- assert(rc == MDBX_SUCCESS);
+ _ASSERT(rc == MDBX_SUCCESS);
UNREFERENCED_PARAMETER(rc);
}
__forceinline ~txn_ptr_ro()
{
int rc = mdbx_txn_reset(m_txn);
/* FIXME: throw an exception */
- assert(rc == MDBX_SUCCESS);
+ _ASSERT(rc == MDBX_SUCCESS);
UNREFERENCED_PARAMETER(rc);
}
__forceinline operator MDBX_txn*() const { return m_txn; }
@@ -155,7 +155,7 @@ public: {
int rc = mdbx_cursor_renew(mdbx_cursor_txn(m_cursor), m_cursor);
/* FIXME: throw an exception */
- assert(rc == MDBX_SUCCESS);
+ _ASSERT(rc == MDBX_SUCCESS);
UNREFERENCED_PARAMETER(rc);
}
__forceinline operator MDBX_cursor*() const { return m_cursor; }
|