From 4ea2523ec747335c4c915a38f2f73b5782711d24 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 22 Jan 2018 19:18:14 +0300 Subject: fix for broken contacts in mdbx --- plugins/Dbx_mdbx/src/dbcontacts.cpp | 18 ++++++++++-------- plugins/Dbx_mdbx/src/stdafx.h | 10 +++++----- 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'plugins/Dbx_mdbx') 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 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; } -- cgit v1.2.3