diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2016-03-02 15:41:48 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2016-03-02 15:41:48 +0000 |
commit | 336401d1771d74771246ac7e3ec6e3b1e562a98e (patch) | |
tree | 1d6d0df96dec368e9af0b6feabd1637877e1cef4 /plugins/Dbx_mdb | |
parent | 3ec4883a6f1dc06a030cd8e64ab6f519982ed1ce (diff) |
dbx_lmdb: code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@16392 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb')
-rw-r--r-- | plugins/Dbx_mdb/src/dbevents.cpp | 4 | ||||
-rw-r--r-- | plugins/Dbx_mdb/src/dbintf.cpp | 2 | ||||
-rw-r--r-- | plugins/Dbx_mdb/src/dbintf.h | 53 | ||||
-rw-r--r-- | plugins/Dbx_mdb/src/init.cpp | 2 |
4 files changed, 6 insertions, 55 deletions
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp index 927ca2598a..0367c9d025 100644 --- a/plugins/Dbx_mdb/src/dbevents.cpp +++ b/plugins/Dbx_mdb/src/dbevents.cpp @@ -247,7 +247,6 @@ void CDbxMdb::FindNextUnread(const txn_ptr &txn, DBCachedContact *cc, DBEventSor cursor_ptr cursor(txn, m_dbEventsSort);
MDB_val key = { sizeof(key2), &key2 }, data;
- //key2.dwEventId++;
if (mdb_cursor_get(cursor, &key, &data, MDB_SET) == MDB_SUCCESS)
{
@@ -278,7 +277,7 @@ STDMETHODIMP_(BOOL) CDbxMdb::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) mir_cslockfull lck(m_csDbAccess);
DWORD wRetVal = 0;
- for (;; Remap())
+ for (cc->Snapshot();; cc->Revert(), Remap())
{
txn_ptr txn(m_pMdbEnv);
@@ -303,7 +302,6 @@ STDMETHODIMP_(BOOL) CDbxMdb::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) MDB_CHECK(mdb_put(txn, m_dbContacts, &key, &data, 0), -1);
wRetVal = dbe->flags;
-
if (txn.commit())
break;
}
diff --git a/plugins/Dbx_mdb/src/dbintf.cpp b/plugins/Dbx_mdb/src/dbintf.cpp index 56a116b234..4124ad5fbf 100644 --- a/plugins/Dbx_mdb/src/dbintf.cpp +++ b/plugins/Dbx_mdb/src/dbintf.cpp @@ -287,8 +287,6 @@ int CDbxMdb::Start(DBCHeckCallback *callback) int CDbxMdb::CheckDb(int, int)
{
return ERROR_OUT_OF_PAPER;
-
- // return (this->*Workers[phase])(firstTime);
}
void CDbxMdb::Destroy()
diff --git a/plugins/Dbx_mdb/src/dbintf.h b/plugins/Dbx_mdb/src/dbintf.h index f744b37d96..706b9e648b 100644 --- a/plugins/Dbx_mdb/src/dbintf.h +++ b/plugins/Dbx_mdb/src/dbintf.h @@ -25,26 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_db_int.h>
-/* tree diagram
-
-DBHeader
-|-->end of file (plain offset)
-|-->first contact (DBContact)
-| |-->next contact (DBContact)
-| | \--> ...
-| |-->first settings (DBContactSettings)
-| | |-->next settings (DBContactSettings)
-| | | \--> ...
-| | \-->module name (DBModuleName)
-| \-->first/last/firstunread event
-|-->user contact (DBContact)
-| |-->next contact = NULL
-| |-->first settings as above
-| \-->first/last/firstunread event as above
-\-->first module name (DBModuleName)
-\-->next module name (DBModuleName)
-\--> ...
-*/
+#pragma warning (disable: 4200)
#define DBMODE_SHARED 0x0001
#define DBMODE_READONLY 0x0002
@@ -83,7 +64,7 @@ struct DBModuleName {
DWORD dwSignature;
BYTE cbName; // number of characters in this module name
- char name[1]; // name, no nul terminator
+ char name[]; // name, no nul terminator
};
#define DBEVENT_SIGNATURE 0x45DECADEu
@@ -214,13 +195,6 @@ protected: bool Remap();
bool Map();
-public: // Check functions
- int WorkInitialChecks(int);
- int WorkModuleChain(int);
- int WorkUser(int);
- int WorkContactChain(int);
- int WorkAggressive(int);
- int WorkFinalTasks(int);
protected:
TCHAR* m_tszProfileName;
@@ -259,7 +233,7 @@ protected: MDB_dbi m_dbContacts;
MDB_cursor *m_curContacts;
- DWORD m_contactCount, m_dwMaxContactId;
+ DWORD m_contactCount, m_dwMaxContactId;
void GatherContactHistory(MCONTACT hContact, LIST<EventItem> &items);
@@ -293,30 +267,11 @@ protected: DWORD GetModuleNameOfs(const char *szName);
char* GetModuleNameByOfs(DWORD ofs);
- ////////////////////////////////////////////////////////////////////////////
- // checker
-
- int PeekSegment(DWORD ofs, PVOID buf, int cbBytes);
- int ReadSegment(DWORD ofs, PVOID buf, int cbBytes);
- int ReadWrittenSegment(DWORD ofs, PVOID buf, int cbBytes);
- int SignatureValid(DWORD ofs, DWORD dwSignature);
- void FreeModuleChain();
-
- DWORD ConvertModuleNameOfs(DWORD ofsOld);
- void ConvertOldEvent(DBEvent*& dbei);
- int GetContactSettingWorker(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, int isStatic);
- int WorkSettingsChain(DBContact *dbc, int firstTime);
- int WorkEventChain(DWORD ofsContact, DBContact *dbc, int firstTime);
+ int GetContactSettingWorker(MCONTACT contactID, LPCSTR szModule, LPCSTR szSetting, DBVARIANT *dbv, int isStatic);
- DWORD WriteSegment(DWORD ofs, PVOID buf, int cbBytes);
- DWORD WriteEvent(DBEvent *dbe);
- DWORD PeekEvent(DWORD ofs, DWORD dwContactID, DBEvent &dbe);
- void WriteOfsNextToPrevious(DWORD ofsPrev, DBContact *dbc, DWORD ofsNext);
- void FinishUp(DWORD ofsLast, DBContact *dbc);
DBCHeckCallback *cb;
- DWORD sourceFileSize, ofsAggrCur;
////////////////////////////////////////////////////////////////////////////
// encryption
diff --git a/plugins/Dbx_mdb/src/init.cpp b/plugins/Dbx_mdb/src/init.cpp index 101608e8da..264ef433f4 100644 --- a/plugins/Dbx_mdb/src/init.cpp +++ b/plugins/Dbx_mdb/src/init.cpp @@ -98,7 +98,7 @@ MIDatabaseChecker* CheckDb(const TCHAR *profile, int *error) static DATABASELINK dblink =
{
sizeof(DATABASELINK),
- "dbx_mdb",
+ "dbx_lmdb",
_T("LMDB database driver"),
makeDatabase,
grokHeader,
|