summaryrefslogtreecommitdiff
path: root/plugins/FileAsMessage/src/main.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-05-15 06:14:17 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-05-15 06:14:17 +0000
commitcc2454c803eb6b96add654fbd99f616217056396 (patch)
tree31d12ba065f57c5c195cfd962243180ec9c01ff9 /plugins/FileAsMessage/src/main.cpp
parentb1571e501505713f1ee2aa8fed181268286d8a1d (diff)
fixed buffer overrun
git-svn-id: http://svn.miranda-ng.org/main/trunk@13600 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FileAsMessage/src/main.cpp')
-rw-r--r--plugins/FileAsMessage/src/main.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp
index 4bc31d1a8f..fc3ce4b1c6 100644
--- a/plugins/FileAsMessage/src/main.cpp
+++ b/plugins/FileAsMessage/src/main.cpp
@@ -12,7 +12,7 @@ PLUGININFOEX pluginInfo =
__AUTHORWEB,
UNICODE_AWARE,
// {34B5A402-1B79-4246-B041-43D0B590AE2C}
- {0x34b5a402, 0x1b79, 0x4246, {0xb0, 0x41, 0x43, 0xd0, 0xb5, 0x90, 0xae, 0x2c}}
+ { 0x34b5a402, 0x1b79, 0x4246, { 0xb0, 0x41, 0x43, 0xd0, 0xb5, 0x90, 0xae, 0x2c } }
};
HANDLE hFileList;
@@ -25,7 +25,7 @@ HANDLE hHookDbSettingChange, hHookContactAdded, hHookSkinIconsChanged;
HICON hIcons[5];
-static IconItem iconList[] =
+static IconItem iconList[] =
{
{ LPGEN("Play"), "FePlay", IDI_PLAY },
{ LPGEN("Pause"), "FePause", IDI_PAUSE },
@@ -34,28 +34,28 @@ static IconItem iconList[] =
{ LPGEN("Main"), "FeMain", IDI_SMALLICON },
};
-int iIconId[5] = {3,2,4,1,0};
+int iIconId[5] = { 3, 2, 4, 1, 0 };
//
// wParam - Section name
// lParam - Icon ID
//
-int OnSkinIconsChanged(WPARAM wParam,LPARAM lParam)
+int OnSkinIconsChanged(WPARAM wParam, LPARAM lParam)
{
- for(int indx = 0; indx < SIZEOF(hIcons); indx++)
- hIcons[indx] = Skin_GetIconByHandle( iconList[indx].hIcolib );
+ for (int indx = 0; indx < SIZEOF(hIcons); indx++)
+ hIcons[indx] = Skin_GetIconByHandle(iconList[indx].hIcolib);
- WindowList_Broadcast(hFileList, WM_FE_SKINCHANGE, 0,0);
+ WindowList_Broadcast(hFileList, WM_FE_SKINCHANGE, 0, 0);
return 0;
}
int OnSettingChanged(WPARAM hContact, LPARAM lParam)
{
- DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam;
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
HWND hwnd = WindowList_Find(hFileList, hContact);
- PostMessage(hwnd, WM_FE_STATUSCHANGE, 0,0);
+ PostMessage(hwnd, WM_FE_STATUSCHANGE, 0, 0);
return 0;
}
@@ -64,7 +64,7 @@ INT_PTR OnRecvFile(WPARAM wParam, LPARAM lParam)
CLISTEVENT *clev = (CLISTEVENT*)lParam;
HWND hwnd = WindowList_Find(hFileList, clev->hContact);
- if(IsWindow(hwnd))
+ if (IsWindow(hwnd))
{
ShowWindow(hwnd, SW_SHOWNORMAL);
SetForegroundWindow(hwnd);
@@ -73,17 +73,17 @@ INT_PTR OnRecvFile(WPARAM wParam, LPARAM lParam)
/*
else
{
- if(hwnd != 0) WindowList_Remove(hFileList, hwnd);
- FILEECHO *fe = new FILEECHO((HANDLE)clev->hContact);
- fe->inSend = FALSE;
- hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, (DLGPROC)DialogProc, (LPARAM)fe);
- if(hwnd == NULL)
- {
- delete fe;
- return 0;
- }
- //SendMessage(hwnd, WM_FE_SERVICE, 0, TRUE);
- ShowWindow(hwnd, SW_SHOWNORMAL);
+ if(hwnd != 0) WindowList_Remove(hFileList, hwnd);
+ FILEECHO *fe = new FILEECHO((HANDLE)clev->hContact);
+ fe->inSend = FALSE;
+ hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, (DLGPROC)DialogProc, (LPARAM)fe);
+ if(hwnd == NULL)
+ {
+ delete fe;
+ return 0;
+ }
+ //SendMessage(hwnd, WM_FE_SERVICE, 0, TRUE);
+ ShowWindow(hwnd, SW_SHOWNORMAL);
}
*/
return 1;
@@ -92,18 +92,18 @@ INT_PTR OnRecvFile(WPARAM wParam, LPARAM lParam)
INT_PTR OnSendFile(WPARAM wParam, LPARAM lParam)
{
HWND hwnd = WindowList_Find(hFileList, wParam);
- if(IsWindow(hwnd))
+ if (IsWindow(hwnd))
{
SetForegroundWindow(hwnd);
SetFocus(hwnd);
}
else
{
- if(hwnd != 0) WindowList_Remove(hFileList, hwnd);
+ if (hwnd != 0) WindowList_Remove(hFileList, hwnd);
FILEECHO *fe = new FILEECHO(wParam);
fe->inSend = TRUE;
hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, DialogProc, (LPARAM)fe);
- if(hwnd == NULL)
+ if (hwnd == NULL)
{
delete fe;
return 0;
@@ -117,25 +117,25 @@ INT_PTR OnSendFile(WPARAM wParam, LPARAM lParam)
INT_PTR OnRecvMessage(WPARAM wParam, LPARAM lParam)
{
CCSDATA *pccsd = (CCSDATA *)lParam;
- PROTORECVEVENT *ppre = ( PROTORECVEVENT * )pccsd->lParam;
+ PROTORECVEVENT *ppre = (PROTORECVEVENT *)pccsd->lParam;
- if(strncmp(ppre->szMessage, szServicePrefix, strlen(szServicePrefix)))
+ if (strncmp(ppre->szMessage, szServicePrefix, mir_strlen(szServicePrefix)))
return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
HWND hwnd = WindowList_Find(hFileList, pccsd->hContact);
- if(!IsWindow(hwnd))
+ if (!IsWindow(hwnd))
{
- if(hwnd != 0) WindowList_Remove(hFileList, hwnd);
+ if (hwnd != 0) WindowList_Remove(hFileList, hwnd);
FILEECHO *fe = new FILEECHO(pccsd->hContact);
fe->inSend = FALSE;
hwnd = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, DialogProc, (LPARAM)fe);
- if(hwnd == NULL)
+ if (hwnd == NULL)
{
delete fe;
return 0;
}
}
- char *msg = strdup(ppre->szMessage + strlen(szServicePrefix));
+ char *msg = mir_strdup(ppre->szMessage + mir_strlen(szServicePrefix));
PostMessage(hwnd, WM_FE_MESSAGE, (WPARAM)pccsd->hContact, (LPARAM)msg);
return 0;
@@ -148,7 +148,7 @@ int OnOptInitialise(WPARAM wParam, LPARAM lParam)
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS);
odp.ptszTitle = _T(SERVICE_TITLE);
odp.ptszGroup = LPGENT("Events");
- odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.pfnDlgProc = OptionsDlgProc;
Options_AddPage(wParam, &odp);
return 0;
@@ -167,10 +167,10 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD dwVersi
// Startup initializing
//
-static int OnModulesLoaded(WPARAM wparam,LPARAM lparam)
+static int OnModulesLoaded(WPARAM wparam, LPARAM lparam)
{
- for(int indx = 0; indx < SIZEOF(hIcons); indx++)
- hIcons[indx] = Skin_GetIconByHandle( iconList[indx].hIcolib );
+ for (int indx = 0; indx < SIZEOF(hIcons); indx++)
+ hIcons[indx] = Skin_GetIconByHandle(iconList[indx].hIcolib);
hHookSkinIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnSkinIconsChanged);
@@ -202,7 +202,7 @@ extern "C" __declspec(dllexport) int Load(void)
PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = SERVICE_NAME;
pd.type = PROTOTYPE_FILTER;
- CallService(MS_PROTO_REGISTERMODULE, 0, ( LPARAM ) &pd);
+ CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
HookEvent(ME_OPT_INITIALISE, OnOptInitialise);
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
@@ -219,7 +219,7 @@ extern "C" __declspec(dllexport) int Load(void)
extern "C" __declspec(dllexport) int Unload(void)
{
WindowList_Destroy(hFileList);
- if(hHookSkinIconsChanged != NULL)
+ if (hHookSkinIconsChanged != NULL)
UnhookEvent(hHookSkinIconsChanged);
UnhookEvent(hHookDbSettingChange);
UnhookEvent(hHookContactAdded);