summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-14 14:57:37 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-14 14:57:37 +0000
commit3d64cefb8851fcf43b9c6109abdddaf71e340a71 (patch)
tree570472c4a55ca462fe9e5049a91702859eeb0fed
parent1d680ee8c0f9b0c2a421a778cb50152581dc2873 (diff)
- various leaks
- code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@965 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/ExtraIcons/DefaultExtraIcons.cpp2
-rw-r--r--plugins/ExtraIcons/commons.h2
-rw-r--r--plugins/ExtraIcons/extraicons.cpp36
-rw-r--r--plugins/NewXstatusNotify/main.cpp5
-rw-r--r--plugins/SeenPlugin/utils.cpp41
-rw-r--r--plugins/TabSRMM/chat/muchighlight.cpp4
-rw-r--r--plugins/TabSRMM/chat/options.cpp8
-rw-r--r--plugins/TabSRMM/chat/window.cpp8
-rw-r--r--plugins/TabSRMM/include/controls.h2
-rw-r--r--plugins/TabSRMM/include/sendqueue.h2
-rw-r--r--plugins/TabSRMM/src/contactcache.cpp2
-rw-r--r--plugins/TabSRMM/src/containeroptions.cpp2
-rw-r--r--plugins/TabSRMM/src/globals.cpp2
-rw-r--r--plugins/TabSRMM/src/hotkeyhandler.cpp2
-rw-r--r--plugins/TabSRMM/src/mim.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp2
-rw-r--r--plugins/TabSRMM/src/msgoptions.cpp8
-rw-r--r--plugins/TabSRMM/src/msgs.cpp2
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp4
-rw-r--r--plugins/TabSRMM/src/sidebar.cpp2
-rw-r--r--plugins/TabSRMM/src/tabctrl.cpp4
-rw-r--r--plugins/TabSRMM/src/themeio.cpp8
-rw-r--r--plugins/TabSRMM/src/themes.cpp6
-rw-r--r--plugins/TabSRMM/tabsrmm_10.vcxproj.filters4
-rw-r--r--plugins/TopToolBar/toolbarwnd.cpp1
-rw-r--r--protocols/IcqOscarJ/icq_infoupdate.cpp2
-rw-r--r--protocols/IcqOscarJ/icq_proto.cpp3
-rw-r--r--protocols/IcqOscarJ/icq_server.cpp3
-rw-r--r--src/mir_core/miranda.cpp1
-rw-r--r--src/mir_core/modules.cpp43
-rw-r--r--src/mir_core/utils.cpp41
-rw-r--r--src/modules/skin/hotkeys.cpp5
32 files changed, 115 insertions, 144 deletions
diff --git a/plugins/ExtraIcons/DefaultExtraIcons.cpp b/plugins/ExtraIcons/DefaultExtraIcons.cpp
index ebdaddff8a..8839aa64ae 100644
--- a/plugins/ExtraIcons/DefaultExtraIcons.cpp
+++ b/plugins/ExtraIcons/DefaultExtraIcons.cpp
@@ -308,7 +308,7 @@ static void DBExtraIconsInit()
hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
}
- hHooks.push_back(HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged));
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingChanged);
}
// Protocol /////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/ExtraIcons/commons.h b/plugins/ExtraIcons/commons.h
index ede4e4325e..d52f4bad21 100644
--- a/plugins/ExtraIcons/commons.h
+++ b/plugins/ExtraIcons/commons.h
@@ -83,8 +83,6 @@ extern HINSTANCE hInst;
#define ICON_SIZE 16
-extern vector<HANDLE> hHooks;
-
extern vector<BaseExtraIcon*> registeredExtraIcons;
extern vector<ExtraIcon*> extraIconsByHandle;
extern vector<ExtraIcon*> extraIconsBySlot;
diff --git a/plugins/ExtraIcons/extraicons.cpp b/plugins/ExtraIcons/extraicons.cpp
index 6c3ae4dc30..f193de7633 100644
--- a/plugins/ExtraIcons/extraicons.cpp
+++ b/plugins/ExtraIcons/extraicons.cpp
@@ -38,8 +38,6 @@ HINSTANCE hInst;
int hLangpack;
-vector<HANDLE> hHooks;
-vector<HANDLE> hServices;
vector<BaseExtraIcon*> registeredExtraIcons;
vector<ExtraIcon*> extraIconsByHandle;
vector<ExtraIcon*> extraIconsBySlot;
@@ -82,14 +80,12 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
extern "C" int __declspec(dllexport) Load(void)
{
-
mir_getLP(&pluginInfo);
DWORD ret = CallService(MS_CLUI_GETCAPS, CLUICAPS_FLAGS2, 0);
clistFirstSlot = HIWORD(ret);
clistSlotCount = LOWORD(ret);
-
// Icons
IcoLib_Register("AlwaysVis", "Contact List", "Always Visible", IDI_ALWAYSVIS);
IcoLib_Register("NeverVis", "Contact List", "Never Visible", IDI_NEVERVIS);
@@ -97,26 +93,25 @@ extern "C" int __declspec(dllexport) Load(void)
IcoLib_Register("gender_male", "Contact List", "Male", IDI_MALE);
IcoLib_Register("gender_female", "Contact List", "Female", IDI_FEMALE);
-
// Hooks
- hHooks.push_back(HookEvent(ME_SYSTEM_MODULESLOADED, &ModulesLoaded));
- hHooks.push_back(HookEvent(ME_SYSTEM_PRESHUTDOWN, &PreShutdown));
- hHooks.push_back(HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, &ClistExtraListRebuild));
- hHooks.push_back(HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, &ClistExtraImageApply));
- hHooks.push_back(HookEvent(ME_CLIST_EXTRA_CLICK, &ClistExtraClick));
-
+ HookEvent(ME_SYSTEM_MODULESLOADED, &ModulesLoaded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, &PreShutdown);
+ HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, &ClistExtraListRebuild);
+ HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, &ClistExtraImageApply);
+ HookEvent(ME_CLIST_EXTRA_CLICK, &ClistExtraClick);
// Services
- hServices.push_back(CreateServiceFunction(MS_EXTRAICON_REGISTER, &ExtraIcon_Register));
- hServices.push_back(CreateServiceFunction(MS_EXTRAICON_SET_ICON, &ExtraIcon_SetIcon));
+ CreateServiceFunction(MS_EXTRAICON_REGISTER, &ExtraIcon_Register);
+ CreateServiceFunction(MS_EXTRAICON_SET_ICON, &ExtraIcon_SetIcon);
DefaultExtraIcons_Load();
-
return 0;
}
extern "C" int __declspec(dllexport) Unload(void)
{
+ for (size_t i=0; i < registeredExtraIcons.size(); i++)
+ delete registeredExtraIcons[i];
return 0;
}
@@ -126,15 +121,13 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
if (ServiceExists(MS_MC_GETPROTOCOLNAME))
metacontacts_proto = (char *) CallService(MS_MC_GETPROTOCOLNAME, 0, 0);
-
// add our modules to the KnownModules list
CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME, 0);
CallService("DBEditorpp/RegisterSingleModule", (WPARAM) MODULE_NAME "Groups", 0);
- hHooks.push_back(HookEvent(ME_SKIN2_ICONSCHANGED, &IconsChanged));
+ HookEvent(ME_SKIN2_ICONSCHANGED, &IconsChanged);
InitOptions();
-
return 0;
}
@@ -146,16 +139,7 @@ int IconsChanged(WPARAM wParam, LPARAM lParam)
int PreShutdown(WPARAM wParam, LPARAM lParam)
{
DefaultExtraIcons_Unload();
-
- unsigned int i;
- for (i = 0; i < hServices.size(); i++)
- DestroyServiceFunction(hServices[i]);
-
- for (i = 0; i < hHooks.size(); i++)
- UnhookEvent(hHooks[i]);
-
DeInitOptions();
-
return 0;
}
diff --git a/plugins/NewXstatusNotify/main.cpp b/plugins/NewXstatusNotify/main.cpp
index a71122551c..3a926259dc 100644
--- a/plugins/NewXstatusNotify/main.cpp
+++ b/plugins/NewXstatusNotify/main.cpp
@@ -580,10 +580,11 @@ int ProcessStatus(DBCONTACTWRITESETTING *cws, HANDLE hContact)
BOOL retem = TRUE, rettime = TRUE;
DBVARIANT dbv;
- if (!DBGetContactSettingString(hContact, "Protocol", "p", &dbv))
- {
+ if ( !DBGetContactSettingString(hContact, "Protocol", "p", &dbv)) {
char dbSetting[128];
mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", dbv.pszVal);
+ db_free(&dbv);
+
if (!DBGetContactSettingByte(NULL, MODULE, dbSetting, 1))
return 0;
}
diff --git a/plugins/SeenPlugin/utils.cpp b/plugins/SeenPlugin/utils.cpp
index 74e688e54b..d989f9e999 100644
--- a/plugins/SeenPlugin/utils.cpp
+++ b/plugins/SeenPlugin/utils.cpp
@@ -711,25 +711,15 @@ int UpdateValues(WPARAM wparam,LPARAM lparam)
static DWORD __stdcall cleanThread(logthread_info* infoParam)
{
- HANDLE hcontact=NULL;
-// char str[MAXMODULELABELLENGTH];
-// sprintf(str,"In Clean: %s; %s; %s\n",
-// infoParam->sProtoName,
-// (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)infoParam->hContact,0),
-// (const char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM)infoParam->courStatus,0)
-// );
-// OutputDebugStringA(str);
Sleep(10000); // I hope in 10 secons all logged-in contacts will be listed
- //Searching for contact marked as online but now are offline
- hcontact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
- while(hcontact!=NULL)
- {
- char * contactProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hcontact,0);
+ HANDLE hcontact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
+ while(hcontact != NULL) {
+ char *contactProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hcontact,0);
if (contactProto) {
- if (!strncmp(infoParam->sProtoName,contactProto,MAXMODULELABELLENGTH)) {
- WORD oldStatus;
- if ( (oldStatus = (DBGetContactSettingWord(hcontact,S_MOD,"StatusTriger",ID_STATUS_OFFLINE))|0x8000)>ID_STATUS_OFFLINE){
+ if ( !strncmp(infoParam->sProtoName, contactProto, MAXMODULELABELLENGTH)) {
+ WORD oldStatus = DBGetContactSettingWord(hcontact,S_MOD,"StatusTriger",ID_STATUS_OFFLINE) | 0x8000;
+ if (oldStatus > ID_STATUS_OFFLINE) {
if (DBGetContactSettingWord(hcontact,contactProto,"Status",ID_STATUS_OFFLINE)==ID_STATUS_OFFLINE){
DBWriteContactSettingWord(hcontact,S_MOD,"OldStatus",(WORD)(oldStatus|0x8000));
if (includeIdle)DBWriteContactSettingByte(hcontact,S_MOD,"OldIdle",(BYTE)((oldStatus&0x8000)?0:1));
@@ -741,19 +731,12 @@ static DWORD __stdcall cleanThread(logthread_info* infoParam)
hcontact=(HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hcontact,0);
}
-// sprintf(str,"OutClean: %s; %s; %s\n",
-// infoParam->sProtoName,
-// (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)infoParam->hContact,0),
-// (const char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,(WPARAM)infoParam->courStatus,0)
-// );
- {
- char *str = (char *)malloc(MAXMODULELABELLENGTH+9);
- mir_snprintf(str,MAXMODULELABELLENGTH+8,"OffTime-%s",infoParam->sProtoName);
- DBDeleteContactSetting(NULL,S_MOD,str);
- free(str);
- }
+ char *str = (char *)malloc(MAXMODULELABELLENGTH+9);
+ mir_snprintf(str,MAXMODULELABELLENGTH+8,"OffTime-%s",infoParam->sProtoName);
+ DBDeleteContactSetting(NULL,S_MOD,str);
+ free(str);
+
free(infoParam);
-// OutputDebugStringA(str);
return 0;
}
@@ -789,7 +772,7 @@ int ModeChange(WPARAM wparam,LPARAM lparam)
info->courStatus = 0;
unsigned int dwThreadId;
- mir_forkthreadex((pThreadFuncEx)cleanThread, info, &dwThreadId);
+ CloseHandle( mir_forkthreadex((pThreadFuncEx)cleanThread, info, &dwThreadId));
}
} else if ((isetting==ID_STATUS_OFFLINE)&&((WORD)ack->hProcess>ID_STATUS_OFFLINE)) {
//we have just loged-off
diff --git a/plugins/TabSRMM/chat/muchighlight.cpp b/plugins/TabSRMM/chat/muchighlight.cpp
index dd06f27d74..3ac3a20a93 100644
--- a/plugins/TabSRMM/chat/muchighlight.cpp
+++ b/plugins/TabSRMM/chat/muchighlight.cpp
@@ -172,7 +172,7 @@ int CMUCHighlight::match(const GCEVENT *pgce, const SESSION_INFO *psi, DWORD dwF
else
p1 = 0;
- for(i = 0; i < m_iTextPatterns && !result; i++)
+ for (i = 0; i < m_iTextPatterns && !result; i++)
result = wildmatch(m_TextPatterns[i], p) ? MATCH_TEXT : 0;
if (p1) {
@@ -206,7 +206,7 @@ skip_textpatterns:
* optinally, match the nickname against the list of nicks to highlight
*/
if ((m_dwFlags & MATCH_NICKNAME) && (dwFlags & MATCH_NICKNAME) && pgce->ptszNick && m_iNickPatterns > 0) {
- for(UINT i = 0; i < m_iNickPatterns && !nResult; i++) {
+ for (UINT i = 0; i < m_iNickPatterns && !nResult; i++) {
if (pgce->ptszNick)
nResult = wildmatch(m_NickPatterns[i], pgce->ptszNick) ? MATCH_NICKNAME : 0;
if ((m_dwFlags & MATCH_UIN) && pgce->ptszUserInfo)
diff --git a/plugins/TabSRMM/chat/options.cpp b/plugins/TabSRMM/chat/options.cpp
index 94278328a5..7a2bff5311 100644
--- a/plugins/TabSRMM/chat/options.cpp
+++ b/plugins/TabSRMM/chat/options.cpp
@@ -845,7 +845,7 @@ void RegisterFontServiceFonts() {
strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
strncpy(cid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
- for(i = 0; i < (sizeof(_clrs) / sizeof(_clrs[0])); i++) {
+ for (i = 0; i < (sizeof(_clrs) / sizeof(_clrs[0])); i++) {
cid.order = _clrs[i].order;
_tcsncpy(cid.group, _clrs[i].tszGroup, SIZEOF(fid.group));
_tcsncpy(cid.name, _clrs[i].tszName, SIZEOF(cid.name));
@@ -862,7 +862,7 @@ void RegisterFontServiceFonts() {
/*
* text and background colors for tabs
*/
- for(i = 0; i < (sizeof(_tabclrs) / sizeof(_tabclrs[0])); i++) {
+ for (i = 0; i < (sizeof(_tabclrs) / sizeof(_tabclrs[0])); i++) {
cid.order = _tabclrs[i].order;
_tcsncpy(cid.group, _tabclrs[i].tszGroup, SIZEOF(fid.group));
_tcsncpy(cid.name, _tabclrs[i].tszName, SIZEOF(cid.name));
@@ -1246,7 +1246,7 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
DWORD dwPopupFlags = M->GetDword("Chat", "PopupFlags", GC_EVENT_ALL);
DWORD dwLogFlags = M->GetDword("Chat", "DiskLogFlags", GC_EVENT_ALL);
- for(int i = 0; _eventorder[i]; i++) {
+ for (int i = 0; _eventorder[i]; i++) {
if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
CheckDlgButton(hwndDlg, IDC_1 + i, dwFilterFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_L1 + i, dwLogFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED);
@@ -1278,7 +1278,7 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM
DWORD dwFilterFlags = 0, dwTrayFlags = 0,
dwPopupFlags = 0, dwLogFlags = 0;
- for(int i = 0; _eventorder[i]; i++) {
+ for (int i = 0; _eventorder[i]; i++) {
if (_eventorder[i] != GC_EVENT_HIGHLIGHT) {
dwFilterFlags |= (IsDlgButtonChecked(hwndDlg, IDC_1 + i) ? _eventorder[i] : 0);
dwLogFlags |= (IsDlgButtonChecked(hwndDlg, IDC_L1 + i) ? _eventorder[i] : 0);
diff --git a/plugins/TabSRMM/chat/window.cpp b/plugins/TabSRMM/chat/window.cpp
index 668428cdf2..cffaa6ba0b 100644
--- a/plugins/TabSRMM/chat/window.cpp
+++ b/plugins/TabSRMM/chat/window.cpp
@@ -1205,7 +1205,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)si);
- for(int i = 0; _eventorder[i]; i++) {
+ for (int i = 0; _eventorder[i]; i++) {
CheckDlgButton(hwndDlg, IDC_1 + i, dwMask & _eventorder[i] ? (dwFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
CheckDlgButton(hwndDlg, IDC_P1 + i, dwPopupMask & _eventorder[i] ? (dwPopupFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
CheckDlgButton(hwndDlg, IDC_T1 + i, dwTrayMask & _eventorder[i] ? (dwTrayFlags & _eventorder[i] ? BST_CHECKED : BST_UNCHECKED) : BST_INDETERMINATE);
@@ -1224,7 +1224,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
UINT result;
DWORD dwMask = 0, dwFlags = 0;
- for(i = 0; _eventorder[i]; i++) {
+ for (i = 0; _eventorder[i]; i++) {
result = IsDlgButtonChecked(hwndDlg, IDC_1 + i);
dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
@@ -1245,7 +1245,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
dwMask = iFlags = 0;
- for(i = 0; _eventorder[i]; i++) {
+ for (i = 0; _eventorder[i]; i++) {
result = IsDlgButtonChecked(hwndDlg, IDC_P1 + i);
dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
@@ -1266,7 +1266,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
dwMask = iFlags = 0;
- for(i = 0; _eventorder[i]; i++) {
+ for (i = 0; _eventorder[i]; i++) {
result = IsDlgButtonChecked(hwndDlg, IDC_T1 + i);
dwMask |= (result != BST_INDETERMINATE ? _eventorder[i] : 0);
iFlags |= (result == BST_CHECKED ? _eventorder[i] : 0);
diff --git a/plugins/TabSRMM/include/controls.h b/plugins/TabSRMM/include/controls.h
index da7544beb4..32be5fe2d3 100644
--- a/plugins/TabSRMM/include/controls.h
+++ b/plugins/TabSRMM/include/controls.h
@@ -85,7 +85,7 @@ public:
const int idToIndex(const int id) const
{
- for(int i = 0; i < NR_BUTTONS; i++) {
+ for (int i = 0; i < NR_BUTTONS; i++) {
if (m_TbButtons[i].idCommand == id )
return(i);
}
diff --git a/plugins/TabSRMM/include/sendqueue.h b/plugins/TabSRMM/include/sendqueue.h
index a829b8ab82..6c97288a55 100644
--- a/plugins/TabSRMM/include/sendqueue.h
+++ b/plugins/TabSRMM/include/sendqueue.h
@@ -78,7 +78,7 @@ public:
~SendQueue()
{
- for(int i = 0; i < NR_SENDJOBS; i++) {
+ for (int i = 0; i < NR_SENDJOBS; i++) {
if (m_jobs[i].sendBuffer)
free(m_jobs[i].sendBuffer);
}
diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp
index 116303b85b..36cf125e56 100644
--- a/plugins/TabSRMM/src/contactcache.cpp
+++ b/plugins/TabSRMM/src/contactcache.cpp
@@ -573,7 +573,7 @@ TCHAR* CContactCache::getNormalizedStatusMsg(const TCHAR *src, bool fStripAll)
tstring dest;
- for(i = 0; i < _tcslen(src); i++) {
+ for (i = 0; i < _tcslen(src); i++) {
if (src[i] == 0x0d || src[i] == '\t')
continue;
if (i && src[i] == (TCHAR)0x0a) {
diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp
index 305c0bdb8b..312435c3ab 100644
--- a/plugins/TabSRMM/src/containeroptions.cpp
+++ b/plugins/TabSRMM/src/containeroptions.cpp
@@ -200,7 +200,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
SendDlgItemMessage(hwndDlg, IDC_OWNAVATARMODE, CB_INSERTSTRING, -1,
(LPARAM)TranslateT("Don't show them"));
- for(i = 0; i < nr_layouts; i++)
+ for (i = 0; i < nr_layouts; i++)
SendDlgItemMessage(hwndDlg, IDC_SBARLAYOUT, CB_INSERTSTRING, -1, (LPARAM)TranslateTS(sblayouts[i].szName));
/* bits 24 - 31 of dwFlagsEx hold the side bar layout id */
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index 009ae7eef6..223c4ff32f 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -618,7 +618,7 @@ int CGlobals::PreshutdownSendRecv(WPARAM wParam, LPARAM lParam)
hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0);
}
- for(i = 0; i < SERVICE_LAST; i++) {
+ for (i = 0; i < SERVICE_LAST; i++) {
if (PluginConfig.hSvc[i])
DestroyServiceFunction(PluginConfig.hSvc[i]);
}
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp
index 2394ee5cf9..9574df156b 100644
--- a/plugins/TabSRMM/src/hotkeyhandler.cpp
+++ b/plugins/TabSRMM/src/hotkeyhandler.cpp
@@ -165,7 +165,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_CREATE:
int i;
- for(i = 0; i < safe_sizeof(_hotkeydescs); i++) {
+ for (i = 0; i < safe_sizeof(_hotkeydescs); i++) {
_hotkeydescs[i].cbSize = sizeof(HOTKEYDESC);
Hotkey_Register(&_hotkeydescs[i]);
}
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp
index bab0647150..ce63a4cd91 100644
--- a/plugins/TabSRMM/src/mim.cpp
+++ b/plugins/TabSRMM/src/mim.cpp
@@ -202,7 +202,7 @@ const TCHAR* CMimAPI::StriStr(const TCHAR *szString, const TCHAR *szSearchFor)
for (; *szString; ++szString) {
if (_totupper(*szString) == _totupper(*szSearchFor)) {
const TCHAR *h, *n;
- for(h = szString, n = szSearchFor; *h && *n; ++h, ++n) {
+ for (h = szString, n = szSearchFor; *h && *n; ++h, ++n) {
if (_totupper(*h) != _totupper(*n))
break;
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index b76eba793d..4a29fe72c3 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -1485,7 +1485,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
{
UINT _ctrls[] = {IDC_RETRY, IDC_CANCELSEND, IDC_MSGSENDLATER};
- for(i = 0; i < 3; i++) {
+ for (i = 0; i < 3; i++) {
SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASPUSHBTN, TRUE, 0);
SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASFLATBTN, FALSE, 0);
SendDlgItemMessage(hwndDlg, _ctrls[i], BUTTONSETASTHEMEDBTN, TRUE, 0);
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp
index 35f146beff..6995ad506e 100644
--- a/plugins/TabSRMM/src/msgoptions.cpp
+++ b/plugins/TabSRMM/src/msgoptions.cpp
@@ -204,7 +204,7 @@ static int TSAPI RescanSkins(HWND hwndCombobox)
SendMessage(hwndCombobox, CB_SETCURSEL, 0, 0);
if (0 == M->GetTString(0, SRMSGMOD_T, "ContainerSkin", &dbv)) {
LRESULT lr = SendMessage(hwndCombobox, CB_GETCOUNT, 0, 0);
- for(int i = 1; i < lr; i++) {
+ for (int i = 1; i < lr; i++) {
TCHAR* idata = (TCHAR *)SendMessage(hwndCombobox, CB_GETITEMDATA, i, 0);
if (idata && idata != (TCHAR *)CB_ERR) {
@@ -227,7 +227,7 @@ static void TSAPI FreeComboData(HWND hwndCombobox)
{
LRESULT lr = SendMessage(hwndCombobox, CB_GETCOUNT, 0, 0);
- for(int i = 1; i < lr; i++) {
+ for (int i = 1; i < lr; i++) {
void *idata = (void *)SendMessage(hwndCombobox, CB_GETITEMDATA, i, 0);
if (idata && idata != (void *)CB_ERR)
@@ -689,7 +689,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
LRESULT r = SendDlgItemMessage(hwndDlg, IDC_MSGLOGDIDSPLAY, CB_GETCURSEL, 0, 0);
Utils::showDlgControl(hwndDlg, IDC_EXPLAINMSGLOGSETTINGS, r == 0 ? SW_HIDE : SW_SHOW);
Utils::showDlgControl(hwndDlg, IDC_LOGOPTIONS, r == 0 ? SW_SHOW : SW_HIDE);
- for(i = 0; i < safe_sizeof(__ctrls); i++)
+ for (i = 0; i < safe_sizeof(__ctrls); i++)
Utils::enableDlgControl(hwndDlg, __ctrls[i], r == 0 ? TRUE : FALSE);
return 0;
}
@@ -1182,7 +1182,7 @@ static INT_PTR CALLBACK DlgProcContainerSettings(HWND hwndDlg, UINT msg, WPARAM
SendDlgItemMessage(hwndDlg, IDC_FLASHINTERVALSPIN, UDM_SETACCEL, 0, (int)M->GetDword("flashinterval", 1000));
CheckDlgButton(hwndDlg, IDC_USEAERO, M->GetByte("useAero", 1));
CheckDlgButton(hwndDlg, IDC_USEAEROPEEK, M->GetByte("useAeroPeek", 1));
- for(int i = 0; i < CSkin::AERO_EFFECT_LAST; i++)
+ for (int i = 0; i < CSkin::AERO_EFFECT_LAST; i++)
SendDlgItemMessage(hwndDlg, IDC_AEROEFFECT, CB_INSERTSTRING, -1, (LPARAM)TranslateTS(CSkin::m_aeroEffects[i].tszName));
SendDlgItemMessage(hwndDlg, IDC_AEROEFFECT, CB_SETCURSEL, (WPARAM)CSkin::m_aeroEffect, 0);
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 5b7a995893..4593a3ea43 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -550,7 +550,7 @@ static void TSAPI InitAPI()
ZeroMemory(PluginConfig.hSvc, sizeof(HANDLE) * CGlobals::SERVICE_LAST);
- for(i = 0; i < safe_sizeof(SERVICES); i++)
+ for (i = 0; i < safe_sizeof(SERVICES); i++)
*(SERVICES[i].h) = CreateServiceFunction(SERVICES[i].szName, SERVICES[i].pfnService);
*(SERVICES[CGlobals::H_MS_MSG_SENDMESSAGEW].h) = CreateServiceFunction(MS_MSG_SENDMESSAGE "W", SendMessageCommand_W);
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index 2d6a02a07c..77a6731c45 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -756,7 +756,7 @@ void CSendLater::qMgrSaveColumns()
LVCOLUMN col = {0};
col.mask = LVCF_WIDTH;
- for(i = 0; i < QMGR_LIST_NRCOLUMNS; i++) {
+ for (i = 0; i < QMGR_LIST_NRCOLUMNS; i++) {
::SendMessage(m_hwndList, LVM_GETCOLUMN, i, reinterpret_cast<LPARAM>(&col));
nWidths[i] = max(col.cx, 10);
}
@@ -899,7 +899,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
MB_ICONQUESTION | MB_OKCANCEL) == IDCANCEL)
break;
}
- for(LRESULT i = 0; i < items; i++) {
+ for (LRESULT i = 0; i < items; i++) {
item.iItem = i;
::SendMessage(m_hwndList, LVM_GETITEM, 0, reinterpret_cast<LPARAM>(&item));
if (item.state & LVIS_SELECTED) {
diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp
index 6988b6c1d3..11ad473251 100644
--- a/plugins/TabSRMM/src/sidebar.cpp
+++ b/plugins/TabSRMM/src/sidebar.cpp
@@ -526,7 +526,7 @@ void CSideBar::populateAll()
m_iTopButtons = 0;
- for(int i = 0; i < iItems; i++) {
+ for (int i = 0; i < iItems; i++) {
TabCtrl_GetItem(hwndTab, i, &item);
if (item.lParam && ::IsWindow((HWND)item.lParam)) {
TWindowData *dat = (TWindowData *)::GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA);
diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp
index 10ac3c39e4..94032a8cc6 100644
--- a/plugins/TabSRMM/src/tabctrl.cpp
+++ b/plugins/TabSRMM/src/tabctrl.cpp
@@ -1453,8 +1453,6 @@ void TSAPI ReloadTabConfig()
void TSAPI FreeTabConfig()
{
- int i;
-
if (PluginConfig.tabConfig.m_hPenItemShadow)
DeleteObject(PluginConfig.tabConfig.m_hPenItemShadow);
@@ -1467,7 +1465,7 @@ void TSAPI FreeTabConfig()
if (PluginConfig.tabConfig.m_hMenuFont)
DeleteObject(PluginConfig.tabConfig.m_hMenuFont);
- for(i = 0; i < 4; i++) {
+ for (int i = 0; i < 4; i++) {
if (PluginConfig.tabConfig.m_brushes[i]) {
DeleteObject(PluginConfig.tabConfig.m_brushes[i]);
PluginConfig.tabConfig.m_brushes[i] = 0;
diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp
index 031d6d88be..05bf677717 100644
--- a/plugins/TabSRMM/src/themeio.cpp
+++ b/plugins/TabSRMM/src/themeio.cpp
@@ -218,12 +218,12 @@ void TSAPI WriteThemeToINI(const TCHAR *szIniFilenameT, struct TWindowData *dat)
}
def = SRMSGDEFSET_BKGCOLOUR;
- for(i = 0; i < safe_sizeof(_extSettings); i++) {
+ for (i = 0; i < safe_sizeof(_extSettings); i++) {
WritePrivateProfileStringA(_extSettings[i].szIniSection, _extSettings[i].szIniName,
_itoa(M->GetDword(_extSettings[i].szDbModule, _extSettings[i].szDbSetting, _extSettings[i].dwDef), szBuf, 10), szIniFilename);
}
- for(i = 0; i < safe_sizeof(_extSettings_v5); i++) {
+ for (i = 0; i < safe_sizeof(_extSettings_v5); i++) {
WritePrivateProfileStringA(_extSettings_v5[i].szIniSection, _extSettings_v5[i].szIniName,
_itoa(M->GetDword(_extSettings_v5[i].szDbModule, _extSettings_v5[i].szDbSetting, _extSettings_v5[i].dwDef), szBuf, 10), szIniFilename);
}
@@ -324,13 +324,13 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in
if (dwFlags & THEME_READ_FONTS) {
COLORREF defclr;
- for(i = 0; i < safe_sizeof(_extSettings); i++) {
+ for (i = 0; i < safe_sizeof(_extSettings); i++) {
M->WriteDword(_extSettings[i].szDbModule, _extSettings[i].szDbSetting,
GetPrivateProfileIntA(_extSettings[i].szIniSection, _extSettings[i].szIniName, _extSettings[i].dwDef, szIniFilename));
}
if (version >= 5) {
- for(i = 0; i < safe_sizeof(_extSettings_v5); i++) {
+ for (i = 0; i < safe_sizeof(_extSettings_v5); i++) {
M->WriteDword(_extSettings_v5[i].szDbModule, _extSettings_v5[i].szDbSetting,
GetPrivateProfileIntA(_extSettings_v5[i].szIniSection, _extSettings_v5[i].szIniName, _extSettings_v5[i].dwDef, szIniFilename));
}
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp
index 5bf22158dc..8426bf8c45 100644
--- a/plugins/TabSRMM/src/themes.cpp
+++ b/plugins/TabSRMM/src/themes.cpp
@@ -1204,7 +1204,7 @@ void CSkin::Unload()
m_SkinDarkShadowPen = 0;
if (m_SkinItems) {
- for(i = 0; i < ID_EXTBK_LAST; i++) {
+ for (i = 0; i < ID_EXTBK_LAST; i++) {
m_SkinItems[i].IGNORED = 1;
m_SkinItems[i].imageItem = 0;
}
@@ -1237,7 +1237,7 @@ void CSkin::Unload()
m_closeIcon = m_maxIcon = m_minIcon = 0;
- for(i = 0; i < m_nrSkinIcons; i++) {
+ for (i = 0; i < m_nrSkinIcons; i++) {
if (m_skinIcons[i].phIcon )
::DestroyIcon(*(m_skinIcons[i].phIcon));
}
@@ -2809,7 +2809,7 @@ void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const
m_fAeroSkinsValid = true;
try {
- for(int i = 0; i < safe_sizeof(my_default_skin); i++)
+ for (int i = 0; i < safe_sizeof(my_default_skin); i++)
Utils::extractResource(g_hInst, my_default_skin[i].ulID, _T("SKIN_GLYPH"), tszBasePath, my_default_skin[i].tszName, fForceOverwrite);
}
catch(CRTException& ex) {
diff --git a/plugins/TabSRMM/tabsrmm_10.vcxproj.filters b/plugins/TabSRMM/tabsrmm_10.vcxproj.filters
index 6ab4275810..ff90ed556a 100644
--- a/plugins/TabSRMM/tabsrmm_10.vcxproj.filters
+++ b/plugins/TabSRMM/tabsrmm_10.vcxproj.filters
@@ -396,6 +396,8 @@
<None Include="chat\Icons\window.ico">
<Filter>Resource Files\Icons</Filter>
</None>
- <None Include="res\SKIN\unknown.png" />
+ <None Include="res\SKIN\unknown.png">
+ <Filter>Resource Files</Filter>
+ </None>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/plugins/TopToolBar/toolbarwnd.cpp b/plugins/TopToolBar/toolbarwnd.cpp
index d082464b4f..e3f19f693b 100644
--- a/plugins/TopToolBar/toolbarwnd.cpp
+++ b/plugins/TopToolBar/toolbarwnd.cpp
@@ -255,6 +255,7 @@ LRESULT CALLBACK TopToolBarProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
INT_PTR OnEventFire(WPARAM wParam, LPARAM lParam)
{
CallService(MS_SYSTEM_REMOVEWAIT, wParam, 0);
+ CloseHandle((HANDLE)wParam);
HWND parent = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
if (parent == NULL) // no clist, no buttons
diff --git a/protocols/IcqOscarJ/icq_infoupdate.cpp b/protocols/IcqOscarJ/icq_infoupdate.cpp
index 5d0abbf47c..014df20e01 100644
--- a/protocols/IcqOscarJ/icq_infoupdate.cpp
+++ b/protocols/IcqOscarJ/icq_infoupdate.cpp
@@ -27,8 +27,8 @@
// Background thread for automatic update of user details
//
// -----------------------------------------------------------------------------
-#include "icqoscar.h"
+#include "icqoscar.h"
// Retrieve users' info
void CIcqProto::icq_InitInfoUpdate(void)
diff --git a/protocols/IcqOscarJ/icq_proto.cpp b/protocols/IcqOscarJ/icq_proto.cpp
index 8e5d11100c..69b8ed8e61 100644
--- a/protocols/IcqOscarJ/icq_proto.cpp
+++ b/protocols/IcqOscarJ/icq_proto.cpp
@@ -359,6 +359,9 @@ int CIcqProto::OnModulesLoaded( WPARAM wParam, LPARAM lParam )
int CIcqProto::OnPreShutdown(WPARAM wParam,LPARAM lParam)
{
+ // signal info update thread to stop
+ icq_InfoUpdateCleanup();
+
// Make sure all connections are closed
CloseContactDirectConns(NULL);
return 0;
diff --git a/protocols/IcqOscarJ/icq_server.cpp b/protocols/IcqOscarJ/icq_server.cpp
index 1226eae0c4..87b975d6d3 100644
--- a/protocols/IcqOscarJ/icq_server.cpp
+++ b/protocols/IcqOscarJ/icq_server.cpp
@@ -182,9 +182,6 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam)
SetCurrentStatus(ID_STATUS_OFFLINE);
}
- // signal info update thread to stop
- icq_InfoUpdateCleanup();
-
// signal keep-alive thread to stop
StopKeepAlive(&info);
diff --git a/src/mir_core/miranda.cpp b/src/mir_core/miranda.cpp
index b059e11cb7..61b14ced06 100644
--- a/src/mir_core/miranda.cpp
+++ b/src/mir_core/miranda.cpp
@@ -79,6 +79,7 @@ MIR_CORE_DLL(void) UnloadCoreModule(void)
{
DestroyWindow(hAPCWindow);
CloseHandle(hStackMutex);
+ CloseHandle(hThreadQueueEmpty);
DestroyModularEngine();
UnloadLangPackModule();
diff --git a/src/mir_core/modules.cpp b/src/mir_core/modules.cpp
index 67cf6ce267..2ff0fabe06 100644
--- a/src/mir_core/modules.cpp
+++ b/src/mir_core/modules.cpp
@@ -575,6 +575,47 @@ static void DestroyServices()
///////////////////////////////////////////////////////////////////////////////
+static int sttComparePlugins(const HINSTANCE__* p1, const HINSTANCE__* p2)
+{
+ if (p1 == p2)
+ return 0;
+
+ return (p1 < p2) ? -1 : 1;
+}
+
+LIST<HINSTANCE__> pluginListAddr(10, sttComparePlugins);
+
+MIR_CORE_DLL(void) RegisterModule(HINSTANCE hInst)
+{
+ pluginListAddr.insert(hInst);
+}
+
+MIR_CORE_DLL(void) UnregisterModule(HINSTANCE hInst)
+{
+ pluginListAddr.remove(hInst);
+}
+
+MIR_CORE_DLL(HINSTANCE) GetInstByAddress(void* codePtr)
+{
+ if (pluginListAddr.getCount() == 0)
+ return NULL;
+
+ int idx;
+ List_GetIndex((SortedList*)&pluginListAddr, codePtr, &idx);
+ if (idx > 0)
+ idx--;
+
+ HINSTANCE result = pluginListAddr[idx];
+ if (result < hInst && codePtr > hInst)
+ result = hInst;
+ else if (idx == 0 && codePtr < (void*)result)
+ result = NULL;
+
+ return result;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
int InitialiseModularEngine(void)
{
InitializeCriticalSection(&csHooks);
@@ -597,5 +638,7 @@ void DestroyModularEngine(void)
services.destroy();
DeleteCriticalSection(&csServices);
+ pluginListAddr.destroy();
+
CloseHandle(hMainThread);
}
diff --git a/src/mir_core/utils.cpp b/src/mir_core/utils.cpp
index 12aad9d8a9..584519f3f0 100644
--- a/src/mir_core/utils.cpp
+++ b/src/mir_core/utils.cpp
@@ -123,44 +123,3 @@ MIR_CORE_DLL(int) wildcmp(char * name, char * mask)
if (*mask != '?' && *mask != *name) name -= (size_t)(mask - last) - 1, mask = last;
}
}
-
-///////////////////////////////////////////////////////////////////////////////
-
-static int sttComparePlugins(const HINSTANCE__* p1, const HINSTANCE__* p2)
-{
- if (p1 == p2)
- return 0;
-
- return (p1 < p2) ? -1 : 1;
-}
-
-LIST<HINSTANCE__> pluginListAddr(10, sttComparePlugins);
-
-MIR_CORE_DLL(void) RegisterModule(HINSTANCE hInst)
-{
- pluginListAddr.insert(hInst);
-}
-
-MIR_CORE_DLL(void) UnregisterModule(HINSTANCE hInst)
-{
- pluginListAddr.remove(hInst);
-}
-
-MIR_CORE_DLL(HINSTANCE) GetInstByAddress(void* codePtr)
-{
- if (pluginListAddr.getCount() == 0)
- return NULL;
-
- int idx;
- List_GetIndex((SortedList*)&pluginListAddr, codePtr, &idx);
- if (idx > 0)
- idx--;
-
- HINSTANCE result = pluginListAddr[idx];
- if (result < hInst && codePtr > hInst)
- result = hInst;
- else if (idx == 0 && codePtr < (void*)result)
- result = NULL;
-
- return result;
-}
diff --git a/src/modules/skin/hotkeys.cpp b/src/modules/skin/hotkeys.cpp
index 05297f92b3..b72a3ad3e2 100644
--- a/src/modules/skin/hotkeys.cpp
+++ b/src/modules/skin/hotkeys.cpp
@@ -396,9 +396,10 @@ void UnloadSkinHotkeys(void)
DestroyHookableEvent(hEvChanged);
UnhookWindowsHookEx(hhkKeyboard);
- UnregisterHotkeys();
- DestroyWindow(g_hwndHotkeyHost);
+
for (int i=0; i < hotkeys.getCount(); i++)
FreeHotkey(hotkeys[i]);
hotkeys.destroy();
+
+ DestroyWindow(g_hwndHotkeyHost);
}