From 06a79b9469f4d187132cd148411d9b92c7e35e6f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 30 Oct 2012 20:46:01 +0000 Subject: fix for that hell with ClcCacheEntryBase git-svn-id: http://svn.miranda-ng.org/main/trunk@2120 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_mw/src/CLUIFrames/extraimage.cpp | 4 +-- plugins/Clist_mw/src/clc.cpp | 4 +-- plugins/Clist_mw/src/clcidents.cpp | 18 ++++++------- plugins/Clist_mw/src/clcitems.cpp | 8 +++--- plugins/Clist_mw/src/clist.h | 6 ++--- plugins/Clist_mw/src/clistmod.cpp | 4 +-- plugins/Clist_mw/src/clistsettings.cpp | 35 ++++++++++++-------------- plugins/Clist_mw/src/clui.cpp | 4 +-- plugins/Clist_mw/src/contact.cpp | 2 +- plugins/Clist_mw/src/init.cpp | 10 ++++---- 10 files changed, 46 insertions(+), 49 deletions(-) (limited to 'plugins/Clist_mw/src') diff --git a/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp b/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp index ca993eb818..49cc833397 100644 --- a/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp +++ b/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp @@ -268,7 +268,7 @@ void SetAllExtraIcons(HWND hwndList,HANDLE hContact) char *ImgIndex[64]; int maxpr,count,i; PROTOACCOUNT **accs; - pdisplayNameCacheEntry pdnce; + pClcCacheEntry pdnce; int em,pr,sms,a1,a2,w1,c1; int tick = 0; BOOL hasExtraIconsService; @@ -310,7 +310,7 @@ void SetAllExtraIcons(HWND hwndList,HANDLE hContact) szProto = NULL; hItem = hContact; if (hItem == 0){continue;}; - pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hItem); + pdnce = (pClcCacheEntry)pcli->pfnGetCacheEntry(hItem); if (pdnce == NULL) {continue;}; // szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); diff --git a/plugins/Clist_mw/src/clc.cpp b/plugins/Clist_mw/src/clc.cpp index 840943b2e8..8852594d7e 100644 --- a/plugins/Clist_mw/src/clc.cpp +++ b/plugins/Clist_mw/src/clc.cpp @@ -63,7 +63,7 @@ void StatusUpdaterThread(void*) if (DBGetContactSettingByte(hContact,"CList","StatusMsgAuto",0)) { for (i = 0; i<5; i++) { if (hContact != NULL) { - pdisplayNameCacheEntry pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry((HANDLE)hContact); + pClcCacheEntry pdnce = (pClcCacheEntry)pcli->pfnGetCacheEntry((HANDLE)hContact); if (pdnce && !pdnce->protoNotExists && pdnce->szProto) CallContactService(hContact, PSS_GETAWAYMSG, 0, 0); @@ -147,7 +147,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L int recalcScrollBar = 0,shouldShow; HANDLE hSelItem = NULL; struct ClcContact *selcontact = NULL; - pdisplayNameCacheEntry cacheEntry = GetContactFullCacheEntry((HANDLE)wParam); + pClcCacheEntry cacheEntry = GetContactFullCacheEntry((HANDLE)wParam); WORD status; int needsResort = 0; diff --git a/plugins/Clist_mw/src/clcidents.cpp b/plugins/Clist_mw/src/clcidents.cpp index 2d706916a9..275a7316b0 100644 --- a/plugins/Clist_mw/src/clcidents.cpp +++ b/plugins/Clist_mw/src/clcidents.cpp @@ -80,23 +80,23 @@ int GetRowsPriorTo(ClcGroup *group,ClcGroup *subgroup,int contactIndex) return -1; } -pdisplayNameCacheEntry GetCLCFullCacheEntry(struct ClcData *dat,HANDLE hContact) +pClcCacheEntry GetCLCFullCacheEntry(struct ClcData *dat,HANDLE hContact) { if (hContact == 0) return NULL; - displayNameCacheEntry dnce; + ClcCacheEntry dnce; dnce.hContact = hContact; - displayNameCacheEntry *pdnce = (displayNameCacheEntry*)List_Find(&dat->lCLCContactsCache,&dnce); + ClcCacheEntry *pdnce = (ClcCacheEntry*)List_Find(&dat->lCLCContactsCache,&dnce); if (pdnce == NULL) { - pdnce = (displayNameCacheEntry*)mir_calloc(sizeof(displayNameCacheEntry)); + pdnce = (ClcCacheEntry*)mir_calloc(sizeof(ClcCacheEntry)); pdnce->hContact = hContact; int idx; List_GetIndex(&dat->lCLCContactsCache,pdnce,&idx); List_Insert(&dat->lCLCContactsCache,pdnce,idx); - displayNameCacheEntry *pdnce2 = (displayNameCacheEntry*)List_Find(&dat->lCLCContactsCache,&dnce);//for check + ClcCacheEntry *pdnce2 = (ClcCacheEntry*)List_Find(&dat->lCLCContactsCache,&dnce);//for check if (pdnce2->hContact != pdnce->hContact) return NULL; @@ -109,14 +109,14 @@ pdisplayNameCacheEntry GetCLCFullCacheEntry(struct ClcData *dat,HANDLE hContact) void ClearClcContactCache(struct ClcData *dat,HANDLE hContact) { - pdisplayNameCacheEntry cacheEntry; + pClcCacheEntry cacheEntry; if (hContact == INVALID_HANDLE_VALUE) { int i,tick; tick = GetTickCount(); for (i = 0;i<(dat->lCLCContactsCache.realCount);i++) { - pdisplayNameCacheEntry pdnce = (pdisplayNameCacheEntry)dat->lCLCContactsCache.items[i]; + pClcCacheEntry pdnce = (pClcCacheEntry)dat->lCLCContactsCache.items[i]; pdnce->ClcContact = NULL; } tick = GetTickCount()-tick; @@ -135,7 +135,7 @@ void ClearClcContactCache(struct ClcData *dat,HANDLE hContact) void SetClcContactCacheItem(struct ClcData *dat,HANDLE hContact,void *contact) { - pdisplayNameCacheEntry cacheEntry; + pClcCacheEntry cacheEntry; if ( !IsHContactGroup(hContact) && !IsHContactInfo(hContact)) { cacheEntry = GetCLCFullCacheEntry(dat,hContact); if (cacheEntry != NULL) @@ -153,7 +153,7 @@ int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **cont if (isVisible == NULL && hItem != NULL && subgroup == NULL && !IsHContactGroup(hItem) && !IsHContactInfo(hItem)) { //try use cache - pdisplayNameCacheEntry cacheEntry; + pClcCacheEntry cacheEntry; cacheEntry = GetCLCFullCacheEntry(dat,hItem); if (cacheEntry != NULL) { if (cacheEntry->ClcContact == NULL) { diff --git a/plugins/Clist_mw/src/clcitems.cpp b/plugins/Clist_mw/src/clcitems.cpp index 16d3c2e309..24c37b102e 100644 --- a/plugins/Clist_mw/src/clcitems.cpp +++ b/plugins/Clist_mw/src/clcitems.cpp @@ -41,7 +41,7 @@ void AddSubcontacts(struct ClcContact * cont) { int subcount,i,j; HANDLE hsub; - pdisplayNameCacheEntry cacheEntry; + pClcCacheEntry cacheEntry; cacheEntry = GetContactFullCacheEntry(cont->hContact); OutputDebugStringA("Proceed AddSubcontacts\r\n"); subcount = (int)CallService(MS_MC_GETNUMCONTACTS,(WPARAM)cont->hContact,0); @@ -111,7 +111,7 @@ int AddInfoItemToGroup(ClcGroup *group,int flags,const TCHAR *pszText) return i; } -static struct ClcContact * AddContactToGroup(struct ClcData *dat,ClcGroup *group,pdisplayNameCacheEntry cacheEntry) +static struct ClcContact * AddContactToGroup(struct ClcData *dat,ClcGroup *group,pClcCacheEntry cacheEntry) { char *szProto; WORD apparentMode; @@ -192,7 +192,7 @@ void AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTo if (FindItem(hwnd,dat,hContact,NULL,NULL,NULL) == 1) return; - pdisplayNameCacheEntry cacheEntry = GetContactFullCacheEntry(hContact); + pClcCacheEntry cacheEntry = GetContactFullCacheEntry(hContact); if (cacheEntry == NULL) return; @@ -357,7 +357,7 @@ void RebuildEntireList(HWND hwnd,struct ClcData *dat) hContact = db_find_first(); while(hContact) { - pdisplayNameCacheEntry cacheEntry; + pClcCacheEntry cacheEntry; cont = NULL; cacheEntry = GetContactFullCacheEntry(hContact); //cacheEntry->ClcContact = NULL; diff --git a/plugins/Clist_mw/src/clist.h b/plugins/Clist_mw/src/clist.h index 20c8a7ce80..56efca3218 100644 --- a/plugins/Clist_mw/src/clist.h +++ b/plugins/Clist_mw/src/clist.h @@ -31,7 +31,7 @@ void SortContacts(void); void ChangeContactIcon(HANDLE hContact,int iIcon,int add); int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status); -struct displayNameCacheEntry : public ClcCacheEntryBase +struct ClcCacheEntry : public ClcCacheEntryBase { int noHiddenOffline; @@ -48,8 +48,8 @@ struct displayNameCacheEntry : public ClcCacheEntryBase boolean isUnknown; }; -typedef displayNameCacheEntry *pdisplayNameCacheEntry; +typedef ClcCacheEntry *pClcCacheEntry; -pdisplayNameCacheEntry GetContactFullCacheEntry(HANDLE hContact); +pClcCacheEntry GetContactFullCacheEntry(HANDLE hContact); #endif \ No newline at end of file diff --git a/plugins/Clist_mw/src/clistmod.cpp b/plugins/Clist_mw/src/clistmod.cpp index 2c0561fd7c..ff096bb96c 100644 --- a/plugins/Clist_mw/src/clistmod.cpp +++ b/plugins/Clist_mw/src/clistmod.cpp @@ -52,8 +52,8 @@ int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact) // substitute params by mostonline contact datas HANDLE hMostOnlineContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hActContact,0); if (hMostOnlineContact && hMostOnlineContact != (HANDLE)CALLSERVICE_NOTFOUND) { - pdisplayNameCacheEntry cacheEntry; - cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hMostOnlineContact); + pClcCacheEntry cacheEntry; + cacheEntry = (pClcCacheEntry)pcli->pfnGetCacheEntry(hMostOnlineContact); if (cacheEntry && cacheEntry->szProto) { szActProto = cacheEntry->szProto; nActStatus = cacheEntry->status; diff --git a/plugins/Clist_mw/src/clistsettings.cpp b/plugins/Clist_mw/src/clistsettings.cpp index d3a9be197a..fc843229ee 100644 --- a/plugins/Clist_mw/src/clistsettings.cpp +++ b/plugins/Clist_mw/src/clistsettings.cpp @@ -30,9 +30,9 @@ char *GetProtoForContact(HANDLE hContact); int GetStatusForContact(HANDLE hContact,char *szProto); TCHAR *UnknownConctactTranslatedName; extern boolean OnModulesLoadedCalled; -void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pdisplayNameCacheEntry pdnce,int SettingType); +void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pClcCacheEntry pdnce,int SettingType); -static int handleCompare( displayNameCacheEntry* c1, displayNameCacheEntry* c2 ) +static int handleCompare( ClcCacheEntry* c1, ClcCacheEntry* c2 ) { return (char*)c1->hContact - (char*)c2->hContact; } @@ -50,7 +50,7 @@ void InitDisplayNameCache(SortedList *list) i = 0; while (hContact != 0) { - displayNameCacheEntry *pdnce = (pdisplayNameCacheEntry)mir_calloc(sizeof(displayNameCacheEntry)); + ClcCacheEntry *pdnce = (pClcCacheEntry)mir_calloc(sizeof(ClcCacheEntry)); pdnce->hContact = hContact; InvalidateDisplayNameCacheEntryByPDNE(hContact,pdnce,0); List_GetIndex(list,pdnce,&idx); @@ -59,9 +59,8 @@ void InitDisplayNameCache(SortedList *list) i++; } } -void FreeDisplayNameCacheItem(ClcCacheEntryBase *_p) +void FreeDisplayNameCacheItem(pClcCacheEntry p) { - pdisplayNameCacheEntry p = (pdisplayNameCacheEntry)_p; if ( p->tszName) { mir_free(p->tszName); p->tszName = NULL; } if ( p->szProto) { mir_free(p->szProto); p->szProto = NULL; } if ( p->tszGroup) { mir_free(p->tszGroup); p->tszGroup = NULL; } @@ -69,19 +68,17 @@ void FreeDisplayNameCacheItem(ClcCacheEntryBase *_p) void FreeDisplayNameCache(SortedList *list) { - int i; - - for ( i = 0; i < list->realCount; i++) { - FreeDisplayNameCacheItem((ClcCacheEntryBase*)list->items[i] ); + for (int i = 0; i < list->realCount; i++) { + FreeDisplayNameCacheItem((ClcCacheEntry*)list->items[i] ); mir_free(list->items[i]); } List_Destroy(list); } -void CheckPDNCE(ClcCacheEntryBase *_pdnce) +void CheckPDNCE(ClcCacheEntry *_pdnce) { - pdisplayNameCacheEntry pdnce = (pdisplayNameCacheEntry)_pdnce; + pClcCacheEntry pdnce = (pClcCacheEntry)_pdnce; if (pdnce == NULL) return; @@ -150,7 +147,7 @@ void CheckPDNCE(ClcCacheEntryBase *_pdnce) pdnce->IsExpanded = DBGetContactSettingByte(pdnce->hContact,"CList","Expanded",0); } -void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pdisplayNameCacheEntry pdnce,int SettingType) +void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pClcCacheEntry pdnce,int SettingType) { if ( hContact == NULL || pdnce == NULL ) return; @@ -201,7 +198,7 @@ void InvalidateDisplayNameCacheEntryByPDNE(HANDLE hContact,pdisplayNameCacheEntr char *GetContactCachedProtocol(HANDLE hContact) { - pdisplayNameCacheEntry cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact); + pClcCacheEntry cacheEntry = (pClcCacheEntry)pcli->pfnGetCacheEntry(hContact); if (cacheEntry&&cacheEntry->szProto) return cacheEntry->szProto; @@ -247,9 +244,9 @@ TCHAR* GetNameForContact(HANDLE hContact,int flag,boolean *isUnknown) return result; } -pdisplayNameCacheEntry GetContactFullCacheEntry(HANDLE hContact) +pClcCacheEntry GetContactFullCacheEntry(HANDLE hContact) { - pdisplayNameCacheEntry cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact); + pClcCacheEntry cacheEntry = (pClcCacheEntry)pcli->pfnGetCacheEntry(hContact); if (cacheEntry != NULL) return(cacheEntry); @@ -258,7 +255,7 @@ pdisplayNameCacheEntry GetContactFullCacheEntry(HANDLE hContact) int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status) { - pdisplayNameCacheEntry cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact); + pClcCacheEntry cacheEntry = (pClcCacheEntry)pcli->pfnGetCacheEntry(hContact); if (cacheEntry != NULL) { if (Proto != NULL) *Proto = cacheEntry->szProto; @@ -270,7 +267,7 @@ int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status int GetContactCachedStatus(HANDLE hContact) { - pdisplayNameCacheEntry cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact); + pClcCacheEntry cacheEntry = (pClcCacheEntry)pcli->pfnGetCacheEntry(hContact); if (cacheEntry&&cacheEntry->status != 0) return cacheEntry->status; return 0; } @@ -278,7 +275,7 @@ int GetContactCachedStatus(HANDLE hContact) int ContactSettingChanged(WPARAM wParam,LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - pdisplayNameCacheEntry pdnce; + pClcCacheEntry pdnce; // Early exit if ((HANDLE)wParam == NULL) @@ -286,7 +283,7 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) __try { - pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry((HANDLE)wParam); + pdnce = (pClcCacheEntry)pcli->pfnGetCacheEntry((HANDLE)wParam); if (pdnce == NULL) { OutputDebugStringA("!!! Very bad pdnce not found."); diff --git a/plugins/Clist_mw/src/clui.cpp b/plugins/Clist_mw/src/clui.cpp index bddf0478e0..77f55e5789 100644 --- a/plugins/Clist_mw/src/clui.cpp +++ b/plugins/Clist_mw/src/clui.cpp @@ -708,9 +708,9 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (!IsHContactGroup(hItem)&&!IsHContactInfo(hItem)) { int extra; - pdisplayNameCacheEntry pdnce; + pClcCacheEntry pdnce; - pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(nm->hItem); + pdnce = (pClcCacheEntry)pcli->pfnGetCacheEntry(nm->hItem); if (pdnce == NULL) return 0; extra = ColumnNumToExtra(nm->iColumn); diff --git a/plugins/Clist_mw/src/contact.cpp b/plugins/Clist_mw/src/contact.cpp index c3c75ec8f4..2f95d98421 100644 --- a/plugins/Clist_mw/src/contact.cpp +++ b/plugins/Clist_mw/src/contact.cpp @@ -77,7 +77,7 @@ void LoadContactTree(void) { HANDLE hContact; int i,hideOffline,status,tick; - pdisplayNameCacheEntry cacheEntry; + pClcCacheEntry cacheEntry; diff --git a/plugins/Clist_mw/src/init.cpp b/plugins/Clist_mw/src/init.cpp index ea29d0d419..b6d6c80c77 100644 --- a/plugins/Clist_mw/src/init.cpp +++ b/plugins/Clist_mw/src/init.cpp @@ -32,10 +32,10 @@ static HANDLE hCListShutdown = 0; HMENU BuildGroupPopupMenu( ClcGroup* group ); void CalcEipPosition( struct ClcData *dat, struct ClcContact *contact, ClcGroup *group, POINT *result); -void CheckPDNCE(ClcCacheEntryBase*); +void CheckPDNCE(ClcCacheEntry*); void CluiProtocolStatusChanged( int, const char* ); int CompareContacts( const struct ClcContact *contact1, const struct ClcContact *contact2 ); -void FreeDisplayNameCacheItem(ClcCacheEntryBase*); +void FreeDisplayNameCacheItem(ClcCacheEntry*); void GetDefaultFontSetting(int i,LOGFONT *lf,COLORREF *colour); void RebuildEntireList(HWND hwnd,struct ClcData *dat); void RecalcScrollBar(HWND hwnd,struct ClcData *dat); @@ -139,12 +139,12 @@ static struct ClcContact* fnCreateClcContact( void ) return (struct ClcContact*)mir_calloc( sizeof( struct ClcContact )); } -static ClcCacheEntryBase* fnCreateCacheItem( HANDLE hContact ) +static pClcCacheEntry fnCreateCacheItem( HANDLE hContact ) { - pdisplayNameCacheEntry p = (pdisplayNameCacheEntry)mir_calloc( sizeof( displayNameCacheEntry )); + pClcCacheEntry p = (pClcCacheEntry)mir_calloc( sizeof( ClcCacheEntry )); if ( p ) p->hContact = hContact; - return (ClcCacheEntryBase*)p; + return p; } extern "C" int __declspec(dllexport) CListInitialise() -- cgit v1.2.3