From 72c158766875ab2bd426fb19278fd80448c77977 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 23 Sep 2014 11:21:43 +0000 Subject: crazy address expression replaced with the single call of mir_tstrndup() git-svn-id: http://svn.miranda-ng.org/main/trunk@10564 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber.h | 29 +++++++++++++++-------------- protocols/JabberG/src/jabber_util.cpp | 11 +---------- 2 files changed, 16 insertions(+), 24 deletions(-) (limited to 'protocols') diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h index a370de37f5..899d38db96 100644 --- a/protocols/JabberG/src/jabber.h +++ b/protocols/JabberG/src/jabber.h @@ -366,22 +366,23 @@ struct ThreadData MCONTACT resolveContact; // features & registration - HWND reg_hwndDlg; - BOOL reg_done, bIsSessionAvailable; - class TJabberAuth* auth; - JabberCapsBits jabberServerCaps; - BOOL bBookmarksLoaded; - DWORD dwLoginRqs; + HWND reg_hwndDlg; + BOOL reg_done, bIsSessionAvailable; + BOOL bBookmarksLoaded; + DWORD dwLoginRqs; // connection & login data - TCHAR username[512]; - TCHAR password[512]; - char server[128]; - char manualHost[128]; - TCHAR resource[128]; - TCHAR fullJID[JABBER_MAX_JID_LEN]; - WORD port; - ptrT tszNewPassword; + TCHAR username[512]; + TCHAR password[512]; + char server[128]; + char manualHost[128]; + TCHAR resource[128]; + TCHAR fullJID[JABBER_MAX_JID_LEN]; + WORD port; + ptrT tszNewPassword; + + class TJabberAuth* auth; + JabberCapsBits jabberServerCaps; void close(void); void shutdown(void); diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 2b37a1c864..d9a5a0695e 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -98,19 +98,10 @@ TCHAR* __stdcall JabberNickFromJID(const TCHAR *jid) return mir_tstrdup(_T("")); const TCHAR *p; - TCHAR *nick; - if ((p = _tcschr(jid, '@')) == NULL) p = _tcschr(jid, '/'); - if (p != NULL) { - if ((nick = (TCHAR*)mir_alloc(sizeof(TCHAR)*(int(p - jid) + 1))) != NULL) { - _tcsncpy_s(nick, p - jid, jid, _TRUNCATE); - nick[p - jid] = '\0'; - } - } - else nick = mir_tstrdup(jid); - return nick; + return (p != NULL) ? mir_tstrndup(jid, p - jid) : mir_tstrdup(jid); } pResourceStatus CJabberProto::ResourceInfoFromJID(const TCHAR *jid) -- cgit v1.2.3