diff options
author | George Hazan <george.hazan@gmail.com> | 2015-03-11 14:44:01 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-03-11 14:44:01 +0000 |
commit | 3217cdb64cee13682bf06656d0556172d3ce2296 (patch) | |
tree | 4bf58ab88437b97d39572632d1e4aa108851e5a9 /plugins/Dbx_mdb | |
parent | b6efa0c9ffff63af5aae1b8e364175112bd43744 (diff) |
minor speed improvement
git-svn-id: http://svn.miranda-ng.org/main/trunk@12381 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb')
-rw-r--r-- | plugins/Dbx_mdb/src/dbevents.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp index 26be93a7af..c0a507f5d3 100644 --- a/plugins/Dbx_mdb/src/dbevents.cpp +++ b/plugins/Dbx_mdb/src/dbevents.cpp @@ -152,9 +152,9 @@ STDMETHODIMP_(BOOL) CDbxMdb::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) // update a contact
key.mv_size = sizeof(int); key.mv_data = &contactID;
- cc->dbc.dwEventCount--; - if (cc->dbc.dwFirstUnread == hDbEvent) - FindNextUnread(txn, cc, key2); + cc->dbc.dwEventCount--;
+ if (cc->dbc.dwFirstUnread == hDbEvent)
+ FindNextUnread(txn, cc, key2);
if (txn.commit())
break;
@@ -228,22 +228,22 @@ STDMETHODIMP_(BOOL) CDbxMdb::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) void CDbxMdb::FindNextUnread(const txn_ptr &txn, DBCachedContact *cc, DBEventSortingKey &key2)
{
- cursor_ptr cursor(txn, m_dbEventsSort); - - MDB_val key = { sizeof(key2), &key2 }, data; - key2.dwEventId++; - mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY); - while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == 0) { - DBEvent *dbe = (DBEvent*)data.mv_data; - if (!dbe->markedRead()) { - cc->dbc.dwFirstUnread = key2.dwEventId; - cc->dbc.tsFirstUnread = key2.ts; - return; - } - } - - cc->dbc.dwFirstUnread = cc->dbc.tsFirstUnread = 0; -} + cursor_ptr cursor(txn, m_dbEventsSort);
+
+ MDB_val key = { sizeof(key2), &key2 }, data;
+ key2.dwEventId++;
+ mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY);
+ while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == 0) {
+ DBEvent *dbe = (DBEvent*)data.mv_data;
+ if (!dbe->markedRead()) {
+ cc->dbc.dwFirstUnread = key2.dwEventId;
+ cc->dbc.tsFirstUnread = key2.ts;
+ return;
+ }
+ }
+
+ cc->dbc.dwFirstUnread = cc->dbc.tsFirstUnread = 0;
+}
STDMETHODIMP_(BOOL) CDbxMdb::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent)
{
@@ -304,7 +304,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindFirstEvent(MCONTACT contactID) txn_ptr txn(m_pMdbEnv, true);
cursor_ptr cursor(txn, m_dbEventsSort);
- mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY);
+ mdb_cursor_get(cursor, &key, &data, MDB_SET);
if (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) != MDB_SUCCESS)
return m_evLast = 0;
@@ -328,7 +328,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindLastEvent(MCONTACT contactID) txn_ptr txn(m_pMdbEnv, true);
cursor_ptr cursor(txn, m_dbEventsSort);
- mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY);
+ mdb_cursor_get(cursor, &key, &data, MDB_SET);
if (mdb_cursor_get(cursor, &key, &data, MDB_PREV) != MDB_SUCCESS)
return m_evLast = 0;
@@ -357,7 +357,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindNextEvent(MCONTACT contactID, MEVENT hDbEvent MDB_val key = { sizeof(keyVal), &keyVal };
cursor_ptr cursor(txn, m_dbEventsSort);
- if (mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY) != MDB_SUCCESS)
+ if (mdb_cursor_get(cursor, &key, &data, MDB_SET) != MDB_SUCCESS)
return m_evLast = 0;
if (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) != MDB_SUCCESS)
@@ -388,7 +388,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindPrevEvent(MCONTACT contactID, MEVENT hDbEvent MDB_val key = { sizeof(keyVal), &keyVal };
cursor_ptr cursor(txn, m_dbEventsSort);
- if (mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY) != MDB_SUCCESS)
+ if (mdb_cursor_get(cursor, &key, &data, MDB_SET) != MDB_SUCCESS)
return m_evLast = 0;
if (mdb_cursor_get(cursor, &key, &data, MDB_PREV) != MDB_SUCCESS)
|