summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-03-19 12:19:51 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-03-19 12:19:51 +0000
commit8b99a8b3a16763267cb2339bb822c2595b659935 (patch)
treecbc151e5bce1a5eaf1ea8cc57be3727d47eeecd3 /plugins
parent9ee16a4d7b872e72db98a8cc893484a418ba9eb9 (diff)
dbx_lmdb: more fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@16509 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Dbx_mdb/src/dbcontacts.cpp8
-rw-r--r--plugins/Dbx_mdb/src/dbevents.cpp10
2 files changed, 11 insertions, 7 deletions
diff --git a/plugins/Dbx_mdb/src/dbcontacts.cpp b/plugins/Dbx_mdb/src/dbcontacts.cpp
index 411f93140f..e2c67c3981 100644
--- a/plugins/Dbx_mdb/src/dbcontacts.cpp
+++ b/plugins/Dbx_mdb/src/dbcontacts.cpp
@@ -219,7 +219,9 @@ void CDbxMdb::GatherContactHistory(MCONTACT hContact, LIST<EventItem> &list)
BOOL CDbxMdb::MetaMergeHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub)
{
- LIST<EventItem> list(10000);
+ mir_cslock lck(m_csDbAccess);
+
+ LIST<EventItem> list(1000);
GatherContactHistory(ccSub->contactID, list);
for (int i = 0; i < list.getCount(); i++) {
@@ -254,7 +256,9 @@ BOOL CDbxMdb::MetaMergeHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub)
BOOL CDbxMdb::MetaSplitHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub)
{
- LIST<EventItem> list(10000);
+ mir_cslock lck(m_csDbAccess);
+
+ LIST<EventItem> list(1000);
GatherContactHistory(ccSub->contactID, list);
for (int i = 0; i < list.getCount(); i++) {
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp
index 721f81e823..d890d86185 100644
--- a/plugins/Dbx_mdb/src/dbevents.cpp
+++ b/plugins/Dbx_mdb/src/dbevents.cpp
@@ -382,18 +382,18 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindLastEvent(MCONTACT contactID)
txn_ptr_ro txn(m_txn);
cursor_ptr_ro cursor(m_curEventsSort);
- if (contactID != (m_dwMaxContactId - 1))
+
+ if (mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE) != MDB_SUCCESS)
{
- if (mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE) != MDB_SUCCESS)
- return m_evLast = 0;
- if (mdb_cursor_get(cursor, &key, &data, MDB_PREV) != MDB_SUCCESS)
+ if (mdb_cursor_get(cursor, &key, &data, MDB_LAST) != MDB_SUCCESS)
return m_evLast = 0;
}
else
{
- if (mdb_cursor_get(cursor, &key, &data, MDB_LAST) != MDB_SUCCESS)
+ if (mdb_cursor_get(cursor, &key, &data, MDB_PREV) != MDB_SUCCESS)
return m_evLast = 0;
}
+
const DBEventSortingKey *pKey = (const DBEventSortingKey*)key.mv_data;
m_tsLast = pKey->ts;
return m_evLast = (pKey->dwContactId == contactID) ? pKey->dwEventId : 0;