diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/options.cpp | 28 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/profiles.cpp | 24 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/startupstatus.h | 4 |
3 files changed, 26 insertions, 30 deletions
diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index 8661aa7d02..708ff717fb 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -133,7 +133,7 @@ static TCHAR* GetLinkDescription(TSettingsList& protoSettings) if ( protoSettings.getCount() == 0 )
return NULL;
- CMString result( _T(SHORTCUT_DESC));
+ CMString result(SHORTCUT_DESC);
for (int i=0; i < protoSettings.getCount(); i++) {
TSSSetting &p = protoSettings[i];
@@ -159,20 +159,19 @@ static TCHAR* GetLinkDescription(TSettingsList& protoSettings) HRESULT CreateLink(TSettingsList& protoSettings)
{
- HRESULT hres;
- IShellLink* psl;
TCHAR savePath[MAX_PATH];
- char *args = GetCMDLArguments(protoSettings);
- TCHAR *desc = GetLinkDescription(protoSettings);
-
if (SHGetSpecialFolderPath(NULL, savePath, 0x10, FALSE))
- _tcscat(savePath, _T(SHORTCUT_FILENAME));
+ _tcsncat(savePath, SHORTCUT_FILENAME, SIZEOF(savePath));
else
- mir_sntprintf(savePath, SIZEOF(savePath), _T(".\\%s"), _T(SHORTCUT_FILENAME));
+ mir_sntprintf(savePath, SIZEOF(savePath), _T(".\\%s"), SHORTCUT_FILENAME);
// Get a pointer to the IShellLink interface.
- hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, ( void** )&psl);
+ IShellLink *psl;
+ HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, ( void** )&psl);
if (SUCCEEDED(hres)) {
+ char *args = GetCMDLArguments(protoSettings);
+ TCHAR *desc = GetLinkDescription(protoSettings);
+
// Set the path to the shortcut target, and add the
// description.
TCHAR path[MAX_PATH];
@@ -183,22 +182,19 @@ HRESULT CreateLink(TSettingsList& protoSettings) // Query IShellLink for the IPersistFile interface for saving the
// shortcut in persistent storage.
- IPersistFile* ppf;
+ IPersistFile *ppf;
hres = psl->QueryInterface(IID_IPersistFile, ( void** )&ppf);
if (SUCCEEDED(hres)) {
-
- WCHAR* wsz = savePath;
-
// Save the link by calling IPersistFile::Save.
- hres = ppf->Save(wsz, TRUE);
+ hres = ppf->Save(savePath, TRUE);
ppf->Release();
}
psl->Release();
+ free(args);
+ free(desc);
}
- free(args);
- free(desc);
return hres;
}
diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index c8a909bacf..f9d9ed8d23 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -51,43 +51,43 @@ static int ttbButtonCount = 0; HANDLE hTTBModuleLoadedHook; // these are some lame functions, if you have a better solution, mail me. :s -static INT_PTR profileService0(WPARAM wParam, LPARAM lParam) +static INT_PTR profileService0(WPARAM, LPARAM) { LoadAndSetProfile((WPARAM)menuprofiles[0], 0); return 0; } -static INT_PTR profileService1(WPARAM wParam, LPARAM lParam) +static INT_PTR profileService1(WPARAM, LPARAM) { LoadAndSetProfile((WPARAM)menuprofiles[1], 0); return 0; } -static INT_PTR profileService2(WPARAM wParam, LPARAM lParam) +static INT_PTR profileService2(WPARAM, LPARAM) { LoadAndSetProfile((WPARAM)menuprofiles[2], 0); return 0; } -static INT_PTR profileService3(WPARAM wParam, LPARAM lParam) +static INT_PTR profileService3(WPARAM, LPARAM) { LoadAndSetProfile((WPARAM)menuprofiles[3], 0); return 0; } -static INT_PTR profileService4(WPARAM wParam, LPARAM lParam) +static INT_PTR profileService4(WPARAM, LPARAM) { LoadAndSetProfile((WPARAM)menuprofiles[4], 0); return 0; } -static INT_PTR profileService5(WPARAM wParam, LPARAM lParam) +static INT_PTR profileService5(WPARAM, LPARAM) { LoadAndSetProfile((WPARAM)menuprofiles[5], 0); return 0; } -static int CreateMainMenuItems(WPARAM wParam, LPARAM lParam) +static int CreateMainMenuItems(WPARAM, LPARAM) { char servicename[128]; int i, count; @@ -146,14 +146,14 @@ static int CreateMainMenuItems(WPARAM wParam, LPARAM lParam) INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam) { int profile = (int)wParam; - TCHAR* buf = (TCHAR*)lParam; - if (wParam < 0) // get default profile + if (profile < 0) // get default profile profile = db_get_w(NULL, MODULENAME, SETTING_DEFAULTPROFILE, 0); int count = db_get_w(NULL, MODULENAME, SETTING_PROFILECOUNT, 0); if (profile >= count && count > 0) return -1; + TCHAR* buf = (TCHAR*)lParam; if (count == 0) { _tcsncpy(buf, TranslateT("default"), 128-1); return 0; @@ -170,7 +170,7 @@ INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam) return 0; } -INT_PTR GetProfileCount(WPARAM wParam, LPARAM lParam) +INT_PTR GetProfileCount(WPARAM wParam, LPARAM) { int *def = (int*)wParam; int count = db_get_w(NULL, MODULENAME, SETTING_PROFILECOUNT, 1); @@ -219,7 +219,7 @@ TCHAR *GetStatusMessage(int profile, char *szProto) pce[pceCount].msg = _tcsdup(dbv.ptszVal); db_free(&dbv); } - pceCount += 1; + pceCount++; return pce[pceCount-1].msg; } @@ -246,7 +246,7 @@ 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 hwnd,UINT message, UINT_PTR idEvent,DWORD dwTime) { KillTimer(NULL, releaseTtbTimerId); for(int i=0; i < ttbButtonCount; i++) diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.h b/plugins/StatusPlugins/StartupStatus/startupstatus.h index 817fed7cc1..7088c7666c 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.h +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.h @@ -124,8 +124,8 @@ typedef struct { #define SETTING_SETPROFILEDELAY "SetStatusDelay"
#define SETTING_DLGTIMEOUT "DialogTimeout"
-#define SHORTCUT_DESC "Miranda NG"
-#define SHORTCUT_FILENAME "\\Miranda NG.lnk"
+#define SHORTCUT_DESC _T("Miranda NG")
+#define SHORTCUT_FILENAME _T("\\Miranda NG.lnk")
#define DOCKED_NONE 0
#define DOCKED_LEFT 1
|