summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-09-23 11:21:43 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-09-23 11:21:43 +0000
commit72c158766875ab2bd426fb19278fd80448c77977 (patch)
treed4720cb3f98b782e20973386fb750ff4bf196ca4 /protocols
parent2be198e70035b758e0cfbd468d551051f9b5d939 (diff)
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
Diffstat (limited to 'protocols')
-rw-r--r--protocols/JabberG/src/jabber.h29
-rw-r--r--protocols/JabberG/src/jabber_util.cpp11
2 files changed, 16 insertions, 24 deletions
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)