summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-01-18 18:55:32 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-01-18 18:55:32 +0000
commitffed014ccd5370a5073594d55dd0dc88080e0b3d (patch)
tree6d8c5c00d7d5e22607e55aa5ce73c1e2b8139044 /src
parentcdad72e9512d163ed15bc89bd0a93e7da2ee4c50 (diff)
contacts cache details to be completely hidden from the outside world
git-svn-id: http://svn.miranda-ng.org/main/trunk@11873 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/modules/database/database.h3
-rw-r--r--src/modules/database/dbintf.cpp2
-rw-r--r--src/modules/database/mdatabasecache.cpp5
3 files changed, 6 insertions, 4 deletions
diff --git a/src/modules/database/database.h b/src/modules/database/database.h
index ebc5a6cdd4..c0acab5c48 100644
--- a/src/modules/database/database.h
+++ b/src/modules/database/database.h
@@ -25,6 +25,7 @@ class MDatabaseCache : public MIDatabaseCache
{
HANDLE m_hCacheHeap;
char* m_lastSetting;
+ size_t m_contactSize;
DBCachedContact *m_lastVL;
mir_cs m_cs;
@@ -35,7 +36,7 @@ class MDatabaseCache : public MIDatabaseCache
void FreeCachedVariant(DBVARIANT* V);
public:
- MDatabaseCache();
+ MDatabaseCache(size_t);
~MDatabaseCache();
protected:
diff --git a/src/modules/database/dbintf.cpp b/src/modules/database/dbintf.cpp
index 62b7db18a3..fed80cd528 100644
--- a/src/modules/database/dbintf.cpp
+++ b/src/modules/database/dbintf.cpp
@@ -123,7 +123,7 @@ static INT_PTR srvInitInstance(WPARAM wParam, LPARAM lParam)
{
MIDatabase* pDb = (MIDatabase*)lParam;
if (pDb != NULL)
- pDb->m_cache = new MDatabaseCache();
+ pDb->m_cache = new MDatabaseCache(pDb->GetContactSize());
return 0;
}
diff --git a/src/modules/database/mdatabasecache.cpp b/src/modules/database/mdatabasecache.cpp
index 3cc8be5972..27283ebb8d 100644
--- a/src/modules/database/mdatabasecache.cpp
+++ b/src/modules/database/mdatabasecache.cpp
@@ -34,7 +34,8 @@ static int compareGlobals(const DBCachedGlobalValue *p1, const DBCachedGlobalVal
return strcmp(p1->name, p2->name);
}
-MDatabaseCache::MDatabaseCache() :
+MDatabaseCache::MDatabaseCache(size_t _size) :
+ m_contactSize(_size),
m_lSettings(100, stringCompare),
m_lContacts(50, NumericKeySortT),
m_lGlobalSettings(50, compareGlobals)
@@ -60,7 +61,7 @@ DBCachedContact* MDatabaseCache::AddContactToCache(MCONTACT contactID)
if (index != -1)
return m_lContacts[index];
- DBCachedContact *cc = (DBCachedContact*)HeapAlloc(m_hCacheHeap, HEAP_ZERO_MEMORY, sizeof(DBCachedContact));
+ DBCachedContact *cc = (DBCachedContact*)HeapAlloc(m_hCacheHeap, HEAP_ZERO_MEMORY, m_contactSize);
cc->contactID = contactID;
cc->nSubs = -1;
m_lContacts.insert(cc);