summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-02-28 00:26:43 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-02-28 00:26:43 +0000
commit4410284da77786594d7009b6c515176de0d5a51e (patch)
tree949362dafe500e6ef07006ade5a9920d72d2c55e /src/modules
parent2095a324e774565a588425ed4a4986063e3c08fa (diff)
Core:
-Some major and minor issues fixed git-svn-id: http://svn.miranda-ng.org/main/trunk@12280 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-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
10 files changed, 22 insertions, 18 deletions
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);
}
}