diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-21 11:11:20 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-21 11:11:20 +0000 |
commit | aa8f4373e0c9614b7d64a5760c0fa071b1c1edc9 (patch) | |
tree | 218b31bc3166dfc36adf55800b7e7cdea17a8c68 | |
parent | c80bc292b555c6666930790c399f6fac6226c468 (diff) |
- MZeroedObject used instead of the operator new() inlining
- SAFE_DELETE of local objects removed from ICQ
git-svn-id: http://svn.miranda-ng.org/main/trunk@1092 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
33 files changed, 200 insertions, 440 deletions
diff --git a/plugins/AVS/src/commonheaders.h b/plugins/AVS/src/commonheaders.h index 26986e89a6..c4b459d8dc 100644 --- a/plugins/AVS/src/commonheaders.h +++ b/plugins/AVS/src/commonheaders.h @@ -88,11 +88,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
// The same fields as avatarCacheEntry + proto name
-struct protoPicCacheEntry : public avatarCacheEntry
+struct protoPicCacheEntry : public avatarCacheEntry, public MZeroedObject
{
- __inline void* operator new( size_t size ) { return mir_alloc( size ); }
- __inline void operator delete( void* p ) { mir_free( p ); }
-
protoPicCacheEntry() { memset(this, 0, sizeof(*this)); };
~protoPicCacheEntry();
diff --git a/plugins/CryptoPP/src/mmi.cpp b/plugins/CryptoPP/src/mmi.cpp index 68026578bb..b7c047a9e5 100644 --- a/plugins/CryptoPP/src/mmi.cpp +++ b/plugins/CryptoPP/src/mmi.cpp @@ -1,72 +1,5 @@ #include "commonheaders.h"
-/*
-void m_check(void *ptr, const char *module) {
- if (ptr==NULL) {
- char buffer[128];
- strcpy(buffer,module); strcat(buffer,": NULL pointer detected !");
- MessageBoxA(0,buffer,szModuleName,MB_OK|MB_ICONSTOP);
- __asm{ int 3 };
- exit(1);
- }
-}
-
-
-void *m_alloc(size_t size) {
- void *ptr;
- ptr = malloc(size);
- m_check(ptr,"m_alloc");
- ZeroMemory(ptr,size);
- return ptr;
-}
-
-
-void m_free(void *ptr) {
-// m_check(ptr,"m_free");
- if (ptr) {
- free(ptr);
- }
-}
-
-
-void *m_realloc(void *ptr,size_t size) {
- r = realloc(ptr,size);
- m_check(ptr,"m_realloc");
- return ptr;
-}
-
-
-#ifndef _DEBUG
-void *operator new(size_t size) {
- return malloc(size);
-}
-#endif
-
-
-void operator delete(void *p) {
- free(p);
-}
-
-
-void *operator new[](size_t size) {
- return operator new(size);
-}
-
-
-void operator delete[](void *p) {
- operator delete(p);
-}
-
-
-char *m_strdup(const char *str) {
- if (str==NULL) return NULL;
- int len = (int)strlen(str)+1;
- char *dup = (char*) m_alloc(len);
- MoveMemory((void*)dup,(void*)str,len);
- return dup;
-}
-*/
-
void __fastcall safe_free(void** p)
{
if (*p) {
diff --git a/plugins/FlashAvatars/src/cflash.cpp b/plugins/FlashAvatars/src/cflash.cpp index 2d101cbbe6..9a2a1511ac 100644 --- a/plugins/FlashAvatars/src/cflash.cpp +++ b/plugins/FlashAvatars/src/cflash.cpp @@ -60,16 +60,14 @@ int __fastcall strcmpnull(const char *str1, const char *str2) { }
-struct flash_avatar_item {
+struct flash_avatar_item : public MZeroedObject
+{
HANDLE hContact;
FLASHAVATAR hFA;
IShockwaveFlash* pFlash;
char* getProto() { return (hFA.cProto) ? hFA.cProto : (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hFA.hContact, 0); }
- __inline void* operator new(size_t size) { return mir_calloc(size); }
- __inline void operator delete( void* p ) { mir_free(p); }
-
flash_avatar_item(HANDLE contact, FLASHAVATAR& fa, IShockwaveFlash *flash) { hContact = contact; hFA = fa; pFlash = flash; }
};
diff --git a/plugins/ModernOpt/src/modernopt.cpp b/plugins/ModernOpt/src/modernopt.cpp index 1345631268..16ed0738ff 100644 --- a/plugins/ModernOpt/src/modernopt.cpp +++ b/plugins/ModernOpt/src/modernopt.cpp @@ -52,15 +52,8 @@ static int g_iSectionRestore = 0; static int ModernOptionsObject_Comparator(const ModernOptionsObject *ptr1, const ModernOptionsObject *ptr2);
-struct ModernOptionsData
+struct ModernOptionsData : public MZeroedObject
{
- __inline void* operator new( size_t size )
- { return calloc( 1, size );
- }
- __inline void operator delete( void* p )
- { free( p );
- }
-
ModernOptionsData(): pObjectList(1, ModernOptionsObject_Comparator) {}
LIST<ModernOptionsObject> pObjectList;
@@ -149,9 +142,9 @@ static int ModernOptionsObject_Comparator(const ModernOptionsObject *ptr1, const }
void li_List_Destruct(LIST<ModernOptionsObject> &pList, ItemDestuctor pItemDestructor)
-{
+{
int i=0;
- for (i=0; i<pList.getCount(); i++) pItemDestructor(pList[i]);
+ for (i=0; i<pList.getCount(); i++) pItemDestructor(pList[i]);
pList.destroy();
}
@@ -196,7 +189,7 @@ static INT_PTR CALLBACK ModernOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, switch (msg) {
case WM_INITDIALOG:
{
- TranslateDialogDefault(hwndDlg);
+ TranslateDialogDefault(hwndDlg);
HIMAGELIST himl = 0;
dat = (struct ModernOptionsData *)lParam;
@@ -350,7 +343,7 @@ static INT_PTR CALLBACK ModernOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, // UI utilities
static HWND ModernOptUI_ShowPage_Impl(HWND hwndDlg, struct ModernOptionsData *dat, int iPage, int dx, HWND hwndInsertAfter)
{
- if ((iPage < 0) || (iPage >= dat->pObjectList.getCount()))
+ if ((iPage < 0) || (iPage >= dat->pObjectList.getCount()))
return NULL;
dat->iPage = iPage;
@@ -389,7 +382,7 @@ static HWND ModernOptUI_ShowPage_Impl(HWND hwndDlg, struct ModernOptionsData *da if (ignoreObj->optObject.iType == MODERNOPT_TYPE_IGNOREOBJECT)
ModernOptIgnore_AddItem(&ignoreObj->optObject);
} } }
- }
+ }
else ShowWindow(obj->hwnd, SW_SHOW);
ShowWindow(GetDlgItem(hwndDlg, IDC_BTN_EXPERT), (obj->optObject.lpzClassicGroup || obj->optObject.lpzClassicPage) ? SW_SHOW : SW_HIDE);
@@ -422,7 +415,7 @@ static void ModernOptUI_ShowPage(HWND hwndDlg, struct ModernOptionsData *dat, in RECT rcWnd; GetWindowRect(dat->pObjectList[i]->hwnd, &rcWnd);
dx += rcWnd.bottom - rcWnd.top;// + 30;
}
- }
+ }
else if (dat->pObjectList[i]->hwnd)
{
ShowWindow(dat->pObjectList[i]->hwnd, SW_HIDE);
@@ -436,7 +429,7 @@ static void ModernOptUI_SelectSection(HWND hwndDlg, struct ModernOptionsData *da HWND hwndTree = GetDlgItem(hwndDlg, IDC_TV_SUBSECTIONS);
dat->iSection = iSection;
-
+
SendMessage(hwndTree, WM_SETREDRAW, FALSE, 0);
TreeView_DeleteAllItems(hwndTree);
for (i = 0; i < dat->pObjectList.getCount(); ++i) {
@@ -449,8 +442,8 @@ static void ModernOptUI_SelectSection(HWND hwndDlg, struct ModernOptionsData *da if (obj->optObject.iType == MODERNOPT_TYPE_SECTIONPAGE) {
ModernOptUI_ShowPage(hwndDlg, dat, i);
break;
- }
-
+ }
+
if (obj->optObject.iType == MODERNOPT_TYPE_SUBSECTIONPAGE) {
TVINSERTSTRUCT tvis = {0};
tvis.hParent = TVI_ROOT;
@@ -472,7 +465,7 @@ static void ModernOptUI_SelectSection(HWND hwndDlg, struct ModernOptionsData *da ShowWindow(hwndTree, SW_SHOW);
RedrawWindow(hwndTree, NULL, NULL, RDW_INVALIDATE);
TreeView_Select(hwndTree, TreeView_GetRoot(hwndTree), TVGN_CARET);
- }
+ }
else ShowWindow(hwndTree, SW_HIDE);
}
@@ -486,7 +479,7 @@ static INT_PTR svcModernOpt_Impl(WPARAM wParam, LPARAM lParam) NotifyEventHooks(hevtModernOpt_Initialize, (WPARAM)dat, 0);
hwndModernOpt = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MODERNOPT), NULL, ModernOptDlgProc, (LPARAM)dat);
ShowWindow(hwndModernOpt, SW_SHOW);
- }
+ }
else SetForegroundWindow(hwndModernOpt);
return 0;
diff --git a/plugins/NewAwaySysMod/Properties.cpp b/plugins/NewAwaySysMod/Properties.cpp index eb14d79950..c9dc3c1c9c 100644 --- a/plugins/NewAwaySysMod/Properties.cpp +++ b/plugins/NewAwaySysMod/Properties.cpp @@ -22,42 +22,6 @@ CProtoStates g_ProtoStates;
-
-/*char *mystrdup(const char *szStr)
-{
- char *szNew = (char *)malloc(lstrlen(szStr) + 1);
- lstrcpy(szNew, szStr);
- return szNew;
-}
-
-
-void *mymalloc(size_t size)
-{
- return HeapAlloc(GetProcessHeap(), 0, size);//GlobalAlloc(GPTR, size);
-}
-
-
-void myfree(void *p)
-{
- //GlobalFree(p);
- HeapFree(GetProcessHeap(), 0, p);
-}
-
-
-void *__cdecl operator new(unsigned int size)
-{
- return (void *)HeapAlloc(GetProcessHeap(), 0, size);//GlobalAlloc(GPTR, size);
-}
-
-
-void __cdecl operator delete(void *p)
-{
-// GlobalFree((HGLOBAL)p);
- HeapFree(GetProcessHeap(), 0, p);
-}
-*/
-
-
void ResetContactSettingsOnStatusChange(HANDLE hContact)
{
DBDeleteContactSetting(hContact, MOD_NAME, DB_REQUESTCOUNT);
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.h b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.h index 93fc3ba8c7..5820a5f85c 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.h +++ b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.h @@ -53,17 +53,14 @@ #define FLAG_MONITORMIRANDA 64 // db: monitor miranda activity only
#define FLAG_ONLOCK 128 // db: on work station lock
-struct TAAAProtoSetting : public PROTOCOLSETTINGEX
+struct TAAAProtoSetting : public PROTOCOLSETTINGEX, public MZeroedObject
{
TAAAProtoSetting( PROTOACCOUNT* pa );
~TAAAProtoSetting();
- __inline void* operator new( size_t size ) { return calloc( 1, size ); }
- __inline void operator delete( void* p ) { free( p ); }
-
int originalStatusMode;
- STATES
- oldState,
+ STATES
+ oldState,
curState;
BOOL statusChanged; // AAA changed the status, don't update mStatus
BOOL mStatus; // status changed manually or not ?
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.h b/plugins/StatusPlugins/StartupStatus/startupstatus.h index 640638f788..69cd54b392 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.h +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.h @@ -29,14 +29,11 @@ #define MODULENAME "StartupStatus"
-struct TSSSetting : public PROTOCOLSETTINGEX
+struct TSSSetting : public PROTOCOLSETTINGEX, public MZeroedObject
{
TSSSetting( PROTOACCOUNT* pa );
TSSSetting( int profile, PROTOACCOUNT* pa );
~TSSSetting();
-
- __inline void* operator new( size_t size ) { return calloc( 1, size ); }
- __inline void operator delete( void* p ) { free( p ); }
};
typedef OBJLIST<TSSSetting> TSettingsList;
@@ -48,10 +45,8 @@ struct PROFILECE TCHAR *msg;
};
-struct PROFILEOPTIONS
+struct PROFILEOPTIONS : public MZeroedObject
{
- __inline void* operator new( size_t size ) { return mir_calloc(size); }
- __inline void operator delete( void* p ) { mir_free(p); }
__inline ~PROFILEOPTIONS()
{
delete ps;
diff --git a/plugins/TopToolBar/common.h b/plugins/TopToolBar/common.h index 996c3bf50f..0840111f2f 100644 --- a/plugins/TopToolBar/common.h +++ b/plugins/TopToolBar/common.h @@ -50,10 +50,8 @@ ///////////////////////////////////////////////////////////////////////////////
// TopButtonInt class
-struct TopButtonInt
+struct TopButtonInt : public MZeroedObject
{
- __inline void* operator new(size_t size) { return calloc( 1, size ); }
- __inline void operator delete(void* p) { free( p ); }
~TopButtonInt();
DWORD CheckFlags(DWORD Flags);
@@ -77,12 +75,12 @@ struct TopButtonInt int x, y, arrangedpos;
HICON hIconUp, hIconDn;
HANDLE hIconHandleUp, hIconHandleDn;
-
+
char *pszService;
TCHAR *ptszProgram;
char *pszName;
TCHAR *ptszTooltip;
-
+
LPARAM lParamUp;
WPARAM wParamUp;
LPARAM lParamDown;
diff --git a/protocols/AimOscar/proto.h b/protocols/AimOscar/proto.h index 14bcf7d2e4..5028ad868f 100644 --- a/protocols/AimOscar/proto.h +++ b/protocols/AimOscar/proto.h @@ -27,16 +27,11 @@ typedef int ( __cdecl CAimProto::*AimEventFunc )( WPARAM, LPARAM ); typedef INT_PTR ( __cdecl CAimProto::*AimServiceFunc )( WPARAM, LPARAM );
typedef INT_PTR ( __cdecl CAimProto::*AimServiceFuncParam )( WPARAM, LPARAM, LPARAM );
-struct CAimProto : public PROTO_INTERFACE
+struct CAimProto : public PROTO_INTERFACE, public MZeroedObject
{
CAimProto( const char*, const TCHAR* );
~CAimProto();
- __inline void* operator new( size_t size )
- { return calloc( 1, size ); }
- __inline void operator delete( void* p )
- { free( p ); }
-
//====================================================================================
// PROTO_INTERFACE
//====================================================================================
@@ -158,7 +153,7 @@ struct CAimProto : public PROTO_INTERFACE unsigned long internal_ip; // our ip
unsigned long detected_ip; // our ip
unsigned short local_port; // our port
-
+
//Peer connection stuff
HANDLE hNetlibPeer;//handle to the peer netlib
HANDLE hDirectBoundPort;//direct connection listening port
@@ -174,7 +169,7 @@ struct CAimProto : public PROTO_INTERFACE //Some mail connection stuff
HANDLE hMailConn;
unsigned short mail_seqno;
-
+
//avatar connection stuff
bool init_cst_fld_ran;
unsigned short avatar_seqno;
@@ -220,7 +215,7 @@ struct CAimProto : public PROTO_INTERFACE //away message retrieval stuff
char *modeMsgs[9];
- char *last_status_msg;
+ char *last_status_msg;
//////////////////////////////////////////////////////////////////////////////////////
// avatars.cpp
@@ -312,7 +307,7 @@ struct CAimProto : public PROTO_INTERFACE int aim_block_buddy(HANDLE hServerConn, unsigned short &seqno, bool remove, const char* sn, unsigned short item_id);
int aim_chatnav_request_limits(HANDLE hServerConn,unsigned short &seqno);
int aim_chatnav_create(HANDLE hServerConn,unsigned short &seqno, char* room, unsigned short exchage);
- int aim_chatnav_room_info(HANDLE hServerConn,unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance);
+ int aim_chatnav_room_info(HANDLE hServerConn,unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance);
int aim_chat_join_room(HANDLE hServerConn,unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance,unsigned short id);
int aim_chat_send_message(HANDLE hServerConn,unsigned short &seqno, char *amsg);
int aim_chat_invite(HANDLE hServerConn,unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance, char* sn, char* msg);
diff --git a/protocols/FacebookRM/proto.h b/protocols/FacebookRM/proto.h index c08e3aaef2..cdeeaf03f6 100644 --- a/protocols/FacebookRM/proto.h +++ b/protocols/FacebookRM/proto.h @@ -22,21 +22,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once
-class FacebookProto : public PROTO_INTERFACE
+class FacebookProto : public PROTO_INTERFACE, public MZeroedObject
{
public:
FacebookProto( const char *proto_name, const TCHAR *username );
~FacebookProto( );
- __inline void* operator new( size_t size )
- {
- return calloc( 1, size );
- }
- __inline void operator delete( void* p )
- {
- free( p );
- }
-
inline const char* ModuleName( ) const
{
return m_szModuleName;
@@ -162,7 +153,7 @@ public: void __cdecl MessagingWorker(void*);
void __cdecl DeleteContactFromServer(void*);
void __cdecl AddContactToServer(void*);
- void __cdecl ApproveContactToServer(void*);
+ void __cdecl ApproveContactToServer(void*);
void __cdecl CancelFriendsRequest(void*);
// Contacts handling
@@ -170,7 +161,7 @@ public: HANDLE ContactIDToHContact(std::string);
HANDLE ChatIDToHContact(std::string);
HANDLE AddToContactList(facebook_user*, BYTE type, bool dont_check = false, const char *new_name = "");
- void SetAllContactStatuses(int);
+ void SetAllContactStatuses(int);
HANDLE HContactFromAuthEvent(HANDLE hEvent);
// Chats handling
diff --git a/protocols/Gadu-Gadu/gg_proto.h b/protocols/Gadu-Gadu/gg_proto.h index 57271e7ad5..bc0d560d3b 100644 --- a/protocols/Gadu-Gadu/gg_proto.h +++ b/protocols/Gadu-Gadu/gg_proto.h @@ -27,18 +27,11 @@ typedef void ( __cdecl GGPROTO::*GGThreadFunc )( void* ); typedef int ( __cdecl GGPROTO::*GGEventFunc )( WPARAM, LPARAM );
typedef INT_PTR ( __cdecl GGPROTO::*GGServiceFunc )( WPARAM, LPARAM );
-struct GGPROTO : public PROTO_INTERFACE
+struct GGPROTO : public PROTO_INTERFACE, public MZeroedObject
{
GGPROTO( const char*, const TCHAR* );
~GGPROTO();
- __inline void* operator new( size_t size )
- { return calloc( 1, size );
- }
- __inline void operator delete( void* p )
- { free( p );
- }
-
//====================================================================================
// PROTO_INTERFACE
//====================================================================================
diff --git a/protocols/IRCG/irc.h b/protocols/IRCG/irc.h index 4580243385..3c4f10ec4f 100644 --- a/protocols/IRCG/irc.h +++ b/protocols/IRCG/irc.h @@ -104,17 +104,6 @@ struct CIrcProto; #include "mstring.h"
typedef CMStringA String;
-class CCallocBase
-{
-public:
- __inline void* operator new( size_t size )
- { return ::calloc( 1, size );
- }
- __inline void operator delete( void* p )
- { ::free( p );
- }
-};
-
// special service for tweaking performance, implemented in chat.dll
#define MS_GC_GETEVENTPTR "GChat/GetNewEventPtr"
typedef int (*GETEVENTFUNC)(WPARAM wParam, LPARAM lParam);
@@ -226,7 +215,7 @@ struct CIrcHandler PfnIrcMessageHandler m_handler;
};
-struct CIrcProto : public PROTO_INTERFACE, public CCallocBase
+struct CIrcProto : public PROTO_INTERFACE, public MZeroedObject
{
CIrcProto( const char*, const TCHAR* );
~CIrcProto();
diff --git a/protocols/IRCG/irclib.h b/protocols/IRCG/irclib.h index c47172d2ab..7dcb5a4c01 100644 --- a/protocols/IRCG/irclib.h +++ b/protocols/IRCG/irclib.h @@ -33,7 +33,7 @@ char* ConvertIntegerToIP(unsigned long int_ip_addr); namespace irc {
////////////////////////////////////////////////////////////////////
-struct DCCINFO : public CCallocBase
+struct DCCINFO : public MZeroedObject
{
DWORD dwAdr;
unsigned __int64 dwSize;
diff --git a/protocols/IcqOscarJ/changeinfo/changeinfo.h b/protocols/IcqOscarJ/changeinfo/changeinfo.h index 9cb2e37220..ecc4fc3106 100644 --- a/protocols/IcqOscarJ/changeinfo/changeinfo.h +++ b/protocols/IcqOscarJ/changeinfo/changeinfo.h @@ -71,7 +71,7 @@ extern const SettingItem setting[]; extern const int settingCount;
//dlgproc.c
-struct ChangeInfoData : public void_struct
+struct ChangeInfoData : public MZeroedObject
{
HWND hwndDlg;
CIcqProto *ppro;
diff --git a/protocols/IcqOscarJ/changeinfo/dlgproc.cpp b/protocols/IcqOscarJ/changeinfo/dlgproc.cpp index babb269c28..404777aa97 100644 --- a/protocols/IcqOscarJ/changeinfo/dlgproc.cpp +++ b/protocols/IcqOscarJ/changeinfo/dlgproc.cpp @@ -39,17 +39,17 @@ static int DrawTextUtf(HDC hDC, char *text, LPRECT lpRect, UINT uFormat, LPSIZE if (lpSize)
GetTextExtentPoint32W(hDC, tmp, strlennull(tmp), lpSize);
SAFE_FREE((void**)&tmp);
-
+
return res;
}
char* ChangeInfoData::GetItemSettingText(int i, char *buf, size_t bufsize)
{
- char *text = buf;
- int alloced = 0;
+ char *text = buf;
+ int alloced = 0;
- buf[0] = '\0';
+ buf[0] = '\0';
if (settingData[i].value == 0 && !(setting[i].displayType & LIF_ZEROISVALID))
{
@@ -64,7 +64,7 @@ char* ChangeInfoData::GetItemSettingText(int i, char *buf, size_t bufsize) case LI_STRING:
case LI_LONGSTRING:
text = BinaryToEscapes((char*)settingData[i].value);
- alloced = 1;
+ alloced = 1;
break;
case LI_NUMBER:
@@ -78,19 +78,19 @@ char* ChangeInfoData::GetItemSettingText(int i, char *buf, size_t bufsize) {
text = ICQTranslateUtfStatic(LPGEN("Unknown value"), buf, bufsize);
- FieldNamesItem *list = (FieldNamesItem*)setting[i].pList;
- for (int j=0; TRUE; j++)
+ FieldNamesItem *list = (FieldNamesItem*)setting[i].pList;
+ for (int j=0; TRUE; j++)
if (list[j].code == settingData[i].value)
{
text = ICQTranslateUtfStatic(list[j].text, buf, bufsize);
break;
}
- else if (!list[j].text)
- {
- if (list[j].code == settingData[i].value)
- text = ICQTranslateUtfStatic("Unspecified", buf, bufsize);
- break;
- }
+ else if (!list[j].text)
+ {
+ if (list[j].code == settingData[i].value)
+ text = ICQTranslateUtfStatic("Unspecified", buf, bufsize);
+ break;
+ }
}
break;
}
@@ -102,23 +102,23 @@ char* ChangeInfoData::GetItemSettingText(int i, char *buf, size_t bufsize) else
{
if (alloced)
- {
+ {
SAFE_FREE(&text);
- alloced = 0;
- }
- text = "********";
+ alloced = 0;
+ }
+ text = "********";
}
}
- if (text != buf)
- {
- char *tmp = text;
+ if (text != buf)
+ {
+ char *tmp = text;
- text = null_strcpy(buf, text, bufsize - 1);
- if (alloced)
- SAFE_FREE(&tmp);
- }
+ text = null_strcpy(buf, text, bufsize - 1);
+ if (alloced)
+ SAFE_FREE(&tmp);
+ }
- return text;
+ return text;
}
@@ -503,7 +503,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM dat->ClearChangeFlags();
UnhookEvent(dat->hAckHook);
- dat->hAckHook = NULL;
+ dat->hAckHook = NULL;
EnableDlgItem(hwndDlg, IDC_LIST, TRUE);
EnableDlgItem(hwndDlg, IDC_UPLOADING, FALSE);
SetDlgItemTextUtf(hwndDlg, IDC_UPLOADING, ICQTranslateUtfStatic(LPGEN("Upload complete"), str, MAX_PATH));
@@ -517,7 +517,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableDlgItem(hwndDlg, IDC_UPLOADING, FALSE);
SetDlgItemTextUtf(hwndDlg, IDC_UPLOADING, ICQTranslateUtfStatic(LPGEN("Upload FAILED"), str, MAX_PATH));
SendMessage(GetParent(hwndDlg), PSM_FORCECHANGED, 0, 0);
- EnableDlgItem(hwndDlg, IDC_SAVE, TRUE);
+ EnableDlgItem(hwndDlg, IDC_SAVE, TRUE);
}
break;
}
@@ -527,13 +527,13 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM UnhookEvent(dat->hAckHook);
dat->hAckHook = NULL;
}
- {
- HFONT hFont = (HFONT)SendMessage(dat->hwndList, WM_GETFONT, 0, 0);
- DeleteObject(hFont);
- }
+ {
+ HFONT hFont = (HFONT)SendMessage(dat->hwndList, WM_GETFONT, 0, 0);
+ DeleteObject(hFont);
+ }
dat->FreeStoredDbSettings();
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
- SAFE_DELETE((void_struct**)&dat);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
+ delete dat;
break;
}
return FALSE;
diff --git a/protocols/IcqOscarJ/icq_avatar.cpp b/protocols/IcqOscarJ/icq_avatar.cpp index 1678f609e5..29a92ec4a4 100644 --- a/protocols/IcqOscarJ/icq_avatar.cpp +++ b/protocols/IcqOscarJ/icq_avatar.cpp @@ -78,8 +78,7 @@ avatars_request* CIcqProto::ReleaseAvatarRequestInQueue(avatars_request *request ar = ar->pNext;
}
- SAFE_DELETE(&request);
-
+ delete request;
return pNext;
}
@@ -859,7 +858,7 @@ int CIcqProto::GetAvatarData(HANDLE hContact, DWORD dwUin, const char *szUid, co if (!ar->hash)
{ // alloc failed
m_avatarsMutex->Leave();
- SAFE_DELETE(&ar);
+ delete ar;
return 0;
}
memcpy(ar->hash, hash, hashlen); // copy the data
@@ -932,7 +931,7 @@ int CIcqProto::SetAvatarData(HANDLE hContact, WORD wRef, const BYTE *data, unsig if (!ar->pData)
{ // alloc failed
m_avatarsMutex->Leave();
- SAFE_DELETE(&ar);
+ delete ar;
return 0;
}
memcpy(ar->pData, data, datalen); // copy the data
@@ -981,7 +980,7 @@ void __cdecl CIcqProto::AvatarThread(avatars_server_connection *pInfo) { // Release connection handler
icq_lock l(m_avatarsMutex);
- SAFE_DELETE(&pInfo);
+ delete pInfo;
}
NetLog_Server("%s thread ended.", "Avatar");
@@ -1010,8 +1009,8 @@ isLoggedIn(FALSE), stopThread(FALSE), isActive(FALSE) avatars_server_connection::~avatars_server_connection()
{
- SAFE_DELETE(&m_ratesMutex);
- SAFE_DELETE(&localSeqMutex);
+ delete m_ratesMutex;
+ delete localSeqMutex;
}
@@ -1206,7 +1205,7 @@ void avatars_server_connection::checkRequestQueue() if (GetTickCount() > pRequest->timeOut)
{ // expired contact block, remove
*ppRequest = pRequest->pNext;
- SAFE_DELETE(&pRequest);
+ delete pRequest;
}
else // it is not time, move to next request
ppRequest = &pRequest->pNext;
@@ -1234,7 +1233,7 @@ void avatars_server_connection::checkRequestQueue() sendUploadAvatarRequest(pRequest->hContact, pRequest->wRef, pRequest->pData, pRequest->cbData);
break;
}
- SAFE_DELETE(&pRequest);
+ delete pRequest;
ppro->m_avatarsMutex->Enter();
}
@@ -1327,7 +1326,7 @@ void avatars_server_connection::connectionThread() { // release rates
icq_lock l(m_ratesMutex);
- SAFE_DELETE((void_struct**)&m_rates);
+ SAFE_DELETE((MZeroedObject**)&m_rates);
}
SAFE_FREE((void**)&pCookie);
diff --git a/protocols/IcqOscarJ/icq_avatar.h b/protocols/IcqOscarJ/icq_avatar.h index 7ac8ed7469..6bfcb65c45 100644 --- a/protocols/IcqOscarJ/icq_avatar.h +++ b/protocols/IcqOscarJ/icq_avatar.h @@ -93,7 +93,7 @@ public: __inline static void SAFE_DELETE(avatars_server_connection **p) { SAFE_DELETE((lockable_struct**)p); };
-struct avatars_request : public void_struct
+struct avatars_request : public MZeroedObject
{
int type;
HANDLE hContact;
@@ -112,7 +112,7 @@ public: virtual ~avatars_request();
};
-__inline static void SAFE_DELETE(avatars_request **p) { SAFE_DELETE((void_struct**)p); };
+__inline static void SAFE_DELETE(avatars_request **p) { SAFE_DELETE((MZeroedObject**)p); };
#define ART_GET 1
#define ART_UPLOAD 2
diff --git a/protocols/IcqOscarJ/icq_proto.h b/protocols/IcqOscarJ/icq_proto.h index 6c2b4a059e..7293763d65 100644 --- a/protocols/IcqOscarJ/icq_proto.h +++ b/protocols/IcqOscarJ/icq_proto.h @@ -51,18 +51,11 @@ struct userinfo time_t queued;
};
-struct CIcqProto : public PROTO_INTERFACE
+struct CIcqProto : public PROTO_INTERFACE, public MZeroedObject
{
CIcqProto( const char*, const TCHAR* );
~CIcqProto();
- __inline void* operator new( size_t size )
- { return SAFE_MALLOC( size );
- }
- __inline void operator delete( void* p )
- { SAFE_FREE( &p );
- }
-
//====================================================================================
// PROTO_INTERFACE
//====================================================================================
diff --git a/protocols/IcqOscarJ/icq_rates.cpp b/protocols/IcqOscarJ/icq_rates.cpp index 09a1b27396..e7513ec148 100644 --- a/protocols/IcqOscarJ/icq_rates.cpp +++ b/protocols/IcqOscarJ/icq_rates.cpp @@ -334,7 +334,7 @@ rates_queue::rates_queue(CIcqProto *ppro, const char *szDescr, int nLimitLevel, rates_queue::~rates_queue()
{
cleanup();
- SAFE_DELETE(&listsMutex);
+ delete listsMutex;
}
@@ -377,7 +377,7 @@ void rates_queue::cleanup() ppro->NetLog_Server("Rates: Purging %d %s(s).", pendingListSize, szDescr);
for (int i=0; i < pendingListSize; i++)
- SAFE_DELETE((void_struct**)&pendingList[i]);
+ delete pendingList[i];
SAFE_FREE((void**)&pendingList);
pendingListSize = 0;
}
@@ -439,7 +439,7 @@ void rates_queue::processQueue() if (nDelay < 10) nDelay = 10;
initDelay(nDelay, &rates_queue::processQueue);
}
- SAFE_DELETE((void_struct**)&item);
+ delete item;
}
@@ -461,7 +461,7 @@ void rates_queue::putItem(rates_queue_item *pItem, int nMinDelay) {
if (duplicates == -1)
{ // discard existing, append new item
- SAFE_DELETE((void_struct**)&pendingList[i]);
+ delete pendingList[i];
memcpy(&pendingList[i], &pendingList[i + 1], (pendingListSize - i - 1) * sizeof(rates_queue_item*));
bFound = TRUE;
}
diff --git a/protocols/IcqOscarJ/icq_rates.h b/protocols/IcqOscarJ/icq_rates.h index de5d9b76d0..ab16e74007 100644 --- a/protocols/IcqOscarJ/icq_rates.h +++ b/protocols/IcqOscarJ/icq_rates.h @@ -47,7 +47,7 @@ struct rates_group int nPairs;
};
-struct rates : public void_struct
+struct rates : public MZeroedObject
{
private:
CIcqProto *ppro;
@@ -90,7 +90,7 @@ public: //
// generic queue item
//
-struct rates_queue_item : public void_struct
+struct rates_queue_item : public MZeroedObject
{
friend struct rates_queue;
protected:
@@ -119,7 +119,7 @@ typedef void (rates_queue::*IcqRateFunc)(void); //
// generic item queue (FIFO)
//
-struct rates_queue : public void_struct
+struct rates_queue : public MZeroedObject
{
private:
CIcqProto *ppro;
diff --git a/protocols/IcqOscarJ/icq_server.cpp b/protocols/IcqOscarJ/icq_server.cpp index 87b975d6d3..63a5d63d84 100644 --- a/protocols/IcqOscarJ/icq_server.cpp +++ b/protocols/IcqOscarJ/icq_server.cpp @@ -221,9 +221,9 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) {
icq_lock l(m_ratesMutex);
- SAFE_DELETE((void_struct**)&m_ratesQueue_Request);
- SAFE_DELETE((void_struct**)&m_ratesQueue_Response);
- SAFE_DELETE((void_struct**)&m_rates);
+ SAFE_DELETE((MZeroedObject**)&m_ratesQueue_Request);
+ SAFE_DELETE((MZeroedObject**)&m_ratesQueue_Response);
+ SAFE_DELETE((MZeroedObject**)&m_rates);
}
FlushServerIDs(); // clear server IDs list
diff --git a/protocols/IcqOscarJ/icqoscar.h b/protocols/IcqOscarJ/icqoscar.h index b565eda497..97e9bf9da0 100644 --- a/protocols/IcqOscarJ/icqoscar.h +++ b/protocols/IcqOscarJ/icqoscar.h @@ -76,6 +76,7 @@ #include <m_protosvc.h>
#include <m_options.h>
#include <m_system.h>
+#include <m_system_cpp.h>
#include <m_userinfo.h>
#include <m_utils.h>
#include <m_idle.h>
diff --git a/protocols/IcqOscarJ/utilities.cpp b/protocols/IcqOscarJ/utilities.cpp index 7ec9edcc8e..4f68ecb535 100644 --- a/protocols/IcqOscarJ/utilities.cpp +++ b/protocols/IcqOscarJ/utilities.cpp @@ -1654,7 +1654,7 @@ BOOL CIcqProto::validateStatusMessageRequest(HANDLE hContact, WORD byMessageType }
-void __fastcall SAFE_DELETE(void_struct **p)
+void __fastcall SAFE_DELETE(MZeroedObject **p)
{
if (*p)
{
diff --git a/protocols/IcqOscarJ/utilities.h b/protocols/IcqOscarJ/utilities.h index 4d881e578e..962ecce15f 100644 --- a/protocols/IcqOscarJ/utilities.h +++ b/protocols/IcqOscarJ/utilities.h @@ -1,22 +1,22 @@ // ---------------------------------------------------------------------------80
// ICQ plugin for Miranda Instant Messenger
// ________________________________________
-//
+//
// Copyright © 2000-2001 Richard Hughes, Roland Rabien, Tristan Van de Vreede
// Copyright © 2001-2002 Jon Keating, Richard Hughes
// Copyright © 2002-2004 Martin Öberg, Sam Kothari, Robert Rainwater
// Copyright © 2004-2010 Joe Kucera
-//
+//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
@@ -107,20 +107,12 @@ void* __fastcall SAFE_REALLOC(void* p, size_t size); __inline static void SAFE_FREE(char** str) { SAFE_FREE((void**)str); }
__inline static void SAFE_FREE(WCHAR** str) { SAFE_FREE((void**)str); }
-struct void_struct
-{
- __inline void* operator new(size_t size) { return SAFE_MALLOC(size); }
- __inline void operator delete(void *p) { SAFE_FREE(&p); }
-
- virtual ~void_struct() {};
-};
-
-struct lockable_struct: public void_struct
+struct lockable_struct: public MZeroedObject
{
private:
int nLockCount;
public:
- lockable_struct(): void_struct() { _Lock(); };
+ lockable_struct() { _Lock(); };
virtual ~lockable_struct() {};
void _Lock() { nLockCount++; };
@@ -129,7 +121,7 @@ public: int getLockCount() { return nLockCount; };
};
-void __fastcall SAFE_DELETE(void_struct **p);
+void __fastcall SAFE_DELETE(MZeroedObject **p);
void __fastcall SAFE_DELETE(lockable_struct **p);
DWORD ICQWaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds, int bWaitAlways = FALSE);
diff --git a/protocols/JabberG/jabber_proto.h b/protocols/JabberG/jabber_proto.h index a2a2baa8b8..c677b5a167 100644 --- a/protocols/JabberG/jabber_proto.h +++ b/protocols/JabberG/jabber_proto.h @@ -122,7 +122,7 @@ struct CJabberNetInterface: public IJabberNetInterface int STDMETHODCALLTYPE RemoveHandler(HJHANDLER hHandler);
int STDMETHODCALLTYPE RegisterFeature(LPCTSTR szFeature, LPCTSTR szDescription); // Registers feature so that it's displayed with proper description in other users' details. Call this function in your ME_SYSTEM_MODULESLOADED handler. Returns TRUE on success or FALSE on error.
- int STDMETHODCALLTYPE AddFeatures(LPCTSTR szFeatures); // Adds features to the list of features returned by the client.
+ int STDMETHODCALLTYPE AddFeatures(LPCTSTR szFeatures); // Adds features to the list of features returned by the client.
int STDMETHODCALLTYPE RemoveFeatures(LPCTSTR szFeatures); // Removes features from the list of features returned by the client.
LPTSTR STDMETHODCALLTYPE GetResourceFeatures(LPCTSTR jid); // Returns all features supported by JID in format "feature1\0feature2\0...\0featureN\0\0". You must free returned string using mir_free().
@@ -144,20 +144,13 @@ struct CJabberInterface: public IJabberInterface CJabberProto *m_psProto;
};
-struct CJabberProto : public PROTO_INTERFACE
+struct CJabberProto : public PROTO_INTERFACE, public MZeroedObject
{
typedef PROTO_INTERFACE CSuper;
CJabberProto( const char*, const TCHAR* );
~CJabberProto();
- __inline void* operator new( size_t size )
- { return calloc( 1, size );
- }
- __inline void operator delete( void* p )
- { free( p );
- }
-
//====================================================================================
// PROTO_INTERFACE
//====================================================================================
@@ -236,7 +229,7 @@ struct CJabberProto : public PROTO_INTERFACE int __cdecl JabberGcInit( WPARAM, LPARAM );
int __cdecl CListMW_ExtraIconsApply( WPARAM, LPARAM );
-
+
// Google Shared Status
BOOL m_bGoogleSharedStatus;
BOOL m_bGoogleSharedStatusLock;
@@ -391,14 +384,14 @@ struct CJabberProto : public PROTO_INTERFACE HWND GetWindowFromIq( HXML iqNode );
BOOL HandleAdhocCommandRequest( HXML iqNode, CJabberIqInfo* pInfo );
BOOL IsRcRequestAllowedByACL( CJabberIqInfo* pInfo );
-
+
int AdhocSetStatusHandler( HXML iqNode, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession );
int AdhocOptionsHandler( HXML iqNode, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession );
int AdhocForwardHandler( HXML iqNode, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession );
int AdhocLockWSHandler( HXML iqNode, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession );
int AdhocQuitMirandaHandler( HXML iqNode, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession );
int AdhocLeaveGroupchatsHandler( HXML iqNode, CJabberIqInfo* pInfo, CJabberAdhocSession* pSession );
-
+
void OnIqResult_ListOfCommands( HXML iqNode );
void OnIqResult_CommandExecution( HXML iqNode );
int AdHoc_RequestListOfCommands( TCHAR * szResponder, HWND hwndDlg );
@@ -409,7 +402,7 @@ struct CJabberProto : public PROTO_INTERFACE int AdHoc_OnJAHMProcessResult( HWND hwndDlg, HXML workNode, JabberAdHocData* dat );
void ContactMenuAdhocCommands( struct CJabberAdhocStartupParams* param );
-
+
//---- jabber_bookmarks.c ------------------------------------------------------------
INT_PTR __cdecl OnMenuHandleBookmarks( WPARAM wParam, LPARAM lParam );
@@ -457,11 +450,11 @@ struct CJabberProto : public PROTO_INTERFACE void GcLogUpdateMemberStatus( JABBER_LIST_ITEM* item, const TCHAR* resource, const TCHAR* nick, const TCHAR* jid, int action, HXML reason, int nStatusCode = -1 );
void GcLogShowInformation( JABBER_LIST_ITEM *item, JABBER_RESOURCE_STATUS *user, TJabberGcLogInfoType type );
void GcQuit( JABBER_LIST_ITEM* jid, int code, HXML reason );
-
+
void FilterList(HWND hwndList);
void ResetListOptions(HWND hwndList);
void InviteUser(TCHAR *room, TCHAR *pUser, TCHAR *text);
-
+
void AdminSet( const TCHAR* to, const TCHAR* ns, const TCHAR* szItem, const TCHAR* itemVal, const TCHAR* var, const TCHAR* varVal );
void AdminGet( const TCHAR* to, const TCHAR* ns, const TCHAR* var, const TCHAR* varVal, JABBER_IQ_PFUNC foo );
void AdminSetReason( const TCHAR* to, const TCHAR* ns, const TCHAR* szItem, const TCHAR* itemVal, const TCHAR* var, const TCHAR* varVal, const TCHAR* rsn );
@@ -476,7 +469,7 @@ struct CJabberProto : public PROTO_INTERFACE void ConsoleInit( void );
void ConsoleUninit( void );
-
+
bool FilterXml(HXML node, DWORD flags);
bool RecursiveCheckFilter(HXML node, DWORD flags);
@@ -500,30 +493,30 @@ struct CJabberProto : public PROTO_INTERFACE void ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode);
BOOL SyncTree(HTREELISTITEM hIndex, CJabberSDNode* pNode);
void ServiceDiscoveryShowMenu(CJabberSDNode *node, HTREELISTITEM hItem, POINT pt);
-
+
int SetupServiceDiscoveryDlg( TCHAR* jid );
-
+
void OnIqResultCapsDiscoInfo( HXML iqNode, CJabberIqInfo* pInfo );
void OnIqResultCapsDiscoInfoSI( HXML iqNode, CJabberIqInfo* pInfo );
-
+
void RegisterAgent( HWND hwndDlg, TCHAR* jid );
//---- jabber_file.cpp ---------------------------------------------------------------
int FileReceiveParse( filetransfer* ft, char* buffer, int datalen );
int FileSendParse( JABBER_SOCKET s, filetransfer* ft, char* buffer, int datalen );
-
+
void UpdateChatUserStatus( wchar_t* chat_jid, wchar_t* jid, wchar_t* nick, int role, int affil, int status, BOOL update_nick );
-
+
void GroupchatJoinRoomByJid(HWND hwndParent, TCHAR *jid);
-
+
void RenameParticipantNick( JABBER_LIST_ITEM* item, const TCHAR* oldNick, HXML itemNode );
void AcceptGroupchatInvite( const TCHAR* roomJid, const TCHAR* reason, const TCHAR* password );
//---- jabber_form.c -----------------------------------------------------------------
void FormCreateDialog( HXML xNode, TCHAR* defTitle, JABBER_FORM_SUBMIT_FUNC pfnSubmit, void *userdata );
-
+
//---- jabber_ft.c -------------------------------------------------------------------
void __cdecl FileReceiveThread( filetransfer* ft );
@@ -536,7 +529,7 @@ struct CJabberProto : public PROTO_INTERFACE void FtAcceptIbbRequest( filetransfer* ft );
BOOL FtHandleBytestreamRequest( HXML iqNode, CJabberIqInfo* pInfo );
BOOL FtHandleIbbRequest( HXML iqNode, BOOL bOpen );
-
+
//---- jabber_groupchat.c ------------------------------------------------------------
INT_PTR __cdecl OnMenuHandleJoinGroupchat( WPARAM wParam, LPARAM lParam );
@@ -578,7 +571,7 @@ struct CJabberProto : public PROTO_INTERFACE void IqAdd( unsigned int iqId, JABBER_IQ_PROCID procId, JABBER_IQ_PFUNC func );
void IqRemove( int index );
void IqExpire();
-
+
void OnIqResultBind( HXML iqNode, CJabberIqInfo* pInfo );
void OnIqResultDiscoBookmarks( HXML iqNode );
void OnIqResultEntityTime( HXML iqNode, CJabberIqInfo* pInfo );
@@ -625,7 +618,7 @@ struct CJabberProto : public PROTO_INTERFACE BOOL OnIqRequestOOB( HXML node, CJabberIqInfo *pInfo );
BOOL OnIqHttpAuth( HXML node, CJabberIqInfo* pInfo );
BOOL AddClistHttpAuthEvent( CJabberHttpAuthParams *pParams );
-
+
void __cdecl IbbSendThread( JABBER_IBB_TRANSFER *jibb );
void __cdecl IbbReceiveThread( JABBER_IBB_TRANSFER *jibb );
@@ -633,7 +626,7 @@ struct CJabberProto : public PROTO_INTERFACE void OnIbbCloseResult( HXML iqNode, CJabberIqInfo* pInfo );
BOOL OnFtHandleIbbIq( HXML iqNode, CJabberIqInfo* pInfo );
BOOL OnIbbRecvdData( const TCHAR *data, const TCHAR *sid, const TCHAR *seq );
-
+
void OnFtSiResult( HXML iqNode, CJabberIqInfo* pInfo );
BOOL FtIbbSend( int blocksize, filetransfer* ft );
BOOL FtSend( HANDLE hConn, filetransfer* ft );
@@ -673,7 +666,7 @@ struct CJabberProto : public PROTO_INTERFACE void SetMucConfig( HXML node, void *from );
void OnIqResultMucGetJidList( HXML iqNode, JABBER_MUC_JIDLIST_TYPE listType );
-
+
void OnIqResultServerDiscoInfo( HXML iqNode );
void OnIqResultGetVcardPhoto( const TCHAR* jid, HXML n, HANDLE hContact, BOOL& hasPhoto );
void SetBookmarkRequest (XmlNodeIq& iqId);
@@ -700,7 +693,7 @@ struct CJabberProto : public PROTO_INTERFACE void MenuHideSrmmIcon(HANDLE hContact);
void MenuUpdateSrmmIcon(JABBER_LIST_ITEM *item);
-
+
void AuthWorker( HANDLE hContact, char* authReqType );
void UpdatePriorityMenu(short priority);
@@ -744,7 +737,7 @@ struct CJabberProto : public PROTO_INTERFACE void _RosterHandleGetRequest( HXML node );
//---- jabber_password.cpp --------------------------------------------------------------
-
+
INT_PTR __cdecl OnMenuHandleChangePassword( WPARAM wParam, LPARAM lParam );
//---- jabber_privacy.cpp ------------------------------------------------------------
@@ -875,7 +868,7 @@ struct CJabberProto : public PROTO_INTERFACE void OnProcessError( HXML node, ThreadData *info );
void OnProcessSuccess( HXML node, ThreadData *info );
void OnProcessChallenge( HXML node, ThreadData *info );
- void OnProcessProceed( HXML node, ThreadData *info );
+ void OnProcessProceed( HXML node, ThreadData *info );
void OnProcessCompressed( HXML node, ThreadData *info );
void OnProcessMessage( HXML node, ThreadData *info );
void OnProcessPresence( HXML node, ThreadData *info );
@@ -1003,7 +996,7 @@ private: HGENMENU m_hPrivacyMenuRoot;
BOOL m_menuItemsStatus;
LIST<void> m_hPrivacyMenuItems;
-
+
int m_nMenuResourceItems;
HANDLE* m_phMenuResourceItems;
diff --git a/protocols/JabberG/ui_utils.cpp b/protocols/JabberG/ui_utils.cpp index 3e0db611a8..39f63ecae7 100644 --- a/protocols/JabberG/ui_utils.cpp +++ b/protocols/JabberG/ui_utils.cpp @@ -1349,7 +1349,7 @@ BOOL CCtrlListView::Update(int iItem) #define FILTER_BOX_HEIGHT 21
-struct CFilterData
+struct CFilterData : public MZeroedObject
{
HFONT m_hfntNormal;
HFONT m_hfntEmpty;
@@ -1363,14 +1363,6 @@ struct CFilterData HWND m_hwndOwner;
HWND m_hwndEditBox;
- __inline void* operator new( size_t size )
- { return calloc( 1, size );
- }
-
- __inline void operator delete( void* p )
- { free( p );
- }
-
void ReleaseFilterData()
{
//DeleteObject(m_hfntNormal); m_hfntNormal = NULL; // managed by system
diff --git a/protocols/MSN/msn_proto.h b/protocols/MSN/msn_proto.h index d038850ba4..5b349bbfc7 100644 --- a/protocols/MSN/msn_proto.h +++ b/protocols/MSN/msn_proto.h @@ -28,18 +28,11 @@ typedef int (__cdecl CMsnProto::*MsnEventFunc)(WPARAM, LPARAM); typedef INT_PTR (__cdecl CMsnProto::*MsnServiceFunc)(WPARAM, LPARAM);
typedef INT_PTR (__cdecl CMsnProto::*MsnServiceFuncParam)(WPARAM, LPARAM, LPARAM);
-struct CMsnProto : public PROTO_INTERFACE
+struct CMsnProto : public PROTO_INTERFACE, public MZeroedObject
{
CMsnProto(const char*, const TCHAR*);
~CMsnProto();
- __inline void* operator new(size_t size)
- { return calloc(1, size);
- }
- __inline void operator delete(void* p)
- { free(p);
- }
-
//====================================================================================
// PROTO_INTERFACE
//====================================================================================
@@ -130,13 +123,13 @@ struct CMsnProto : public PROTO_INTERFACE //====| Data |========================================================================
// Security Tokens
- char *pAuthToken, *tAuthToken;
+ char *pAuthToken, *tAuthToken;
char *oimSendToken;
- char *authStrToken, *authSecretToken;
+ char *authStrToken, *authSecretToken;
char *authContactToken;
char *authStorageToken;
char *hotSecretToken, *hotAuthToken;
-
+
char *abCacheKey, *sharingCacheKey, *storageCacheKey;
CRITICAL_SECTION csLists;
@@ -212,11 +205,11 @@ struct CMsnProto : public PROTO_INTERFACE void MSN_GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen, const TCHAR *ext);
int MSN_SetMyAvatar(const TCHAR* szFname, void* pData, size_t cbLen);
void MSN_GetCustomSmileyFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen, const char* SmileyName, int Type);
-
+
const char* MirandaStatusToMSN(int status);
WORD MSNStatusToMiranda(const char *status);
char** GetStatusMsgLoc(int status);
-
+
void MSN_SendStatusMessage(const char* msg);
void MSN_SetServerStatus(int newStatus);
void MSN_StartStopTyping(ThreadData* info, bool start);
@@ -235,7 +228,7 @@ struct CMsnProto : public PROTO_INTERFACE void sttCustomSmiley(const char* msgBody, char* email, char* nick, int iSmileyType);
void sttInviteMessage(ThreadData* info, char* msgBody, char* email, char* nick);
void sttSetMirVer(HANDLE hContact, DWORD dwValue, bool always);
-
+
void LoadOptions(void);
void InitPopups(void);
@@ -282,7 +275,7 @@ struct CMsnProto : public PROTO_INTERFACE /////////////////////////////////////////////////////////////////////////////////////////
// MSN thread functions
-
+
void __cdecl msn_keepAliveThread(void* arg);
void __cdecl MSNServerThread(void* arg);
@@ -361,14 +354,14 @@ struct CMsnProto : public PROTO_INTERFACE void p2p_processMsg(ThreadData* info, char* msgbody, const char* wlid);
void p2p_processMsgV2(ThreadData* info, char* msgbody, const char* wlid);
void p2p_processSIP(ThreadData* info, char* msgbody, P2PB_Header* hdr, const char* wlid);
-
+
void p2p_AcceptTransfer(MimeHeaders& tFileInfo, MimeHeaders& tFileInfo2, const char* wlid);
void p2p_InitDirectTransfer(MimeHeaders& tFileInfo, MimeHeaders& tFileInfo2, const char* wlid);
void p2p_InitDirectTransfer2(MimeHeaders& tFileInfo, MimeHeaders& tFileInfo2, const char* wlid);
void p2p_InitFileTransfer(ThreadData* info, MimeHeaders& tFileInfo, MimeHeaders& tFileInfo2, const char* wlid);
void p2p_pictureTransferFailed(filetransfer* ft);
void p2p_savePicture2disk(filetransfer* ft);
-
+
bool p2p_createListener(filetransfer* ft, directconnection *dc, MimeHeaders& chdrs);
void p2p_startConnect(const char* wlid, const char* szCallID, const char* addr, const char* port, bool ipv6);
@@ -418,7 +411,7 @@ struct CMsnProto : public PROTO_INTERFACE void msnftp_invite(filetransfer *ft);
void msnftp_sendAcceptReject(filetransfer *ft, bool acc);
void msnftp_startFileSend(ThreadData* info, const char* Invcommand, const char* Invcookie);
-
+
int MSN_HandleMSNFTP(ThreadData *info, char *cmdString);
void __cdecl msnftp_sendFileThread(void* arg);
@@ -449,10 +442,10 @@ struct CMsnProto : public PROTO_INTERFACE MsnContact* Lists_Get(const char* email);
MsnContact* Lists_Get(HANDLE hContact);
MsnContact* Lists_GetNext(int& i);
-
+
MsnPlace* Lists_GetPlace(const char* wlid);
MsnPlace* Lists_AddPlace(const char* email, const char* id, unsigned cap1, unsigned cap2);
-
+
void Lists_Init(void);
void Lists_Uninit(void);
@@ -504,7 +497,7 @@ struct CMsnProto : public PROTO_INTERFACE void getMetaData(void);
void getOIMs(ezxml_t xmli);
ezxml_t oimRecvHdr(const char* service, ezxml_t& tbdy, char*& httphdr);
-
+
void processMailData(char* mailData);
void sttNotificationMessage(char* msgBody, bool isInitial);
void displayEmailCount(HANDLE hContact);
diff --git a/protocols/Omegle/proto.h b/protocols/Omegle/proto.h index 457ea775cd..053071aac8 100644 --- a/protocols/Omegle/proto.h +++ b/protocols/Omegle/proto.h @@ -22,21 +22,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once
-class OmegleProto : public PROTO_INTERFACE
+class OmegleProto : public PROTO_INTERFACE, public MZeroedObject
{
public:
OmegleProto( const char *proto_name, const TCHAR *username );
~OmegleProto( );
- __inline void* operator new( size_t size )
- {
- return calloc( 1, size );
- }
- __inline void operator delete( void* p )
- {
- free( p );
- }
-
inline const char* ModuleName( ) const
{
return m_szModuleName;
@@ -124,7 +115,7 @@ public: void __cdecl SendMsgWorker(void*);
void __cdecl SendTypingWorker(void*);
-
+
void __cdecl NewChatWorker(void*);
void __cdecl StopChatWorker(void*);
@@ -140,7 +131,7 @@ public: void AddChatContact(const TCHAR *nick);
void DeleteChatContact(const TCHAR *name);
void SetChatStatus(int);
- void ClearChat();
+ void ClearChat();
void SetTopic(const TCHAR *topic = NULL);
// Connection client
diff --git a/protocols/Twitter/proto.h b/protocols/Twitter/proto.h index eb5b9a2198..31acca9768 100644 --- a/protocols/Twitter/proto.h +++ b/protocols/Twitter/proto.h @@ -25,21 +25,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <m_protoint.h>
-class TwitterProto : public PROTO_INTERFACE
+class TwitterProto : public PROTO_INTERFACE, public MZeroedObject
{
public:
TwitterProto(const char *,const TCHAR *);
~TwitterProto();
- __inline void* operator new(size_t size)
- {
- return calloc(1,size);
- }
- __inline void operator delete(void *p)
- {
- free(p);
- }
-
inline const char * ModuleName() const
{
return m_szModuleName;
diff --git a/protocols/Yahoo/proto.h b/protocols/Yahoo/proto.h index bf41f53104..d8c72dadb1 100644 --- a/protocols/Yahoo/proto.h +++ b/protocols/Yahoo/proto.h @@ -1,9 +1,9 @@ /*
* $Id: proto.h 14181 2012-03-11 17:51:16Z george.hazan $
*
- * myYahoo Miranda Plugin
+ * myYahoo Miranda Plugin
*
- * Authors: Gennady Feldman (aka Gena01)
+ * Authors: Gennady Feldman (aka Gena01)
* Laurent Marechal (aka Peorth)
*
* This code is under GPL and is based on AIM, MSN and Miranda source code.
@@ -33,18 +33,11 @@ extern "C" typedef INT_PTR ( __cdecl CYahooProto::*YServiceFuncParam )( WPARAM, LPARAM, LPARAM );
#endif
-struct CYahooProto : public PROTO_INTERFACE
+struct CYahooProto : public PROTO_INTERFACE, public MZeroedObject
{
CYahooProto( const char*, const TCHAR* );
virtual ~CYahooProto();
- __inline void* operator new( size_t size )
- { return calloc( 1, size );
- }
- __inline void operator delete( void* p )
- { free( p );
- }
-
//====================================================================================
// PROTO_INTERFACE
//====================================================================================
@@ -92,7 +85,7 @@ struct CYahooProto : public PROTO_INTERFACE virtual int __cdecl SendAwayMsg( HANDLE hContact, HANDLE hProcess, const char* msg );
virtual int __cdecl SetAwayMsg( int m_iStatus, const PROTOCHAR* msg );
virtual INT_PTR __cdecl GetMyAwayMsg(WPARAM wParam, LPARAM lParam);
-
+
virtual int __cdecl UserIsTyping( HANDLE hContact, int type );
virtual int __cdecl OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam );
@@ -113,7 +106,7 @@ struct CYahooProto : public PROTO_INTERFACE INT_PTR __cdecl OnRefreshCommand( WPARAM, LPARAM );
INT_PTR __cdecl OnShowMyProfileCommand( WPARAM, LPARAM );
INT_PTR __cdecl OnShowProfileCommand( WPARAM, LPARAM );
-
+
INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl GetUnreadEmailCount( WPARAM, LPARAM );
INT_PTR __cdecl SendNudge( WPARAM, LPARAM );
@@ -127,7 +120,7 @@ struct CYahooProto : public PROTO_INTERFACE void MenuMainInit( void );
void MenuContactInit( void );
void MenuUninit( void );
-
+
//====| Data |========================================================================
BOOL m_bLoggedIn;
YList *m_connections;
@@ -138,19 +131,19 @@ struct CYahooProto : public PROTO_INTERFACE char *name;
YList *members;
- ChatRoom(const char* name, YList *members)
+ ChatRoom(const char* name, YList *members)
: name(strdup(name)), members(members) {}
~ChatRoom()
{ for (YList *l = members; l; l = l->next) free(l->data);
free(name); y_list_free(members); }
- static int compare(const ChatRoom* c1, const ChatRoom* c2)
+ static int compare(const ChatRoom* c1, const ChatRoom* c2)
{ return strcmp(c1->name, c2->name); }
};
OBJLIST <ChatRoom> m_chatrooms;
-
+
char* m_startMsg;
// former ylad structure
@@ -177,7 +170,7 @@ struct CYahooProto : public PROTO_INTERFACE void ext_got_picture_status(const char *me, const char *who, int buddy_icon);
void ext_got_picture_upload(const char *me, const char *url, unsigned int ts);
void ext_got_avatar_share(int buddy_icon);
-
+
void reset_avatar(HANDLE hContact);
void request_avatar(const char* who);
@@ -197,7 +190,7 @@ struct CYahooProto : public PROTO_INTERFACE //====| filetransfer.cpp |============================================================
void __cdecl recv_filethread(void *psf);
void __cdecl send_filethread(void *psf);
-
+
void ext_got_file(const char *me, const char *who, const char *url, long expires, const char *msg, const char *fname, unsigned long fesize, const char *ft_token, int y7);
void ext_got_files(const char *me, const char *who, const char *ft_token, int y7, YList* files);
void ext_got_file7info(const char *me, const char *who, const char *url, const char *fname, const char *ft_token);
@@ -208,14 +201,14 @@ struct CYahooProto : public PROTO_INTERFACE HICON LoadIconEx(const char* name, bool big = false);
HANDLE GetIconHandle(int iconId);
void ReleaseIconEx(const char* name, bool big = false);
-
+
//====| ignore.cpp |==================================================================
const YList* GetIgnoreList(void);
void IgnoreBuddy(const char *buddy, int ignore);
int BuddyIgnored(const char *who);
void ext_got_ignore(YList * igns);
-
+
//====| im.cpp |======================================================================
void ext_got_im(const char *me, const char *who, int protocol, const char *msg, long tm, int stat, int utf8, int buddy_icon, const char *seqn=NULL, int sendn=0);
@@ -247,7 +240,7 @@ struct CYahooProto : public PROTO_INTERFACE //====| user_info.cpp |===============================================================
int __cdecl OnUserInfoInit( WPARAM wParam, LPARAM lParam );
-
+
//====| util.cpp |====================================================================
int GetByte( const char* valueName, int parDefltValue );
int SetByte( const char* valueName, int parValue );
@@ -257,12 +250,12 @@ struct CYahooProto : public PROTO_INTERFACE int GetString( const char* name, DBVARIANT* );
int GetString( HANDLE hContact, const char* name, DBVARIANT* );
int GetStringUtf( HANDLE hContact, const char* name, DBVARIANT* );
-
+
void SetString( const char* name, const char* value );
void SetString( HANDLE hContact, const char* name, const char* value );
void SetStringT( HANDLE hContact, const char* name, const TCHAR* value );
DWORD SetStringUtf( HANDLE hContact, const char* valueName, const char* parValue );
-
+
DWORD GetDword( const char* valueName, DWORD parDefltValue );
DWORD SetDword( const char* valueName, DWORD parValue );
DWORD GetDword( HANDLE hContact, const char* valueName, DWORD parDefltValue );
@@ -328,10 +321,10 @@ struct CYahooProto : public PROTO_INTERFACE void AddBuddy(HANDLE hContact, const char *group, const TCHAR *msg);
void YAHOO_utils_logversion();
-
+
unsigned int ext_add_handler(int fd, yahoo_input_condition cond, void *data);
void ext_remove_handler(unsigned int tag);
-
+
private:
int m_startStatus;
int m_unreadMessages;
diff --git a/src/modules/clist/genmenu.h b/src/modules/clist/genmenu.h index aa924656e0..81f737d405 100644 --- a/src/modules/clist/genmenu.h +++ b/src/modules/clist/genmenu.h @@ -2,7 +2,7 @@ Miranda IM: the free IM client for Microsoft* Windows*
-Copyright 2000-2010 Miranda ICQ/IM project,
+Copyright 2000-2010 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -11,7 +11,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -57,18 +57,11 @@ typedef struct _tagIntMenuItem }
TMO_IntMenuItem, *PMO_IntMenuItem;
-struct TIntMenuObject
+struct TIntMenuObject : public MZeroedObject
{
TIntMenuObject();
~TIntMenuObject();
- __inline void* operator new(size_t size)
- { return mir_calloc(size);
- }
- __inline void operator delete(void* p)
- { mir_free(p);
- }
-
char* Name;
int id;
diff --git a/src/modules/options/headerbar.cpp b/src/modules/options/headerbar.cpp index ad06f75f98..4d6b93268b 100644 --- a/src/modules/options/headerbar.cpp +++ b/src/modules/options/headerbar.cpp @@ -3,7 +3,7 @@ Miranda IM: the free IM client for Microsoft* Windows*
Copyright 2007 Artem Shpynov
-Copyright 2000-2007 Miranda ICQ/IM project,
+Copyright 2000-2007 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -13,7 +13,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -46,15 +46,8 @@ static BOOL IsVSMode() static LRESULT CALLBACK MHeaderbarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
// structure is used for storing list of tab info
-struct MHeaderbarCtrl
+struct MHeaderbarCtrl : public MZeroedObject
{
- __inline void* operator new(size_t size)
- { return mir_calloc(size);
- }
- __inline void operator delete(void* p)
- { mir_free(p);
- }
-
MHeaderbarCtrl() {}
~MHeaderbarCtrl() { mir_free(controlsToRedraw); }
@@ -64,7 +57,7 @@ struct MHeaderbarCtrl RECT rc;
int width, height;
HICON hIcon;
-
+
// control colors
RGBQUAD rgbBkgTop, rgbBkgBottom;
COLORREF clText;
@@ -88,7 +81,7 @@ int LoadHeaderbarModule() wc.cbWndExtra = sizeof(MHeaderbarCtrl*);
wc.hbrBackground = 0; //GetStockObject(WHITE_BRUSH);
wc.style = CS_GLOBALCLASS|CS_SAVEBITS;
- RegisterClassEx(&wc);
+ RegisterClassEx(&wc);
return 0;
}
@@ -129,8 +122,8 @@ static void MHeaderbar_DrawGradient(HDC hdc, int x, int y, int width, int height for (i = y+height; --i >= y;)
{
COLORREF color = RGB(
- ((height-i-1)*rgb0->rgbRed + i*rgb1->rgbRed) / height,
- ((height-i-1)*rgb0->rgbGreen + i*rgb1->rgbGreen) / height,
+ ((height-i-1)*rgb0->rgbRed + i*rgb1->rgbRed) / height,
+ ((height-i-1)*rgb0->rgbGreen + i*rgb1->rgbGreen) / height,
((height-i-1)*rgb0->rgbBlue + i*rgb1->rgbBlue) / height);
rc.top = rc.bottom = i;
++rc.bottom;
@@ -183,7 +176,7 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit, UINT msg, WTA_OPTIONS opts;
opts.dwFlags = opts.dwMask = WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON;
setWindowThemeAttribute(GetParent(hwndDlg), WTA_NONCLIENT, &opts, sizeof(opts));
- }
+ }
else {
if (IsVSMode())
MHeaderbar_FillRect(tempDC, 0, 0, mit->width, mit->height, GetSysColor(COLOR_WINDOW));
@@ -345,14 +338,14 @@ static LRESULT CALLBACK MHeaderbarWndProc(HWND hwndDlg, UINT msg, WPARAM wParam case WM_LBUTTONDOWN:
SendMessage(GetParent(hwndDlg), WM_SYSCOMMAND, 0xF012, 0);
return 0;
-
+
case WM_SETICON:
if (wParam < 3) {
itc->hIcon = (HICON)lParam;
InvalidateRect(hwndDlg, NULL, FALSE);
}
break;
-
+
case WM_ERASEBKGND:
return 1;
diff --git a/src/modules/options/iconheader.cpp b/src/modules/options/iconheader.cpp index afaf893d04..aeb0bbd833 100644 --- a/src/modules/options/iconheader.cpp +++ b/src/modules/options/iconheader.cpp @@ -3,7 +3,7 @@ Miranda IM: the free IM client for Microsoft* Windows*
Copyright 2007 Artem Shpynov
-Copyright 2000-2007 Miranda ICQ/IM project,
+Copyright 2000-2007 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -13,7 +13,7 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@@ -48,15 +48,8 @@ static BOOL IsVSMode() static LRESULT CALLBACK MIcoTabWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
// structure is used for storing list of tab info
-struct MIcoTabCtrl
+struct MIcoTabCtrl : public MZeroedObject
{
- __inline void* operator new(size_t size)
- { return mir_calloc(size);
- }
- __inline void operator delete(void* p)
- { mir_free(p);
- }
-
MIcoTabCtrl(): pList(1) {}
HWND hwnd;
@@ -93,14 +86,14 @@ static void MITListDestructor(void * adr) {
MIcoTab * mit = (MIcoTab *)adr;
mir_free(mit->tcsName);
- if (mit->hIcon && !(mit->flag&MITCF_SHAREDICON))
+ if (mit->hIcon && !(mit->flag&MITCF_SHAREDICON))
DestroyIcon(mit->hIcon);
mir_free(adr);
}
void li_ListDestruct(LIST<MIcoTab> &pList, ItemDestuctor pItemDestructor)
-{
- for (int i=0; i<pList.getCount(); i++) pItemDestructor(pList[i]);
+{
+ for (int i=0; i<pList.getCount(); i++) pItemDestructor(pList[i]);
pList.destroy();
}
@@ -117,7 +110,7 @@ int LoadIcoTabsModule() wc.cbWndExtra = sizeof(MIcoTabCtrl*);
wc.hbrBackground = 0; //GetStockObject(WHITE_BRUSH);
wc.style = CS_GLOBALCLASS/*|CS_SAVEBITS*/;
- RegisterClassEx(&wc);
+ RegisterClassEx(&wc);
return 0;
}
@@ -171,8 +164,8 @@ static void MIcoTab_DrawGradient(HDC hdc, int x, int y, int width, int height, R RECT rc; SetRect(&rc, x, 0, x+width, 0);
for (int i = y+height; --i >= y;) {
COLORREF color = RGB(
- ((height-i-1)*rgb0->rgbRed + i*rgb1->rgbRed) / height,
- ((height-i-1)*rgb0->rgbGreen + i*rgb1->rgbGreen) / height,
+ ((height-i-1)*rgb0->rgbRed + i*rgb1->rgbRed) / height,
+ ((height-i-1)*rgb0->rgbGreen + i*rgb1->rgbGreen) / height,
((height-i-1)*rgb0->rgbBlue + i*rgb1->rgbBlue) / height);
rc.top = rc.bottom = i;
++rc.bottom;
@@ -212,13 +205,13 @@ static void MIcoTab_DrawItem(HWND hwnd, HDC hdc, MIcoTabCtrl *dat, MIcoTab *tab, drawThemeBackground(hTheme, hdc, LVP_LISTITEM, LISS_SELECTED, &rc, NULL);
closeThemeData(hTheme);
- }
+ }
else {
MIcoTab_FillRect(hdc, itemX, ITC_BORDER_SIZE, dat->itemWidth, dat->itemHeight, dat->clSelBorder);
MIcoTab_DrawGradient(hdc, itemX+1, ITC_BORDER_SIZE+1, dat->itemWidth-2, dat->itemHeight-2, &dat->rgbSelTop, &dat->rgbSelBottom);
}
SetTextColor(hdc, dat->clSelText);
- }
+ }
else if (dat->nHotIdx == i) {
if (IsVSMode()) {
RECT rc;
@@ -230,13 +223,13 @@ static void MIcoTab_DrawItem(HWND hwnd, HDC hdc, MIcoTabCtrl *dat, MIcoTab *tab, HANDLE hTheme = openThemeData(hwnd, L"ListView");
drawThemeBackground(hTheme, hdc, LVP_LISTITEM, LISS_HOT, &rc, NULL);
closeThemeData(hTheme);
- }
+ }
else {
MIcoTab_FillRect(hdc, itemX, ITC_BORDER_SIZE, dat->itemWidth, dat->itemHeight, dat->clHotBorder);
MIcoTab_DrawGradient(hdc, itemX+1, ITC_BORDER_SIZE+1, dat->itemWidth-2, dat->itemHeight-2, &dat->rgbHotTop, &dat->rgbHotBottom);
}
SetTextColor(hdc, dat->clHotText);
- }
+ }
else SetTextColor(hdc, dat->clText);
RECT textRect;
@@ -244,7 +237,7 @@ static void MIcoTab_DrawItem(HWND hwnd, HDC hdc, MIcoTabCtrl *dat, MIcoTab *tab, textRect.right = itemX+dat->itemWidth;
textRect.top = textTop;
textRect.bottom = iconTop+dat->itemHeight;
- DrawIcon(hdc, itemX+dat->itemWidth/2-16, iconTop, tab->hIcon);
+ DrawIcon(hdc, itemX+dat->itemWidth/2-16, iconTop, tab->hIcon);
if (IsVSMode()) {
DTTOPTS dto = {0};
@@ -256,7 +249,7 @@ static void MIcoTab_DrawItem(HWND hwnd, HDC hdc, MIcoTabCtrl *dat, MIcoTab *tab, drawThemeTextEx(hTheme, hdc, WP_CAPTION, CS_ACTIVE, tcsNameW, -1, DT_VCENTER|DT_CENTER|DT_END_ELLIPSIS, &textRect, &dto);
mir_free(tcsNameW);
closeThemeData(hTheme);
- }
+ }
else DrawText(hdc, tab->tcsName, -1, &textRect, DT_VCENTER|DT_CENTER|DT_END_ELLIPSIS);
if (hFntSave)
@@ -292,7 +285,7 @@ static LRESULT MIcoTab_OnPaint(HWND hwndDlg, MIcoTabCtrl *mit, UINT msg, WPARAM temprc.top = 0;
temprc.bottom = mit->width;
FillRect(tempDC, &temprc, (HBRUSH)GetStockObject(BLACK_BRUSH));
- }
+ }
else {
if (mit->hBkgBmp)
StretchBlt(tempDC, 0, 0, mit->width, mit->height, mit->hBkgDC, 0, 0, mit->BkgSize.cx, mit->BkgSize.cy, SRCCOPY);
@@ -360,7 +353,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (itc->pList.getCount()) {
itc->itemWidth = (itc->width-2*ITC_BORDER_SIZE)/itc->pList.getCount();
itc->itemHeight = itc->height-2*ITC_BORDER_SIZE-2;
- }
+ }
else itc->itemWidth = itc->itemHeight = 0;
return TRUE;
@@ -397,8 +390,8 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L itc->nSelectedIdx = itc->nHotIdx;
SetWindowText(hwndDlg, itc->pList[itc->nSelectedIdx]->tcsName);
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
- SendMessage(GetParent(hwndDlg), WM_COMMAND,
- MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGED),
+ SendMessage(GetParent(hwndDlg), WM_COMMAND,
+ MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGED),
itc->nSelectedIdx);
}
return 0;
@@ -454,8 +447,8 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L itc->nSelectedIdx = newIdx;
SetWindowText(hwndDlg, itc->pList[itc->nSelectedIdx]->tcsName);
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
- SendMessage(GetParent(hwndDlg), WM_COMMAND,
- MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGEDKBD),
+ SendMessage(GetParent(hwndDlg), WM_COMMAND,
+ MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGEDKBD),
itc->nSelectedIdx);
}
return 0;
@@ -474,7 +467,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case ITCM_SETBACKGROUND:
itc->hBkgBmp = (HBITMAP)lParam;
- if ( !itc->hBkgDC)
+ if ( !itc->hBkgDC)
itc->hBkgDC = CreateCompatibleDC(NULL);
itc->hBkgOldBmp = (HBITMAP)SelectObject(itc->hBkgDC, itc->hBkgBmp);
{
@@ -488,7 +481,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case ITCM_ADDITEM:
{
MIcoTab* pMit = (MIcoTab *)wParam;
- if ( !pMit)
+ if ( !pMit)
return FALSE;
MIcoTab* pListMit = (MIcoTab *)mir_calloc(sizeof(MIcoTab));
@@ -508,7 +501,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L itc->itemWidth = (itc->width-2*ITC_BORDER_SIZE)/itc->pList.getCount();
itc->itemHeight = itc->height-2*ITC_BORDER_SIZE-2;
-
+
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
return TRUE;
}
@@ -518,8 +511,8 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L itc->nSelectedIdx = wParam;
SetWindowText(hwndDlg, itc->pList[itc->nSelectedIdx]->tcsName);
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
- SendMessage(GetParent(hwndDlg), WM_COMMAND,
- MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGED),
+ SendMessage(GetParent(hwndDlg), WM_COMMAND,
+ MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGED),
itc->nSelectedIdx);
}
return TRUE;
|