diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-21 19:25:14 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-21 19:25:14 +0000 |
commit | b4caa062df453412e7cafa5b96afab0b0c3a2940 (patch) | |
tree | 1bc9525da82181a285cfd80f57fc0ac5975a59d4 /protocols/JabberG | |
parent | 9f8f69354030860c05e3c89b8050723a135b74f4 (diff) |
some unused variables & functions
git-svn-id: http://svn.miranda-ng.org/main/trunk@6169 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG')
-rw-r--r-- | protocols/JabberG/src/jabber_caps.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_opt.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_proto.h | 11 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_svc.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_util.cpp | 76 |
6 files changed, 34 insertions, 61 deletions
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index 252042966a..083baf3001 100644 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -179,7 +179,7 @@ void CJabberProto::OnIqResultCapsDiscoInfo(HXML, CJabberIqInfo* pInfo) JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid)
{
- if ( !jid)
+ if (jid == NULL)
return JABBER_RESOURCE_CAPS_NONE;
TCHAR szBareJid[JABBER_MAX_JID_LEN];
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 53dfa67f6c..c00e7025d7 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -1045,7 +1045,7 @@ void CJabberProto::_RosterHandleGetRequest(HXML node) break;
const TCHAR *jid = xmlGetAttrValue(item, _T("jid"));
- if ( !jid)
+ if (jid == NULL)
continue;
const TCHAR *name = xmlGetAttrValue(item, _T("name"));
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 9f7afeab88..bf49fe07be 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -148,7 +148,6 @@ CJabberProto::CJabberProto(const char* aProtoName, const TCHAR *aUserName) : GlobalMenuInit();
WsInit();
IqInit();
- SerialInit();
ConsoleInit();
InitCustomFolders();
@@ -188,7 +187,6 @@ CJabberProto::~CJabberProto() {
WsUninit();
IqUninit();
- SerialUninit();
ConsoleUninit();
GlobalMenuUninit();
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index 02253c9217..5122f1c086 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -241,7 +241,7 @@ struct CJabberProto : public PROTO<CJabberProto> HANDLE m_hThreadHandle;
TCHAR *m_szJabberJID;
- char* m_szStreamId;
+ char *m_szStreamId;
BOOL m_bJabberOnline; // XMPP connection initialized and we can send XMPP packets
int m_nJabberSearchID;
time_t m_tmJabberLoggedInTime;
@@ -249,11 +249,9 @@ struct CJabberProto : public PROTO<CJabberProto> UINT m_nJabberCodePage;
TCHAR *m_tszSelectedLang;
- CMString m_szCurrentEntityCapsHash;
-
CRITICAL_SECTION m_csModeMsgMutex;
JABBER_MODEMSGS m_modeMsgs;
- BOOL m_bModeMsgStatusChangePending;
+ BOOL m_bModeMsgStatusChangePending;
BOOL m_bChangeStatusMessageOnly;
BOOL m_bSendKeepAlive;
@@ -862,8 +860,6 @@ struct CJabberProto : public PROTO<CJabberProto> //---- jabber_util.c -----------------------------------------------------------------
pResourceStatus ResourceInfoFromJID(const TCHAR *jid);
- void SerialInit(void);
- void SerialUninit(void);
int SerialNext(void);
HANDLE HContactFromJID(const TCHAR *jid , BOOL bStripResource = 3);
@@ -957,8 +953,7 @@ private: HANDLE m_hJabberAvatarsFolder;
BOOL m_bFoldersInitDone;
- CRITICAL_SECTION m_csSerial;
- unsigned int m_nSerial;
+ LONG m_nSerial;
HGENMENU m_hPrivacyMenuRoot;
BOOL m_menuItemsStatus;
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index eba2f9976c..8003584fa3 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -772,7 +772,7 @@ int CJabberSysInterface::CompareJIDs(LPCTSTR jid1, LPCTSTR jid2) HANDLE CJabberSysInterface::ContactFromJID(LPCTSTR jid)
{
- if ( !jid) return NULL;
+ if (jid == NULL) return NULL;
return m_psProto->HContactFromJID(jid);
}
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index ad8e170346..13b058820e 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -29,26 +29,9 @@ extern CRITICAL_SECTION mutex; extern int bSecureIM, bMirOTR, bNewGPG, bPlatform;
-void CJabberProto::SerialInit(void)
-{
- InitializeCriticalSection(&m_csSerial);
- m_nSerial = 0;
-}
-
-void CJabberProto::SerialUninit(void)
-{
- DeleteCriticalSection(&m_csSerial);
-}
-
int CJabberProto::SerialNext(void)
{
- unsigned int ret;
-
- EnterCriticalSection(&m_csSerial);
- ret = m_nSerial;
- m_nSerial++;
- LeaveCriticalSection(&m_csSerial);
- return ret;
+ return ::InterlockedIncrement(&m_nSerial);
}
void CJabberProto::Log(const char* fmt, ...)
@@ -82,7 +65,8 @@ HANDLE CJabberProto::ChatRoomHContactFromJID(const TCHAR *jid) db_free(&dbv);
if ( !result && isChatRoom(hContact))
return hContact;
- } }
+ }
+ }
return NULL;
}
@@ -130,7 +114,8 @@ HANDLE CJabberProto::HContactFromJID(const TCHAR *jid , BOOL bStripResource) TCHAR* __stdcall JabberNickFromJID(const TCHAR *jid)
{
- if ( !jid) return mir_tstrdup(_T(""));
+ if (jid == NULL)
+ return mir_tstrdup(_T(""));
const TCHAR *p;
TCHAR *nick;
@@ -150,7 +135,7 @@ TCHAR* __stdcall JabberNickFromJID(const TCHAR *jid) pResourceStatus CJabberProto::ResourceInfoFromJID(const TCHAR *jid)
{
- if ( !jid)
+ if (jid == NULL)
return NULL;
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_VCARD_TEMP, jid);
@@ -168,7 +153,7 @@ pResourceStatus CJabberProto::ResourceInfoFromJID(const TCHAR *jid) TCHAR* JabberPrepareJid(LPCTSTR jid)
{
- if ( !jid) return NULL;
+ if (jid == NULL) return NULL;
TCHAR *szNewJid = mir_tstrdup(jid);
if ( !szNewJid) return NULL;
TCHAR *pDelimiter = _tcschr(szNewJid, _T('/'));
@@ -187,7 +172,7 @@ void strdel(char* parBuffer, int len) p[ -len ] = '\0';
}
-char* __stdcall JabberUrlDecode(char* str)
+char* __stdcall JabberUrlDecode(char *str)
{
char* p, *q;
@@ -197,41 +182,36 @@ char* __stdcall JabberUrlDecode(char* str) for (p=q=str; *p!='\0'; p++,q++) {
if (*p == '<') {
// skip CDATA
- if ( !strncmp(p, "<![CDATA[", 9))
- {
+ if ( !strncmp(p, "<![CDATA[", 9)) {
p += 9;
char *tail = strstr(p, "]]>");
size_t count = tail ? (tail-p) : strlen(p);
memmove(q, p, count);
q += count-1;
p = (tail ? (tail+3) : (p+count)) - 1;
- } else
- {
- *q = *p;
}
- } else
- if (*p == '&') {
+ else *q = *p;
+ }
+ else if (*p == '&') {
if ( !strncmp(p, "&", 5)) { *q = '&'; p += 4; }
else if ( !strncmp(p, "'", 6)) { *q = '\''; p += 5; }
else if ( !strncmp(p, ">", 4)) { *q = '>'; p += 3; }
else if ( !strncmp(p, "<", 4)) { *q = '<'; p += 3; }
else if ( !strncmp(p, """, 6)) { *q = '"'; p += 5; }
else { *q = *p; }
- } else
- {
- *q = *p;
}
+ else *q = *p;
}
*q = '\0';
return str;
}
-void __stdcall JabberUrlDecodeW(WCHAR* str)
+void __stdcall JabberUrlDecodeW(WCHAR *str)
{
if (str == NULL)
return;
- WCHAR* p, *q;
+ WCHAR *p, *q;
for (p=q=str; *p!='\0'; p++,q++) {
if (*p == '&') {
if ( !wcsncmp(p, L"&", 5)) { *q = '&'; p += 4; }
@@ -248,7 +228,7 @@ void __stdcall JabberUrlDecodeW(WCHAR* str) *q = '\0';
}
-char* __stdcall JabberUrlEncode(const char* str)
+char* __stdcall JabberUrlEncode(const char *str)
{
char* s, *p, *q;
int c;
@@ -256,7 +236,7 @@ char* __stdcall JabberUrlEncode(const char* str) if (str == NULL)
return NULL;
- for (c=0,p=(char*)str; *p!='\0'; p++) {
+ for (c=0,p=(char*)str; *p != '\0'; p++) {
switch (*p) {
case '&': c += 5; break;
case '\'': c += 6; break;
@@ -297,7 +277,7 @@ char* __stdcall JabberUrlEncode(const char* str) return s;
}
-void __stdcall JabberUtfToTchar(const char* pszValue, size_t cbLen, LPTSTR& dest)
+void __stdcall JabberUtfToTchar(const char *pszValue, size_t cbLen, LPTSTR &dest)
{
char* pszCopy = NULL;
bool bNeedsFree = false;
@@ -344,7 +324,8 @@ char* __stdcall JabberSha1(char* str) TCHAR* __stdcall JabberStrFixLines(const TCHAR *str)
{
- if ( !str) return NULL;
+ if (str == NULL)
+ return NULL;
const TCHAR *p;
int add = 0;
@@ -358,8 +339,7 @@ TCHAR* __stdcall JabberStrFixLines(const TCHAR *str) TCHAR *buf = (TCHAR *)mir_alloc((lstrlen(str) + add + 1) * sizeof(TCHAR));
TCHAR *res = buf;
- for (p = str; p && *p; ++p)
- {
+ for (p = str; p && *p; ++p) {
if (*p == _T('\n') && !prev_r)
*res++ = _T('\r');
if (*p != _T('\r') && *p != _T('\n') && prev_r)
@@ -408,10 +388,10 @@ WCHAR* __stdcall JabberUnixToDosW(const WCHAR* str) WCHAR* q, *res;
int extra = 0;
- for (p = str; *p!='\0'; p++) {
+ for (p = str; *p!='\0'; p++)
if (*p == '\n')
extra++;
- }
+
if ((res = (WCHAR*)mir_alloc(sizeof(WCHAR)*(wcslen(str) + extra + 1))) != NULL) {
for (p = str,q=res; *p!='\0'; p++,q++) {
if (*p == '\n') {
@@ -425,7 +405,7 @@ WCHAR* __stdcall JabberUnixToDosW(const WCHAR* str) return res;
}
-void __stdcall JabberHttpUrlDecode(TCHAR* str)
+void __stdcall JabberHttpUrlDecode(TCHAR *str)
{
TCHAR *p, *q;
unsigned int code;
@@ -437,9 +417,8 @@ void __stdcall JabberHttpUrlDecode(TCHAR* str) *q = (unsigned char) code;
p += 2;
}
- else {
- *q = *p;
- } }
+ else *q = *p;
+ }
*q = '\0';
}
@@ -822,7 +801,8 @@ void CJabberProto::SendIqGoogleSharedStatus(int status, const TCHAR *msg) { if (status == ID_STATUS_INVISIBLE) {
query << XCHILD(_T("show"), _T("default"));
query << XCHILD(_T("invisible")) << XATTR(_T("value"), _T("true"));
- } else {
+ }
+ else {
if (status == ID_STATUS_DND)
query << XCHILD(_T("show"), _T("dnd"));
else
|