diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-02-28 11:47:11 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-02-28 11:47:11 +0000 |
commit | a1009bf5a26ec6e13badf360278765ea8c0f0edd (patch) | |
tree | 3deac61399b3d6cf9a5237622833fe9098550191 | |
parent | e44d626b32c534cace3a54d54778dfa9cf3599c9 (diff) |
Jabber:
-minor fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@12286 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/JabberG/src/jabber_adhoc.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_disco.cpp | 13 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_file.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_form.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_groupchat.cpp | 3 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iqid.cpp | 3 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_menu.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_opt.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_rc.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_search.cpp | 5 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_userinfo.cpp | 4 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_util.cpp | 17 |
12 files changed, 32 insertions, 31 deletions
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index 09db6b285b..1896805a56 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -442,7 +442,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA 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/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 9dd0f97267..a2ab2eb010 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -631,8 +631,6 @@ void CJabberDlgDiscovery::OnInitDialog() // TranslateDialogDefault(m_hwnd);
WindowSetIcon(m_hwnd, m_proto, "servicediscovery");
- int i;
-
if (m_jid) {
SetDlgItemText(m_hwnd, IDC_COMBO_JID, m_jid);
SetDlgItemText(m_hwnd, IDC_COMBO_NODE, _T(""));
@@ -677,7 +675,7 @@ void CJabberDlgDiscovery::OnInitDialog() TreeList_Create(hwndList);
TreeList_AddIcon(hwndList, m_proto->LoadIconEx("main"), 0);
- for (i=0; i < SIZEOF(sttNodeIcons); i++)
+ for (int i=0; i < SIZEOF(sttNodeIcons); i++)
{
bool needDestroy = false;
HICON hIcon;
@@ -1381,12 +1379,13 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM item = ListGetItemPtr(LIST_BOOKMARK, pNode->GetJid());
if (item == NULL) {
item = ListAdd(LIST_ROOM, pNode->GetJid());
+ if (item == NULL)
+ break;
item->name = mir_tstrdup(pNode->GetName());
}
- if (item != NULL) {
- item->type = _T("conference");
- AddEditBookmark(item);
- }
+
+ item->type = _T("conference");
+ AddEditBookmark(item);
}
}
break;
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index 6943fa8171..eb6de79073 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -148,7 +148,7 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen) int bufferSize, writeSize;
__int64 remainingBytes;
- if (ft->std.currentFileSize < 0 || ft->std.currentFileProgress < ft->std.currentFileSize) {
+ if (ft->std.currentFileProgress < ft->std.currentFileSize) {
bufferSize = eob - p;
remainingBytes = ft->std.currentFileSize - ft->std.currentFileProgress;
if (remainingBytes < bufferSize)
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp index 20ce305381..d9680fe64a 100644 --- a/protocols/JabberG/src/jabber_form.cpp +++ b/protocols/JabberG/src/jabber_form.cpp @@ -736,7 +736,7 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, else {
if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode, _T("title"))) != NULL && xmlGetText(n) != NULL)
JabberFormSetInstruction(hwndDlg, xmlGetText(n));
- else if (jfi->defTitle != NULL)
+ else
JabberFormSetInstruction(hwndDlg, TranslateTS(jfi->defTitle));
}
@@ -781,7 +781,7 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, 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/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 94ecf7f5c1..80e6391a3f 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -411,8 +411,7 @@ void CJabberDlgGcJoin::OnInitDialog() JabberGcRecentInfo *info = NULL;
if (m_jid)
info = new JabberGcRecentInfo(m_proto, m_jid);
- else {
- OpenClipboard(m_hwnd);
+ else if(OpenClipboard(m_hwnd)) {
HANDLE hData = GetClipboardData(CF_UNICODETEXT);
if (hData) {
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 0618a30505..7269561533 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -619,7 +619,8 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid);
if (item == NULL) {
item = ListAdd(LIST_VCARD_TEMP, jid); // adding to the temp list to store information about photo
- item->bUseResource = TRUE;
+ if (item != NULL)
+ item->bUseResource = TRUE;
}
if (item != NULL) {
hasPhoto = TRUE;
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 73ad98f51d..6b3d3b3636 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -602,7 +602,7 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM hContact, LPARAM) void CJabberProto::MenuInit()
{
char text[200];
- strcpy(text, m_szModuleName);
+ strncpy(text, m_szModuleName, sizeof(text)-1);
char* tDest = text + strlen(text);
CLISTMENUITEM mi = { sizeof(mi) };
@@ -833,7 +833,7 @@ void CJabberProto::GlobalMenuInit() // Hotkeys
char text[200];
- strcpy(text, m_szModuleName);
+ strncpy(text, m_szModuleName, sizeof(text) - 1);
char* tDest = text + strlen(text);
HOTKEYDESC hkd = { sizeof(hkd) };
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 91add0957a..d3e9ea0917 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -1097,9 +1097,9 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) }
if (bPushed) {
HXML item = query << XCHILD(_T("item"));
- if (group && _tcslen(group))
+ if (_tcslen(group))
item << XCHILD(_T("group"), group);
- if (name && _tcslen(name))
+ if (_tcslen(name))
item << XATTR(_T("name"), name);
item << XATTR(_T("jid"), jid) << XATTR(_T("subscription"), subscr[0] ? subscr : _T("none"));
itemCount++;
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 049805bea0..f1d6cca287 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -338,7 +338,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
HXML fieldNode = xmlGetChildByTag(xNode, "field", "var", _T("status")), valueNode;
- if (!xNode)
+ if (!fieldNode)
return JABBER_ADHOC_HANDLER_STATUS_CANCEL;
LPCTSTR ptszValue = xmlGetText( xmlGetChild(fieldNode , "value"));
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index b1485226a7..f6029926a9 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -643,13 +643,14 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR } 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); for (int i=0; i<(nScrollLines+1)/2; i++) SendMessage(hwndDlg,WM_VSCROLL, (zDelta<0)?SB_LINEDOWN:SB_LINEUP,0); - } } + } + } return TRUE; case WM_VSCROLL: diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index c392175dd4..34b9ad249c 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -578,12 +578,12 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa break; case WM_DESTROY: - dat->ppro->WindowUnsubscribe(hwndDlg); - WindowList_Remove(hUserInfoList, hwndDlg); if (dat) { + dat->ppro->WindowUnsubscribe(hwndDlg); mir_free(dat); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); } + WindowList_Remove(hUserInfoList, hwndDlg); ImageList_Destroy(TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_TV_INFO), NULL, TVSIL_NORMAL)); WindowFreeIcon(hwndDlg); break; diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index ec6197c78a..dea5b49ff7 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -1000,14 +1000,15 @@ void JabberCopyText(HWND hwnd, const TCHAR *text) {
if (!hwnd || !text) return;
- OpenClipboard(hwnd);
- EmptyClipboard();
- HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(text) + 1));
- TCHAR *s = (TCHAR *)GlobalLock(hMem);
- mir_tstrcpy(s, text);
- GlobalUnlock(hMem);
- SetClipboardData(CF_UNICODETEXT, hMem);
- CloseClipboard();
+ if (OpenClipboard(hwnd)) {
+ EmptyClipboard();
+ HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(text) + 1));
+ TCHAR *s = (TCHAR *)GlobalLock(hMem);
+ mir_tstrcpy(s, text);
+ GlobalUnlock(hMem);
+ SetClipboardData(CF_UNICODETEXT, hMem);
+ CloseClipboard();
+ }
}
BOOL CJabberProto::EnterString(CMString &result, LPCTSTR caption, int type, char *windowName, int recentCount, int timeout)
|