diff options
author | George Hazan <george.hazan@gmail.com> | 2012-10-30 20:46:01 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-10-30 20:46:01 +0000 |
commit | 06a79b9469f4d187132cd148411d9b92c7e35e6f (patch) | |
tree | bb9ee9b9daf2016ecc97d9af8b575cd32b8574da /src/modules | |
parent | 0edc13560169b35dc38e2923f0d240531221cd03 (diff) |
fix for that hell with ClcCacheEntryBase
git-svn-id: http://svn.miranda-ng.org/main/trunk@2120 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/clist/clc.h | 12 | ||||
-rw-r--r-- | src/modules/clist/clcitems.cpp | 6 | ||||
-rw-r--r-- | src/modules/clist/clistsettings.cpp | 24 | ||||
-rw-r--r-- | src/modules/clist/groups.cpp | 14 |
4 files changed, 30 insertions, 26 deletions
diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h index dc5fac0a88..7175e0f8b0 100644 --- a/src/modules/clist/clc.h +++ b/src/modules/clist/clc.h @@ -29,6 +29,10 @@ struct ClcData : public ClcDataBase {
};
+struct ClcCacheEntry : public ClcCacheEntryBase
+{
+};
+
/* clc.c */
extern int g_IconWidth, g_IconHeight;
@@ -118,10 +122,10 @@ TCHAR* fnGetContactDisplayName(HANDLE hContact, int mode); void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF * colour);
void fnInvalidateDisplayNameCacheEntry(HANDLE hContact);
-ClcCacheEntryBase* fnGetCacheEntry(HANDLE hContact);
-ClcCacheEntryBase* fnCreateCacheItem (HANDLE hContact);
-void fnCheckCacheItem(ClcCacheEntryBase* p);
-void fnFreeCacheItem(ClcCacheEntryBase* p);
+ClcCacheEntry* fnGetCacheEntry(HANDLE hContact);
+ClcCacheEntry* fnCreateCacheItem (HANDLE hContact);
+void fnCheckCacheItem(ClcCacheEntry *p);
+void fnFreeCacheItem(ClcCacheEntry *p);
/* clcfiledrop.c */
void InitFileDropping(void);
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index d7d0fa284b..0530f75fb8 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -108,7 +108,7 @@ ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
HANDLE hContact = db_find_first();
while (hContact) {
- ClcCacheEntryBase* cache = cli.pfnGetCacheEntry(hContact);
+ ClcCacheEntry* cache = cli.pfnGetCacheEntry(hContact);
if ( !lstrcmp(cache->tszGroup, szName) && (style & CLS_SHOWHIDDEN || !cache->bIsHidden))
group->totalMembers++;
@@ -204,7 +204,7 @@ int fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact) group->cl.items[i]->flags |= CONTACTF_IDLE;
lstrcpyn(group->cl.items[i]->szText, cli.pfnGetContactDisplayName(hContact, 0), SIZEOF(group->cl.items[i]->szText));
- ClcCacheEntryBase* p = cli.pfnGetCacheEntry(hContact);
+ ClcCacheEntry *p = cli.pfnGetCacheEntry(hContact);
if (p != NULL)
replaceStrT(p->tszGroup, NULL);
@@ -291,7 +291,7 @@ ClcGroup* fnRemoveItemFromGroup(HWND hwnd, ClcGroup *group, ClcContact *contact, if (updateTotalCount)
group->totalMembers--;
- ClcCacheEntryBase* p = cli.pfnGetCacheEntry(contact->hContact);
+ ClcCacheEntry *p = cli.pfnGetCacheEntry(contact->hContact);
if (p != NULL) {
if (p->tszGroup) mir_free(p->tszGroup);
p->tszGroup = NULL;
diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp index 62795e8450..4535781588 100644 --- a/src/modules/clist/clistsettings.cpp +++ b/src/modules/clist/clistsettings.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. SortedList* clistCache = NULL;
-static int compareContacts(ClcCacheEntryBase* p1, ClcCacheEntryBase* p2)
+static int compareContacts(ClcCacheEntry *p1, ClcCacheEntry *p2)
{
return (char*)p1->hContact - (char*)p2->hContact;
}
@@ -41,7 +41,7 @@ void FreeDisplayNameCache(void) if (clistCache != NULL) {
int i;
for (i=0; i < clistCache->realCount; i++) {
- cli.pfnFreeCacheItem((ClcCacheEntryBase*)clistCache->items[i]);
+ cli.pfnFreeCacheItem((ClcCacheEntry*)clistCache->items[i]);
mir_free(clistCache->items[i]);
}
@@ -52,9 +52,9 @@ void FreeDisplayNameCache(void) // default handlers for the cache item creation and destruction
-ClcCacheEntryBase* fnCreateCacheItem(HANDLE hContact)
+ClcCacheEntry* fnCreateCacheItem(HANDLE hContact)
{
- ClcCacheEntryBase* p = (ClcCacheEntryBase*)mir_calloc(sizeof(ClcCacheEntryBase));
+ ClcCacheEntry* p = (ClcCacheEntry*)mir_calloc(sizeof(ClcCacheEntry));
if (p == NULL)
return NULL;
@@ -62,7 +62,7 @@ ClcCacheEntryBase* fnCreateCacheItem(HANDLE hContact) return p;
}
-void fnCheckCacheItem(ClcCacheEntryBase* p)
+void fnCheckCacheItem(ClcCacheEntry *p)
{
DBVARIANT dbv;
if (p->tszGroup == NULL) {
@@ -77,16 +77,16 @@ void fnCheckCacheItem(ClcCacheEntryBase* p) p->bIsHidden = db_get_b(p->hContact, "CList", "Hidden", 0);
}
-void fnFreeCacheItem(ClcCacheEntryBase* p)
+void fnFreeCacheItem(ClcCacheEntry *p)
{
if (p->tszName) { mir_free(p->tszName); p->tszName = NULL; }
if (p->tszGroup) { mir_free(p->tszGroup); p->tszGroup = NULL; }
p->bIsHidden = -1;
}
-ClcCacheEntryBase* fnGetCacheEntry(HANDLE hContact)
+ClcCacheEntry* fnGetCacheEntry(HANDLE hContact)
{
- ClcCacheEntryBase* p;
+ ClcCacheEntry *p;
int idx;
if ( !List_GetIndex(clistCache, &hContact, &idx)) {
if ((p = cli.pfnCreateCacheItem(hContact)) != NULL) {
@@ -94,7 +94,7 @@ ClcCacheEntryBase* fnGetCacheEntry(HANDLE hContact) cli.pfnInvalidateDisplayNameCacheEntry(p);
}
}
- else p = (ClcCacheEntryBase*)clistCache->items[idx];
+ else p = (ClcCacheEntry*)clistCache->items[idx];
cli.pfnCheckCacheItem(p);
return p;
@@ -110,12 +110,12 @@ void fnInvalidateDisplayNameCacheEntry(HANDLE hContact) else {
int idx;
if (List_GetIndex(clistCache, &hContact, &idx))
- cli.pfnFreeCacheItem((ClcCacheEntryBase*)clistCache->items[idx]);
+ cli.pfnFreeCacheItem((ClcCacheEntry*)clistCache->items[idx]);
} }
TCHAR* fnGetContactDisplayName(HANDLE hContact, int mode)
{
- ClcCacheEntryBase* cacheEntry = NULL;
+ ClcCacheEntry *cacheEntry = NULL;
if (mode & GCDNF_NOCACHE)
mode &= ~GCDNF_NOCACHE;
@@ -155,7 +155,7 @@ TCHAR* fnGetContactDisplayName(HANDLE hContact, int mode) INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam)
{
static char retVal[200];
- ClcCacheEntryBase* cacheEntry = NULL;
+ ClcCacheEntry *cacheEntry = NULL;
HANDLE hContact = (HANDLE)wParam;
if (lParam & GCDNF_UNICODE)
diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp index 905574c51b..cc3d79f280 100644 --- a/src/modules/clist/groups.cpp +++ b/src/modules/clist/groups.cpp @@ -275,15 +275,15 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) //must rename setting in all child contacts too
hContact = db_find_first();
do {
- ClcCacheEntryBase* cache = cli.pfnGetCacheEntry(hContact);
+ ClcCacheEntry* cache = cli.pfnGetCacheEntry(hContact);
if ( !lstrcmp(cache->tszGroup, oldName)) {
- db_set_ts(hContact, "CList", "Group", szName);
- mir_free(cache->tszGroup);
- cache->tszGroup = 0;
- cli.pfnCheckCacheItem(cache);
- }
+ db_set_ts(hContact, "CList", "Group", szName);
+ mir_free(cache->tszGroup);
+ cache->tszGroup = 0;
+ cli.pfnCheckCacheItem(cache);
+ }
}
- while ((hContact = db_find_next(hContact)) != NULL);
+ while ((hContact = db_find_next(hContact)) != NULL);
//rename subgroups
{
|