diff options
-rw-r--r-- | include/m_db_int.h | 9 | ||||
-rw-r--r-- | libs/win32/mir_app.lib | bin | 130606 -> 129562 bytes | |||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 126202 -> 125170 bytes | |||
-rw-r--r-- | plugins/Db3x_mmap/src/dbintf.cpp | 2 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbintf.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/MDatabaseCommon.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/database.h | 4 | ||||
-rw-r--r-- | src/mir_app/src/db_intf.cpp | 15 | ||||
-rw-r--r-- | src/mir_app/src/mdatabasecache.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 6 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 6 |
11 files changed, 14 insertions, 42 deletions
diff --git a/include/m_db_int.h b/include/m_db_int.h index fd10999153..19d5377039 100644 --- a/include/m_db_int.h +++ b/include/m_db_int.h @@ -140,6 +140,7 @@ protected: protected:
MDatabaseCommon();
+ ~MDatabaseCommon();
int CheckProto(DBCachedContact *cc, const char *proto);
@@ -274,12 +275,4 @@ EXTERN_C MIR_APP_DLL(void) RegisterDatabasePlugin(DATABASELINK *pDescr); EXTERN_C MIR_APP_DLL(DATABASELINK*) FindDatabasePlugin(const wchar_t *ptszFileName);
-// initializes a database instance
-
-EXTERN_C MIR_APP_DLL(void) InitDbInstance(MIDatabase *pDatabase);
-
-// destroys a database instance
-
-EXTERN_C MIR_APP_DLL(void) DestroyDbInstance(MIDatabase *pDatabase);
-
#endif // M_DB_INT_H__
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 88068ccf04..258fb23bd0 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex 93620bd47a..8f45bbccef 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp index da2e998595..dc775b82b1 100644 --- a/plugins/Db3x_mmap/src/dbintf.cpp +++ b/plugins/Db3x_mmap/src/dbintf.cpp @@ -49,7 +49,6 @@ CDb3Mmap::CDb3Mmap(const wchar_t *tszFileName, int iMode) : m_lOfs(50, OfsCompare)
{
m_tszProfileName = mir_wstrdup(tszFileName);
- InitDbInstance(this);
SYSTEM_INFO sinf;
GetSystemInfo(&sinf);
@@ -98,7 +97,6 @@ CDb3Mmap::~CDb3Mmap() DestroyHookableEvent(hEventDeletedEvent);
DestroyHookableEvent(hEventFilterAddedEvent);
- DestroyDbInstance(this);
mir_free(m_tszProfileName);
free(m_pNull);
diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp index 93d6a7db09..e74f266248 100644 --- a/plugins/Dbx_mdbx/src/dbintf.cpp +++ b/plugins/Dbx_mdbx/src/dbintf.cpp @@ -30,7 +30,6 @@ CDbxMDBX::CDbxMDBX(const TCHAR *tszFileName, int iMode) : m_maxContactId(0)
{
m_tszProfileName = mir_wstrdup(tszFileName);
- InitDbInstance(this);
mdbx_env_create(&m_env);
mdbx_env_set_maxdbs(m_env, 10);
@@ -57,7 +56,6 @@ CDbxMDBX::~CDbxMDBX() DestroyHookableEvent(hEventDeletedEvent);
DestroyHookableEvent(hEventFilterAddedEvent);
- DestroyDbInstance(this);
mir_free(m_tszProfileName);
}
diff --git a/src/mir_app/src/MDatabaseCommon.cpp b/src/mir_app/src/MDatabaseCommon.cpp index bfab4d2793..c909a57e77 100644 --- a/src/mir_app/src/MDatabaseCommon.cpp +++ b/src/mir_app/src/MDatabaseCommon.cpp @@ -33,6 +33,12 @@ MDatabaseCommon::MDatabaseCommon() : m_lResidentSettings(50, stringCompare2) { m_codePage = Langpack_GetDefaultCodePage(); + m_cache = new MDatabaseCache(this); +} + +MDatabaseCommon::~MDatabaseCommon() +{ + delete (MDatabaseCache*)m_cache; } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/mir_app/src/database.h b/src/mir_app/src/database.h index 6bd310bb2c..30db71ad2d 100644 --- a/src/mir_app/src/database.h +++ b/src/mir_app/src/database.h @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class MDatabaseCache : public MIDatabaseCache
{
char* m_lastSetting;
- size_t m_contactSize;
+ MIDatabase* m_db;
DBCachedContact *m_lastVL;
mir_cs m_csContact, m_csVal;
@@ -37,7 +37,7 @@ class MDatabaseCache : public MIDatabaseCache void FreeCachedVariant(DBVARIANT* V);
public:
- MDatabaseCache(size_t);
+ MDatabaseCache(MIDatabase*);
~MDatabaseCache();
protected:
diff --git a/src/mir_app/src/db_intf.cpp b/src/mir_app/src/db_intf.cpp index c62b71927b..1a20ef4263 100644 --- a/src/mir_app/src/db_intf.cpp +++ b/src/mir_app/src/db_intf.cpp @@ -46,21 +46,6 @@ MIR_APP_DLL(DATABASELINK*) FindDatabasePlugin(const wchar_t *ptszFileName) return nullptr;
}
-MIR_APP_DLL(void) InitDbInstance(MIDatabase *pDatabase)
-{
- if (pDatabase != nullptr)
- pDatabase->m_cache = new MDatabaseCache(pDatabase->GetContactSize());
-}
-
-MIR_APP_DLL(void) DestroyDbInstance(MIDatabase *pDatabase)
-{
- if (pDatabase != nullptr) {
- MDatabaseCache *pCache = (MDatabaseCache*)pDatabase->m_cache;
- pDatabase->m_cache = nullptr;
- delete pCache;
- }
-}
-
///////////////////////////////////////////////////////////////////////////////
int LoadDbintfModule()
diff --git a/src/mir_app/src/mdatabasecache.cpp b/src/mir_app/src/mdatabasecache.cpp index 5c33fcf8c7..c9e72c8d71 100644 --- a/src/mir_app/src/mdatabasecache.cpp +++ b/src/mir_app/src/mdatabasecache.cpp @@ -36,8 +36,8 @@ static int compareGlobals(const DBCachedGlobalValue *p1, const DBCachedGlobalVal return mir_strcmp(p1->name, p2->name);
}
-MDatabaseCache::MDatabaseCache(size_t _size) :
- m_contactSize(_size),
+MDatabaseCache::MDatabaseCache(MIDatabase *_db) :
+ m_db(_db),
m_lSettings(100, stringCompare),
m_lContacts(50, NumericKeySortT),
m_lGlobalSettings(50, compareGlobals),
@@ -62,7 +62,7 @@ DBCachedContact* MDatabaseCache::AddContactToCache(MCONTACT contactID) if (index != -1)
return m_lContacts[index];
- DBCachedContact *cc = (DBCachedContact*)mir_calloc(m_contactSize);
+ DBCachedContact *cc = (DBCachedContact*)mir_calloc(m_db->GetContactSize());
cc->contactID = contactID;
cc->nSubs = -1;
m_lContacts.insert(cc);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 3fde886325..4bcd151b11 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -284,9 +284,7 @@ Profile_GetNameW @291 Profile_GetPathA @292
Profile_GetPathW @293
Profile_SetDefault @294
-DestroyDbInstance @295
FindDatabasePlugin @296
-InitDbInstance @297
RegisterDatabasePlugin @298
Chat_GetInterface @299
Chat_Event @300
@@ -452,14 +450,12 @@ Skin_PlaySoundFile @463 Clist_SetStatusMode @464
??0CProtoIntDlgBase@@QAE@$$QAV0@@Z @465 NONAME
??0MDatabaseCommon@@IAE@XZ @466 NONAME
-??0MDatabaseCommon@@QAE@$$QAV0@@Z @467 NONAME
??0MDatabaseCommon@@QAE@ABV0@@Z @468 NONAME
??0MIDatabase@@QAE@$$QAU0@@Z @469 NONAME
??0MIDatabase@@QAE@ABU0@@Z @470 NONAME
??0MIDatabase@@QAE@XZ @471 NONAME
-??1MDatabaseCommon@@QAE@XZ @473 NONAME
+??1MDatabaseCommon@@IAE@XZ @473 NONAME
??4CProtoIntDlgBase@@QAEAAV0@$$QAV0@@Z @474 NONAME
-??4MDatabaseCommon@@QAEAAV0@$$QAV0@@Z @475 NONAME
??4MDatabaseCommon@@QAEAAV0@ABV0@@Z @476 NONAME
??4MIDatabase@@QAEAAU0@$$QAU0@@Z @477 NONAME
??4MIDatabase@@QAEAAU0@ABU0@@Z @478 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 31958bb466..9939debfff 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -284,9 +284,7 @@ Profile_GetNameW @291 Profile_GetPathA @292
Profile_GetPathW @293
Profile_SetDefault @294
-DestroyDbInstance @295
FindDatabasePlugin @296
-InitDbInstance @297
RegisterDatabasePlugin @298
Chat_GetInterface @299
Chat_Event @300
@@ -452,14 +450,12 @@ Skin_PlaySoundFile @463 Clist_SetStatusMode @464
??0CProtoIntDlgBase@@QEAA@$$QEAV0@@Z @465 NONAME
??0MDatabaseCommon@@IEAA@XZ @466 NONAME
-??0MDatabaseCommon@@QEAA@$$QEAV0@@Z @467 NONAME
??0MDatabaseCommon@@QEAA@AEBV0@@Z @468 NONAME
??0MIDatabase@@QEAA@$$QEAU0@@Z @469 NONAME
??0MIDatabase@@QEAA@AEBU0@@Z @470 NONAME
??0MIDatabase@@QEAA@XZ @471 NONAME
-??1MDatabaseCommon@@QEAA@XZ @473 NONAME
+??1MDatabaseCommon@@IEAA@XZ @473 NONAME
??4CProtoIntDlgBase@@QEAAAEAV0@$$QEAV0@@Z @474 NONAME
-??4MDatabaseCommon@@QEAAAEAV0@$$QEAV0@@Z @475 NONAME
??4MDatabaseCommon@@QEAAAEAV0@AEBV0@@Z @476 NONAME
??4MIDatabase@@QEAAAEAU0@$$QEAU0@@Z @477 NONAME
??4MIDatabase@@QEAAAEAU0@AEBU0@@Z @478 NONAME
|