diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2014-11-28 21:19:14 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2014-11-28 21:19:14 +0000 |
commit | 6895d635acb37ba42e53ba95ca3eee2ddbbef24d (patch) | |
tree | f85a1d97784c4597099864119acb027b9a3f2dba /protocols | |
parent | 8ef06acf351fdb6034b6e13670d84bfd79161956 (diff) |
Massive code cleanup and fixes for a lot of warnings reported in #837
git-svn-id: http://svn.miranda-ng.org/main/trunk@11136 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/IcqOscarJ/src/icq_proto.cpp | 4 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_servlist.cpp | 1 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iqid_muc.cpp | 171 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_opt.cpp | 3 | ||||
-rw-r--r-- | protocols/Sametime/src/files.cpp | 6 | ||||
-rw-r--r-- | protocols/Sametime/src/sametime.cpp | 6 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/gchat.cpp | 9 | ||||
-rw-r--r-- | protocols/SkypeClassic/src/skype.cpp | 9 | ||||
-rw-r--r-- | protocols/Steam/src/steam_pooling.cpp | 8 | ||||
-rw-r--r-- | protocols/Steam/src/steam_proto.cpp | 2 | ||||
-rw-r--r-- | protocols/Steam/src/steam_queue.cpp | 4 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_opt.cpp | 78 | ||||
-rw-r--r-- | protocols/Tlen/src/tlen_voice.cpp | 79 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 4 | ||||
-rw-r--r-- | protocols/Yahoo/src/libyahoo2/libyahoo2.cpp | 2 | ||||
-rw-r--r-- | protocols/Yahoo/src/options.cpp | 47 |
16 files changed, 232 insertions, 201 deletions
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 3928a7c64d..c24ea8bfcf 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -1309,7 +1309,7 @@ HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const TCHAR* szDescription // Send file transfer request
debugLogA("Init file send");
- char *pszFiles;
+ char *pszFiles, szFiles[64];
if (ft->dwFileCount == 1) {
pszFiles = strchr(ft->pszFiles[0], '\\');
if (pszFiles)
@@ -1318,7 +1318,7 @@ HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const TCHAR* szDescription pszFiles = ft->pszFiles[0];
}
else {
- char szFiles[64], tmp[64];
+ char tmp[64];
mir_snprintf(szFiles, SIZEOF(szFiles), ICQTranslateUtfStatic("%d Files", tmp, SIZEOF(tmp)), ft->dwFileCount);
pszFiles = szFiles;
}
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index ecf67683ed..233c0d07d8 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -223,7 +223,6 @@ void __cdecl CIcqProto::servlistQueueThread(void *param) SAFE_FREE((void**)&((servlistgroupitemdouble*)(pItem->pItems[i]))->packet2.pData);
}
SAFE_FREE((void**)&pItem->pItems[i]);
- break;
}
SAFE_FREE((void**)&pItem);
// resize the queue
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index 1e941ee9dc..91187d0715 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -37,22 +37,25 @@ void CJabberProto::SetMucConfig(HXML node, void *from) }
}
+// RECVED: room config form
+// ACTION: show the form
void CJabberProto::OnIqResultGetMuc(HXML iqNode, CJabberIqInfo *pInfo)
{
- HXML queryNode, xNode;
- const TCHAR *type, *from, *str;
-
- // RECVED: room config form
- // ACTION: show the form
debugLogA("<iq/> iqIdGetMuc");
- if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
- if ((from = xmlGetAttrValue(iqNode, _T("from"))) == NULL) return;
+ LPCTSTR type = xmlGetAttrValue(iqNode, _T("type"));
+ if (type == NULL)
+ return;
+ LPCTSTR from = xmlGetAttrValue(iqNode, _T("from"));
+ if (from == NULL)
+ return;
if (!_tcscmp(type, _T("result"))) {
- if ((queryNode = xmlGetChild(iqNode , "query")) != NULL) {
- str = xmlGetAttrValue(queryNode, _T("xmlns"));
+ HXML queryNode = xmlGetChild(iqNode , _T("query"));
+ if (queryNode != NULL) {
+ LPCTSTR str = xmlGetAttrValue(queryNode, _T("xmlns"));
if (!lstrcmp(str, JABBER_FEAT_MUC_OWNER)) {
- if ((xNode = xmlGetChild(queryNode , "x")) != NULL) {
+ HXML xNode = xmlGetChild(queryNode , _T("x"));
+ if (xNode != NULL) {
str = xmlGetAttrValue(xNode, _T("xmlns"));
if (!lstrcmp(str, JABBER_FEAT_DATA_FORMS))
//LaunchForm(xNode);
@@ -65,13 +68,6 @@ void CJabberProto::OnIqResultGetMuc(HXML iqNode, CJabberIqInfo *pInfo) static void sttFillJidList(HWND hwndDlg)
{
- JABBER_MUC_JIDLIST_INFO *jidListInfo;
- HXML iqNode, queryNode;
- const TCHAR *from, *jid, *reason, *nick;
- LVITEM lvi;
- HWND hwndList;
- int count, i;
-
TCHAR *filter = NULL;
if (GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FILTER), GWLP_USERDATA))
{
@@ -80,17 +76,18 @@ static void sttFillJidList(HWND hwndDlg) GetDlgItemText(hwndDlg, IDC_FILTER, filter, filterLength);
}
- jidListInfo = (JABBER_MUC_JIDLIST_INFO *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ JABBER_MUC_JIDLIST_INFO *jidListInfo = (JABBER_MUC_JIDLIST_INFO *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (!jidListInfo)
return;
- hwndList = GetDlgItem(hwndDlg, IDC_LIST);
+ HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
SendMessage(hwndList, WM_SETREDRAW, FALSE, 0);
- count = ListView_GetItemCount(hwndList);
+ int count = ListView_GetItemCount(hwndList);
+ LVITEM lvi;
lvi.mask = LVIF_PARAM;
lvi.iSubItem = 0;
- for (i=0; i<count; i++) {
+ for (int i=0; i<count; i++) {
lvi.iItem = i;
if (ListView_GetItem(hwndList, &lvi) == TRUE) {
if (lvi.lParam!=(LPARAM)(-1) && lvi.lParam!=(LPARAM)(NULL)) {
@@ -101,32 +98,38 @@ static void sttFillJidList(HWND hwndDlg) ListView_DeleteAllItems(hwndList);
// Populate displayed list from iqNode
- if ((iqNode = jidListInfo->iqNode) != NULL) {
- if ((from = xmlGetAttrValue(iqNode, _T("from"))) != NULL) {
- if ((queryNode = xmlGetChild(iqNode , "query")) != NULL) {
+ TCHAR tszItemText[ JABBER_MAX_JID_LEN + 256 ];
+ HXML iqNode = jidListInfo->iqNode;
+ if (iqNode != NULL) {
+ LPCTSTR from = xmlGetAttrValue(iqNode, _T("from"));
+ if (from != NULL) {
+ HXML queryNode = xmlGetChild(iqNode , _T("query"));
+ if (queryNode != NULL) {
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iSubItem = 0;
lvi.iItem = 0;
- for (i=0; ; i++) {
+ for (int i=0; ; i++) {
HXML itemNode = xmlGetChild(queryNode ,i);
if (!itemNode)
break;
- if ((jid = xmlGetAttrValue(itemNode, _T("jid"))) != NULL) {
+ LPCTSTR jid = xmlGetAttrValue(itemNode, _T("jid"));
+ if (jid != NULL) {
lvi.pszText = (TCHAR*)jid;
if (jidListInfo->type == MUC_BANLIST) {
- if ((reason = xmlGetText(xmlGetChild(itemNode , "reason"))) != NULL) {
- TCHAR jidreason[ JABBER_MAX_JID_LEN + 256 ];
- mir_sntprintf(jidreason, SIZEOF(jidreason), _T("%s (%s)") , jid, reason);
- lvi.pszText = jidreason;
- } }
-
- if (jidListInfo->type == MUC_VOICELIST || jidListInfo->type == MUC_MODERATORLIST) {
- if ((nick = xmlGetAttrValue(itemNode, _T("nick"))) != NULL) {
- TCHAR nickjid[ JABBER_MAX_JID_LEN + 256 ];
- mir_sntprintf(nickjid, SIZEOF(nickjid), _T("%s (%s)") , nick, jid);
- lvi.pszText = nickjid;
- } }
+ LPCTSTR reason = xmlGetText(xmlGetChild(itemNode , _T("reason")));
+ if (reason != NULL) {
+ mir_sntprintf(tszItemText, SIZEOF(tszItemText), _T("%s (%s)") , jid, reason);
+ lvi.pszText = tszItemText;
+ }
+ }
+ else if (jidListInfo->type == MUC_VOICELIST || jidListInfo->type == MUC_MODERATORLIST) {
+ LPCTSTR nick = xmlGetAttrValue(itemNode, _T("nick"));
+ if (nick != NULL) {
+ mir_sntprintf(tszItemText, SIZEOF(tszItemText), _T("%s (%s)") , nick, jid);
+ lvi.pszText = tszItemText;
+ }
+ }
if (filter && *filter && !JabberStrIStr(lvi.pszText, filter))
continue;
@@ -135,7 +138,11 @@ static void sttFillJidList(HWND hwndDlg) ListView_InsertItem(hwndList, &lvi);
lvi.iItem++;
- } } } } }
+ }
+ }
+ }
+ }
+ }
lvi.mask = LVIF_PARAM;
lvi.lParam = (LPARAM)(-1);
@@ -169,11 +176,10 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w {
LVCOLUMN lvc;
RECT rc;
- HWND hwndList;
TranslateDialogDefault(hwndDlg);
- hwndList = GetDlgItem(hwndDlg, IDC_LIST);
+ HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
GetClientRect(hwndList, &rc);
//rc.right -= GetSystemMetrics(SM_CXVSCROLL);
@@ -233,8 +239,6 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w case WM_JABBER_REFRESH:
{
// lParam is (JABBER_MUC_JIDLIST_INFO *)
- HXML iqNode, queryNode;
- const TCHAR *from;
TCHAR title[256];
// Clear current GWL_USERDATA, if any
@@ -248,11 +252,13 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w // Populate displayed list from iqNode
lstrcpyn(title, TranslateT("JID List"), SIZEOF(title));
if ((dat=(JABBER_MUC_JIDLIST_INFO *) lParam) != NULL) {
- if ((iqNode = dat->iqNode) != NULL) {
- if ((from = xmlGetAttrValue(iqNode, _T("from"))) != NULL) {
+ HXML iqNode = dat->iqNode;
+ if (iqNode != NULL) {
+ LPCTSTR from = xmlGetAttrValue(iqNode, _T("from"));
+ if (from != NULL) {
dat->roomJid = mir_tstrdup(from);
-
- if ((queryNode = xmlGetChild(iqNode , "query")) != NULL) {
+ HXML queryNode = xmlGetChild(iqNode , _T("query"));
+ if (queryNode != NULL) {
TCHAR *localFrom = mir_tstrdup(from);
mir_sntprintf(title, SIZEOF(title), TranslateT("%s, %d items (%s)"),
(dat->type == MUC_VOICELIST) ? TranslateT("Voice List") :
@@ -263,7 +269,10 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w (dat->type == MUC_OWNERLIST) ? TranslateT("Owner List") :
TranslateT("JID List"), xmlGetChildCount(queryNode), localFrom);
mir_free(localFrom);
- } } } }
+ }
+ }
+ }
+ }
SetWindowText(hwndDlg, title);
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FILTER), GWLP_USERDATA, 0);
@@ -285,10 +294,9 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w case CDDS_SUBITEM|CDDS_ITEMPREPAINT:
{
RECT rc;
- HICON hIcon;
-
ListView_GetSubItemRect(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, LVIR_LABEL, &rc);
if (nm->iSubItem == 1) {
+ HICON hIcon;
if (nm->nmcd.lItemlParam == (LPARAM)(-1))
hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ADDCONTACT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
else
@@ -297,7 +305,10 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w DestroyIcon(hIcon);
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT);
return TRUE;
- } } } }
+ }
+ }
+ }
+ }
break;
case NM_CLICK:
{
@@ -376,16 +387,14 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w case WM_CLOSE:
{
- HWND hwndList;
- int count, i;
LVITEM lvi;
// Free lParam of the displayed list items
- hwndList = GetDlgItem(hwndDlg, IDC_LIST);
- count = ListView_GetItemCount(hwndList);
+ HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
+ int count = ListView_GetItemCount(hwndList);
lvi.mask = LVIF_PARAM;
lvi.iSubItem = 0;
- for (i=0; i<count; i++) {
+ for (int i=0; i<count; i++) {
lvi.iItem = i;
if (ListView_GetItem(hwndList, &lvi) == TRUE) {
if (lvi.lParam!=(LPARAM)(-1) && lvi.lParam!=(LPARAM)(NULL)) {
@@ -434,17 +443,24 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w static void CALLBACK JabberMucJidListCreateDialogApcProc(void* param)
{
- HXML iqNode, queryNode;
- const TCHAR *from;
- HWND *pHwndJidList;
JABBER_MUC_JIDLIST_INFO *jidListInfo = (JABBER_MUC_JIDLIST_INFO *)param;
+ if (jidListInfo == NULL)
+ return;
- if (jidListInfo == NULL) return;
- if ((iqNode = jidListInfo->iqNode) == NULL) return;
- if ((from = xmlGetAttrValue(iqNode, _T("from"))) == NULL) return;
- if ((queryNode = xmlGetChild(iqNode , "query")) == NULL) return;
+ HXML iqNode = jidListInfo->iqNode;
+ if (iqNode == NULL)
+ return;
+
+ LPCTSTR from = xmlGetAttrValue(iqNode, _T("from"));
+ if (from == NULL)
+ return;
+
+ HXML queryNode = xmlGetChild(iqNode , _T("query"));
+ if (queryNode == NULL)
+ return;
CJabberProto *ppro = jidListInfo->ppro;
+ HWND *pHwndJidList;
switch (jidListInfo->type) {
case MUC_VOICELIST:
pHwndJidList = &ppro->m_hwndMucVoiceList;
@@ -478,13 +494,13 @@ static void CALLBACK JabberMucJidListCreateDialogApcProc(void* param) void CJabberProto::OnIqResultMucGetJidList(HXML iqNode, JABBER_MUC_JIDLIST_TYPE listType)
{
- const TCHAR *type;
- JABBER_MUC_JIDLIST_INFO *jidListInfo;
-
- if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
+ LPCTSTR type = xmlGetAttrValue(iqNode, _T("type"));
+ if (type == NULL)
+ return;
if (!lstrcmp(type, _T("result"))) {
- if ((jidListInfo = new JABBER_MUC_JIDLIST_INFO) != NULL) {
+ JABBER_MUC_JIDLIST_INFO *jidListInfo = new JABBER_MUC_JIDLIST_INFO;
+ if (jidListInfo != NULL) {
jidListInfo->type = listType;
jidListInfo->ppro = this;
jidListInfo->roomJid = NULL; // Set in the dialog procedure
@@ -492,39 +508,41 @@ void CJabberProto::OnIqResultMucGetJidList(HXML iqNode, JABBER_MUC_JIDLIST_TYPE CallFunctionAsync(JabberMucJidListCreateDialogApcProc, jidListInfo);
else
mir_free(jidListInfo);
-} } }
+ }
+ }
+}
-void CJabberProto::OnIqResultMucGetVoiceList(HXML iqNode, CJabberIqInfo *pInfo)
+void CJabberProto::OnIqResultMucGetVoiceList(HXML iqNode, CJabberIqInfo *)
{
debugLogA("<iq/> iqResultMucGetVoiceList");
OnIqResultMucGetJidList(iqNode, MUC_VOICELIST);
}
-void CJabberProto::OnIqResultMucGetMemberList(HXML iqNode, CJabberIqInfo *pInfo)
+void CJabberProto::OnIqResultMucGetMemberList(HXML iqNode, CJabberIqInfo *)
{
debugLogA("<iq/> iqResultMucGetMemberList");
OnIqResultMucGetJidList(iqNode, MUC_MEMBERLIST);
}
-void CJabberProto::OnIqResultMucGetModeratorList(HXML iqNode, CJabberIqInfo *pInfo)
+void CJabberProto::OnIqResultMucGetModeratorList(HXML iqNode, CJabberIqInfo *)
{
debugLogA("<iq/> iqResultMucGetModeratorList");
OnIqResultMucGetJidList(iqNode, MUC_MODERATORLIST);
}
-void CJabberProto::OnIqResultMucGetBanList(HXML iqNode, CJabberIqInfo *pInfo)
+void CJabberProto::OnIqResultMucGetBanList(HXML iqNode, CJabberIqInfo *)
{
debugLogA("<iq/> iqResultMucGetBanList");
OnIqResultMucGetJidList(iqNode, MUC_BANLIST);
}
-void CJabberProto::OnIqResultMucGetAdminList(HXML iqNode, CJabberIqInfo *pInfo)
+void CJabberProto::OnIqResultMucGetAdminList(HXML iqNode, CJabberIqInfo *)
{
debugLogA("<iq/> iqResultMucGetAdminList");
OnIqResultMucGetJidList(iqNode, MUC_ADMINLIST);
}
-void CJabberProto::OnIqResultMucGetOwnerList(HXML iqNode, CJabberIqInfo *pInfo)
+void CJabberProto::OnIqResultMucGetOwnerList(HXML iqNode, CJabberIqInfo *)
{
debugLogA("<iq/> iqResultMucGetOwnerList");
OnIqResultMucGetJidList(iqNode, MUC_OWNERLIST);
@@ -547,7 +565,6 @@ TCHAR* JABBER_MUC_JIDLIST_INFO::type2str() const case MUC_BANLIST: return TranslateT("Ban List");
case MUC_ADMINLIST: return TranslateT("Admin List");
case MUC_OWNERLIST: return TranslateT("Owner List");
+ default: return TranslateT("JID List");
}
-
- return TranslateT("JID List");
}
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index ce8ea900d9..9b225a91e5 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -255,8 +255,7 @@ protected: else
SetDlgItemText(m_hwnd, IDC_REG_STATUS, (TCHAR*)lParam);
- if (wParam >= 0)
- SendMessage(GetDlgItem(m_hwnd, IDC_PROGRESS_REG), PBM_SETPOS, wParam, 0);
+ SendMessage(GetDlgItem(m_hwnd, IDC_PROGRESS_REG), PBM_SETPOS, wParam, 0);
if (wParam >= 100)
m_btnOk.SetText(TranslateT("Close"));
else
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index cfbc52d824..29f3a0a077 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -358,7 +358,7 @@ HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, PROTOCHAR** files, con HANDLE CSametimeProto::AcceptFileTransfer(MCONTACT hContact, HANDLE hFt, char* save_path)
{
- mwFileTransfer* ft = (mwFileTransfer*)(hFt);
+ mwFileTransfer* ft = (mwFileTransfer*)hFt;
CSametimeProto* proto = getProtoFromMwFileTransfer(ft);
debugLog(_T("CSametimeProto::AcceptFileTransfer() start"));
@@ -366,7 +366,7 @@ HANDLE CSametimeProto::AcceptFileTransfer(MCONTACT hContact, HANDLE hFt, char* s memset((void*)ftcd, 0, sizeof(FileTransferClientData));
ftcd->ft = ft;
ftcd->sending = false;
- ftcd->hFt = (HANDLE)ft;
+ ftcd->hFt = hFt;
if (save_path) // save path
ftcd->save_path = _strdup(save_path);
@@ -420,7 +420,7 @@ void CSametimeProto::CancelFileTransfer(HANDLE hFt) FileTransferClientData* ftcd = (FileTransferClientData*)mwFileTransfer_getClientData(ft);
if (ftcd) {
- while (mwFileTransfer_isDone(ftcd->ft) && ftcd)
+ while (ftcd && mwFileTransfer_isDone(ftcd->ft))
ftcd = ftcd->next;
if (ftcd) mwFileTransfer_cancel(ftcd->ft);
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index b0b50a6e52..f8966db031 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -174,12 +174,12 @@ void __cdecl sttRecvAwayThread(void *param) int CSametimeProto::OnWindowEvent(WPARAM, LPARAM lParam)
{
- MessageWindowEventData* mwed = (MessageWindowEventData*)lParam;
+ MessageWindowEventData *mwed = (MessageWindowEventData*)lParam;
- if (db_get_b(mwed->hContact, m_szModuleName, "ChatRoom", 0))
+ if ((mwed == NULL) || db_get_b(mwed->hContact, m_szModuleName, "ChatRoom", 0))
return 0;
- if (mwed && (mwed->uType == MSG_WINDOW_EVT_CLOSING || mwed->uType == MSG_WINDOW_EVT_CLOSE))
+ if ((mwed->uType == MSG_WINDOW_EVT_CLOSING) || (mwed->uType == MSG_WINDOW_EVT_CLOSE))
CloseIm(mwed->hContact);
return 0;
diff --git a/protocols/SkypeClassic/src/gchat.cpp b/protocols/SkypeClassic/src/gchat.cpp index a36884bc11..02046beeca 100644 --- a/protocols/SkypeClassic/src/gchat.cpp +++ b/protocols/SkypeClassic/src/gchat.cpp @@ -595,9 +595,8 @@ void SetChatTopic(const TCHAR *szChatId, TCHAR *szTopic, BOOL bSet) int GCEventHook(WPARAM,LPARAM lParam) {
GCHOOK *gch = (GCHOOK*) lParam;
- gchat_contacts *gc = GetChat(gch->pDest->ptszID);
-
if(gch) {
+ gchat_contacts *gc = GetChat(gch->pDest->ptszID);
if (!_stricmp(gch->pDest->pszModule, SKYPE_PROTONAME)) {
switch (gch->pDest->iType) {
@@ -847,8 +846,10 @@ void GCExit(void) {
DeleteCriticalSection (&m_GCMutex);
for (int i=0;i<chatcount;i++) {
- if (chats[i].szChatName) free(chats[i].szChatName);
- if (chats[i].mJoinedContacts) free(chats[i].mJoinedContacts);
+ if(chats[i]) {
+ free(chats[i].szChatName);
+ free(chats[i].mJoinedContacts);
+ }
}
if (chats) free (chats);
chats = NULL;
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 76cb2801dc..d9f8502980 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -471,8 +471,8 @@ int SearchFriends(void) { static void QueryUserWaitingAuthorization(char *pszNick, char *pszAuthRq)
{
- MCONTACT hContact;
- char *firstname = NULL, *lastname = NULL, *pCurBlob, *authmsg = NULL;
+ MCONTACT hContact = add_contact(pszNick, PALF_TEMPORARY);
+ char *lastname = NULL, *pCurBlob, *authmsg = NULL;
LOG(("Awaiting auth: %s", pszNick));
PROTORECVEVENT pre = { 0 };
@@ -481,14 +481,15 @@ static void QueryUserWaitingAuthorization(char *pszNick, char *pszAuthRq) CCSDATA ccs = { 0 };
ccs.szProtoService = PSR_AUTH;
- ccs.hContact = hContact = add_contact(pszNick, PALF_TEMPORARY);
+ ccs.hContact = hContact;
ccs.wParam = 0;
ccs.lParam = (LPARAM)⪯
/* blob is: */
//DWORD protocolSpecific MCONTACT hContact
//ASCIIZ nick, firstName, lastName, e-mail, requestReason
- if (firstname = SkypeGet("USER", pszNick, "FULLNAME")) {
+ char *firstname = SkypeGet("USER", pszNick, "FULLNAME");
+ if (firstname) {
if (lastname = strchr(firstname, ' ')) {
*lastname = 0;
lastname++;
diff --git a/protocols/Steam/src/steam_pooling.cpp b/protocols/Steam/src/steam_pooling.cpp index 64d72acb09..164baa9b47 100644 --- a/protocols/Steam/src/steam_pooling.cpp +++ b/protocols/Steam/src/steam_pooling.cpp @@ -65,7 +65,7 @@ void CSteamProto::ParsePollData(JSONNODE *data) if (status != m_iStatus)
{
- debugLogA("CSteamProto::ParsePollData: Change own status to %i", status);
+ debugLog(_T("CSteamProto::ParsePollData: Change own status to %i"), status);
int oldStatus = m_iStatus;
m_iStatus = m_iDesiredStatus = status;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
@@ -170,7 +170,7 @@ void CSteamProto::ParsePollData(JSONNODE *data) void CSteamProto::PollingThread(void*)
{
- debugLogA("CSteamProto::PollingThread: entering");
+ debugLog(_T("CSteamProto::PollingThread: entering"));
ptrA token(getStringA("TokenSecret"));
ptrA umqId(getStringA("UMQID"));
@@ -235,7 +235,7 @@ void CSteamProto::PollingThread(void*) else
{
// something wrong
- debugLogA("CSteamProto::PollingThread: %s (%d)", _T2A(error), response->resultCode);
+ debugLog(_T("CSteamProto::PollingThread: %s (%d)"), error, response->resultCode);
// token has expired
if (response->resultCode == HTTP_STATUS_UNAUTHORIZED)
@@ -250,7 +250,7 @@ void CSteamProto::PollingThread(void*) setDword("MessageID", messageId);
m_hPollingThread = NULL;
- debugLogA("CSteamProto::PollingThread: leaving");
+ debugLog(_T("CSteamProto::PollingThread: leaving"));
if (!isTerminated)
{
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index e6a72ca52a..8941a73f74 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -317,7 +317,7 @@ int CSteamProto::SetStatus(int new_status) if (new_status == m_iDesiredStatus)
return 0;
- debugLogA("CSteamProto::SetStatus: changing status from %i to %i", m_iStatus, new_status);
+ debugLog(_T("CSteamProto::SetStatus: changing status from %i to %i"), m_iStatus, new_status);
int old_status = m_iStatus;
m_iDesiredStatus = new_status;
diff --git a/protocols/Steam/src/steam_queue.cpp b/protocols/Steam/src/steam_queue.cpp index d500ea708d..b0a7c959d9 100644 --- a/protocols/Steam/src/steam_queue.cpp +++ b/protocols/Steam/src/steam_queue.cpp @@ -117,7 +117,7 @@ void CSteamProto::ExecuteRequest(QueueItem *item) void CSteamProto::QueueThread(void*)
{
- debugLogA("CSteamProto::QueueThread: entering");
+ debugLog(_T("CSteamProto::QueueThread: entering"));
while (!isTerminated)
{
@@ -142,5 +142,5 @@ void CSteamProto::QueueThread(void*) }
}
- debugLogA("CSteamProto::QueueThread: leaving");
+ debugLog(_T("CSteamProto::QueueThread: leaving"));
}
\ No newline at end of file diff --git a/protocols/Tlen/src/tlen_opt.cpp b/protocols/Tlen/src/tlen_opt.cpp index 110124bced..580de2c3cb 100644 --- a/protocols/Tlen/src/tlen_opt.cpp +++ b/protocols/Tlen/src/tlen_opt.cpp @@ -155,24 +155,30 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: { - BOOL reconnectRequired = FALSE; + bool reconnectRequired = false; DBVARIANT dbv; GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text)); - dbv.pszVal = NULL; - if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv) || lstrcmpA(text, dbv.pszVal)) - reconnectRequired = TRUE; - if (dbv.pszVal != NULL) + if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) { + reconnectRequired = true; + } + else { + if(lstrcmpA(text, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text)); if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) { GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text)); - dbv.pszVal = NULL; - if (db_get(NULL, proto->m_szModuleName, "Password", &dbv) || lstrcmpA(text, dbv.pszVal)) - reconnectRequired = TRUE; - if (dbv.pszVal != NULL) + if (db_get(NULL, proto->m_szModuleName, "Password", &dbv)) { + reconnectRequired = true; + } + else { + if(lstrcmpA(text, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } db_set_s(NULL, proto->m_szModuleName, "Password", text); } else @@ -276,7 +282,7 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara MarkChanges(1, hwndDlg); break; case IDC_REGISTERACCOUNT: - CallService(MS_UTILS_OPENURL, (WPARAM) 1, (LPARAM) TLEN_REGISTER); + CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM) TLEN_REGISTER); break; case IDC_OFFLINE_MESSAGE_OPTION: case IDC_ALERT_POLICY: @@ -293,24 +299,30 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: { - BOOL reconnectRequired = FALSE; + bool reconnectRequired = false; DBVARIANT dbv; GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text)); - dbv.pszVal = NULL; - if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv) || lstrcmpA(text, dbv.pszVal)) - reconnectRequired = TRUE; - if (dbv.pszVal != NULL) + if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) { + reconnectRequired = true; + } + else { + if(lstrcmpA(text, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text)); if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) { GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text)); - dbv.pszVal = NULL; - if (db_get(NULL, proto->m_szModuleName, "Password", &dbv) || lstrcmpA(text, dbv.pszVal)) - reconnectRequired = TRUE; - if (dbv.pszVal != NULL) + if (db_get(NULL, proto->m_szModuleName, "Password", &dbv)) { + reconnectRequired = true; + } + else { + if(lstrcmpA(text, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } db_set_s(NULL, proto->m_szModuleName, "Password", text); } else @@ -512,28 +524,34 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, case PSN_APPLY: WORD port; BOOL useEncryption; - BOOL reconnectRequired = FALSE; + bool reconnectRequired = false; DBVARIANT dbv; GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, sizeof(text)); - dbv.pszVal = NULL; - if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv) || lstrcmpA(text, dbv.pszVal)) - reconnectRequired = TRUE; - if (dbv.pszVal != NULL) + if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) { + reconnectRequired = true; + } + else { + if(lstrcmpA(text, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } db_set_s(NULL, proto->m_szModuleName, "LoginServer", strlwr(text)); GetDlgItemTextA(hwndDlg, IDC_HOST, text, sizeof(text)); - dbv.pszVal = NULL; - if (db_get(NULL, proto->m_szModuleName, "ManualHost", &dbv) || lstrcmpA(text, dbv.pszVal)) - reconnectRequired = TRUE; - if (dbv.pszVal != NULL) + if (db_get(NULL, proto->m_szModuleName, "ManualHost", &dbv)) { + reconnectRequired = true; + } + else { + if(lstrcmpA(text, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } db_set_s(NULL, proto->m_szModuleName, "ManualHost", text); port = (WORD) GetDlgItemInt(hwndDlg, IDC_HOSTPORT, NULL, FALSE); if (db_get_w(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT) != port) - reconnectRequired = TRUE; + reconnectRequired = true; db_set_w(NULL, proto->m_szModuleName, "ManualPort", port); proto->tlenOptions.sendKeepAlive = IsDlgButtonChecked(hwndDlg, IDC_KEEPALIVE); @@ -541,7 +559,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, useEncryption = IsDlgButtonChecked(hwndDlg, IDC_USE_SSL); if (db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE) != useEncryption) - reconnectRequired = TRUE; + reconnectRequired = true; db_set_b(NULL, proto->m_szModuleName, "UseEncryption", (BYTE) useEncryption); db_set_b(NULL, proto->m_szModuleName, "VisibilitySupport", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VISIBILITY_SUPPORT)); diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index ce97653f71..dff4305394 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -111,12 +111,11 @@ static DWORD WINAPI TlenVoiceRecordingThreadProc(TLEN_VOICE_CONTROL *control) static int TlenVoicePlaybackStart(TLEN_VOICE_CONTROL *control)
{
- WAVEFORMATEX wfm;
- MMRESULT mmres;
- int i, j;
+ int i;
int iNumDevs, iSelDev;
WAVEOUTCAPS wic;
+ WAVEFORMATEX wfm;
memset(&wfm, 0, sizeof(wfm));
wfm.cbSize = sizeof(WAVEFORMATEX);
wfm.nChannels = 1;
@@ -131,7 +130,7 @@ static int TlenVoicePlaybackStart(TLEN_VOICE_CONTROL *control) control->waveHeadersPos = 0;
control->waveHeadersNum = FRAMES_AVAILABLE_MAX_LIMIT + 2;
- j = db_get_w(NULL, control->proto->m_szModuleName, "VoiceDeviceOut", 0);
+ int j = db_get_w(NULL, control->proto->m_szModuleName, "VoiceDeviceOut", 0);
iSelDev = WAVE_MAPPER;
if (j != 0) {
iNumDevs = waveOutGetNumDevs();
@@ -151,7 +150,7 @@ static int TlenVoicePlaybackStart(TLEN_VOICE_CONTROL *control) control->proto->debugLogA("Playback device ID #%u: %s\r\n", iSelDev, wic.szPname);
}
- mmres = waveOutOpen(&control->hWaveOut, iSelDev, &wfm, (DWORD) &TlenVoicePlaybackCallback, (DWORD) control, CALLBACK_FUNCTION);
+ MMRESULT mmres = waveOutOpen(&control->hWaveOut, iSelDev, &wfm, (DWORD_PTR) &TlenVoicePlaybackCallback, (DWORD) control, CALLBACK_FUNCTION);
if (mmres != MMSYSERR_NOERROR) {
control->proto->debugLogA("TlenVoiceStart FAILED!");
return 1;
@@ -167,7 +166,6 @@ static int TlenVoicePlaybackStart(TLEN_VOICE_CONTROL *control) static int TlenVoiceRecordingStart(TLEN_VOICE_CONTROL *control)
{
WAVEFORMATEX wfm;
- MMRESULT mmres;
int i, j;
int iNumDevs, iSelDev;
WAVEINCAPS wic;
@@ -218,7 +216,7 @@ static int TlenVoiceRecordingStart(TLEN_VOICE_CONTROL *control) control->proto->debugLogA("Recording device ID #%u: %s\r\n", iSelDev, wic.szPname);
}
- mmres = waveInOpen(&control->hWaveIn, iSelDev, &wfm, (DWORD) control->threadID, 0, CALLBACK_THREAD);
+ MMRESULT mmres = waveInOpen(&control->hWaveIn, iSelDev, &wfm, control->threadID, 0, CALLBACK_THREAD);
// mmres = waveInOpen(&control->hWaveIn, 3, &wfm, (DWORD) &TlenVoiceRecordingCallback, (DWORD) control, CALLBACK_FUNCTION);
if (mmres != MMSYSERR_NOERROR) {
PostThreadMessage(control->threadID, WIM_CLOSE, 0, 0);
@@ -251,8 +249,7 @@ static int TlenVoiceRecordingStart(TLEN_VOICE_CONTROL *control) static TLEN_VOICE_CONTROL *TlenVoiceCreateVC(TlenProtocol *proto, int codec)
{
- TLEN_VOICE_CONTROL *vc;
- vc = (TLEN_VOICE_CONTROL *) mir_alloc(sizeof (TLEN_VOICE_CONTROL));
+ TLEN_VOICE_CONTROL *vc = (TLEN_VOICE_CONTROL *) mir_alloc(sizeof (TLEN_VOICE_CONTROL));
memset(vc, 0, sizeof(TLEN_VOICE_CONTROL));
vc->gsmstate = gsm_create();
vc->codec = codec;
@@ -261,7 +258,6 @@ static TLEN_VOICE_CONTROL *TlenVoiceCreateVC(TlenProtocol *proto, int codec) }
static void TlenVoiceFreeVc(TLEN_VOICE_CONTROL *vc)
{
- int i;
vc->proto->debugLogA("-> TlenVoiceFreeVc");
vc->stopThread = 1;
PostThreadMessage(vc->threadID, MM_WIM_CLOSE, 0, 0);
@@ -270,7 +266,7 @@ static void TlenVoiceFreeVc(TLEN_VOICE_CONTROL *vc) }
if (vc->hThread != NULL) CloseHandle(vc->hThread);
if (vc->hWaveIn) {
- for (i=0;i<vc->waveHeadersNum;i++) {
+ for (int i=0;i<vc->waveHeadersNum;i++) {
while (waveInUnprepareHeader(vc->hWaveIn, &vc->waveHeaders[i], sizeof(WAVEHDR)) == WAVERR_STILLPLAYING) {
Sleep(50);
}
@@ -280,7 +276,7 @@ static void TlenVoiceFreeVc(TLEN_VOICE_CONTROL *vc) }
}
if (vc->hWaveOut) {
- for (i=0;i<vc->waveHeadersNum;i++) {
+ for (int i=0;i<vc->waveHeadersNum;i++) {
while (waveOutUnprepareHeader(vc->hWaveOut, &vc->waveHeaders[i], sizeof(WAVEHDR)) == WAVERR_STILLPLAYING) {
Sleep(50);
}
@@ -344,15 +340,13 @@ void __cdecl TlenVoiceReceiveThread(TLEN_FILE_TRANSFER *ft) ft->pfnNewConnectionV2 = TlenVoiceReceivingConnection;
s = TlenP2PListen(ft);
if (s != NULL) {
- HANDLE hEvent;
- char *nick;
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Waiting for connection..."));
ft->s = s;
- hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
ft->hFileEvent = hEvent;
ft->currentFile = 0;
ft->state = FT_CONNECTING;
- nick = TlenNickFromJID(ft->jid);
+ char *nick = TlenNickFromJID(ft->jid);
TlenSend(ft->proto, "<v t='%s' i='%s' e='7' a='%s' p='%d'/>", nick, ft->iqId, ft->localName, ft->wLocalPort);
mir_free(nick);
ft->proto->debugLogA("Waiting for the file to be received...");
@@ -385,10 +379,9 @@ void __cdecl TlenVoiceReceiveThread(TLEN_FILE_TRANSFER *ft) static void TlenVoiceReceivingConnection(HANDLE hConnection, DWORD dwRemoteIP, void * pExtra)
{
HANDLE slisten;
- TLEN_FILE_TRANSFER *ft;
TlenProtocol *proto = (TlenProtocol *)pExtra;
- ft = TlenP2PEstablishIncomingConnection(proto, hConnection, LIST_VOICE, FALSE);
+ TLEN_FILE_TRANSFER *ft = TlenP2PEstablishIncomingConnection(proto, hConnection, LIST_VOICE, FALSE);
if (ft != NULL) {
slisten = ft->s;
ft->s = hConnection;
@@ -426,8 +419,7 @@ static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft) int i, j;
char *p;
float val;
- TLEN_FILE_PACKET *packet;
- packet = TlenP2PPacketReceive(ft->s);
+ TLEN_FILE_PACKET *packet = TlenP2PPacketReceive(ft->s);
if (packet != NULL) {
statusTxt = " Unknown packet ";
p = packet->packet;
@@ -529,13 +521,11 @@ static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft) void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft)
{
- HANDLE s = NULL;
- HANDLE hEvent;
char *nick;
ft->proto->debugLogA("Thread started: type=voice_send");
ft->pfnNewConnectionV2 = TlenVoiceReceivingConnection;
- s = TlenP2PListen(ft);
+ HANDLE s = TlenP2PListen(ft);
if (s != NULL) {
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Waiting for connection..."));
//ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
@@ -543,7 +533,7 @@ void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft) //TlenLog("ft->s = %d", s);
//TlenLog("fileCount = %d", ft->fileCount);
- hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
+ HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
ft->hFileEvent = hEvent;
ft->currentFile = 0;
ft->state = FT_CONNECTING;
@@ -619,11 +609,11 @@ void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft) static void TlenVoiceSendParse(TLEN_FILE_TRANSFER *ft)
{
- int codec, i;
- TLEN_FILE_PACKET *packet;
+ int i;
- codec = ft->proto->recordingControl->codec;
- if ((packet=TlenP2PPacketCreate(sizeof(DWORD)+MODE_FRAME_SIZE[codec]*33)) != NULL) {
+ int codec = ft->proto->recordingControl->codec;
+ TLEN_FILE_PACKET *packet = TlenP2PPacketCreate(sizeof(DWORD)+MODE_FRAME_SIZE[codec]*33);
+ if (packet != NULL) {
short *in;
float val;
in = ft->proto->recordingControl->recordingData;
@@ -658,12 +648,12 @@ static void TlenVoiceSendParse(TLEN_FILE_TRANSFER *ft) int TlenVoiceCancelAll(TlenProtocol *proto)
{
- TLEN_LIST_ITEM *item;
HANDLE hEvent;
int i = 0;
while ((i=TlenListFindNext(proto, LIST_VOICE, 0)) >=0 ) {
- if ((item=TlenListGetItemPtrFromIndex(proto, i)) != NULL) {
+ TLEN_LIST_ITEM *item = TlenListGetItemPtrFromIndex(proto, i);
+ if (item != NULL) {
TLEN_FILE_TRANSFER *ft = item->ft;
TlenListRemoveByIndex(proto, i);
if (ft != NULL) {
@@ -693,19 +683,18 @@ int TlenVoiceCancelAll(TlenProtocol *proto) INT_PTR TlenProtocol::VoiceContactMenuHandleVoice(WPARAM wParam, LPARAM lParam)
{
- MCONTACT hContact;
- DBVARIANT dbv;
- TLEN_LIST_ITEM *item;
- TLEN_FILE_TRANSFER *ft;
if (!isOnline)
return 1;
- if ((hContact=wParam) != NULL) {
+ MCONTACT hContact = (MCONTACT) wParam;
+ if (hContact != NULL) {
+ DBVARIANT dbv;
if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
char serialId[32];
mir_snprintf(serialId, SIZEOF(serialId), "%d", TlenSerialNext(this));
- if ((item = TlenListAdd(this, LIST_VOICE, serialId)) != NULL) {
- ft = TlenFileCreateFT(this, dbv.pszVal);
+ TLEN_LIST_ITEM *item = TlenListAdd(this, LIST_VOICE, serialId);
+ if (item != NULL) {
+ TLEN_FILE_TRANSFER *ft = TlenFileCreateFT(this, dbv.pszVal);
ft->iqId = mir_strdup(serialId);
item->ft = ft;
TlenVoiceStart(ft, 2);
@@ -727,9 +716,7 @@ int TlenVoiceIsInUse(TlenProtocol *proto) { static HBITMAP TlenVoiceMakeBitmap(int w, int h, int bpp, void *ptr)
{
- BITMAPINFO bmih;
- HBITMAP hbm;
- HDC hdc;
+ BITMAPINFO bmih;
bmih.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmih.bmiHeader.biWidth = w&0xFFFFFFFC;
bmih.bmiHeader.biHeight = h;//&0xFFFFFFFC;
@@ -741,8 +728,8 @@ static HBITMAP TlenVoiceMakeBitmap(int w, int h, int bpp, void *ptr) bmih.bmiHeader.biYPelsPerMeter = 0;
bmih.bmiHeader.biClrUsed = 0;
bmih.bmiHeader.biClrImportant = 0;
- hdc = CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
- hbm = CreateDIBitmap(hdc, (PBITMAPINFOHEADER) &bmih, CBM_INIT, ptr, &bmih, DIB_RGB_COLORS);
+ HDC hdc = CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
+ HBITMAP hbm = CreateDIBitmap(hdc, (PBITMAPINFOHEADER) &bmih, CBM_INIT, ptr, &bmih, DIB_RGB_COLORS);
ReleaseDC(NULL,hdc);
return hbm;
}
@@ -920,7 +907,7 @@ static void __cdecl TlenVoiceDlgThread(void *ptr) {
TLEN_FILE_TRANSFER *ft = (TLEN_FILE_TRANSFER *)ptr;
- TlenProtocol * proto = ft->proto;
+ TlenProtocol *proto = ft->proto;
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_VOICE), NULL, TlenVoiceDlgProc, (LPARAM) proto);
TlenVoiceCancelAll(proto);
}
@@ -1073,7 +1060,8 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) }
int TlenVoiceBuildInDeviceList(TlenProtocol *proto, HWND hWnd)
-{ int i, j, iNumDevs;
+{
+ int i, j, iNumDevs;
WAVEINCAPS wic;
iNumDevs = waveInGetNumDevs();
SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)TranslateT("Default"));
@@ -1092,7 +1080,8 @@ int TlenVoiceBuildInDeviceList(TlenProtocol *proto, HWND hWnd) }
int TlenVoiceBuildOutDeviceList(TlenProtocol *proto, HWND hWnd)
-{ int i, j, iNumDevs;
+{
+ int i, j, iNumDevs;
WAVEOUTCAPS woc;
iNumDevs = waveInGetNumDevs();
SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)TranslateT("Default"));
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 91716d916e..9dc10e69ee 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -637,8 +637,8 @@ int CVkProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason) return 1;
MCONTACT hContact = MContactFromDbEvent(hDbEvent);
if (hContact == -1)
- return 1; - + return 1;
+
return SvcDeleteFriend(hContact,(LPARAM)true);
}
diff --git a/protocols/Yahoo/src/libyahoo2/libyahoo2.cpp b/protocols/Yahoo/src/libyahoo2/libyahoo2.cpp index 88bf217d28..1b178f580e 100644 --- a/protocols/Yahoo/src/libyahoo2/libyahoo2.cpp +++ b/protocols/Yahoo/src/libyahoo2/libyahoo2.cpp @@ -4484,7 +4484,7 @@ static void yahoo_process_search_connection(struct yahoo_input_data *yid, int ov yct->age = atoi(cp); break; case 5: - if (cp != "\005") + if (strcmp(cp,"\005")) yct->location = cp; k = 0; break; diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index 9ca0b249ba..237f5e49ce 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -98,22 +98,25 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, char str[128]; GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, sizeof( str )); - dbv.pszVal = NULL; - - if ( ppro->getString( YAHOO_LOGINID, &dbv) || lstrcmpA( str, dbv.pszVal )) + if (ppro->getString(YAHOO_LOGINID, &dbv)) { reconnectRequired = true; - - if ( dbv.pszVal != NULL) + } + else { + if(lstrcmpA(str, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); - + } ppro->setString( YAHOO_LOGINID, str ); GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof( str )); - dbv.pszVal = NULL; - if ( ppro->getString( YAHOO_PASSWORD, &dbv) || lstrcmpA( str, dbv.pszVal )) + if (ppro->getString(YAHOO_PASSWORD, &dbv)) { reconnectRequired = true; - if ( dbv.pszVal != NULL) + } + else { + if(lstrcmpA(str, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } ppro->setString( YAHOO_PASSWORD, str ); GetDlgItemTextA(hwndDlg, IDC_NICK, str, sizeof( str )); @@ -133,11 +136,12 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ppro->setByte("DisableYahoomail", (BYTE)!IsDlgButtonChecked(hwndDlg, IDC_DISABLEYAHOOMAIL)); ppro->setByte("ShowErrors", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_ERRORS)); - if (reconnectRequired) + if (reconnectRequired) { ppro->delSetting(YAHOO_PWTOKEN); + if (ppro->m_bLoggedIn ) + MessageBox(hwndDlg, TranslateT("The changes you have made require you to reconnect to the Yahoo network before they take effect"), TranslateT("YAHOO Options"), MB_OK ); - if ( reconnectRequired && ppro->m_bLoggedIn ) - MessageBoxA(hwndDlg, Translate("The changes you have made require you to reconnect to the Yahoo network before they take effect"), Translate("YAHOO Options"), MB_OK ); + } return TRUE; } @@ -207,29 +211,32 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY ) { - BOOL reconnectRequired = FALSE; + bool reconnectRequired = false; char str[128]; GetDlgItemTextA(hwndDlg, IDC_LOGINSERVER, str, sizeof( str )); DBVARIANT dbv; - dbv.pszVal = NULL; - if ( ppro->getString( YAHOO_LOGINSERVER, &dbv) || lstrcmpA( str, dbv.pszVal )) - reconnectRequired = TRUE; - if ( dbv.pszVal != NULL) + if (ppro->getString(YAHOO_LOGINSERVER, &dbv)) { + reconnectRequired = true; + } + else { + if(lstrcmpA(str, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } ppro->setString(YAHOO_LOGINSERVER, str); int port = GetDlgItemInt(hwndDlg, IDC_YAHOOPORT, NULL, FALSE ); if ( ppro->getWord(YAHOO_LOGINPORT, -1) != port) - reconnectRequired = TRUE; + reconnectRequired = true; ppro->setWord(YAHOO_LOGINPORT, port); ppro->setByte("YahooJapan", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_YAHOO_JAPAN )); if ( reconnectRequired && ppro->m_bLoggedIn ) - MessageBoxA(hwndDlg, Translate("The changes you have made require you to reconnect to the Yahoo network before they take effect"), Translate("YAHOO Options"), MB_OK ); + MessageBox(hwndDlg, TranslateT("The changes you have made require you to reconnect to the Yahoo network before they take effect"), TranslateT("YAHOO Options"), MB_OK ); return TRUE; } @@ -353,7 +360,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsIgnore(HWND hwndDlg, UINT msg, WPARAM wP * YahooOptInit - initialize/register our Options w/ Miranda. */ -int __cdecl CYahooProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) +int __cdecl CYahooProto::OnOptionsInit(WPARAM wParam,LPARAM) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -790000000; |