From 41a7300678e4bb3cd703e2c236e57af4a31962c7 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Mon, 1 Dec 2014 04:50:22 +0000 Subject: mir_snprintf(..., sizeof() -> SIZEOF(), ...) small fixs cleanups git-svn-id: http://svn.miranda-ng.org/main/trunk@11188 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_console.cpp | 2 +- protocols/JabberG/src/jabber_disco.cpp | 30 ++++++++++++++-------------- protocols/JabberG/src/jabber_file.cpp | 4 ++-- protocols/JabberG/src/jabber_groupchat.cpp | 16 +++++++-------- protocols/JabberG/src/jabber_icolib.cpp | 6 +++--- protocols/JabberG/src/jabber_iq_handlers.cpp | 2 +- protocols/JabberG/src/jabber_notes.cpp | 2 +- protocols/JabberG/src/jabber_secur.cpp | 6 +++--- protocols/JabberG/src/jabber_std.cpp | 6 +++--- protocols/JabberG/src/jabber_util.cpp | 4 ++-- 10 files changed, 39 insertions(+), 39 deletions(-) (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 4a2c08e023..11aae68660 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -180,7 +180,7 @@ static void sttAppendBufW(StringBuf *buf, const WCHAR *str) tmp[0] = (char)*p; tmp[1] = 0; } - else mir_snprintf(tmp, sizeof(tmp), "\\u%d ?", (int)*p); + else mir_snprintf(tmp, SIZEOF(tmp), "\\u%d ?", (int)*p); sttAppendBufRaw(buf, tmp); } diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 73e75d5faf..66b60174bc 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -441,14 +441,14 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) int count = getDword("discoWnd_favCount", 0); for (int i=0; i < count; i++) { char setting[MAXMODULELABELLENGTH]; - mir_snprintf(setting, sizeof(setting), "discoWnd_favName_%d", i); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favName_%d", i); ptrT tszName( getTStringA(setting)); if (tszName == NULL) continue; - mir_snprintf(setting, sizeof(setting), "discoWnd_favJID_%d", i); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favJID_%d", i); ptrT dbvJid( getTStringA(setting)); - mir_snprintf(setting, sizeof(setting), "discoWnd_favNode_%d", i); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favNode_%d", i); ptrT dbvNode( getTStringA(setting)); CJabberSDNode *pNode = m_SDManager.AddPrimaryNode(dbvJid, dbvNode, tszName); SendBothRequests(pNode, NULL); @@ -801,7 +801,7 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) int count = m_proto->getDword("discoWnd_favCount", 0); for (int i=0; i < count; i++) { char setting[MAXMODULELABELLENGTH]; - mir_snprintf(setting, sizeof(setting), "discoWnd_favName_%d", i); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favName_%d", i); ptrT tszName( m_proto->getTStringA(setting)); if (tszName != NULL) { HMENU hSubMenu = CreatePopupMenu(); @@ -835,11 +835,11 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) if (res % 10) { res /= 10; char setting[MAXMODULELABELLENGTH]; - mir_snprintf(setting, sizeof(setting), "discoWnd_favName_%d", res); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favName_%d", res); m_proto->delSetting(setting); - mir_snprintf(setting, sizeof(setting), "discoWnd_favJID_%d", res); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favJID_%d", res); m_proto->delSetting(setting); - mir_snprintf(setting, sizeof(setting), "discoWnd_favNode_%d", res); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favNode_%d", res); m_proto->delSetting(setting); } else { @@ -849,11 +849,11 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) SetDlgItemText(m_hwnd, IDC_COMBO_NODE, _T("")); char setting[MAXMODULELABELLENGTH]; - mir_snprintf(setting, sizeof(setting), "discoWnd_favJID_%d", res); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favJID_%d", res); ptrT dbv( m_proto->getTStringA(setting)); if (dbv) SetDlgItemText(m_hwnd, IDC_COMBO_JID, dbv); - mir_snprintf(setting, sizeof(setting), "discoWnd_favNode_%d", res); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favNode_%d", res); dbv = m_proto->getTStringA(setting); if (dbv) SetDlgItemText(m_hwnd, IDC_COMBO_NODE, dbv); @@ -864,11 +864,11 @@ void CJabberDlgDiscovery::btnBookmarks_OnClick(CCtrlButton *) int count = m_proto->getDword("discoWnd_favCount", 0); for (int i=0; i < count; i++) { char setting[MAXMODULELABELLENGTH]; - mir_snprintf(setting, sizeof(setting), "discoWnd_favName_%d", i); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favName_%d", i); m_proto->delSetting(setting); - mir_snprintf(setting, sizeof(setting), "discoWnd_favJID_%d", i); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favJID_%d", i); m_proto->delSetting(setting); - mir_snprintf(setting, sizeof(setting), "discoWnd_favNode_%d", i); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favNode_%d", i); m_proto->delSetting(setting); } m_proto->delSetting("discoWnd_favCount"); @@ -1342,11 +1342,11 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM { char setting[MAXMODULELABELLENGTH]; int count = getDword("discoWnd_favCount", 0); - mir_snprintf(setting, sizeof(setting), "discoWnd_favName_%d", count); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favName_%d", count); setTString(setting, pNode->GetName() ? pNode->GetName() : pNode->GetJid()); - mir_snprintf(setting, sizeof(setting), "discoWnd_favJID_%d", count); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favJID_%d", count); setTString(setting, pNode->GetJid()); - mir_snprintf(setting, sizeof(setting), "discoWnd_favNode_%d", count); + mir_snprintf(setting, SIZEOF(setting), "discoWnd_favNode_%d", count); setTString(setting, pNode->GetNode() ? pNode->GetNode() : _T("")); setDword("discoWnd_favCount", ++count); } diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index 511825a65b..f22ea22984 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -294,7 +294,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) myAddr = (char*)CallService(MS_NETLIB_ADDRESSTOSTRING, 1, nlb.dwExternalIP); char szAddr[256]; - mir_snprintf(szAddr, sizeof(szAddr), "http://%s:%d/%s", myAddr, nlb.wPort, pFileName); + mir_snprintf(szAddr, SIZEOF(szAddr), "http://%s:%d/%s", myAddr, nlb.wPort, pFileName); mir_free(pFileName); @@ -410,7 +410,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer, } char fileBuffer[2048]; - int bytes = mir_snprintf(fileBuffer, sizeof(fileBuffer), "HTTP/1.1 200 OK\r\nContent-Length: %I64u\r\n\r\n", statbuf.st_size); + int bytes = mir_snprintf(fileBuffer, SIZEOF(fileBuffer), "HTTP/1.1 200 OK\r\nContent-Length: %I64u\r\n\r\n", statbuf.st_size); WsSend(s, fileBuffer, bytes, MSG_DUMPASTEXT); ft->std.flags |= PFTS_SENDING; diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 93b65fc94e..3bdb6ee215 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -119,16 +119,16 @@ struct JabberGcRecentInfo BOOL loadRecent(int iRecent) { char setting[MAXMODULELABELLENGTH]; - mir_snprintf(setting, sizeof(setting), "rcMuc_%d_server", iRecent); + mir_snprintf(setting, SIZEOF(setting), "rcMuc_%d_server", iRecent); server = ppro->getTStringA(setting); - mir_snprintf(setting, sizeof(setting), "rcMuc_%d_room", iRecent); + mir_snprintf(setting, SIZEOF(setting), "rcMuc_%d_room", iRecent); room = ppro->getTStringA(setting); - mir_snprintf(setting, sizeof(setting), "rcMuc_%d_nick", iRecent); + mir_snprintf(setting, SIZEOF(setting), "rcMuc_%d_nick", iRecent); nick = ppro->getTStringA(setting); - mir_snprintf(setting, sizeof(setting), "password_rcMuc_%d", iRecent); + mir_snprintf(setting, SIZEOF(setting), "password_rcMuc_%d", iRecent); password = ppro->getTStringA(NULL, setting); return room || server || nick || password; @@ -138,25 +138,25 @@ struct JabberGcRecentInfo { char setting[MAXMODULELABELLENGTH]; - mir_snprintf(setting, sizeof(setting), "rcMuc_%d_server", iRecent); + mir_snprintf(setting, SIZEOF(setting), "rcMuc_%d_server", iRecent); if (server) ppro->setTString(setting, server); else ppro->delSetting(setting); - mir_snprintf(setting, sizeof(setting), "rcMuc_%d_room", iRecent); + mir_snprintf(setting, SIZEOF(setting), "rcMuc_%d_room", iRecent); if (room) ppro->setTString(setting, room); else ppro->delSetting(setting); - mir_snprintf(setting, sizeof(setting), "rcMuc_%d_nick", iRecent); + mir_snprintf(setting, SIZEOF(setting), "rcMuc_%d_nick", iRecent); if (nick) ppro->setTString(setting, nick); else ppro->delSetting(setting); - mir_snprintf(setting, sizeof(setting), "password_rcMuc_%d", iRecent); + mir_snprintf(setting, SIZEOF(setting), "password_rcMuc_%d", iRecent); if (password) ppro->setTString(setting, password); else diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 939ecb82a3..af074cc60c 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -278,8 +278,8 @@ static HICON LoadTransportIcon(char *filename,int i,char *IconName,TCHAR *SectNa GetModuleFileNameA(NULL, szPath, MAX_PATH); str=strrchr(szPath,'\\'); if (str != NULL) *str=0; - mir_snprintf(szMyPath, sizeof(szMyPath), "%s\\Icons\\%s", szPath, filename); - mir_snprintf(szFullPath, sizeof(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i); + mir_snprintf(szMyPath, SIZEOF(szMyPath), "%s\\Icons\\%s", szPath, filename); + mir_snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i); BOOL nf; HICON hi=ExtractIconFromPath(szFullPath,&nf); if (hi) has_proto_icon=TRUE; @@ -558,7 +558,7 @@ HANDLE g_GetIconHandle(int iconId) HICON g_LoadIconEx(const char* name, bool big) { char szSettingName[100]; - mir_snprintf(szSettingName, sizeof(szSettingName), "%s_%s", GLOBAL_SETTING_PREFIX, name); + mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", GLOBAL_SETTING_PREFIX, name); return Skin_GetIcon(szSettingName, big); } diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 4685104f4e..bf2837a9d0 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -742,7 +742,7 @@ BOOL CJabberProto::AddClistHttpAuthEvent(CJabberHttpAuthParams *pParams) { CLISTEVENT cle = {0}; char szService[256]; - mir_snprintf(szService, sizeof(szService), "%s%s", m_szModuleName, JS_HTTP_AUTH); + mir_snprintf(szService, SIZEOF(szService), "%s%s", m_szModuleName, JS_HTTP_AUTH); cle.cbSize = sizeof(CLISTEVENT); cle.hIcon = (HICON) LoadIconEx("openid"); cle.flags = CLEF_PROTOCOLGLOBAL | CLEF_TCHAR; diff --git a/protocols/JabberG/src/jabber_notes.cpp b/protocols/JabberG/src/jabber_notes.cpp index 9b7798da0a..90a7c70353 100644 --- a/protocols/JabberG/src/jabber_notes.cpp +++ b/protocols/JabberG/src/jabber_notes.cpp @@ -775,7 +775,7 @@ bool CJabberProto::OnIncomingNote(const TCHAR *szFrom, HXML hXml) CLISTEVENT cle = { 0 }; char szService[256]; - mir_snprintf(szService, sizeof(szService), "%s%s", m_szModuleName, JS_INCOMING_NOTE_EVENT); + mir_snprintf(szService, SIZEOF(szService), "%s%s", m_szModuleName, JS_INCOMING_NOTE_EVENT); cle.cbSize = sizeof(CLISTEVENT); cle.hIcon = (HICON)LoadIconEx("notes"); cle.flags = CLEF_PROTOCOLGLOBAL | CLEF_TCHAR; diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index b5a39e768d..de6a62609b 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -286,7 +286,7 @@ char* TScramAuth::getChallenge(const TCHAR *challenge) mir_sha1_finish(&ctx, storedKey); char authmsg[4096]; - int authmsgLen = mir_snprintf(authmsg, sizeof(authmsg), "%s,%s,c=biws,r=%s", msg1, chl, snonce); + int authmsgLen = mir_snprintf(authmsg, SIZEOF(authmsg), "%s,%s,c=biws,r=%s", msg1, chl, snonce); BYTE clientSig[MIR_SHA1_HASH_SIZE]; mir_hmac_sha1(clientSig, storedKey, sizeof(storedKey), (BYTE*)authmsg, authmsgLen); @@ -305,7 +305,7 @@ char* TScramAuth::getChallenge(const TCHAR *challenge) char buf[4096]; ptrA encproof(mir_base64_encode((PBYTE)clientProof, sizeof(clientProof))); - int cbLen = mir_snprintf(buf, sizeof(buf), "c=biws,r=%s,p=%s", snonce, encproof); + int cbLen = mir_snprintf(buf, SIZEOF(buf), "c=biws,r=%s,p=%s", snonce, encproof); return mir_base64_encode((PBYTE)buf, cbLen); } @@ -318,7 +318,7 @@ char* TScramAuth::getInitialRequest() cnonce = mir_base64_encode((PBYTE)nonce, sizeof(nonce)); char buf[4096]; - int cbLen = mir_snprintf(buf, sizeof(buf), "n,,n=%s,r=%s", uname, cnonce); + int cbLen = mir_snprintf(buf, SIZEOF(buf), "n,,n=%s,r=%s", uname, cnonce); msg1 = mir_strdup(buf + 3); return mir_base64_encode((PBYTE)buf, cbLen); } diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp index 09284f20b8..6192fe52c0 100644 --- a/protocols/JabberG/src/jabber_std.cpp +++ b/protocols/JabberG/src/jabber_std.cpp @@ -72,16 +72,16 @@ void CJabberProto::ConvertPasswords() for (int i = 0;; i++) { char varName[100]; - mir_snprintf(varName, sizeof(varName), "rcMuc_%d_server", i); + mir_snprintf(varName, SIZEOF(varName), "rcMuc_%d_server", i); ptrA str(getStringA(NULL, varName)); if (str == NULL) break; - mir_snprintf(varName, sizeof(varName), "rcMuc_%d", i); + mir_snprintf(varName, SIZEOF(varName), "rcMuc_%d", i); if ((passw = JSetStringCrypt(m_szModuleName, NULL, varName)) != NULL) { delSetting(varName); - mir_snprintf(varName, sizeof(varName), "password_rcMuc_%d", i); + mir_snprintf(varName, SIZEOF(varName), "password_rcMuc_%d", i); setTString(varName, passw); } } diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 7416fa20d4..ea9c7a8519 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -859,7 +859,7 @@ void CJabberProto::ComboLoadRecentStrings(HWND hwndDlg, UINT idcCombo, char *par { for (int i = 0; i < recentCount; i++) { char setting[MAXMODULELABELLENGTH]; - mir_snprintf(setting, sizeof(setting), "%s%d", param, i); + mir_snprintf(setting, SIZEOF(setting), "%s%d", param, i); ptrT tszRecent(getTStringA(setting)); if (tszRecent != NULL) SendDlgItemMessage(hwndDlg, idcCombo, CB_ADDSTRING, 0, tszRecent); @@ -883,7 +883,7 @@ void CJabberProto::ComboAddRecentString(HWND hwndDlg, UINT idcCombo, char *param id = getByte(param, 0); char setting[MAXMODULELABELLENGTH]; - mir_snprintf(setting, sizeof(setting), "%s%d", param, id); + mir_snprintf(setting, SIZEOF(setting), "%s%d", param, id); setTString(setting, string); setByte(param, (id + 1) % recentCount); } -- cgit v1.2.3