summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/stdaway/src/awaymsg.cpp2
-rw-r--r--src/core/stdaway/src/sendmsg.cpp1
-rw-r--r--src/core/stdchat/src/window.cpp10
-rw-r--r--src/core/stdfile/src/fileexistsdlg.cpp10
-rw-r--r--src/core/stdfile/src/fileopts.cpp4
-rw-r--r--src/core/stdfile/src/filerecvdlg.cpp16
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp5
-rw-r--r--src/core/stdfile/src/ftmanager.cpp2
-rw-r--r--src/core/stdmsg/src/msgoptions.cpp5
-rw-r--r--src/core/stdurl/urldialogs.cpp60
-rw-r--r--src/modules/button/button.cpp2
-rw-r--r--src/modules/chat/manager.cpp2
-rw-r--r--src/modules/clist/clistmenus.cpp5
-rw-r--r--src/modules/clist/genmenu.cpp8
-rw-r--r--src/modules/findadd/searchresults.cpp1
-rw-r--r--src/modules/metacontacts/meta_services.cpp4
-rw-r--r--src/modules/metacontacts/meta_utils.cpp7
-rw-r--r--src/modules/netlib/netliblog.cpp2
-rw-r--r--src/modules/protocols/protocols.cpp1
-rw-r--r--src/modules/srmm/statusicon.cpp8
20 files changed, 82 insertions, 73 deletions
diff --git a/src/core/stdaway/src/awaymsg.cpp b/src/core/stdaway/src/awaymsg.cpp
index d420df71ca..6d476adcff 100644
--- a/src/core/stdaway/src/awaymsg.cpp
+++ b/src/core/stdaway/src/awaymsg.cpp
@@ -140,7 +140,7 @@ static int AwayMsgPreBuildMenu(WPARAM hContact, LPARAM)
mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_HIDDEN | CMIF_TCHAR;
if (szProto != NULL) {
- int chatRoom = szProto ? db_get_b(hContact, szProto, "ChatRoom", 0) : 0;
+ int chatRoom = db_get_b(hContact, szProto, "ChatRoom", 0);
if (!chatRoom) {
int status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
mir_sntprintf(str, SIZEOF(str), TranslateT("Re&ad %s message"), pcli->pfnGetStatusModeDescription(status, 0));
diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp
index 667db52b6a..e7ab0681ed 100644
--- a/src/core/stdaway/src/sendmsg.cpp
+++ b/src/core/stdaway/src/sendmsg.cpp
@@ -431,7 +431,6 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam
{
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
if (dis->CtlID != IDC_LST_STATUS) break;
- if (dis->itemID < 0) break;
TCHAR buf[128];
SendDlgItemMessage(hwndDlg, IDC_LST_STATUS, LB_GETTEXT, dis->itemID, (LPARAM)buf);
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp
index 87309e530c..d89dc41914 100644
--- a/src/core/stdchat/src/window.cpp
+++ b/src/core/stdchat/src/window.cpp
@@ -2138,11 +2138,13 @@ LABEL_SHOWWINDOW:
case ID_LOCKPOSITION:
TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TAB), i, &id);
- if (!(GetMenuState(hSubMenu, ID_LOCKPOSITION, MF_BYCOMMAND)&MF_CHECKED)) {
- if (s->hContact)
- db_set_w(s->hContact, s->pszModule, "TabPosition", (WORD)(i + 1));
+ if (s!=0) {
+ if (!(GetMenuState(hSubMenu, ID_LOCKPOSITION, MF_BYCOMMAND)&MF_CHECKED)) {
+ if (s->hContact)
+ db_set_w(s->hContact, s->pszModule, "TabPosition", (WORD)(i + 1));
+ }
+ else db_unset(s->hContact, s->pszModule, "TabPosition");
}
- else db_unset(s->hContact, s->pszModule, "TabPosition");
break;
}
}
diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp
index 2fbc9dce60..3c15484676 100644
--- a/src/core/stdfile/src/fileexistsdlg.cpp
+++ b/src/core/stdfile/src/fileexistsdlg.cpp
@@ -177,7 +177,13 @@ void __cdecl LoadIconsAndTypesThread(void* param)
if (szIconFile[0]) {
TCHAR *pszComma = _tcsrchr(szIconFile, ',');
- int iconIndex = (pszComma == NULL) ? 0 : _ttoi(pszComma + 1); *pszComma = '\0';
+ int iconIndex;
+ if (pszComma) {
+ iconIndex = _ttoi(pszComma + 1);
+ *pszComma = '\0';
+ }
+ else
+ iconIndex = 0;
HICON hIcon = ExtractIcon(hInst, szIconFile, iconIndex);
if (hIcon)
fileInfo.hIcon = hIcon;
@@ -281,7 +287,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
- _tcscpy(filter, TranslateT("All files"));
+ _tcsncpy(filter, TranslateT("All files"),SIZEOF(filter)-1);
_tcscat(filter, _T(" (*)"));
pfilter = filter + _tcslen(filter) + 1;
_tcscpy(pfilter, _T("*"));
diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp
index 42903c987f..899eb224a6 100644
--- a/src/core/stdfile/src/fileopts.cpp
+++ b/src/core/stdfile/src/fileopts.cpp
@@ -34,9 +34,7 @@ struct virusscannerinfo {
const TCHAR *szExeRegPath;
const TCHAR *szExeRegValue;
const TCHAR *szCommandLine;
-};
-
-static const struct virusscannerinfo virusScanners[] = {
+} virusScanners[] = {
{_T("Network Associates/McAfee VirusScan"), _T("SOFTWARE\\McAfee\\VirusScan"), _T("Scan32EXE"), _T("\"%s\" %%f /nosplash /comp /autoscan /autoexit /noboot")},
{_T("Dr Solomon's VirusScan (Network Associates)"), _T("SOFTWARE\\Network Associates\\TVD\\VirusScan\\AVConsol\\General"), _T("szScannerExe"), _T("\"%s\" %%f /uinone /noboot /comp /prompt /autoexit")},
{_T("Norton AntiVirus"), _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Navw32.exe"), NULL, _T("\"%s\" %%f /b- /m- /s+ /noresults")},
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp
index e1cff072ea..f28660dea0 100644
--- a/src/core/stdfile/src/filerecvdlg.cpp
+++ b/src/core/stdfile/src/filerecvdlg.cpp
@@ -54,8 +54,7 @@ void RemoveInvalidFilenameChars(TCHAR *tszString)
size_t i;
if (tszString) {
for (i = _tcscspn(tszString, InvalidFilenameChars); tszString[i]; i+=_tcscspn(tszString+i+1, InvalidFilenameChars)+1)
- if (tszString[i] >= 0)
- tszString[i] = _T('_');
+ tszString[i] = _T('_');
}
}
@@ -64,8 +63,7 @@ void RemoveInvalidPathChars(TCHAR *tszString)
{
if (tszString)
for (size_t i = _tcscspn(tszString, InvalidPathChars); tszString[i]; i += _tcscspn(tszString + i + 1, InvalidPathChars) + 1)
- if (tszString[i] >= 0)
- tszString[i] = _T('_');
+ tszString[i] = _T('_');
}
static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData)
@@ -317,7 +315,10 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
if (hIcon) {
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
DestroyIcon(hIcon);
- } } } }
+ }
+ }
+ }
+ }
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case WM_COMMAND:
@@ -415,9 +416,8 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case HM_RECVEVENT:
{
ACKDATA *ack = (ACKDATA*)lParam;
- if (ack->hProcess != dat->fs) break;
- if (ack->type != ACKTYPE_FILE) break;
- if (ack->hContact != dat->hContact) break;
+ if ((ack == NULL) || (ack->hProcess != dat->fs) || (ack->type != ACKTYPE_FILE) || (ack->hContact != dat->hContact))
+ break;
if (ack->result == ACKRESULT_DENIED || ack->result == ACKRESULT_FAILED) {
EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp
index e435e2627b..c89c518fa4 100644
--- a/src/core/stdfile/src/filexferdlg.cpp
+++ b/src/core/stdfile/src/filexferdlg.cpp
@@ -341,6 +341,9 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
break;
case WM_COMMAND:
+ if (!dat)
+ break;
+
if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact))
break;
@@ -368,7 +371,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
}
case IDC_OPENFOLDER:
- if (dat) {
+ {
TCHAR *path = dat->transferStatus.tszWorkingDir;
if (!path || !path[0]) {
path = NEWTSTR_ALLOCA(dat->transferStatus.tszCurrentFile);
diff --git a/src/core/stdfile/src/ftmanager.cpp b/src/core/stdfile/src/ftmanager.cpp
index c99577b89f..a361dd7a30 100644
--- a/src/core/stdfile/src/ftmanager.cpp
+++ b/src/core/stdfile/src/ftmanager.cpp
@@ -177,7 +177,7 @@ static INT_PTR CALLBACK FtMgrPageDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
case WM_MOUSEWHEEL:
{
- int zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
+ short zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
if (zDelta) {
int nScrollLines = 0;
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, (void*)&nScrollLines, 0);
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp
index 85e4ac4475..8582886b1d 100644
--- a/src/core/stdmsg/src/msgoptions.cpp
+++ b/src/core/stdmsg/src/msgoptions.cpp
@@ -82,7 +82,7 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour)
DBVARIANT dbv;
if (db_get_ts(NULL, SRMMMOD, str, &dbv))
- _tcscpy(lf->lfFaceName, fontOptionsList[i].szDefFace);
+ _tcsncpy(lf->lfFaceName, fontOptionsList[i].szDefFace, SIZEOF(lf->lfFaceName)-1);
else {
mir_tstrncpy(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName));
db_free(&dbv);
@@ -135,8 +135,7 @@ struct CheckBoxValues_t
{
DWORD style;
TCHAR* szDescr;
-}
-static const statusValues[] =
+} statusValues[] =
{
{ MODEF_OFFLINE, LPGENT("Offline") },
{ PF2_ONLINE, LPGENT("Online") },
diff --git a/src/core/stdurl/urldialogs.cpp b/src/core/stdurl/urldialogs.cpp
index afe0d103ad..96bef0f424 100644
--- a/src/core/stdurl/urldialogs.cpp
+++ b/src/core/stdurl/urldialogs.cpp
@@ -57,7 +57,8 @@ static void sttUpdateTitle(HWND hwndDlg, MCONTACT hContact)
hasName = 1;
mir_snprintf(buf, SIZEOF(buf), "%u", ci.dVal);
break;
- } }
+ }
+ }
contactName = pcli->pfnGetContactDisplayName(hContact, 0);
if (hasName)
@@ -65,7 +66,7 @@ static void sttUpdateTitle(HWND hwndDlg, MCONTACT hContact)
else
SetDlgItemText(hwndDlg, IDC_NAME, contactName);
- szStatus = pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
+ szStatus = pcli->pfnGetStatusModeDescription(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s %s (%s)"), pszNewTitleStart, contactName, szStatus);
}
}
@@ -136,17 +137,16 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
{
LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) {
- char *szProto;
-
- szProto = GetContactProto(dat->hContact);
+ char *szProto = GetContactProto(dat->hContact);
if (szProto) {
- HICON hIcon;
-
- hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
+ HICON hIcon = (HICON)CallProtoService(szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0);
if (hIcon) {
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
DestroyIcon(hIcon);
- } } } }
+ }
+ }
+ }
+ }
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case DM_UPDATETITLE:
@@ -154,17 +154,18 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
case WM_COMMAND:
- if (dat)
- if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact))
- break;
+ if (!dat)
+ break;
+ if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact))
+ break;
switch(LOWORD(wParam)) {
case IDOK:
- { HMENU hMenu, hSubMenu;
+ {
RECT rc;
char url[256];
- hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT));
- hSubMenu = GetSubMenu(hMenu, 6);
+ HMENU hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT));
+ HMENU hSubMenu = GetSubMenu(hMenu, 6);
TranslateMenu(hSubMenu);
GetWindowRect((HWND)lParam, &rc);
GetDlgItemTextA(hwndDlg, IDC_URL, url, SIZEOF(url));
@@ -176,10 +177,10 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
CallService(MS_UTILS_OPENURL, 0, (LPARAM)url);
break;
case IDM_COPYLINK:
- { HGLOBAL hData;
+ {
if ( !OpenClipboard(hwndDlg)) break;
EmptyClipboard();
- hData = GlobalAlloc(GMEM_MOVEABLE, mir_strlen(url)+1);
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_strlen(url)+1);
mir_strcpy((char*)GlobalLock(hData), url);
GlobalUnlock(hData);
SetClipboardData(CF_TEXT, hData);
@@ -279,11 +280,10 @@ static LRESULT DdeMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
static HGLOBAL DoDdeRequest(const char *szItemName, HWND hwndDlg)
{
- ATOM hSzItemName;
DWORD timeoutTick, thisTick;
MSG msg;
- hSzItemName = GlobalAddAtomA(szItemName);
+ ATOM hSzItemName = GlobalAddAtomA(szItemName);
if ( !PostMessage(hwndDde, WM_DDE_REQUEST, (WPARAM)hwndDlg, MAKELPARAM(CF_TEXT, hSzItemName))) {
GlobalDeleteAtom(hSzItemName);
return NULL;
@@ -311,8 +311,7 @@ static HGLOBAL DoDdeRequest(const char *szItemName, HWND hwndDlg)
static void FreeDdeRequestData(HGLOBAL hData)
{
- DDEDATA *data;
- data = (DDEDATA*)GlobalLock(hData);
+ DDEDATA *data = (DDEDATA*)GlobalLock(hData);
if (data->fRelease) {
GlobalUnlock(hData);
GlobalFree(hData);
@@ -363,17 +362,13 @@ static void AddBrowserPageToCombo(char *url, HWND hwndCombo)
//see Q160957 and http://developer.netscape.com/docs/manuals/communicator/DDE/index.htm
static void GetOpenBrowserUrlsForBrowser(const char *szBrowser, HWND hwndDlg, HWND hwndCombo)
{
- ATOM hSzBrowser, hSzTopic;
int windowCount, i;
DWORD *windowId;
DWORD dwResult;
- HGLOBAL hData;
- DDEDATA *data;
- int dataLength;
- hSzBrowser = GlobalAddAtomA(szBrowser);
+ ATOM hSzBrowser = GlobalAddAtomA(szBrowser);
- hSzTopic = GlobalAddAtomA("WWW_ListWindows");
+ ATOM hSzTopic = GlobalAddAtomA("WWW_ListWindows");
ddeAcked = 0;
if ( !SendMessageTimeout(HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndDlg, MAKELPARAM(hSzBrowser, hSzTopic), SMTO_ABORTIFHUNG|SMTO_NORMAL, DDEMESSAGETIMEOUT, (PDWORD_PTR)&dwResult)
|| !ddeAcked) {
@@ -381,14 +376,14 @@ static void GetOpenBrowserUrlsForBrowser(const char *szBrowser, HWND hwndDlg, HW
GlobalDeleteAtom(hSzBrowser);
return;
}
- hData = DoDdeRequest("WWW_ListWindows", hwndDlg);
+ HGLOBAL hData = DoDdeRequest("WWW_ListWindows", hwndDlg);
if (hData == NULL) {
GlobalDeleteAtom(hSzTopic);
GlobalDeleteAtom(hSzBrowser);
return;
}
- dataLength = GlobalSize(hData)-offsetof(DDEDATA, Value);
- data = (DDEDATA*)GlobalLock(hData);
+ int dataLength = GlobalSize(hData)-offsetof(DDEDATA, Value);
+ DDEDATA *data = (DDEDATA*)GlobalLock(hData);
windowCount = dataLength/sizeof(DWORD);
windowId = (PDWORD)mir_alloc(sizeof(DWORD)*windowCount);
memcpy(windowId, data->Value, windowCount*sizeof(DWORD));
@@ -522,7 +517,10 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (hIcon) {
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
DestroyIcon(hIcon);
- } } } }
+ }
+ }
+ }
+ }
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case DM_UPDATETITLE:
diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp
index 2a3aa8a934..0df5c21806 100644
--- a/src/modules/button/button.cpp
+++ b/src/modules/button/button.cpp
@@ -564,7 +564,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
if (bct->stateId != PBS_DISABLED) { // don't change states if disabled
if (bct->stateId == PBS_PRESSED)
showClick = 1;
- bct->stateId = (msg == WM_LBUTTONUP) ? PBS_HOT : PBS_NORMAL;
+ bct->stateId = PBS_HOT;
InvalidateRect(bct->hwnd, NULL, TRUE);
}
if (showClick && !bct->bSendOnDown) // Tell your daddy you got clicked.
diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp
index ca28cad9b6..41d0571c92 100644
--- a/src/modules/chat/manager.cpp
+++ b/src/modules/chat/manager.cpp
@@ -664,6 +664,8 @@ static char* SM_GetUsers(SESSION_INFO *si)
break;
}
}
+ if (utemp == NULL)
+ return NULL;
char* p = NULL;
size_t alloced = 0;
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp
index f93fcab42b..c4e4eb7834 100644
--- a/src/modules/clist/clistmenus.cpp
+++ b/src/modules/clist/clistmenus.cpp
@@ -535,7 +535,6 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM)
}
else {
if (smep->status == 0 && smep->protoindex != 0 && smep->proto != NULL) {
- PMO_IntMenuItem pimi;
char *prot = smep->proto;
char szHumanName[64] = { 0 };
PROTOACCOUNT *acc = Proto_GetAccount(smep->proto);
@@ -543,7 +542,7 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM)
db_set_b(NULL, prot, "LockMainStatus", bIsLocked);
CallProtoServiceInt(NULL, smep->proto, PS_GETNAME, (WPARAM)SIZEOF(szHumanName), (LPARAM)szHumanName);
- pimi = MO_GetIntMenuItem((HGENMENU)smep->protoindex);
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)smep->protoindex);
PMO_IntMenuItem root = (PMO_IntMenuItem)pimi->mi.root;
mir_free(pimi->mi.pszName);
mir_free(root->mi.pszName);
@@ -827,7 +826,7 @@ void RebuildMenuOrder(void)
hStatusMenuObject = MO_CreateMenuObject("StatusMenu", LPGEN("Status menu"), "StatusMenuCheckService", "StatusMenuExecService");
MO_SetOptionsMenuObject(hStatusMenuObject, OPT_MENUOBJECT_SET_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu");
- hStatusMainMenuHandles = (PMO_IntMenuItem*)mir_calloc(SIZEOF(statusModeList) * sizeof(PMO_IntMenuItem*));
+ hStatusMainMenuHandles = (PMO_IntMenuItem*)mir_calloc(SIZEOF(statusModeList) * sizeof(PMO_IntMenuItem));
hStatusMainMenuHandlesCnt = SIZEOF(statusModeList);
hStatusMenuHandles = (tStatusMenuHandles*)mir_calloc(sizeof(tStatusMenuHandles)*accounts.getCount());
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp
index 436cecefde..9391a8693d 100644
--- a/src/modules/clist/genmenu.cpp
+++ b/src/modules/clist/genmenu.cpp
@@ -113,16 +113,16 @@ PMO_IntMenuItem MO_RecursiveWalkMenu(PMO_IntMenuItem parent, pfnWalkFunc func, v
//lparam = LPMEASUREITEMSTRUCT
int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis)
{
- // prevent win9x from ugly menus displaying when there is no icon
- mis->itemWidth = 0;
- mis->itemHeight = 0;
-
if (!bIsGenMenuInited)
return -1;
if (mis == NULL)
return FALSE;
+ // prevent win9x from ugly menus displaying when there is no icon
+ mis->itemWidth = 0;
+ mis->itemHeight = 0;
+
PMO_IntMenuItem pimi = MO_GetIntMenuItem((HGENMENU)mis->itemData);
if (pimi == NULL)
return FALSE;
diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp
index 3f37798d6a..75dd68cf5a 100644
--- a/src/modules/findadd/searchresults.cpp
+++ b/src/modules/findadd/searchresults.cpp
@@ -47,7 +47,6 @@ void SaveColumnSizes(HWND hwndResults)
char szSetting[32];
mir_snprintf(szSetting, SIZEOF(szSetting), "ColOrder%d", i);
db_set_b(NULL, "FindAdd", szSetting, (BYTE)columnOrder[i]);
- if (i>=columnCount) continue;
mir_snprintf(szSetting, SIZEOF(szSetting), "ColWidth%d", i);
db_set_w(NULL, "FindAdd", szSetting, (WORD)ListView_GetColumnWidth(hwndResults, i));
}
diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp
index 4452fda309..033afc4b25 100644
--- a/src/modules/metacontacts/meta_services.cpp
+++ b/src/modules/metacontacts/meta_services.cpp
@@ -245,7 +245,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam)
tfap->hContact = ccs->hContact;
tfap->hEvent = hEvent;
tfap->id = 10;
- strcpy(tfap->msg, Translate("No online contacts found."));
+ strncpy(tfap->msg, Translate("No online contacts found."),SIZEOF(tfap->msg)-1);
DWORD dwThreadId;
CloseHandle(CreateThread(NULL, 0, sttFakeAckFail, tfap, 0, &dwThreadId));
@@ -275,6 +275,8 @@ INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam)
int Meta_HandleACK(WPARAM, LPARAM lParam)
{
ACKDATA *ack = (ACKDATA*)lParam;
+ if (ack == NULL)
+ return 0;
DBCachedContact *cc = CheckMeta(ack->hContact);
if (cc == NULL)
return 0;
diff --git a/src/modules/metacontacts/meta_utils.cpp b/src/modules/metacontacts/meta_utils.cpp
index 3fc3e26e72..6955973266 100644
--- a/src/modules/metacontacts/meta_utils.cpp
+++ b/src/modules/metacontacts/meta_utils.cpp
@@ -151,7 +151,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default)
db_set_ts(hMeta, META_PROTO, buffer, cli.pfnGetContactDisplayName(hSub, 0));
// Get the status
- WORD status = (!szProto) ? ID_STATUS_OFFLINE : db_get_w(hSub, szProto, "Status", ID_STATUS_OFFLINE);
+ WORD status = db_get_w(hSub, szProto, "Status", ID_STATUS_OFFLINE);
// write the status
mir_snprintf(buffer, SIZEOF(buffer), "Status%d", ccDest->nSubs);
@@ -284,7 +284,7 @@ MCONTACT Meta_GetMostOnlineSupporting(DBCachedContact *cc, int pflagnum, unsigne
if (!szProto || CallProtoService(szProto, PS_GETSTATUS, 0, 0) < ID_STATUS_ONLINE) // szProto offline or connecting
continue;
- DWORD caps = szProto ? CallProtoService(szProto, PS_GETCAPS, pflagnum, 0) : 0;
+ DWORD caps = CallProtoService(szProto, PS_GETCAPS, pflagnum, 0);
if (szProto && (capability == -1 || (caps & capability) == capability)) {
int status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
if (status == ID_STATUS_ONLINE) {
@@ -531,7 +531,8 @@ void Meta_GetSubNick(MCONTACT hMeta, int i, CMString &tszDest)
mir_snprintf(idStr, SIZEOF(idStr), "Login%d", i);
DBVARIANT dbv;
- db_get(hMeta, META_PROTO, idStr, &dbv);
+ if(db_get(hMeta, META_PROTO, idStr, &dbv))
+ return;
switch (dbv.type) {
case DBVT_ASCIIZ:
tszDest = dbv.pszVal;
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp
index ac3843a702..9a3aa08ebb 100644
--- a/src/modules/netlib/netliblog.cpp
+++ b/src/modules/netlib/netliblog.cpp
@@ -170,7 +170,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
ofn.Flags |= OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
ofn.lpstrTitle = TranslateT("Select program to be run");
}
- _tcscpy(filter, TranslateT("All files"));
+ _tcsncpy(filter, TranslateT("All files"), SIZEOF(filter) - 1);
_tcscat(filter, _T(" (*)"));
TCHAR *pfilter = filter + mir_tstrlen(filter) + 1;
_tcscpy(pfilter, _T("*"));
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp
index ee89f89233..5eef009c36 100644
--- a/src/modules/protocols/protocols.cpp
+++ b/src/modules/protocols/protocols.cpp
@@ -521,6 +521,7 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char
INT_PTR res = (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action,
(const PROTOCHAR**)&szFname);
mir_free(szFname);
+ return (INT_PTR) res;
}
}
case 106:
diff --git a/src/modules/srmm/statusicon.cpp b/src/modules/srmm/statusicon.cpp
index 18674add19..1722dac64a 100644
--- a/src/modules/srmm/statusicon.cpp
+++ b/src/modules/srmm/statusicon.cpp
@@ -61,7 +61,7 @@ struct StatusIconMain : public MZeroedObject
StatusIconData sid;
- int hPangpack;
+ int hLangpack;
OBJLIST<StatusIconChild> arChildren;
};
@@ -130,7 +130,7 @@ static INT_PTR AddStatusIcon(WPARAM wParam, LPARAM lParam)
p = new StatusIconMain;
memcpy(&p->sid, sid, sizeof(p->sid));
- p->hPangpack = (int)wParam;
+ p->hLangpack = (int)wParam;
p->sid.szModule = mir_strdup(sid->szModule);
if (sid->flags & MBF_UNICODE)
p->sid.tszTooltip = mir_u2t(sid->wszTooltip);
@@ -182,7 +182,7 @@ static INT_PTR GetNthIcon(WPARAM wParam, LPARAM lParam)
if (pc->tszTooltip) res.tszTooltip = pc->tszTooltip;
res.flags = pc->flags;
}
- res.tszTooltip = TranslateTH(p.hPangpack, res.tszTooltip);
+ res.tszTooltip = TranslateTH(p.hLangpack, res.tszTooltip);
return (INT_PTR)&res;
}
nVis++;
@@ -197,7 +197,7 @@ void KillModuleSrmmIcons(int hLangpack)
{
for (int i=arIcons.getCount()-1; i >= 0; i--) {
StatusIconMain &p = arIcons[i];
- if (p.hPangpack == hLangpack)
+ if (p.hLangpack == hLangpack)
arIcons.remove(i);
}
}