diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2016-09-17 12:46:35 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2016-09-17 12:46:35 +0000 |
commit | 120cf25c9986127259ceb413a46f2ba9716d8bf6 (patch) | |
tree | 672c4879fa10264bbc92d9f7323a2d5e27458ec6 | |
parent | 7057588689d25144fc5e5930d95451bf0791b3ab (diff) |
StartupStatus: Cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@17307 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
6 files changed, 70 insertions, 73 deletions
diff --git a/plugins/StatusPlugins/StartupStatus/StartupStatus_14.vcxproj b/plugins/StatusPlugins/StartupStatus/StartupStatus_14.vcxproj index f19b3e6b15..794b36247e 100644 --- a/plugins/StatusPlugins/StartupStatus/StartupStatus_14.vcxproj +++ b/plugins/StatusPlugins/StartupStatus/StartupStatus_14.vcxproj @@ -82,7 +82,7 @@ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>../commonstatus.h</PrecompiledHeaderFile>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>false</ExceptionHandling>
@@ -116,7 +116,7 @@ <FloatingPointModel>Fast</FloatingPointModel>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>../commonstatus.h</PrecompiledHeaderFile>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<ResourceCompile>
@@ -149,7 +149,7 @@ <PrecompiledHeaderFile>../commonstatus.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>..\..\..\include;..\..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;STARTUPSTATUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
@@ -174,7 +174,7 @@ <PrecompiledHeaderFile>../commonstatus.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>..\..\..\include;..\..\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;STARTUPSTATUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
diff --git a/plugins/StatusPlugins/StartupStatus/main.cpp b/plugins/StatusPlugins/StartupStatus/main.cpp index a93e7b81b1..9a3ceb3e84 100644 --- a/plugins/StatusPlugins/StartupStatus/main.cpp +++ b/plugins/StatusPlugins/StartupStatus/main.cpp @@ -37,7 +37,7 @@ int CSModuleLoaded( WPARAM, LPARAM ); /////////////////////////////////////////////////////////////////////////////////////////
// dll entry point
-BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
hInst = hinstDLL;
return TRUE;
@@ -59,7 +59,7 @@ PLUGININFOEX pluginInfoEx={ { 0x4b733944, 0x5a70, 0x4b52, { 0xab, 0x2d, 0x68, 0xb1, 0xef, 0x38, 0xff, 0xe8 } } // {4B733944-5A70-4b52-AB2D-68B1EF38FFE8}
};
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index 212e04ff37..36681553ee 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -21,21 +21,14 @@ #include "startupstatus.h"
#include "../resource.h"
-// for db cleanup
-static int settingIndex;
-
// prototypes
INT_PTR CALLBACK CmdlOptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam);
INT_PTR CALLBACK OptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam);
INT_PTR CALLBACK addProfileDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam);
-static int CountSettings(const char *szSetting,LPARAM lParam);
-static int DeleteSetting(const char *szSetting,LPARAM lParam);
-static int ClearDatabase(char* filter);
-
/////////////////////////////////////////////////////////////////////////////////////////
-static TSettingsList* GetCurrentProtoSettings()
+TSettingsList* GetCurrentProtoSettings()
{
int count;
PROTOACCOUNT **protos;
@@ -500,6 +493,49 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wPa ///////////////////////////////////////////////////////////////////////////////
+static int CountSettings(const char *, LPARAM lParam)
+{
+ *(int *)lParam++;
+
+ return 0;
+}
+
+// for db cleanup
+static int settingIndex;
+
+static int DeleteSetting(const char *szSetting, LPARAM lParam)
+{
+ char** settings = *(char ***)lParam;
+ settings[settingIndex] = (char*)malloc(mir_strlen(szSetting) + 1);
+ mir_strcpy(settings[settingIndex], szSetting);
+ settingIndex++;
+
+ return 0;
+}
+
+static int ClearDatabase(char* filter)
+{
+ settingIndex = 0;
+
+ int settingCount = 0;
+ db_enum_settings(NULL, CountSettings, MODULENAME, &settingCount);
+
+ char **settings = (char**)malloc(settingCount * sizeof(char*));
+ db_enum_settings(NULL, DeleteSetting, MODULENAME, &settings);
+
+ for (int i = 0; i < settingCount; i++) {
+ if ((filter == NULL) || (!strncmp(filter, settings[i], mir_strlen(filter))))
+ db_unset(NULL, MODULENAME, settings[i]);
+ free(settings[i]);
+ }
+ free(settings);
+ // < v0.0.0.9
+ if (filter == NULL) db_unset(NULL, "AutoAway", "Confirm");
+
+ return 0;
+}
+
+
static OBJLIST<PROFILEOPTIONS> arProfiles(5);
static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
@@ -648,8 +684,8 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP if (ps->szMsg != NULL)
SetDlgItemText(hwndDlg, IDC_STATUSMSG, ps->szMsg);
- bStatusMsg = ( (((CallProtoService(ps->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0)&PF1_MODEMSGSEND&~PF1_INDIVMODEMSG)) &&
- (CallProtoService(ps->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(ps->status))) || (ps->status == ID_STATUS_CURRENT) || (ps->status == ID_STATUS_LAST));
+ bStatusMsg = ( (((CallProtoService(ps->szName, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_MODEMSGSEND&~PF1_INDIVMODEMSG)) &&
+ (CallProtoService(ps->szName, PS_GETCAPS, PFLAGNUM_3, 0)&Proto_Status2Flag(ps->status))) || (ps->status == ID_STATUS_CURRENT) || (ps->status == ID_STATUS_LAST));
}
EnableWindow(GetDlgItem(hwndDlg, IDC_MIRANDAMSG), bStatusMsg);
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMMSG), bStatusMsg);
@@ -812,12 +848,12 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
char setting[128];
- int i, oldCount = db_get_w(NULL, MODULENAME, SETTING_PROFILECOUNT, 0);
- for (i=0; i < oldCount; i++) {
+ int oldCount = db_get_w(NULL, MODULENAME, SETTING_PROFILECOUNT, 0);
+ for (int i=0; i < oldCount; i++) {
mir_snprintf(setting, "%d_", i);
ClearDatabase(setting);
}
- for (i=0; i < arProfiles.getCount(); i++) {
+ for (int i=0; i < arProfiles.getCount(); i++) {
PROFILEOPTIONS& po = arProfiles[i];
db_set_b(NULL, MODULENAME, OptName(i, SETTING_SHOWCONFIRMDIALOG), po.showDialog);
db_set_b(NULL, MODULENAME, OptName(i, SETTING_CREATETTBBUTTON), po.createTtb);
@@ -889,7 +925,7 @@ INT_PTR CALLBACK addProfileDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lP return 0;
}
-int OptionsInit(WPARAM wparam,LPARAM lparam)
+int OptionsInit(WPARAM wparam,LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.hInstance = hInst;
@@ -909,45 +945,6 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) return 0;
}
-static int ClearDatabase(char* filter)
-{
- settingIndex = 0;
-
- int settingCount = 0;
- db_enum_settings(NULL, CountSettings, MODULENAME, &settingCount);
-
- char **settings = (char**)malloc(settingCount*sizeof(char*));
- db_enum_settings(NULL, DeleteSetting, MODULENAME, &settings);
-
- for (int i=0; i < settingCount; i++) {
- if ((filter == NULL) || (!strncmp(filter, settings[i], mir_strlen(filter))))
- db_unset(NULL, MODULENAME, settings[i]);
- free(settings[i]);
- }
- free(settings);
- // < v0.0.0.9
- if (filter == NULL) db_unset(NULL, "AutoAway", "Confirm");
-
- return 0;
-}
-
-static int CountSettings(const char *szSetting,LPARAM lParam)
-{
- *(int *)lParam += 1;
-
- return 0;
-}
-
-static int DeleteSetting(const char *szSetting,LPARAM lParam)
-{
- char** settings = (char**)*(char ***)lParam;
- settings[settingIndex] = ( char* )malloc(mir_strlen(szSetting)+1);
- mir_strcpy(settings[settingIndex], szSetting);
- settingIndex += 1;
-
- return 0;
-}
-
char* OptName(int i, const char* setting)
{
static char buf[100];
diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index 03687e5834..faa14b04ca 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -193,14 +193,14 @@ int GetProfile(int profile, TSettingsList& arSettings) return (arSettings.getCount() == 0) ? -1 : 0; } -static void CALLBACK releaseTtbTimerFunction(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime) +static void CALLBACK releaseTtbTimerFunction(HWND, UINT, UINT_PTR, DWORD) { KillTimer(NULL, releaseTtbTimerId); for (int i = 0; i < ttbButtonCount; i++) CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)ttbButtons[i], 0); } -INT_PTR LoadAndSetProfile(WPARAM wParam, LPARAM lParam) +INT_PTR LoadAndSetProfile(WPARAM wParam, LPARAM) { // wParam == profile no. int profileCount = GetProfileCount(0, 0); @@ -240,7 +240,7 @@ static UINT GetFsModifiers(WORD wHotKey) return fsm; } -static DWORD CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +static DWORD CALLBACK MessageWndProc(HWND, UINT msg, WPARAM wParam, LPARAM) { if (msg == WM_HOTKEY) { for (int i = 0; i < hkiCount; i++) diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp index 55fcf30050..3cf1f07b49 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp @@ -204,7 +204,7 @@ int OnAccChanged(WPARAM wParam, LPARAM lParam) }
// 'allow override'
-static int ProcessProtoAck(WPARAM wParam, LPARAM lParam)
+static int ProcessProtoAck(WPARAM, LPARAM lParam)
{
// 'something' made a status change
ACKDATA *ack = (ACKDATA*)lParam;
@@ -224,7 +224,7 @@ static int ProcessProtoAck(WPARAM wParam, LPARAM lParam) return 0;
}
-static int StatusChange(WPARAM wParam, LPARAM lParam)
+static int StatusChange(WPARAM, LPARAM lParam)
{
// change by menu
if (!db_get_b(NULL, MODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0)
@@ -249,7 +249,7 @@ static int StatusChange(WPARAM wParam, LPARAM lParam) return 0;
}
-static int CSStatusChangeEx(WPARAM wParam, LPARAM lParam)
+static int CSStatusChangeEx(WPARAM wParam, LPARAM)
{
// another status plugin made the change
if (!db_get_b(NULL, MODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0)
@@ -277,7 +277,7 @@ static int CSStatusChangeEx(WPARAM wParam, LPARAM lParam) return 0;
}
-static VOID CALLBACK SetStatusTimed(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime)
+static void CALLBACK SetStatusTimed(HWND, UINT, UINT_PTR, DWORD)
{
KillTimer(NULL, setStatusTimerId);
UnhookEvent(hProtoAckHook);
@@ -307,11 +307,11 @@ static int OnOkToExit(WPARAM, LPARAM) mir_snprintf(lastMsg, "%s%s", PREFIX_LASTMSG, pa->szModuleName);
db_unset(NULL, MODULENAME, lastMsg);
- if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0) & PF1_MODEMSGSEND & ~PF1_INDIVMODEMSG))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND & ~PF1_INDIVMODEMSG))
continue;
int status = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
- if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0) & Proto_Status2Flag(status)))
+ if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(status)))
continue;
// NewAwaySys
@@ -333,7 +333,7 @@ static int OnOkToExit(WPARAM, LPARAM) if (db_get_b(NULL, MODULENAME, SETTING_SETPROFILE, 1) || db_get_b(NULL, MODULENAME, SETTING_OFFLINECLOSE, 0)) {
if (ServiceExists(MS_CLIST_SETSTATUSMODE))
- CallService(MS_CLIST_SETSTATUSMODE, (WPARAM)ID_STATUS_OFFLINE, 0);
+ CallService(MS_CLIST_SETSTATUSMODE, ID_STATUS_OFFLINE, 0);
else
log_debugA("StartupStatus: MS_CLIST_SETSTATUSMODE not available!");
}
@@ -341,7 +341,7 @@ static int OnOkToExit(WPARAM, LPARAM) return 0;
}
-static int OnShutdown(WPARAM wParam, LPARAM lParam)
+static int OnShutdown(WPARAM, LPARAM)
{
DeinitProfilesModule();
@@ -387,7 +387,7 @@ static int OnShutdown(WPARAM wParam, LPARAM lParam) }
/* Window proc for poweroff event */
-static DWORD CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static DWORD CALLBACK MessageWndProc(HWND, UINT msg, WPARAM wParam, LPARAM)
{
switch (msg) {
case WM_ENDSESSION:
@@ -403,7 +403,7 @@ static DWORD CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return TRUE;
}
-int CSModuleLoaded(WPARAM wParam, LPARAM lParam)
+int CSModuleLoaded(WPARAM, LPARAM)
{
protoList = (OBJLIST<PROTOCOLSETTINGEX>*)&startupSettings;
diff --git a/plugins/StatusPlugins/StartupStatus/toolbars.cpp b/plugins/StatusPlugins/StartupStatus/toolbars.cpp index b2e2057da7..acb76f5c28 100644 --- a/plugins/StatusPlugins/StartupStatus/toolbars.cpp +++ b/plugins/StatusPlugins/StartupStatus/toolbars.cpp @@ -43,7 +43,7 @@ void RemoveTopToolbarButtons() ttbButtons.destroy();
}
-int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam)
+int CreateTopToolbarButtons(WPARAM, LPARAM)
{
if (iconList[0].hIcolib == NULL)
Icon_Register(hInst, "Toolbar/StartupStatus", iconList, _countof(iconList));
|