diff options
author | George Hazan <george.hazan@gmail.com> | 2012-10-03 18:27:17 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-10-03 18:27:17 +0000 |
commit | 8cb2a99e08a3f8fadc3b39f00228efa7d2b20050 (patch) | |
tree | 65576462073546d462936d7ad8a2aa3e4e6147d8 /plugins/Db3x_mmap/src/dbintf.cpp | |
parent | d2da1f079fc61195437007882296184714d2fe54 (diff) |
database cache migration, phase 1
git-svn-id: http://svn.miranda-ng.org/main/trunk@1772 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/src/dbintf.cpp')
-rw-r--r-- | plugins/Db3x_mmap/src/dbintf.cpp | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp index 34a34ab6ab..be56756d35 100644 --- a/plugins/Db3x_mmap/src/dbintf.cpp +++ b/plugins/Db3x_mmap/src/dbintf.cpp @@ -25,21 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. DBSignature dbSignature = {"Miranda ICQ DB",0x1A};
-static int stringCompare(const char* p1, const char* p2)
-{
- return strcmp(p1+1, p2+1);
-}
-
-static int stringCompare2(const char* p1, const char* p2)
-{
- return strcmp(p1, p2);
-}
-
-static int compareGlobals(const DBCachedGlobalValue* p1, const DBCachedGlobalValue* p2)
-{
- return strcmp(p1->name, p2->name);
-}
-
static int ModCompare(const ModuleName *mn1, const ModuleName *mn2 )
{
return strcmp( mn1->name, mn2->name );
@@ -50,18 +35,20 @@ static int OfsCompare(const ModuleName *mn1, const ModuleName *mn2 ) return ( mn1->ofs - mn2->ofs );
}
+static int stringCompare2(const char* p1, const char* p2)
+{ return strcmp(p1, p2);
+}
+
CDb3Base::CDb3Base(const TCHAR* tszFileName) :
m_hDbFile(INVALID_HANDLE_VALUE),
m_safetyMode(true),
m_bReadOnly(true),
- m_lSettings(100, stringCompare),
- m_lContacts(50, LIST<DBCachedContactValueList>::FTSortFunc(HandleKeySort)),
- m_lGlobalSettings(50, compareGlobals),
- m_lResidentSettings(50, stringCompare2),
m_lMods(50, ModCompare),
- m_lOfs(50, OfsCompare)
+ m_lOfs(50, OfsCompare),
+ m_lResidentSettings(50, stringCompare2)
{
m_tszProfileName = mir_tstrdup(tszFileName);
+ InitDbInstance(this);
InitializeCriticalSection(&m_csDbAccess);
@@ -70,17 +57,11 @@ CDb3Base::CDb3Base(const TCHAR* tszFileName) : m_ChunkSize = sinf.dwAllocationGranularity;
m_codePage = CallService(MS_LANGPACK_GETCODEPAGE, 0, 0);
- m_hCacheHeap = HeapCreate(0, 0, 0);
m_hModHeap = HeapCreate(0,0,0);
}
CDb3Base::~CDb3Base()
{
- // destroy settings
- HeapDestroy(m_hCacheHeap);
- m_lContacts.destroy();
- m_lSettings.destroy();
- m_lGlobalSettings.destroy();
m_lResidentSettings.destroy();
// destroy modules
@@ -108,6 +89,7 @@ CDb3Base::~CDb3Base() DeleteCriticalSection(&m_csDbAccess);
+ DestroyDbInstance(this);
mir_free(m_tszProfileName);
}
|