diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-07 21:52:27 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-07 21:52:27 +0300 |
commit | 1cd15bc24f7e8cb87e9a9b96dd05ce62ce58cf0d (patch) | |
tree | a51a5fdefa1f8e5b2546547d48894867ced740b3 /src/mir_app | |
parent | fe0a3147a8050a987281beb4b5e1481b982c93bc (diff) |
old C-style code is obsolete now because of MDatabaseCommon existence
Diffstat (limited to 'src/mir_app')
-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 |
6 files changed, 13 insertions, 30 deletions
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
|