diff options
author | George Hazan <george.hazan@gmail.com> | 2013-08-11 14:08:24 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-08-11 14:08:24 +0000 |
commit | d6738c3c5796bd7f0def65eb7b3236bbf6d8373e (patch) | |
tree | cb5c871bf3f92453441a1e708f37ed6a0907c0ab | |
parent | 5f4dfea172962d33442546739976edf7023a1a7c (diff) |
trap #2 for a crash
git-svn-id: http://svn.miranda-ng.org/main/trunk@5652 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/TabSRMM/src/chat/chat.h | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/chat/manager.cpp | 40 |
2 files changed, 14 insertions, 28 deletions
diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h index f64b71728c..38ca3e9bd9 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat/chat.h @@ -154,7 +154,7 @@ struct STATUSINFO {
TCHAR *pszGroup;
HICON hIcon;
- WORD Status;
+ DWORD Status;
STATUSINFO *next;
};
diff --git a/plugins/TabSRMM/src/chat/manager.cpp b/plugins/TabSRMM/src/chat/manager.cpp index fcb5daf808..8171ea2dcc 100644 --- a/plugins/TabSRMM/src/chat/manager.cpp +++ b/plugins/TabSRMM/src/chat/manager.cpp @@ -751,7 +751,6 @@ SESSION_INFO* SM_FindSessionByIndex(const char* pszModule, int iItem) }
return NULL;
-
}
SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const TCHAR* pszOriginal, const TCHAR* pszCurrent)
@@ -903,8 +902,7 @@ STATUSINFO * TM_AddStatus(STATUSINFO** ppStatusList, const TCHAR* pszStatus, int return NULL;
if (!TM_FindStatus(*ppStatusList, pszStatus)) {
- STATUSINFO *node = (STATUSINFO*) mir_alloc(sizeof(STATUSINFO));
- ZeroMemory(node, sizeof(STATUSINFO));
+ STATUSINFO *node = (STATUSINFO*)mir_calloc(sizeof(STATUSINFO));
replaceStrT(node->pszGroup, pszStatus);
node->hIcon = (HICON)(*iCount);
while ((int)node->hIcon > STATUSICONCOUNT - 1)
@@ -927,60 +925,48 @@ STATUSINFO * TM_AddStatus(STATUSINFO** ppStatusList, const TCHAR* pszStatus, int STATUSINFO * TM_FindStatus(STATUSINFO* pStatusList, const TCHAR* pszStatus)
{
- STATUSINFO *pTemp = pStatusList;
-
if (!pStatusList || !pszStatus)
return NULL;
- while (pTemp != NULL) {
- if (lstrcmpi(pTemp->pszGroup, pszStatus) == 0)
- return pTemp;
+ for (STATUSINFO *si = pStatusList; si != NULL; si = si->next)
+ if (lstrcmpi(si->pszGroup, pszStatus) == 0)
+ return si;
- pTemp = pTemp->next;
- }
return 0;
}
WORD TM_StringToWord(STATUSINFO* pStatusList, const TCHAR* pszStatus)
{
- STATUSINFO *pTemp = pStatusList;
-
if (!pStatusList || !pszStatus)
return 0;
- while (pTemp != NULL) {
- if (lstrcmpi(pTemp->pszGroup, pszStatus) == 0)
- return pTemp->Status;
+ for (STATUSINFO *si = pStatusList; si != NULL; si = si->next) {
+ if (lstrcmpi(si->pszGroup, pszStatus) == 0)
+ return si->Status;
- if (pTemp->next == NULL)
+ if (si->next == NULL)
return pStatusList->Status;
-
- pTemp = pTemp->next;
}
return 0;
}
TCHAR* TM_WordToString(STATUSINFO* pStatusList, WORD Status)
{
- STATUSINFO *pTemp = pStatusList;
-
if (!pStatusList)
return NULL;
- while (pTemp != NULL) {
- if (pTemp->Status&Status) {
- Status -= pTemp->Status;
+ for (STATUSINFO *si = pStatusList; si != NULL; si = si->next)
+ if (si->Status&Status) {
+ Status -= si->Status;
if (Status == 0)
- return pTemp->pszGroup;
+ return si->pszGroup;
}
- pTemp = pTemp->next;
- }
+
return 0;
}
BOOL TM_RemoveAll(STATUSINFO** ppStatusList)
{
-
if (!ppStatusList)
return FALSE;
|