diff options
Diffstat (limited to 'protocols/JabberG')
36 files changed, 327 insertions, 327 deletions
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index 697dcfa3da..a78d4512ef 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -136,7 +136,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) fontid.deffontsettings.charset = DEFAULT_CHARSET;
fontid.deffontsettings.colour = GetSysColor(COLOR_WINDOWTEXT);
fontid.deffontsettings.size = -11;
- mir_tstrncpy(fontid.deffontsettings.szFace, _T("MS Shell Dlg"), SIZEOF(fontid.deffontsettings.szFace));
+ mir_tstrncpy(fontid.deffontsettings.szFace, _T("MS Shell Dlg"), _countof(fontid.deffontsettings.szFace));
fontid.deffontsettings.style = 0;
_tcsncpy_s(fontid.name, LPGENT("Frame title"), _TRUNCATE);
@@ -196,7 +196,7 @@ extern "C" int __declspec(dllexport) Load() WORD v[4];
CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
- mir_sntprintf(szCoreVersion, SIZEOF(szCoreVersion), _T("%d.%d.%d.%d"), v[0], v[1], v[2], v[3]);
+ mir_sntprintf(szCoreVersion, _countof(szCoreVersion), _T("%d.%d.%d.%d"), v[0], v[1], v[2], v[3]);
CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&g_cbCountries, (LPARAM)&g_countries);
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index 723b45a43a..348f7cabf5 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -385,7 +385,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA dat->proto->AdHoc_RequestListOfCommands(pStartupParams->m_szJid, hwndDlg);
TCHAR Caption[512];
- mir_sntprintf(Caption, SIZEOF(Caption), TranslateT("Jabber Ad-Hoc commands at %s"), dat->ResponderJID);
+ mir_sntprintf(Caption, _countof(Caption), TranslateT("Jabber Ad-Hoc commands at %s"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
else {
@@ -398,7 +398,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA SetDlgItemText(hwndDlg, IDC_SUBMIT, TranslateT("OK"));
TCHAR Caption[512];
- mir_sntprintf(Caption, SIZEOF(Caption), TranslateT("Sending Ad-Hoc command to %s"), dat->ResponderJID);
+ mir_sntprintf(Caption, _countof(Caption), TranslateT("Sending Ad-Hoc command to %s"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
@@ -541,8 +541,8 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam) if (selected > 0) {
JABBER_RESOURCE_STATUS *r = item->arResources[selected - 1];
if (r) {
- mir_tstrncat(jid, _T("/"), SIZEOF(jid) - mir_tstrlen(jid));
- mir_tstrncat(jid, r->m_tszResourceName, SIZEOF(jid) - mir_tstrlen(jid));
+ mir_tstrncat(jid, _T("/"), _countof(jid) - mir_tstrlen(jid));
+ mir_tstrncat(jid, r->m_tszResourceName, _countof(jid) - mir_tstrlen(jid));
}
selected = 1;
}
diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index 21e686c742..f12dbd5c4b 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -45,7 +45,7 @@ void CJabberProto::RetrieveMessageArchive(MCONTACT hContact, JABBER_LIST_ITEM *p time_t tmLast = getDword(hContact, "LastCollection", 0);
if (tmLast) {
TCHAR buf[40];
- list << XATTR(_T("start"), time2str(tmLast, buf, SIZEOF(buf)));
+ list << XATTR(_T("start"), time2str(tmLast, buf, _countof(buf)));
}
m_ThreadInfo->send(iq);
}
diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp index 6a75105d87..bc33468517 100644 --- a/protocols/JabberG/src/jabber_bookmarks.cpp +++ b/protocols/JabberG/src/jabber_bookmarks.cpp @@ -104,12 +104,12 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM switch (LOWORD(wParam)) {
case IDC_ROOM_JID:
if ((HWND)lParam==GetFocus() && HIWORD(wParam)==EN_CHANGE)
- EnableWindow(GetDlgItem(hwndDlg, IDOK), GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, SIZEOF(text)));
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, _countof(text)));
break;
case IDOK:
{
- GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, _countof(text));
TCHAR *roomJID = NEWTSTR_ALLOCA(text);
if (param->m_item)
@@ -122,13 +122,13 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM else
replaceStrT(item->type, _T("conference"));
- GetDlgItemText(hwndDlg, IDC_NICK, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_NICK, text, _countof(text));
replaceStrT(item->nick, text);
- GetDlgItemText(hwndDlg, IDC_PASSWORD, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_PASSWORD, text, _countof(text));
replaceStrT(item->password, text);
- GetDlgItemText(hwndDlg, IDC_NAME, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_NAME, text, _countof(text));
replaceStrT(item->name, (text[0] == 0) ? roomJID : text);
item->bAutoJoin = (IsDlgButtonChecked(hwndDlg, IDC_CHECK_BM_AUTOJOIN) == BST_CHECKED);
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index 914a528824..fcde4046de 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -94,7 +94,7 @@ void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra) NETLIBCONNINFO connInfo = { sizeof(connInfo) };
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConn, (LPARAM)&connInfo);
- mir_sntprintf(szPort, SIZEOF(szPort), _T("%u"), connInfo.wPort);
+ mir_sntprintf(szPort, _countof(szPort), _T("%u"), connInfo.wPort);
ppro->debugLogA("bytestream_send_connection incoming connection accepted: %s", connInfo.szIpPort);
if ((item = ppro->ListGetItemPtr(LIST_BYTE, szPort)) == NULL) {
@@ -208,7 +208,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) if (localAddr == NULL)
localAddr = (char*)CallService(MS_NETLIB_ADDRESSTOSTRING, 1, nlb.dwExternalIP);
- mir_sntprintf(szPort, SIZEOF(szPort), _T("%d"), nlb.wPort);
+ mir_sntprintf(szPort, _countof(szPort), _T("%d"), nlb.wPort);
JABBER_LIST_ITEM *item = ListAdd(LIST_BYTE, szPort);
item->jbt = jbt;
hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -406,7 +406,7 @@ void CJabberProto::IqResultStreamActivate(HXML iqNode, CJabberIqInfo*) int id = JabberGetPacketID(iqNode);
TCHAR listJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(listJid, SIZEOF(listJid), _T("ftproxy_%d"), id);
+ mir_sntprintf(listJid, _countof(listJid), _T("ftproxy_%d"), id);
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_FTIQID, listJid);
if (item == NULL)
@@ -555,7 +555,7 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch int iqId = SerialNext();
TCHAR listJid[256];
- mir_sntprintf(listJid, SIZEOF(listJid), _T("ftproxy_%d"), iqId);
+ mir_sntprintf(listJid, _countof(listJid), _T("ftproxy_%d"), iqId);
JABBER_LIST_ITEM *item = ListAdd(LIST_FTIQID, listJid);
item->jbt = jbt;
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index a68814d7cf..6b0581032a 100644 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -183,7 +183,7 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid) return JABBER_RESOURCE_CAPS_NONE;
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(jid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(jid, szBareJid, _countof(szBareJid));
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, szBareJid);
if (item == NULL)
@@ -201,7 +201,7 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid) if (item) {
for (int i = 0; i < item->arResources.getCount(); i++) {
TCHAR szFullJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(szFullJid, SIZEOF(szFullJid), _T("%s/%s"), szBareJid, item->arResources[i]->m_tszResourceName);
+ mir_sntprintf(szFullJid, _countof(szFullJid), _T("%s/%s"), szBareJid, item->arResources[i]->m_tszResourceName);
JabberCapsBits jcb = GetResourceCapabilites(szFullJid, FALSE);
if (!(jcb & JABBER_RESOURCE_CAPS_ERROR))
jcbToReturn |= jcb;
@@ -214,7 +214,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen {
TCHAR fullJid[JABBER_MAX_JID_LEN];
if (appendBestResource)
- GetClientJID(jid, fullJid, SIZEOF(fullJid));
+ GetClientJID(jid, fullJid, _countof(fullJid));
else
_tcsncpy_s(fullJid, jid, _TRUNCATE);
@@ -240,7 +240,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen r->m_dwDiscoInfoRequestTime = pInfo->GetRequestTime();
TCHAR queryNode[512];
- mir_sntprintf(queryNode, SIZEOF(queryNode), _T("%s#%s"), r->m_tszCapsNode, r->m_tszCapsVer);
+ mir_sntprintf(queryNode, _countof(queryNode), _T("%s#%s"), r->m_tszCapsNode, r->m_tszCapsVer);
m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_DISCO_INFO) << XATTR(_T("node"), queryNode));
bRequestSent = TRUE;
@@ -615,7 +615,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con continue;
TCHAR szExtCap[ 512 ];
- mir_sntprintf(szExtCap, SIZEOF(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
+ mir_sntprintf(szExtCap, _countof(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
if (!mir_tstrcmp(szNode, szExtCap)) {
jcb = g_JabberFeatCapPairsExt[i].jcbCap;
break;
@@ -625,7 +625,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con // check features registered through IJabberNetInterface::RegisterFeature() and IJabberNetInterface::AddFeatures()
for (i=0; i < ppro->m_lstJabberFeatCapPairsDynamic.getCount(); i++) {
TCHAR szExtCap[ 512 ];
- mir_sntprintf(szExtCap, SIZEOF(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt);
+ mir_sntprintf(szExtCap, _countof(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt);
if (!mir_tstrcmp(szNode, szExtCap)) {
jcb = ppro->m_lstJabberFeatCapPairsDynamic[i]->jcbCap;
break;
@@ -667,8 +667,8 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con TCHAR *os = szOsBuffer;
if (ppro->m_options.ShowOSVersion) {
- if (!GetOSDisplayString(szOsBuffer, SIZEOF(szOsBuffer)))
- mir_tstrncpy(szOsBuffer, _T(""), SIZEOF(szOsBuffer));
+ if (!GetOSDisplayString(szOsBuffer, _countof(szOsBuffer)))
+ mir_tstrncpy(szOsBuffer, _T(""), _countof(szOsBuffer));
else {
TCHAR *szOsWindows = _T("Microsoft Windows");
size_t nOsWindowsLength = mir_tstrlen(szOsWindows);
diff --git a/protocols/JabberG/src/jabber_captcha.cpp b/protocols/JabberG/src/jabber_captcha.cpp index 4e9bcc331c..c923fee4a1 100644 --- a/protocols/JabberG/src/jabber_captcha.cpp +++ b/protocols/JabberG/src/jabber_captcha.cpp @@ -93,7 +93,7 @@ INT_PTR CALLBACK JabberCaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, return TRUE;
case IDC_SUBMIT:
- GetDlgItemText(hwndDlg, IDC_VALUE, params->Result, SIZEOF(params->Result));
+ GetDlgItemText(hwndDlg, IDC_VALUE, params->Result, _countof(params->Result));
EndDialog(hwndDlg, 1);
return TRUE;
}
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index e5cdc1e3e0..ee686bddb7 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -120,8 +120,8 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) int i;
// translate string for menus (this can't be done in initializer)
- for (i = 0; i < SIZEOF(sttAffiliationItems); i++) sttAffiliationItems[i].translate();
- for (i = 0; i < SIZEOF(sttRoleItems); i++) sttRoleItems[i].translate();
+ for (i = 0; i < _countof(sttAffiliationItems); i++) sttAffiliationItems[i].translate();
+ for (i = 0; i < _countof(sttRoleItems); i++) sttRoleItems[i].translate();
ptrT szNick(JabberNickFromJID(item->jid));
@@ -163,7 +163,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
- for (i = SIZEOF(sttStatuses) - 1; i >= 0; i--) {
+ for (i = _countof(sttStatuses) - 1; i >= 0; i--) {
gce.ptszStatus = TranslateTS(sttStatuses[i]);
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
}
@@ -355,7 +355,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason) if (m_bJabberOnline) {
TCHAR szPresenceTo[JABBER_MAX_JID_LEN];
- mir_sntprintf(szPresenceTo, SIZEOF(szPresenceTo), _T("%s/%s"), item->jid, item->nick);
+ mir_sntprintf(szPresenceTo, _countof(szPresenceTo), _T("%s/%s"), item->jid, item->nick);
m_ThreadInfo->send(
XmlNode(_T("presence")) << XATTR(_T("to"), szPresenceTo) << XATTR(_T("type"), _T("unavailable"))
@@ -524,7 +524,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) if (gcmi->Type == MENU_ON_LOG) {
static TCHAR url_buf[1024] = { 0 };
- gcmi->nItems = SIZEOF(sttLogListItems);
+ gcmi->nItems = _countof(sttLogListItems);
gcmi->Item = sttLogListItems;
static DWORD sttModeratorItems[] = { IDM_LST_PARTICIPANT, 0 };
@@ -539,7 +539,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) TCHAR *bufPtr = url_buf;
for (TCHAR *p = _tcsstr(ptszStatusMsg, _T("http")); p && *p; p = _tcsstr(p + 1, _T("http"))) {
if (!_tcsncmp(p, _T("http://"), 7) || !_tcsncmp(p, _T("https://"), 8)) {
- mir_tstrncpy(bufPtr, p, SIZEOF(url_buf) - (bufPtr - url_buf));
+ mir_tstrncpy(bufPtr, p, _countof(url_buf) - (bufPtr - url_buf));
gc_item *pItem = sttFindGcMenuItem(gcmi, idx);
pItem->pszDesc = bufPtr;
pItem->uType = MENU_POPUPITEM;
@@ -565,7 +565,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) }
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
- gcmi->nItems = SIZEOF(sttListItems);
+ gcmi->nItems = _countof(sttListItems);
gcmi->Item = sttListItems;
static DWORD sttRJidItems[] = { IDM_RJID_VCARD, IDM_RJID_ADD, IDM_RJID_COPY, 0 };
@@ -587,20 +587,20 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) for (; idx <= IDM_LINK9; ++idx)
sttFindGcMenuItem(gcmi, idx)->uType = 0;
- for (i = 0; i < SIZEOF(sttAffiliationItems); i++) {
+ for (i = 0; i < _countof(sttAffiliationItems); i++) {
gc_item *item = sttFindGcMenuItem(gcmi, sttAffiliationItems[i].id);
item->uType = (him->m_affiliation == sttAffiliationItems[i].value) ? MENU_POPUPCHECK : MENU_POPUPITEM;
item->bDisabled = !(force || sttAffiliationItems[i].check(me, him));
}
- for (i = 0; i < SIZEOF(sttRoleItems); i++) {
+ for (i = 0; i < _countof(sttRoleItems); i++) {
gc_item *item = sttFindGcMenuItem(gcmi, sttRoleItems[i].id);
item->uType = (him->m_role == sttRoleItems[i].value) ? MENU_POPUPCHECK : MENU_POPUPITEM;
item->bDisabled = !(force || sttRoleItems[i].check(me, him));
}
if (him->m_tszRealJid && *him->m_tszRealJid) {
- mir_sntprintf(sttRJidBuf, SIZEOF(sttRJidBuf), TranslateT("Real &JID: %s"), him->m_tszRealJid);
+ mir_sntprintf(sttRJidBuf, _countof(sttRJidBuf), TranslateT("Real &JID: %s"), him->m_tszRealJid);
if (TCHAR *tmp = _tcschr(sttRJidBuf, _T('/'))) *tmp = 0;
if (MCONTACT hContact = HContactFromJID(him->m_tszRealJid)) {
@@ -740,7 +740,7 @@ public: void OnCommand_AddJid(CCtrlButton*)
{
TCHAR buf[JABBER_MAX_JID_LEN];
- m_txtNewJid.GetText(buf, SIZEOF(buf));
+ m_txtNewJid.GetText(buf, _countof(buf));
m_txtNewJid.SetTextA("");
MCONTACT hContact = m_proto->HContactFromJID(buf);
@@ -865,7 +865,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam SetDlgItemText(hwndDlg, IDC_TXT_JID, dat->him->m_tszRealJid ? dat->him->m_tszRealJid : TranslateT("Real JID not available"));
SetDlgItemText(hwndDlg, IDC_TXT_STATUS, dat->him->m_tszStatusMessage);
- for (int i = 0; i < SIZEOF(sttRoleItems); i++) {
+ for (int i = 0; i < _countof(sttRoleItems); i++) {
if ((sttRoleItems[i].value == dat->him->m_role) || sttRoleItems[i].check(dat->me, dat->him)) {
SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETITEMDATA,
idx = SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_ADDSTRING, 0, (LPARAM)sttRoleItems[i].title),
@@ -874,7 +874,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETCURSEL, idx, 0);
}
}
- for (int i = 0; i < SIZEOF(sttAffiliationItems); i++) {
+ for (int i = 0; i < _countof(sttAffiliationItems); i++) {
if ((sttAffiliationItems[i].value == dat->him->m_affiliation) || sttAffiliationItems[i].check(dat->me, dat->him)) {
SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_SETITEMDATA,
idx = SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_ADDSTRING, 0, (LPARAM)sttAffiliationItems[i].title),
@@ -912,7 +912,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam break;
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(dat->him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(dat->him->m_tszRealJid, szBareJid, _countof(szBareJid));
switch (value) {
case AFFILIATION_NONE:
@@ -1019,7 +1019,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* *p = 0;
mir_sntprintf(buf, _T("%s%s%s"), szMessage, him->m_tszResourceName, p + 2);
}
- else mir_tstrncpy(buf, szMessage, SIZEOF(buf));
+ else mir_tstrncpy(buf, szMessage, _countof(buf));
UnEscapeChatTags(buf);
ppro->m_ThreadInfo->send(
@@ -1087,7 +1087,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if (him->m_affiliation != AFFILIATION_NONE) {
if (him->m_tszRealJid) {
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("jid"), szBareJid, _T("affiliation"), _T("none"));
}
else ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("nick"), him->m_tszResourceName, _T("affiliation"), _T("none"));
@@ -1098,7 +1098,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if (him->m_affiliation != AFFILIATION_MEMBER) {
if (him->m_tszRealJid) {
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("jid"), szBareJid, _T("affiliation"), _T("member"));
}
else ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("nick"), him->m_tszResourceName, _T("affiliation"), _T("member"));
@@ -1109,7 +1109,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if (him->m_affiliation != AFFILIATION_ADMIN) {
if (him->m_tszRealJid) {
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("jid"), szBareJid, _T("affiliation"), _T("admin"));
}
else ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("nick"), him->m_tszResourceName, _T("affiliation"), _T("admin"));
@@ -1120,7 +1120,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if (him->m_affiliation != AFFILIATION_OWNER) {
if (him->m_tszRealJid) {
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("jid"), szBareJid, _T("affiliation"), _T("owner"));
}
else ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("nick"), him->m_tszResourceName, _T("affiliation"), _T("owner"));
@@ -1131,7 +1131,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if ((GetTickCount() - dwLastBanKickTime) > BAN_KICK_INTERVAL) {
if (him->m_tszRealJid && *him->m_tszRealJid) {
TCHAR szVictimBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szVictimBareJid, SIZEOF(szVictimBareJid));
+ JabberStripJid(him->m_tszRealJid, szVictimBareJid, _countof(szVictimBareJid));
szBuffer.Format(_T("%s: "), me->m_tszResourceName);
szTitle.Format(TranslateT("Reason to ban %s"), him->m_tszResourceName);
@@ -1357,7 +1357,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, const TCHAR *nick)
{
TCHAR szFullJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(szFullJid, SIZEOF(szFullJid), _T("%s/%s"), item->jid, nick);
+ mir_sntprintf(szFullJid, _countof(szFullJid), _T("%s/%s"), item->jid, nick);
MCONTACT hContact = ppro->DBCreateContact(szFullJid, NULL, TRUE, FALSE);
if (hContact != NULL) {
pResourceStatus r(item->findResource(nick));
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 57b968ce96..16de723cc1 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -194,7 +194,7 @@ static void sttEmptyBuf(StringBuf *buf) static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent)
{
char indentLevel[128];
- mir_snprintf(indentLevel, SIZEOF(indentLevel), RTF_INDENT_FMT, (int)(indent*200));
+ mir_snprintf(indentLevel, _countof(indentLevel), RTF_INDENT_FMT, (int)(indent*200));
sttAppendBufRaw(buf, RTF_BEGINTAG);
sttAppendBufRaw(buf, indentLevel);
@@ -228,7 +228,7 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent) if (xmlGetChildCount(node)) {
sttAppendBufRaw(buf, RTF_BEGINTEXT);
char indentTextLevel[128];
- mir_snprintf(indentTextLevel, SIZEOF(indentTextLevel), RTF_TEXTINDENT_FMT, (int)((indent + 1) * 200));
+ mir_snprintf(indentTextLevel, _countof(indentTextLevel), RTF_TEXTINDENT_FMT, (int)((indent + 1) * 200));
sttAppendBufRaw(buf, indentTextLevel);
}
@@ -348,7 +348,7 @@ void CJabberDlgConsole::OnInitDialog() *m_proto->m_filterInfo.pattern = 0;
ptrT tszPattern( m_proto->getTStringA("consoleWnd_fpattern"));
if (tszPattern != NULL)
- mir_tstrncpy(m_proto->m_filterInfo.pattern, tszPattern, SIZEOF(m_proto->m_filterInfo.pattern));
+ mir_tstrncpy(m_proto->m_filterInfo.pattern, tszPattern, _countof(m_proto->m_filterInfo.pattern));
sttJabberConsoleRebuildStrings(m_proto, GetDlgItem(m_hwnd, IDC_CB_FILTER));
SetDlgItemText(m_hwnd, IDC_CB_FILTER, m_proto->m_filterInfo.pattern);
@@ -370,7 +370,7 @@ void CJabberDlgConsole::OnInitDialog() { IDC_BTN_FILTER_REFRESH, "Refresh list", "sd_nav_refresh", false, FALSE},
};
- for (int i=0; i < SIZEOF(buttons); i++) {
+ for (int i=0; i < _countof(buttons); i++) {
SendDlgItemMessage(m_hwnd, buttons[i].idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(buttons[i].icon));
SendDlgItemMessage(m_hwnd, buttons[i].idc, BUTTONSETASFLATBTN, TRUE, 0);
SendDlgItemMessage(m_hwnd, buttons[i].idc, BUTTONADDTOOLTIP, (WPARAM)buttons[i].title, 0);
@@ -378,7 +378,7 @@ void CJabberDlgConsole::OnInitDialog() if (buttons[i].pushed) CheckDlgButton(m_hwnd, buttons[i].idc, BST_CHECKED);
}
- for (int i=0; i < SIZEOF(filter_modes); i++)
+ for (int i=0; i < _countof(filter_modes); i++)
if (filter_modes[i].type == m_proto->m_filterInfo.type) {
g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon)));
SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon));
@@ -549,23 +549,23 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) mir_cslock lck(m_proto->m_filterInfo.csPatternLock);
- if (len > SIZEOF(m_proto->m_filterInfo.pattern)) {
+ if (len > _countof(m_proto->m_filterInfo.pattern)) {
TCHAR *buf = (TCHAR *)_alloca(len * sizeof(TCHAR));
SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)buf);
- mir_tstrncpy(m_proto->m_filterInfo.pattern, buf, SIZEOF(m_proto->m_filterInfo.pattern));
+ mir_tstrncpy(m_proto->m_filterInfo.pattern, buf, _countof(m_proto->m_filterInfo.pattern));
}
else SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)m_proto->m_filterInfo.pattern);
}
else if (HIWORD(wParam) == CBN_EDITCHANGE) {
mir_cslock lck(m_proto->m_filterInfo.csPatternLock);
- GetDlgItemText(m_hwnd, IDC_CB_FILTER, m_proto->m_filterInfo.pattern, SIZEOF(m_proto->m_filterInfo.pattern));
+ GetDlgItemText(m_hwnd, IDC_CB_FILTER, m_proto->m_filterInfo.pattern, _countof(m_proto->m_filterInfo.pattern));
}
break;
case IDC_BTN_FILTER:
int i;
HMENU hMenu = CreatePopupMenu();
- for (i = 0; i < SIZEOF(filter_modes); i++)
+ for (i = 0; i < _countof(filter_modes); i++)
AppendMenu(hMenu,
MF_STRING | ((filter_modes[i].type == m_proto->m_filterInfo.type) ? MF_CHECKED : 0),
filter_modes[i].type + 1, TranslateTS(filter_modes[i].title));
@@ -578,7 +578,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (res) {
m_proto->m_filterInfo.type = (TFilterInfo::Type)(res - 1);
- for (i = 0; i < SIZEOF(filter_modes); i++) {
+ for (i = 0; i < _countof(filter_modes); i++) {
if (filter_modes[i].type == m_proto->m_filterInfo.type) {
g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon)));
break;
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 425b6a18ef..99658d0a49 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -380,9 +380,9 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) {
TCHAR szJid[JABBER_MAX_JID_LEN];
TCHAR szNode[ 512 ];
- if (!GetDlgItemText(hwndDlg, IDC_COMBO_JID, szJid, SIZEOF(szJid)))
+ if (!GetDlgItemText(hwndDlg, IDC_COMBO_JID, szJid, _countof(szJid)))
szJid[ 0 ] = 0;
- if (!GetDlgItemText(hwndDlg, IDC_COMBO_NODE, szNode, SIZEOF(szNode)))
+ if (!GetDlgItemText(hwndDlg, IDC_COMBO_NODE, szNode, _countof(szNode)))
szNode[ 0 ] = 0;
ComboAddRecentString(hwndDlg, IDC_COMBO_JID, "discoWnd_rcJid", szJid);
@@ -504,7 +504,7 @@ void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode) iOverlay = SD_OVERLAY_NONE;
}
- for (int i=0; i < SIZEOF(sttNodeIcons); i++)
+ for (int i=0; i < _countof(sttNodeIcons); i++)
{
if (!sttNodeIcons[i].iconIndex && !sttNodeIcons[i].iconName) continue;
@@ -674,7 +674,7 @@ void CJabberDlgDiscovery::OnInitDialog() TreeList_Create(hwndList);
TreeList_AddIcon(hwndList, m_proto->LoadIconEx("main"), 0);
- for (int i=0; i < SIZEOF(sttNodeIcons); i++)
+ for (int i=0; i < _countof(sttNodeIcons); i++)
{
bool needDestroy = false;
HICON hIcon;
@@ -1201,7 +1201,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM HMENU hMenu = CreatePopupMenu();
BOOL lastSeparator = TRUE;
bool bFilterItems = !GetAsyncKeyState(VK_CONTROL);
- for (int i=0; i < SIZEOF(items); i++) {
+ for (int i=0; i < _countof(items); i++) {
JABBER_LIST_ITEM *rosterItem = NULL;
if (bFilterItems) {
if ((items[i].flags & SD_FLG_NONODE) && pNode->GetNode())
@@ -1325,7 +1325,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM case SD_ACT_COPYINFO:
{
TCHAR buf[8192];
- pNode->GetTooltipText(buf, SIZEOF(buf));
+ pNode->GetTooltipText(buf, _countof(buf));
JabberCopyText(m_pDlgServiceDiscovery->GetHwnd(), buf);
}
break;
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index f45074ea30..1eb848004c 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -43,7 +43,7 @@ int CJabberProto::OnContactDeleted(WPARAM hContact, LPARAM) if (ListGetItemPtr(LIST_ROSTER, jid)) {
if (!_tcschr(jid, _T('@'))) {
TCHAR szStrippedJid[JABBER_MAX_JID_LEN];
- JabberStripJid(m_ThreadInfo->fullJID, szStrippedJid, SIZEOF(szStrippedJid));
+ JabberStripJid(m_ThreadInfo->fullJID, szStrippedJid, _countof(szStrippedJid));
TCHAR *szDog = _tcschr(szStrippedJid, _T('@'));
if (szDog && mir_tstrcmpi(szDog + 1, jid))
m_ThreadInfo->send(XmlNodeIq(_T("set"), SerialNext(), jid) << XQUERY(JABBER_FEAT_REGISTER) << XCHILD(_T("remove")));
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index d4bfc3dd61..0160e65e96 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -178,7 +178,7 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/, CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConnection, (LPARAM)&connInfo);
TCHAR szPort[10];
- mir_sntprintf(szPort, SIZEOF(szPort), _T("%d"), connInfo.wPort);
+ mir_sntprintf(szPort, _countof(szPort), _T("%d"), connInfo.wPort);
ppro->debugLogA("File server incoming connection accepted: %s", connInfo.szIpPort);
JABBER_LIST_ITEM *item = ppro->ListGetItemPtr(LIST_FILE, szPort);
@@ -258,7 +258,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) ft->hFileEvent = hEvent;
TCHAR szPort[20];
- mir_sntprintf(szPort, SIZEOF(szPort), _T("%d"), nlb.wPort);
+ mir_sntprintf(szPort, _countof(szPort), _T("%d"), nlb.wPort);
JABBER_LIST_ITEM *item = ListAdd(LIST_FILE, szPort);
item->ft = ft;
@@ -288,7 +288,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, _countof(szAddr), "http://%s:%d/%s", myAddr, nlb.wPort, pFileName);
size_t len = mir_tstrlen(ptszResource) + mir_tstrlen(ft->jid) + 2;
TCHAR *fulljid = (TCHAR *)alloca(sizeof(TCHAR) * len);
@@ -402,7 +402,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, _countof(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;
@@ -498,7 +498,7 @@ int filetransfer::create() return fileId;
TCHAR filefull[MAX_PATH];
- mir_sntprintf(filefull, SIZEOF(filefull), _T("%s\\%s"), std.tszWorkingDir, std.tszCurrentFile);
+ mir_sntprintf(filefull, _countof(filefull), _T("%s\\%s"), std.tszWorkingDir, std.tszCurrentFile);
replaceStrT(std.tszCurrentFile, filefull);
if (hWaitEvent != INVALID_HANDLE_VALUE)
diff --git a/protocols/JabberG/src/jabber_filterlist.cpp b/protocols/JabberG/src/jabber_filterlist.cpp index 5e769b42a5..0d8ff6e567 100644 --- a/protocols/JabberG/src/jabber_filterlist.cpp +++ b/protocols/JabberG/src/jabber_filterlist.cpp @@ -135,7 +135,7 @@ void CCtrlFilterListView::FilterHighlight(TCHAR *str) bool found = false;
if (str) {
for (int j = 0; j < 10; ++j) {
- GetItemText(i, j, buf, SIZEOF(buf));
+ GetItemText(i, j, buf, _countof(buf));
if (!*buf)
break;
@@ -247,7 +247,7 @@ LRESULT CCtrlFilterListView::CustomWndProc(UINT msg, WPARAM wParam, LPARAM lPara {rc.left+FILTER_BOX_HEIGHT, rc.top+FILTER_BOX_HEIGHT},
{rc.left, rc.top+FILTER_BOX_HEIGHT},
};
- HRGN hrgnFilter = CreatePolygonRgn(pts, SIZEOF(pts), ALTERNATE);
+ HRGN hrgnFilter = CreatePolygonRgn(pts, _countof(pts), ALTERNATE);
HDC hdc = GetWindowDC(m_hwnd);
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index 9b19832a8c..fbc4db5b45 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -100,7 +100,7 @@ void CJabberProto::FtInitiate(TCHAR* jid, filetransfer *ft) filename = p+1;
TCHAR tszJid[ 512 ];
- mir_sntprintf(tszJid, SIZEOF(tszJid), _T("%s/%s"), jid, rs);
+ mir_sntprintf(tszJid, _countof(tszJid), _T("%s/%s"), jid, rs);
XmlNodeIq iq( AddIQ(&CJabberProto::OnFtSiResult, JABBER_IQ_TYPE_SET, tszJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_TO, -1, ft));
HXML si = iq << XCHILDNS(_T("si"), JABBER_FEAT_SI) << XATTR(_T("id"), sid)
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 14aadd27d8..fb1e164ece 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -369,7 +369,7 @@ static void sttJoinDlgShowRecentItems(HWND hwndDlg, int newCount) RECT rc;
int ctrls[] = { IDC_BOOKMARKS, IDOK, IDCANCEL };
- for (int i = 0; i < SIZEOF(ctrls); i++) {
+ for (int i = 0; i < _countof(ctrls); i++) {
GetWindowRect(GetDlgItem(hwndDlg, ctrls[i]), &rc);
MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc, 2);
SetWindowPos(GetDlgItem(hwndDlg, ctrls[i]), NULL, rc.left, rc.top + offset, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
@@ -466,7 +466,7 @@ void CJabberDlgGcJoin::OnInitDialog() if (!info.loadRecent(i))
break;
- mir_sntprintf(jid, SIZEOF(jid), _T("%s@%s (%s)"),
+ mir_sntprintf(jid, _countof(jid), _T("%s@%s (%s)"),
info.room, info.server,
info.nick ? info.nick : TranslateT("<no nick>"));
SetDlgItemText(m_hwnd, IDC_RECENT1 + i, jid);
@@ -687,18 +687,18 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) // fall through
case IDOK:
{
- GetDlgItemText(m_hwnd, IDC_SERVER, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_SERVER, text, _countof(text));
TCHAR *server = NEWTSTR_ALLOCA(text), *room;
m_proto->ComboAddRecentString(m_hwnd, IDC_SERVER, "joinWnd_rcSvr", server);
- GetDlgItemText(m_hwnd, IDC_ROOM, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_ROOM, text, _countof(text));
room = NEWTSTR_ALLOCA(text);
- GetDlgItemText(m_hwnd, IDC_NICK, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_NICK, text, _countof(text));
TCHAR *nick = NEWTSTR_ALLOCA(text);
- GetDlgItemText(m_hwnd, IDC_PASSWORD, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_PASSWORD, text, _countof(text));
TCHAR *password = NEWTSTR_ALLOCA(text);
m_proto->GroupchatJoinRoom(server, room, nick, password);
}
@@ -1182,7 +1182,7 @@ public: void OnCommand_Accept(CCtrlButton*)
{
TCHAR text[128];
- GetDlgItemText(m_hwnd, IDC_NICK, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_NICK, text, _countof(text));
m_proto->AcceptGroupchatInvite(m_info->roomJid, text, m_info->password);
EndDialog(m_hwnd, 0);
}
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 3a5ba46a40..aca69dc538 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -113,7 +113,7 @@ CIconPool::~CIconPool() void CIconPool::RegisterIcon(const char *name, TCHAR *filename, int iconid, TCHAR *szSection, TCHAR *szDescription)
{
char szSettingName[128];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "jabber_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "jabber_%s", name);
CPoolItem *item = new CPoolItem;
item->m_name = mir_strdup(name);
@@ -167,8 +167,8 @@ CIconPool::CPoolItem *CIconPool::FindItemByName(const char *name) void CJabberProto::IconsInit(void)
{
- m_transportProtoTableStartIndex = (int *)mir_alloc(sizeof(int) * SIZEOF(TransportProtoTable));
- for (int i=0; i < SIZEOF(TransportProtoTable); i++)
+ m_transportProtoTableStartIndex = (int *)mir_alloc(sizeof(int) * _countof(TransportProtoTable));
+ for (int i=0; i < _countof(TransportProtoTable); i++)
m_transportProtoTableStartIndex[i] = -1;
}
@@ -277,8 +277,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, _countof(szMyPath), "%s\\Icons\\%s", szPath, filename);
+ mir_snprintf(szFullPath, _countof(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i);
BOOL nf;
HICON hi=ExtractIconFromPath(szFullPath,&nf);
if (hi) has_proto_icon=TRUE;
@@ -316,8 +316,8 @@ int CJabberProto::LoadAdvancedIcons(int iID) int first=-1;
HICON empty=LoadSmallIcon(NULL,MAKEINTRESOURCE(102));
- mir_sntprintf(Group, SIZEOF(Group), LPGENT("Status icons")_T("/%s/%S %s"), m_tszUserName, proto, TranslateT("transport"));
- mir_snprintf(defFile, SIZEOF(defFile), "proto_%s.dll",proto);
+ mir_sntprintf(Group, _countof(Group), LPGENT("Status icons")_T("/%s/%S %s"), m_tszUserName, proto, TranslateT("transport"));
+ mir_snprintf(defFile, _countof(defFile), "proto_%s.dll",proto);
if (!hAdvancedStatusIcon)
hAdvancedStatusIcon=(HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0);
@@ -326,7 +326,7 @@ int CJabberProto::LoadAdvancedIcons(int iID) BOOL needFree;
int n = skinStatusToJabberStatus[i];
TCHAR *descr = pcli->pfnGetStatusModeDescription(n+ID_STATUS_OFFLINE, 0);
- mir_snprintf(Uname, SIZEOF(Uname), "%s_Transport_%s_%d", m_szModuleName, proto, n);
+ mir_snprintf(Uname, _countof(Uname), "%s_Transport_%s_%d", m_szModuleName, proto, n);
HICON hicon = LoadTransportIcon(defFile,-skinIconStatusToResourceId[i],Uname,Group,descr,-(n+ID_STATUS_OFFLINE),&needFree);
int index = (m_transportProtoTableStartIndex[iID] == -1)?-1:m_transportProtoTableStartIndex[iID]+n;
int added = ImageList_ReplaceIcon(hAdvancedStatusIcon,index,hicon?hicon:empty);
@@ -343,7 +343,7 @@ int CJabberProto::LoadAdvancedIcons(int iID) int CJabberProto::GetTransportProtoID(TCHAR* TransportDomain)
{
- for (int i=0; i<SIZEOF(TransportProtoTable); i++)
+ for (int i=0; i<_countof(TransportProtoTable); i++)
if ( MatchMask(TransportDomain, TransportProtoTable[i].mask))
return i;
@@ -352,7 +352,7 @@ int CJabberProto::GetTransportProtoID(TCHAR* TransportDomain) int CJabberProto::GetTransportStatusIconIndex(int iID, int Status)
{
- if (iID < 0 || iID >= SIZEOF(TransportProtoTable))
+ if (iID < 0 || iID >= _countof(TransportProtoTable))
return -1;
//icons not loaded - loading icons
@@ -374,7 +374,7 @@ int CJabberProto::GetTransportStatusIconIndex(int iID, int Status) int CJabberProto::OnReloadIcons(WPARAM, LPARAM)
{
- for (int i=0; i < SIZEOF(TransportProtoTable); i++)
+ for (int i=0; i < _countof(TransportProtoTable); i++)
if (m_transportProtoTableStartIndex[i] != -1)
LoadAdvancedIcons(i);
@@ -432,7 +432,7 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, MCONTACT hConta if (resourcepos != NULL)
*resourcepos = '\0';
- for (int i=0; i < SIZEOF(TransportProtoTable); i++)
+ for (int i=0; i < _countof(TransportProtoTable); i++)
if (MatchMask(domain, TransportProtoTable[i].mask)) {
GetTransportStatusIconIndex(GetTransportProtoID(domain), ID_STATUS_OFFLINE);
isTransported = TRUE;
@@ -525,29 +525,29 @@ static IconItem sharedIconList4[] = void g_IconsInit()
{
- Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Jabber"), sharedIconList1, SIZEOF(sharedIconList1), GLOBAL_SETTING_PREFIX);
- Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Jabber")"/"LPGEN("Dialogs"), sharedIconList2, SIZEOF(sharedIconList2), GLOBAL_SETTING_PREFIX);
- Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Dialogs")"/"LPGEN("Discovery"), sharedIconList3, SIZEOF(sharedIconList3), GLOBAL_SETTING_PREFIX);
- Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Dialogs")"/"LPGEN("Privacy"), sharedIconList4, SIZEOF(sharedIconList4), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Jabber"), sharedIconList1, _countof(sharedIconList1), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Jabber")"/"LPGEN("Dialogs"), sharedIconList2, _countof(sharedIconList2), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Dialogs")"/"LPGEN("Discovery"), sharedIconList3, _countof(sharedIconList3), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Dialogs")"/"LPGEN("Privacy"), sharedIconList4, _countof(sharedIconList4), GLOBAL_SETTING_PREFIX);
}
HANDLE g_GetIconHandle(int iconId)
{
int i;
- for (i=0; i < SIZEOF(sharedIconList1); i++)
+ for (i=0; i < _countof(sharedIconList1); i++)
if (sharedIconList1[i].defIconID == iconId)
return sharedIconList1[i].hIcolib;
- for (i=0; i < SIZEOF(sharedIconList2); i++)
+ for (i=0; i < _countof(sharedIconList2); i++)
if (sharedIconList2[i].defIconID == iconId)
return sharedIconList2[i].hIcolib;
- for (i=0; i < SIZEOF(sharedIconList3); i++)
+ for (i=0; i < _countof(sharedIconList3); i++)
if (sharedIconList3[i].defIconID == iconId)
return sharedIconList3[i].hIcolib;
- for (i=0; i < SIZEOF(sharedIconList4); i++)
+ for (i=0; i < _countof(sharedIconList4); i++)
if (sharedIconList4[i].defIconID == iconId)
return sharedIconList4[i].hIcolib;
@@ -557,7 +557,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, _countof(szSettingName), "%s_%s", GLOBAL_SETTING_PREFIX, name);
return IcoLib_GetIcon(szSettingName, big);
}
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index c2b6dc5c67..909f05f939 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -335,8 +335,8 @@ BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo) if (m_options.ShowOSVersion) {
TCHAR os[256] = { 0 };
- if (!GetOSDisplayString(os, SIZEOF(os)))
- mir_tstrncpy(os, _T("Microsoft Windows"), SIZEOF(os));
+ if (!GetOSDisplayString(os, _countof(os)))
+ mir_tstrncpy(os, _T("Microsoft Windows"), _countof(os));
query << XCHILD(_T("os"), os);
}
@@ -393,10 +393,10 @@ BOOL CJabberProto::OnIqRequestTime(HXML, CJabberIqInfo *pInfo) TCHAR stime[100];
TCHAR szTZ[10];
- TimeZone_PrintDateTime(UTC_TIME_HANDLE, _T("I"), stime, SIZEOF(stime), 0);
+ TimeZone_PrintDateTime(UTC_TIME_HANDLE, _T("I"), stime, _countof(stime), 0);
int nGmtOffset = GetGMTOffset();
- mir_sntprintf(szTZ, SIZEOF(szTZ), _T("%+03d:%02d"), nGmtOffset / 60, nGmtOffset % 60);
+ mir_sntprintf(szTZ, _countof(szTZ), _T("%+03d:%02d"), nGmtOffset / 60, nGmtOffset % 60);
XmlNodeIq iq(_T("result"), pInfo);
HXML timeNode = iq << XCHILDNS(_T("time"), JABBER_FEAT_ENTITY_TIME);
@@ -417,7 +417,7 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo) _tzset();
time(<ime);
gmt = gmtime(<ime);
- mir_sntprintf(stime, SIZEOF(stime), _T("%.4i%.2i%.2iT%.2i:%.2i:%.2i"),
+ mir_sntprintf(stime, _countof(stime), _T("%.4i%.2i%.2iT%.2i:%.2i:%.2i"),
gmt->tm_year + 1900, gmt->tm_mon + 1,
gmt->tm_mday, gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
dtime = _tctime(<ime);
@@ -453,7 +453,7 @@ BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo) }
TCHAR szFileName[MAX_PATH];
- GetAvatarFileName(NULL, szFileName, SIZEOF(szFileName));
+ GetAvatarFileName(NULL, szFileName, _countof(szFileName));
FILE* in = _tfopen(szFileName, _T("rb"));
if (in == NULL)
@@ -641,7 +641,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) TCHAR *p = str + 7, *q;
if ((q = _tcschr(p, '/')) != NULL) {
TCHAR text[1024];
- if (q - p < SIZEOF(text)) {
+ if (q - p < _countof(text)) {
_tcsncpy_s(text, p, q - p);
text[q - p] = '\0';
if ((p = _tcschr(text, ':')) != NULL) {
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 38712cd0c1..3e1b65b3f0 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -219,7 +219,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo*) JabberShaStrBuf buf;
T2Utf str(m_ThreadInfo->conn.password);
char text[200];
- mir_snprintf(text, SIZEOF(text), "%s%s", m_ThreadInfo->szStreamId, str);
+ mir_snprintf(text, _countof(text), "%s%s", m_ThreadInfo->szStreamId, str);
query << XCHILD(_T("digest"), _A2T(JabberSha1(text, buf)));
}
else if (xmlGetChild(queryNode, "password") != NULL)
@@ -279,7 +279,7 @@ void CJabberProto::OnIqResultBind(HXML iqNode, CJabberIqInfo *pInfo) if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
LPCTSTR szJid = XPathT(iqNode, "bind[@xmlns='urn:ietf:params:xml:ns:xmpp-bind']/jid");
if (szJid) {
- if (!_tcsncmp(m_ThreadInfo->fullJID, szJid, SIZEOF(m_ThreadInfo->fullJID)))
+ if (!_tcsncmp(m_ThreadInfo->fullJID, szJid, _countof(m_ThreadInfo->fullJID)))
debugLog(_T("Result Bind: %s confirmed "), m_ThreadInfo->fullJID);
else {
debugLog(_T("Result Bind: %s changed to %s"), m_ThreadInfo->fullJID, szJid);
@@ -589,7 +589,7 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP return;
TCHAR szAvatarFileName[MAX_PATH];
- GetAvatarFileName(hContact, szAvatarFileName, SIZEOF(szAvatarFileName));
+ GetAvatarFileName(hContact, szAvatarFileName, _countof(szAvatarFileName));
debugLog(_T("Picture file name set to %s"), szAvatarFileName);
HANDLE hFile = CreateFile(szAvatarFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -752,13 +752,13 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) if (nEmail == 0)
mir_strcpy(text, "e-mail");
else
- mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail - 1);
+ mir_snprintf(text, _countof(text), "e-mail%d", nEmail - 1);
}
- else mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail);
+ else mir_snprintf(text, _countof(text), "e-mail%d", nEmail);
setTString(hContact, text, xmlGetText(m));
if (hContact == NULL) {
- mir_snprintf(text, SIZEOF(text), "e-mailFlag%d", nEmail);
+ mir_snprintf(text, _countof(text), "e-mailFlag%d", nEmail);
int nFlag = 0;
if (xmlGetChild(n, "HOME") != NULL) nFlag |= JABBER_VCEMAIL_HOME;
if (xmlGetChild(n, "WORK") != NULL) nFlag |= JABBER_VCEMAIL_WORK;
@@ -820,7 +820,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) mir_sntprintf(text, _T("%s\r\n%s"), xmlGetText(m), xmlGetText(o));
else
_tcsncpy_s(text, xmlGetText(m), _TRUNCATE);
- text[SIZEOF(text)-1] = '\0';
+ text[_countof(text)-1] = '\0';
setTString(hContact, "Street", text);
}
else {
@@ -863,7 +863,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) mir_sntprintf(text, _T("%s\r\n%s"), xmlGetText(m), xmlGetText(o));
else
_tcsncpy_s(text, xmlGetText(m), _TRUNCATE);
- text[SIZEOF(text)-1] = '\0';
+ text[_countof(text)-1] = '\0';
setTString(hContact, "CompanyStreet", text);
}
else {
@@ -924,10 +924,10 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
else {
char text[100];
- mir_snprintf(text, SIZEOF(text), "Phone%d", nPhone);
+ mir_snprintf(text, _countof(text), "Phone%d", nPhone);
setTString(text, xmlGetText(m));
- mir_snprintf(text, SIZEOF(text), "PhoneFlag%d", nPhone);
+ mir_snprintf(text, _countof(text), "PhoneFlag%d", nPhone);
int nFlag = 0;
if (xmlGetChild(n, "HOME") != NULL) nFlag |= JABBER_VCTEL_HOME;
if (xmlGetChild(n, "WORK") != NULL) nFlag |= JABBER_VCTEL_WORK;
@@ -1012,7 +1012,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) delSetting(hContact, "e-mail");
else {
char text[100];
- mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail - 1);
+ mir_snprintf(text, _countof(text), "e-mail%d", nEmail - 1);
if (db_get_s(hContact, m_szModuleName, text, &dbv)) break;
db_free(&dbv);
delSetting(hContact, text);
@@ -1023,11 +1023,11 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) else {
while (true) {
char text[100];
- mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail);
+ mir_snprintf(text, _countof(text), "e-mail%d", nEmail);
if (getString(text, &dbv)) break;
db_free(&dbv);
delSetting(text);
- mir_snprintf(text, SIZEOF(text), "e-mailFlag%d", nEmail);
+ mir_snprintf(text, _countof(text), "e-mailFlag%d", nEmail);
delSetting(text);
nEmail++;
}
@@ -1057,11 +1057,11 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) else {
while (true) {
char text[100];
- mir_snprintf(text, SIZEOF(text), "Phone%d", nPhone);
+ mir_snprintf(text, _countof(text), "Phone%d", nPhone);
if (getString(text, &dbv)) break;
db_free(&dbv);
delSetting(text);
- mir_snprintf(text, SIZEOF(text), "PhoneFlag%d", nPhone);
+ mir_snprintf(text, _countof(text), "PhoneFlag%d", nPhone);
delSetting(text);
nPhone++;
}
@@ -1327,7 +1327,7 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*) }
TCHAR szJid[JABBER_MAX_JID_LEN];
- mir_tstrncpy(szJid, from, SIZEOF(szJid));
+ mir_tstrncpy(szJid, from, _countof(szJid));
TCHAR *res = _tcschr(szJid, _T('/'));
if (res != NULL)
*res = 0;
@@ -1367,7 +1367,7 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) }
TCHAR szJid[JABBER_MAX_JID_LEN];
- mir_tstrncpy(szJid, from, SIZEOF(szJid));
+ mir_tstrncpy(szJid, from, _countof(szJid));
TCHAR *res = _tcschr(szJid, _T('/'));
if (res != NULL)
*res = 0;
@@ -1407,7 +1407,7 @@ LBL_ErrFormat: TCHAR tszFileName[MAX_PATH];
if (getByte(hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) {
- GetAvatarFileName(hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(hContact, tszFileName, _countof(tszFileName));
DeleteFile(tszFileName);
}
@@ -1419,7 +1419,7 @@ LBL_ErrFormat: mir_sha1_append(&sha, (BYTE*)(char*)body, resultLen);
mir_sha1_finish(&sha, digest);
- GetAvatarFileName(hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(hContact, tszFileName, _countof(tszFileName));
_tcsncpy_s(ai.filename, tszFileName, _TRUNCATE);
FILE *out = _tfopen(tszFileName, _T("wb"));
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index fde613418b..b66a55cf5b 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -117,14 +117,14 @@ static void sttFillJidList(HWND hwndDlg) if (jidListInfo->type == MUC_BANLIST) {
LPCTSTR reason = xmlGetText(xmlGetChild(itemNode , _T("reason")));
if (reason != NULL) {
- mir_sntprintf(tszItemText, SIZEOF(tszItemText), _T("%s (%s)") , jid, reason);
+ mir_sntprintf(tszItemText, _countof(tszItemText), _T("%s (%s)") , jid, reason);
lvi.pszText = tszItemText;
}
}
else if (jidListInfo->type == MUC_VOICELIST || jidListInfo->type == MUC_MODERATORLIST) {
LPCTSTR nick = xmlGetAttrValue(itemNode, _T("nick"));
if (nick != NULL) {
- mir_sntprintf(tszItemText, SIZEOF(tszItemText), _T("%s (%s)") , nick, jid);
+ mir_sntprintf(tszItemText, _countof(tszItemText), _T("%s (%s)") , nick, jid);
lvi.pszText = tszItemText;
}
}
@@ -200,7 +200,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w {IDC_BTN_FILTERAPPLY, "Apply filter", "sd_filter_apply", false},
{IDC_BTN_FILTERRESET, "Reset filter", "sd_filter_reset", false},
};
- for (int i=0; i < SIZEOF(buttons); i++)
+ for (int i=0; i < _countof(buttons); i++)
{
SendDlgItemMessage(hwndDlg, buttons[i].idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)dat->ppro->LoadIconEx(buttons[i].icon));
SendDlgItemMessage(hwndDlg, buttons[i].idc, BUTTONSETASFLATBTN, TRUE, 0);
@@ -248,7 +248,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dat);
// Populate displayed list from iqNode
- mir_tstrncpy(title, TranslateT("JID List"), SIZEOF(title));
+ mir_tstrncpy(title, TranslateT("JID List"), _countof(title));
if ((dat=(JABBER_MUC_JIDLIST_INFO *) lParam) != NULL) {
HXML iqNode = dat->iqNode;
if (iqNode != NULL) {
@@ -258,7 +258,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w HXML queryNode = xmlGetChild(iqNode , _T("query"));
if (queryNode != NULL) {
TCHAR *localFrom = mir_tstrdup(from);
- mir_sntprintf(title, SIZEOF(title), TranslateT("%s, %d items (%s)"),
+ mir_sntprintf(title, _countof(title), TranslateT("%s, %d items (%s)"),
(dat->type == MUC_VOICELIST) ? TranslateT("Voice List") :
(dat->type == MUC_MEMBERLIST) ? TranslateT("Member List") :
(dat->type == MUC_MODERATORLIST) ? TranslateT("Moderator List") :
@@ -331,7 +331,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w lvi.iItem = hti.iItem;
lvi.iSubItem = 0;
lvi.pszText = text;
- lvi.cchTextMax = SIZEOF(text);
+ lvi.cchTextMax = _countof(text);
ListView_GetItem(nm->hdr.hwndFrom, &lvi);
if (lvi.lParam == -1) {
CMString szBuffer(dat->type2str());
@@ -357,7 +357,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w //delete
TCHAR msgText[128];
- mir_sntprintf(msgText, SIZEOF(msgText), TranslateT("Removing %s?"), text);
+ mir_sntprintf(msgText, _countof(msgText), TranslateT("Removing %s?"), text);
if (MessageBox(hwndDlg, msgText, dat->type2str(), MB_YESNO|MB_SETFOREGROUND) == IDYES) {
dat->ppro->DeleteMucListItem(dat, (TCHAR*)lvi.lParam);
mir_free((void *)lvi.lParam);
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index f100a5afbf..727f31b3a4 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -64,7 +64,7 @@ static PresenceModeArray[] = { SKINICON_STATUS_DND, ID_STATUS_DND },
{ SKINICON_STATUS_FREE4CHAT, ID_STATUS_FREECHAT },
};
-static HGENMENU g_hMenuDirectPresence[SIZEOF(PresenceModeArray) + 1];
+static HGENMENU g_hMenuDirectPresence[_countof(PresenceModeArray) + 1];
static INT_PTR JabberMenuChooseService(WPARAM wParam, LPARAM lParam)
{
@@ -287,9 +287,9 @@ void g_MenuInit(void) g_hMenuDirectPresence[0] = Menu_AddContactMenuItem(&mi);
mi.flags |= CMIF_ROOTHANDLE | CMIF_TCHAR;
- for (int i=0; i < SIZEOF(PresenceModeArray); i++) {
+ for (int i=0; i < _countof(PresenceModeArray); i++) {
char buf[] = "Jabber/DirectPresenceX";
- buf[SIZEOF(buf)-2] = '0' + i;
+ buf[_countof(buf)-2] = '0' + i;
mi.pszService = buf;
mi.ptszName = pcli->pfnGetStatusModeDescription(PresenceModeArray[i].mode, 0);
mi.position = -1999901000;
@@ -368,7 +368,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) return 0;
Menu_ShowItem(g_hMenuDirectPresence[0], TRUE);
- for (int i=0; i < SIZEOF(PresenceModeArray); i++) {
+ for (int i=0; i < _countof(PresenceModeArray); i++) {
CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_ICON | CMIM_FLAGS;
clmi.hIcon = (HICON)Skin_LoadProtoIcon(m_szModuleName, PresenceModeArray[i].mode);
@@ -445,7 +445,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) CMString szTmp;
for (int i=0; i < nMenuResourceItemsNew; i++) {
- mir_snprintf(tDest, SIZEOF(text) - nModuleNameLength, "/UseResource_%d", i);
+ mir_snprintf(tDest, _countof(text) - nModuleNameLength, "/UseResource_%d", i);
if (i >= m_nMenuResourceItems) {
CreateProtoServiceParam(tDest, &CJabberProto::OnMenuHandleResource, MENUITEM_RESOURCES+i);
mi.pszName = "";
@@ -734,19 +734,19 @@ void CJabberProto::MenuInit() mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.hParentMenu = m_hMenuPriorityRoot;
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuSetPriority/0", m_szModuleName);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/menuSetPriority/0", m_szModuleName);
bool needServices = !ServiceExists(srvFce);
if (needServices)
CreateProtoServiceParam(svcName, &CJabberProto::OnMenuSetPriority, 0);
int steps[] = { 10, 5, 1, 0, -1, -5, -10 };
- for (int i = 0; i < SIZEOF(steps); i++) {
+ for (int i = 0; i < _countof(steps); i++) {
if (!steps[i]) {
mi.position += 100000;
continue;
}
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuSetPriority/%d", m_szModuleName, steps[i]);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/menuSetPriority/%d", m_szModuleName, steps[i]);
if (steps[i] > 0) {
mir_sntprintf(szName, TranslateT("Increase priority by %d"), steps[i]);
mi.icolibItem = GetIconHandle(IDI_ARROW_UP);
@@ -1004,7 +1004,7 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam) return 0;
TCHAR jid[JABBER_MAX_JID_LEN];
- if (GetClientJID(event->hContact, jid, SIZEOF(jid))) {
+ if (GetClientJID(event->hContact, jid, _countof(jid))) {
pResourceStatus r(ResourceInfoFromJID(jid));
if (r && r->m_bMessageSessionActive) {
r->m_bMessageSessionActive = FALSE;
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 6c9372874b..e0961c2a9f 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -61,8 +61,8 @@ int JabberCompareJids(const TCHAR *jid1, const TCHAR *jid2) // match only node@domain part
TCHAR szTempJid1[JABBER_MAX_JID_LEN], szTempJid2[JABBER_MAX_JID_LEN];
return mir_tstrcmpi(
- JabberStripJid(jid1, szTempJid1, SIZEOF(szTempJid1)),
- JabberStripJid(jid2, szTempJid2, SIZEOF(szTempJid2)));
+ JabberStripJid(jid1, szTempJid1, _countof(szTempJid1)),
+ JabberStripJid(jid2, szTempJid2, _countof(szTempJid2)));
}
///////////////////////////////////////////////////////////////////////////////
@@ -361,14 +361,14 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMString &res) int i;
// search through known software list
- for (i = 0; i < SIZEOF(sttCapsNodeToName_Map); i++)
+ for (i = 0; i < _countof(sttCapsNodeToName_Map); i++)
if (_tcsstr(resource->m_tszCapsNode, sttCapsNodeToName_Map[i].node)) {
res.Format(_T("%s %s"), sttCapsNodeToName_Map[i].name, resource->m_tszCapsVer);
break;
}
// unknown software
- if (i == SIZEOF(sttCapsNodeToName_Map))
+ if (i == _countof(sttCapsNodeToName_Map))
res.Format(_T("%s %s"), resource->m_tszCapsNode, resource->m_tszCapsVer);
}
@@ -407,9 +407,9 @@ void CJabberProto::UpdateMirVer(MCONTACT hContact, pResourceStatus &resource) TCHAR szFullJid[JABBER_MAX_JID_LEN];
if (resource->m_tszResourceName && !_tcschr(jid, '/'))
- mir_sntprintf(szFullJid, SIZEOF(szFullJid), _T("%s/%s"), jid, resource->m_tszResourceName);
+ mir_sntprintf(szFullJid, _countof(szFullJid), _T("%s/%s"), jid, resource->m_tszResourceName);
else
- mir_tstrncpy(szFullJid, jid, SIZEOF(szFullJid));
+ mir_tstrncpy(szFullJid, jid, _countof(szFullJid));
setTString(hContact, DBSETTING_DISPLAY_UID, szFullJid);
}
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index df53cb80f4..f521cdcbfe 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -437,7 +437,7 @@ protected: // fill predefined resources
TCHAR *szResources[] = { _T("Home"), _T("Work"), _T("Office"), _T("Miranda") };
- for (int i=0; i < SIZEOF(szResources); i++)
+ for (int i=0; i < _countof(szResources); i++)
m_cbResource.AddString(szResources[i]);
// append computer name to the resource list
@@ -546,7 +546,7 @@ private: if (!m_proto->EnterString(buf, TranslateT("Confirm password"), ESF_PASSWORD))
return;
- m_txtPassword.GetText(pass, SIZEOF(pass));
+ m_txtPassword.GetText(pass, _countof(pass));
if (mir_tstrcmp(buf, pass)) {
MessageBox(m_hwnd, TranslateT("Passwords do not match."), _T("Miranda NG"), MB_ICONSTOP|MB_OK);
return;
@@ -558,12 +558,12 @@ private: SendMessage(m_hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
JABBER_CONN_DATA regInfo;
- m_txtUsername.GetText(regInfo.username, SIZEOF(regInfo.username));
- m_txtPassword.GetText(regInfo.password, SIZEOF(regInfo.password));
- m_cbServer.GetTextA(regInfo.server, SIZEOF(regInfo.server));
+ m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
+ m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
+ m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
if (m_chkManualHost.GetState() == BST_CHECKED) {
regInfo.port = (WORD)m_txtManualPort.GetInt();
- m_txtManualHost.GetTextA(regInfo.manualHost, SIZEOF(regInfo.manualHost));
+ m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
}
else {
regInfo.port = (WORD)m_txtPort.GetInt();
@@ -677,12 +677,12 @@ private: void CheckRegistration()
{
JABBER_CONN_DATA regInfo;
- m_txtUsername.GetText(regInfo.username, SIZEOF(regInfo.username));
- m_txtPassword.GetText(regInfo.password, SIZEOF(regInfo.password));
- m_cbServer.GetTextA(regInfo.server, SIZEOF(regInfo.server));
+ m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
+ m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
+ m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
if (m_chkManualHost.GetState() == BST_CHECKED) {
regInfo.port = (WORD)m_txtManualPort.GetInt();
- m_txtManualHost.GetTextA(regInfo.manualHost, SIZEOF(regInfo.manualHost));
+ m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
}
else {
regInfo.port = (WORD)m_txtPort.GetInt();
@@ -1058,10 +1058,10 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) TCHAR name[260]=_T("");
TCHAR group[260]=_T("");
TCHAR subscr[260]=_T("");
- ListView_GetItemText(hList, index, 0, jid, SIZEOF(jid));
- ListView_GetItemText(hList, index, 1, name, SIZEOF(name));
- ListView_GetItemText(hList, index, 2, group, SIZEOF(group));
- ListView_GetItemText(hList, index, 3, subscr, SIZEOF(subscr));
+ ListView_GetItemText(hList, index, 0, jid, _countof(jid));
+ ListView_GetItemText(hList, index, 1, name, _countof(name));
+ ListView_GetItemText(hList, index, 2, group, _countof(group));
+ ListView_GetItemText(hList, index, 3, subscr, _countof(subscr));
HXML itemRoster = xmlGetChildByTag(queryRoster, "item", "jid", jid);
BOOL bRemove = !ListView_GetCheckState(hList,index);
if (itemRoster && bRemove) {
@@ -1179,7 +1179,7 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg) TCHAR filename[MAX_PATH] = { 0 };
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s (*.xml)%c*.xml%c%c"), TranslateT("XML for MS Excel (UTF-8 encoded)"), 0, 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s (*.xml)%c*.xml%c%c"), TranslateT("XML for MS Excel (UTF-8 encoded)"), 0, 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
@@ -1187,7 +1187,7 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg) ofn.lpstrFilter = filter;
ofn.lpstrFile = filename;
ofn.Flags = OFN_HIDEREADONLY;
- ofn.nMaxFile = SIZEOF(filename);
+ ofn.nMaxFile = _countof(filename);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("xml");
if (!GetSaveFileName(&ofn)) return;
@@ -1214,10 +1214,10 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg) TCHAR name[260]=_T("");
TCHAR group[260]=_T("");
TCHAR subscr[260]=_T("");
- ListView_GetItemText(hList, index, 0, jid, SIZEOF(jid));
- ListView_GetItemText(hList, index, 1, name, SIZEOF(name));
- ListView_GetItemText(hList, index, 2, group, SIZEOF(group));
- ListView_GetItemText(hList, index, 3, subscr, SIZEOF(subscr));
+ ListView_GetItemText(hList, index, 0, jid, _countof(jid));
+ ListView_GetItemText(hList, index, 1, name, _countof(name));
+ ListView_GetItemText(hList, index, 2, group, _countof(group));
+ ListView_GetItemText(hList, index, 3, subscr, _countof(subscr));
HXML node = table << XCHILD(_T("Row"));
node << XCHILD(_T("Cell")) << XCHILD(_T("Data"), _T("+")) << XATTR(_T("ss:Type"), _T("String"));
@@ -1248,7 +1248,7 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg) ofn.lpstrFilter = filter;
ofn.lpstrFile = filename;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = SIZEOF(filename);
+ ofn.nMaxFile = _countof(filename);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = "xml";
if (!GetOpenFileNameA(&ofn))
@@ -1351,7 +1351,7 @@ static LRESULT CALLBACK _RosterNewListProc(HWND hList, UINT msg, WPARAM wParam, RECT rc;
TCHAR buff[260];
ListView_GetSubItemRect(hList, lvhti.iItem, lvhti.iSubItem, LVIR_BOUNDS,&rc);
- ListView_GetItemText(hList, lvhti.iItem, lvhti.iSubItem, buff, SIZEOF(buff));
+ ListView_GetItemText(hList, lvhti.iItem, lvhti.iSubItem, buff, _countof(buff));
HWND hEditor=CreateWindow(TEXT("EDIT"),buff,WS_CHILD|ES_AUTOHSCROLL,rc.left+3, rc.top+2, rc.right-rc.left-3, rc.bottom - rc.top-3,hList, NULL, hInst, NULL);
SendMessage(hEditor,WM_SETFONT,(WPARAM)SendMessage(hList,WM_GETFONT,0,0),0);
ShowWindow(hEditor,SW_SHOW);
@@ -1593,7 +1593,7 @@ protected: // fill predefined resources
TCHAR *szResources[] = { _T("Home"), _T("Work"), _T("Office"), _T("Miranda") };
- for (int i=0; i < SIZEOF(szResources); i++)
+ for (int i=0; i < _countof(szResources); i++)
m_cbResource.AddString(szResources[i]);
// append computer name to the resource list
@@ -1619,10 +1619,10 @@ protected: m_cbType.AddString(TranslateT("S.ms"), ACC_SMS);
char server[256], manualServer[256]={0};
- m_cbServer.GetTextA(server, SIZEOF(server));
+ m_cbServer.GetTextA(server, _countof(server));
ptrA dbManualServer( db_get_sa(NULL, m_proto->m_szModuleName, "ManualHost"));
if (dbManualServer != NULL)
- mir_strncpy(manualServer, dbManualServer, SIZEOF(manualServer));
+ mir_strncpy(manualServer, dbManualServer, _countof(manualServer));
m_canregister = true;
if (!mir_strcmp(manualServer, "talk.google.com")) {
@@ -1696,7 +1696,7 @@ protected: TCHAR szCompName[MAX_COMPUTERNAME_LENGTH + 1], szResource[MAX_COMPUTERNAME_LENGTH + 1];
DWORD dwCompNameLength = MAX_COMPUTERNAME_LENGTH;
if (GetComputerName(szCompName, &dwCompNameLength)) {
- m_cbResource.GetText(szResource, SIZEOF(szResource));
+ m_cbResource.GetText(szResource, _countof(szResource));
if (!mir_tstrcmp(szCompName, szResource))
bUseHostnameAsResource = TRUE;
}
@@ -1750,8 +1750,8 @@ protected: char server[256];
char manualServer[256];
- m_cbServer.GetTextA(server, SIZEOF(server));
- m_txtManualHost.GetTextA(manualServer, SIZEOF(manualServer));
+ m_cbServer.GetTextA(server, _countof(server));
+ m_txtManualHost.GetTextA(manualServer, _countof(manualServer));
if ((m_chkManualHost.GetState() == BST_CHECKED) && mir_strcmp(server, manualServer)) {
m_proto->m_options.ManualConnect = TRUE;
@@ -1808,7 +1808,7 @@ private: return;
TCHAR pass[512];
- m_txtPassword.GetText(pass, SIZEOF(pass));
+ m_txtPassword.GetText(pass, _countof(pass));
if (mir_tstrcmp(buf, pass)) {
MessageBox(m_hwnd, TranslateT("Passwords do not match."), _T("Miranda NG"), MB_ICONSTOP|MB_OK);
return;
@@ -1820,12 +1820,12 @@ private: SendMessage(m_hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
JABBER_CONN_DATA regInfo;
- m_txtUsername.GetText(regInfo.username, SIZEOF(regInfo.username));
- m_txtPassword.GetText(regInfo.password, SIZEOF(regInfo.password));
- m_cbServer.GetTextA(regInfo.server, SIZEOF(regInfo.server));
+ m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
+ m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
+ m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
regInfo.port = (WORD)m_txtPort.GetInt();
if (m_chkManualHost.GetState() == BST_CHECKED)
- m_txtManualHost.GetTextA(regInfo.manualHost, SIZEOF(regInfo.manualHost));
+ m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
else
regInfo.manualHost[0] = '\0';
@@ -1867,7 +1867,7 @@ private: if (chk->GetState() == BST_CHECKED) {
char buf[256];
- m_cbServer.GetTextA(buf, SIZEOF(buf));
+ m_cbServer.GetTextA(buf, _countof(buf));
m_txtManualHost.SetTextA(buf);
m_txtPort.SetInt(5222);
@@ -1902,12 +1902,12 @@ void CJabberDlgAccMgrUI::CheckRegistration() }
JABBER_CONN_DATA regInfo;
- m_txtUsername.GetText(regInfo.username, SIZEOF(regInfo.username));
- m_txtPassword.GetText(regInfo.password, SIZEOF(regInfo.password));
- m_cbServer.GetTextA(regInfo.server, SIZEOF(regInfo.server));
+ m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
+ m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
+ m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
regInfo.port = m_txtPort.GetInt();
if (m_chkManualHost.GetState() == BST_CHECKED)
- m_txtManualHost.GetTextA(regInfo.manualHost, SIZEOF(regInfo.manualHost));
+ m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
else
regInfo.manualHost[0] = '\0';
diff --git a/protocols/JabberG/src/jabber_password.cpp b/protocols/JabberG/src/jabber_password.cpp index e36ed79c55..8b047cc134 100644 --- a/protocols/JabberG/src/jabber_password.cpp +++ b/protocols/JabberG/src/jabber_password.cpp @@ -59,13 +59,13 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR case IDOK:
if (ppro->m_bJabberOnline && ppro->m_ThreadInfo != NULL) {
TCHAR newPasswd[512], text[512];
- GetDlgItemText(hwndDlg, IDC_NEWPASSWD, newPasswd, SIZEOF(newPasswd));
- GetDlgItemText(hwndDlg, IDC_NEWPASSWD2, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_NEWPASSWD, newPasswd, _countof(newPasswd));
+ GetDlgItemText(hwndDlg, IDC_NEWPASSWD2, text, _countof(text));
if (mir_tstrcmp(newPasswd, text)) {
MessageBox(hwndDlg, TranslateT("New password does not match."), TranslateT("Change Password"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
break;
}
- GetDlgItemText(hwndDlg, IDC_OLDPASSWD, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_OLDPASSWD, text, _countof(text));
if (mir_tstrcmp(text, ppro->m_ThreadInfo->conn.password)) {
MessageBox(hwndDlg, TranslateT("Current password is incorrect."), TranslateT("Change Password"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
break;
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 558d70b028..2a8a556305 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -314,7 +314,7 @@ public: void btnOk_OnClick(CCtrlButton*)
{
- GetDlgItemText(m_hwnd, IDC_EDIT_NAME, szLine, SIZEOF(szLine));
+ GetDlgItemText(m_hwnd, IDC_EDIT_NAME, szLine, _countof(szLine));
EndDialog(m_hwnd, 1);
}
void btnCancel_OnClick(CCtrlButton*)
@@ -369,7 +369,7 @@ public: TCHAR *szTypes[] = { _T("JID"), _T("Group"), _T("Subscription"), _T("Any") };
int i, nTypes[] = { Jid, Group, Subscription, Else };
- for (i=0; i < SIZEOF(szTypes); i++) {
+ for (i=0; i < _countof(szTypes); i++) {
LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szTypes[i]));
SendDlgItemMessage(m_hwnd, IDC_COMBO_TYPE, CB_SETITEMDATA, nItem, nTypes[i]);
if (m_pRule->GetType() == nTypes[i])
@@ -378,7 +378,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_RESETCONTENT, 0, 0);
TCHAR *szSubscriptions[] = { _T("none"), _T("from"), _T("to"), _T("both") };
- for (i=0; i < SIZEOF(szSubscriptions); i++) {
+ for (i=0; i < _countof(szSubscriptions); i++) {
LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szSubscriptions[i]));
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_SETITEMDATA, nItem, (LPARAM)szSubscriptions[i]);
}
@@ -497,7 +497,7 @@ public: case Group:
{
TCHAR szText[ 512 ];
- GetDlgItemText(m_hwnd, IDC_COMBO_VALUES, szText, SIZEOF(szText));
+ GetDlgItemText(m_hwnd, IDC_COMBO_VALUES, szText, _countof(szText));
m_pRule->SetValue(szText);
}
break;
@@ -946,7 +946,7 @@ BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) DrawLists(lpdis);
else if (lpdis->CtlID == IDC_CANVAS) {
int i, totalWidth = -5; // spacing for last item
- for (i=0; i < SIZEOF(drawItems); i++) {
+ for (i=0; i < _countof(drawItems); i++) {
SIZE sz = {0};
drawItems[i].text = TranslateTS(drawItems[i].textEng);
GetTextExtentPoint32(lpdis->hDC, drawItems[i].text, (int)mir_tstrlen(drawItems[i].text), &sz);
@@ -957,7 +957,7 @@ BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) RECT rc = lpdis->rcItem;
rc.left = (rc.left + rc.right - totalWidth)/2;
- for (i=0; i < SIZEOF(drawItems); i++) {
+ for (i=0; i < _countof(drawItems); i++) {
DrawIconEx(lpdis->hDC, rc.left, (rc.top+rc.bottom-16)/2, m_proto->LoadIconEx(drawItems[i].icon),
16, 16, 0, NULL, DI_NORMAL);
rc.left += 18;
@@ -991,16 +991,16 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) TCHAR szTypeValue[ 512 ];
switch (pRule->GetType()) {
case Jid:
- mir_sntprintf(szTypeValue, SIZEOF(szTypeValue), _T("If Jabber ID is '%s' then"), pRule->GetValue());
+ mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("If Jabber ID is '%s' then"), pRule->GetValue());
break;
case Group:
- mir_sntprintf(szTypeValue, SIZEOF(szTypeValue), _T("If group is '%s' then"), pRule->GetValue());
+ mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("If group is '%s' then"), pRule->GetValue());
break;
case Subscription:
- mir_sntprintf(szTypeValue, SIZEOF(szTypeValue), _T("If subscription is '%s' then"), pRule->GetValue());
+ mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("If subscription is '%s' then"), pRule->GetValue());
break;
case Else:
- mir_sntprintf(szTypeValue, SIZEOF(szTypeValue), _T("Else"));
+ mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("Else"));
break;
}
@@ -1033,7 +1033,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) }
TCHAR szListItem[ 512 ];
- mir_sntprintf(szListItem, SIZEOF(szListItem), _T("%s %s %s"), szTypeValue, pRule->GetAction() ? _T("allow") : _T("deny"), szPackets);
+ mir_sntprintf(szListItem, _countof(szListItem), _T("%s %s %s"), szTypeValue, pRule->GetAction() ? _T("allow") : _T("deny"), szPackets);
LRESULT nItemId = SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_ADDSTRING, 0, (LPARAM)szListItem);
SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_SETITEMDATA, nItemId, (LPARAM)pRule);
@@ -2101,7 +2101,7 @@ void CJabberProto::BuildPrivacyMenu() CreateProtoService("/PrivacyLists", &CJabberProto::OnMenuHandlePrivacyLists);
char srvFce[MAX_PATH + 64];
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/PrivacyLists", m_szModuleName);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/PrivacyLists", m_szModuleName);
mi.pszService = srvFce;
mi.position = 3000040000;
mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR;
@@ -2130,7 +2130,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) mi.pszService = srvFce;
int i = 0;
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
if (i > m_privacyMenuServiceAllocated) {
CreateProtoServiceParam(svcName, &CJabberProto::menuSetPrivacyList, i);
m_privacyMenuServiceAllocated = i;
@@ -2142,7 +2142,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) for (CPrivacyList *pList = m_privacyListManager.GetFirstList(); pList; pList = pList->GetNext()) {
i++;
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
if (i > m_privacyMenuServiceAllocated) {
CreateProtoServiceParam(svcName, &CJabberProto::menuSetPrivacyList, i);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 076e76aeca..3ea5af5ddf 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -46,8 +46,8 @@ static int compareListItems(const JABBER_LIST_ITEM *p1, const JABBER_LIST_ITEM * return mir_tstrcmpi(p1->jid, p2->jid);
TCHAR szp1[JABBER_MAX_JID_LEN], szp2[JABBER_MAX_JID_LEN];
- JabberStripJid(p1->jid, szp1, SIZEOF(szp1));
- JabberStripJid(p2->jid, szp2, SIZEOF(szp2));
+ JabberStripJid(p1->jid, szp1, _countof(szp1));
+ JabberStripJid(p2->jid, szp2, _countof(szp2));
return mir_tstrcmpi(szp1, szp2);
}
@@ -577,7 +577,7 @@ DWORD_PTR __cdecl CJabberProto::GetCaps(int type, MCONTACT hContact) return (DWORD_PTR)"jid";
case PFLAG_MAXCONTACTSPERPACKET:
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if (GetClientJID(hContact, szClientJid, SIZEOF(szClientJid))) {
+ if (GetClientJID(hContact, szClientJid, _countof(szClientJid))) {
JabberCapsBits jcb = GetResourceCapabilites(szClientJid, TRUE);
return ((~jcb & JABBER_CAPS_ROSTER_EXCHANGE) ? 0 : 50);
}
@@ -594,10 +594,10 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) return 1;
TCHAR jid[JABBER_MAX_JID_LEN], szBareJid[JABBER_MAX_JID_LEN];
- if (!GetClientJID(hContact, jid, SIZEOF(jid)))
+ if (!GetClientJID(hContact, jid, _countof(jid)))
return 1;
- JabberStripJid(jid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(jid, szBareJid, _countof(szBareJid));
bool bUseResource = ListGetItemPtr(LIST_CHATROOM, szBareJid) != NULL;
if (m_ThreadInfo) {
@@ -633,7 +633,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) for (int i=0; i < item->arResources.getCount(); i++) {
pResourceStatus r(item->arResources[i]);
TCHAR tmp[JABBER_MAX_JID_LEN];
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s/%s"), szBareJid, r->m_tszResourceName);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s/%s"), szBareJid, r->m_tszResourceName);
if (r->m_jcbCachedCaps & JABBER_CAPS_DISCO_INFO) {
XmlNodeIq iq5(AddIQ(&CJabberProto::OnIqResultCapsDiscoInfoSI, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE | JABBER_IQ_PARSE_HCONTACT));
@@ -716,7 +716,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid) mir_free(szServer);
szServer = mir_tstrdup(_T("sms"));
}
- mir_sntprintf(jsb->jid, SIZEOF(jsb->jid), _T("%s@%s"), szJid, szServer);
+ mir_sntprintf(jsb->jid, _countof(jsb->jid), _T("%s@%s"), szJid, szServer);
}
else _tcsncpy_s(jsb->jid, szJid, _TRUNCATE);
mir_free(szServer);
@@ -813,7 +813,7 @@ int __cdecl CJabberProto::SendContacts(MCONTACT hContact, int, int nContacts, MC return 0;
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if (!GetClientJID(hContact, szClientJid, SIZEOF(szClientJid)))
+ if (!GetClientJID(hContact, szClientJid, _countof(szClientJid)))
return 0;
JabberCapsBits jcb = GetResourceCapabilites(szClientJid, TRUE);
@@ -952,7 +952,7 @@ static char PGP_EPILOG[] = "\r\n-----END PGP MESSAGE-----\r\n"; int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int, const char* pszSrc)
{
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if (!m_bJabberOnline || !GetClientJID(hContact, szClientJid, SIZEOF(szClientJid))) {
+ if (!m_bJabberOnline || !GetClientJID(hContact, szClientJid, _countof(szClientJid))) {
TFakeAckParams *param = new TFakeAckParams(hContact, Translate("Protocol is offline or no JID"));
ForkThread(&CJabberProto::SendMessageAckThread, param);
return 1;
@@ -1239,7 +1239,7 @@ int __cdecl CJabberProto::UserIsTyping(MCONTACT hContact, int type) if (!m_bJabberOnline) return 0;
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if (!GetClientJID(hContact, szClientJid, SIZEOF(szClientJid)))
+ if (!GetClientJID(hContact, szClientJid, _countof(szClientJid)))
return 0;
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, szClientJid);
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index a2ac93a80d..6e11c3c324 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -310,7 +310,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc // priority
TCHAR szPriority[ 256 ];
- mir_sntprintf(szPriority, SIZEOF(szPriority), _T("%d"), (short)getWord("Priority", 5));
+ mir_sntprintf(szPriority, _countof(szPriority), _T("%d"), (short)getWord("Priority", 5));
xNode << XCHILD(_T("field")) << XATTR(_T("label"), TranslateT("Priority")) << XATTR(_T("type"), _T("text-single"))
<< XATTR(_T("var"), _T("status-priority")) << XCHILD(_T("value"), szPriority);
@@ -414,12 +414,12 @@ int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe // Automatically Accept File Transfers
TCHAR szTmpBuff[ 1024 ];
- mir_sntprintf(szTmpBuff, SIZEOF(szTmpBuff), _T("%d"), db_get_b(NULL, "SRFile", "AutoAccept", 0));
+ mir_sntprintf(szTmpBuff, _countof(szTmpBuff), _T("%d"), db_get_b(NULL, "SRFile", "AutoAccept", 0));
xNode << XCHILD(_T("field")) << XATTR(_T("label"), TranslateT("Automatically Accept File Transfers"))
<< XATTR(_T("type"), _T("boolean")) << XATTR(_T("var"), _T("auto-files")) << XCHILD(_T("value"), szTmpBuff);
// Use sounds
- mir_sntprintf(szTmpBuff, SIZEOF(szTmpBuff), _T("%d"), db_get_b(NULL, "Skin", "UseSound", 0));
+ mir_sntprintf(szTmpBuff, _countof(szTmpBuff), _T("%d"), db_get_b(NULL, "Skin", "UseSound", 0));
xNode << XCHILD(_T("field")) << XATTR(_T("label"), TranslateT("Play sounds"))
<< XATTR(_T("type"), _T("boolean")) << XATTR(_T("var"), _T("sounds")) << XCHILD(_T("value"), szTmpBuff);
@@ -495,7 +495,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe if (pSession->GetStage() == 0) {
int nUnreadEvents = RcGetUnreadEventsCount();
if (!nUnreadEvents) {
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("There is no messages to forward"));
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("There is no messages to forward"));
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
@@ -517,7 +517,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe xNode << XCHILD(_T("title"), TranslateT("Forward options"));
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("%d message(s) to be forwarded"), nUnreadEvents);
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("%d message(s) to be forwarded"), nUnreadEvents);
xNode << XCHILD(_T("instructions"), szMsg);
xNode << XCHILD(_T("field")) << XATTR(_T("type"), _T("hidden")) << XATTR(_T("var"), _T("FORM_TYPE"))
@@ -583,7 +583,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe size_t cbBlob = mir_strlen((LPSTR)dbei.pBlob)+1;
if (cbBlob < dbei.cbBlob) { // rest of message contains a sender's resource
ptrT szOResource( mir_utf8decodeT((LPSTR)dbei.pBlob + cbBlob+1));
- mir_sntprintf(szOFrom, SIZEOF(szOFrom), _T("%s/%s"), tszJid, szOResource);
+ mir_sntprintf(szOFrom, _countof(szOFrom), _T("%s/%s"), tszJid, szOResource);
} else
_tcsncpy_s(szOFrom, tszJid, _TRUNCATE);
@@ -593,7 +593,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe time_t ltime = (time_t)dbei.timestamp;
struct tm *gmt = gmtime(<ime);
TCHAR stime[512];
- mir_sntprintf(stime, SIZEOF(stime), _T("%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ"), gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
+ mir_sntprintf(stime, _countof(stime), _T("%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ"), gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
msg << XCHILDNS(_T("delay"), _T("urn:xmpp:delay")) << XATTR(_T("stamp"), stime);
@@ -607,7 +607,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe }
}
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("%d message(s) forwarded"), nEventsSent);
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("%d message(s) forwarded"), nEventsSent);
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
@@ -627,9 +627,9 @@ int CJabberProto::AdhocLockWSHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSes TCHAR szMsg[ 1024 ];
if (bOk)
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("Workstation successfully locked"));
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("Workstation successfully locked"));
else
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("Error %d occurred during workstation lock"), GetLastError());
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("Error %d occurred during workstation lock"), GetLastError());
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
@@ -709,7 +709,7 @@ int CJabberProto::AdhocLeaveGroupchatsHandler(HXML, CJabberIqInfo *pInfo, CJabbe if (!nChatsCount) {
TCHAR szMsg[ 1024 ];
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("There is no group chats to leave"));
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("There is no group chats to leave"));
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index af1ebda659..87fcc15b21 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -461,7 +461,7 @@ int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData *dat) { TCHAR szServerName[100]; EnableWindow(GetDlgItem(hwndDlg, IDC_GO), FALSE); - GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, SIZEOF(szServerName)); + GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, _countof(szServerName)); dat->CurrentHeight = 0; dat->curPos = 0; SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, 0, FALSE); @@ -493,21 +493,21 @@ void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, BOOL deleteLastFr //search in recent for (int i = 0; i < 10; i++) { char key[30]; - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", i); ptrT szValue(getTStringA(key)); if (szValue == NULL || mir_tstrcmpi(szAddr, szValue)) continue; for (int j = i; j < 10; j++) { - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j + 1); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", j + 1); szValue = getTStringA(key); if (szValue != NULL) { - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", j); setTString(NULL, key, szValue); } else { if (deleteLastFromDB) { - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", j); delSetting(NULL, key); } break; @@ -523,15 +523,15 @@ void CJabberProto::SearchAddToRecent(const TCHAR *szAddr, HWND hwndDialog) SearchDeleteFromRecent(szAddr); for (int j = 9; j > 0; j--) { - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j - 1); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", j - 1); ptrT szValue(getTStringA(key)); if (szValue != NULL) { - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", j); setTString(NULL, key, szValue); } } - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", 0); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", 0); setTString(key, szAddr); if (hwndDialog) JabberSearchAddUrlToRecentCombo(hwndDialog, szAddr); @@ -563,7 +563,7 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR for (i = 0; i < 10; i++) { char key[30]; - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", i); ptrT szValue(dat->ppro->getTStringA(key)); if (szValue != NULL) JabberSearchAddUrlToRecentCombo(hwndDlg, szValue); @@ -743,7 +743,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg) // get server name TCHAR szServerName[100]; - GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, SIZEOF(szServerName)); + GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, _countof(szServerName)); // formating query CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultAdvancedSearch, JABBER_IQ_TYPE_SET, szServerName); @@ -764,7 +764,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg) else { //and Simple fields: XEP-0055 Example 3 for (int i = 0; i < dat->nJSInfCount; i++) { TCHAR szFieldValue[100]; - GetWindowText(dat->pJSInf[i].hwndValueItem, szFieldValue, SIZEOF(szFieldValue)); + GetWindowText(dat->pJSInf[i].hwndValueItem, szFieldValue, _countof(szFieldValue)); if (szFieldValue[0] != 0) { xmlAddChild(query, dat->pJSInf[i].szFieldName, szFieldValue); fRequestNotEmpty = TRUE; diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index 5bebb8ac3a..24c93439db 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -50,7 +50,7 @@ LBL_Invalid: TCHAR szSpn[1024] = _T("");
if (mir_strcmp(mechanism, "NTLM"))
- if (!getSpn(szSpn, SIZEOF(szSpn)) && !mir_strcmp(mechanism, "GSSAPI"))
+ if (!getSpn(szSpn, _countof(szSpn)) && !mir_strcmp(mechanism, "GSSAPI"))
goto LBL_Invalid;
if ((hProvider = Netlib_InitSecurityProvider2(szProvider, szSpn)) == NULL)
@@ -66,10 +66,10 @@ TNtlmAuth::~TNtlmAuth() bool TNtlmAuth::getSpn(TCHAR* szSpn, size_t dwSpnLen)
{
TCHAR szFullUserName[128] = _T("");
- ULONG szFullUserNameLen = SIZEOF(szFullUserName);
+ ULONG szFullUserNameLen = _countof(szFullUserName);
if (!GetUserNameEx(NameDnsDomain, szFullUserName, &szFullUserNameLen)) {
szFullUserName[0] = 0;
- szFullUserNameLen = SIZEOF(szFullUserName);
+ szFullUserNameLen = _countof(szFullUserName);
GetUserNameEx(NameSamCompatible, szFullUserName, &szFullUserNameLen);
}
@@ -155,7 +155,7 @@ char* TMD5Auth::getChallenge(const TCHAR *challenge) mir_md5_state_t ctx;
CallService(MS_UTILS_GETRANDOM, sizeof(digest), (LPARAM)digest);
- mir_snprintf(cnonce, SIZEOF(cnonce), "%08x%08x%08x%08x", htonl(digest[0]), htonl(digest[1]), htonl(digest[2]), htonl(digest[3]));
+ mir_snprintf(cnonce, _countof(cnonce), "%08x%08x%08x%08x", htonl(digest[0]), htonl(digest[1]), htonl(digest[2]), htonl(digest[3]));
T2Utf uname(info->conn.username), passw(info->conn.password);
ptrA serv(mir_utf8encode(info->conn.server));
@@ -182,15 +182,15 @@ char* TMD5Auth::getChallenge(const TCHAR *challenge) mir_md5_finish(&ctx, (BYTE*)hash2);
mir_md5_init(&ctx);
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "%08x%08x%08x%08x", htonl(hash1[0]), htonl(hash1[1]), htonl(hash1[2]), htonl(hash1[3]));
+ mir_snprintf(tmpBuf, _countof(tmpBuf), "%08x%08x%08x%08x", htonl(hash1[0]), htonl(hash1[1]), htonl(hash1[2]), htonl(hash1[3]));
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf));
mir_md5_append(&ctx, (BYTE*)":", 1);
mir_md5_append(&ctx, (BYTE*)nonce, (int)mir_strlen(nonce));
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), ":%08d:", iCallCount);
+ mir_snprintf(tmpBuf, _countof(tmpBuf), ":%08d:", iCallCount);
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf));
mir_md5_append(&ctx, (BYTE*)cnonce, (int)mir_strlen(cnonce));
mir_md5_append(&ctx, (BYTE*)":auth:", 6);
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "%08x%08x%08x%08x", htonl(hash2[0]), htonl(hash2[1]), htonl(hash2[2]), htonl(hash2[3]));
+ mir_snprintf(tmpBuf, _countof(tmpBuf), "%08x%08x%08x%08x", htonl(hash2[0]), htonl(hash2[1]), htonl(hash2[2]), htonl(hash2[3]));
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf));
mir_md5_finish(&ctx, (BYTE*)digest);
@@ -278,7 +278,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, _countof(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);
diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp index 84745e30d5..485d85ff01 100644 --- a/protocols/JabberG/src/jabber_std.cpp +++ b/protocols/JabberG/src/jabber_std.cpp @@ -72,17 +72,17 @@ void CJabberProto::ConvertPasswords() for (int i = 0;; i++) {
char varName[100];
- mir_snprintf(varName, SIZEOF(varName), "rcMuc_%d_server", i);
+ mir_snprintf(varName, _countof(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, _countof(varName), "rcMuc_%d", i);
ptrT passw(JSetStringCrypt(m_szModuleName, NULL, varName));
if (passw != NULL) {
delSetting(varName);
- mir_snprintf(varName, SIZEOF(varName), "password_rcMuc_%d", i);
+ mir_snprintf(varName, _countof(varName), "password_rcMuc_%d", i);
setTString(varName, passw);
}
}
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index 916a3ce87c..ff9279d881 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -130,7 +130,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) }
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(pai->hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName));
_tcsncpy_s(pai->filename, tszFileName, _TRUNCATE);
pai->format = (pai->hContact == NULL) ? PA_FORMAT_PNG : getByte(pai->hContact, "AvatarType", 0);
@@ -153,7 +153,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) TCHAR szJid[JABBER_MAX_JID_LEN]; szJid[0] = 0;
if (item->arResources.getCount() != NULL && !isXVcard)
if (TCHAR *bestResName = ListGetBestClientResourceNamePtr(tszJid))
- mir_sntprintf(szJid, SIZEOF(szJid), _T("%s/%s"), tszJid, bestResName);
+ mir_sntprintf(szJid, _countof(szJid), _T("%s/%s"), tszJid, bestResName);
if (szJid[0] == 0)
_tcsncpy_s(szJid, tszJid, _TRUNCATE);
@@ -533,7 +533,7 @@ INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM hContact, LPARAM) TCHAR tszJid[JABBER_MAX_JID_LEN];
TCHAR *szResource = ListGetBestClientResourceNamePtr(jid);
if (szResource)
- mir_sntprintf(tszJid, SIZEOF(tszJid), _T("%s/%s"), jid, szResource);
+ mir_sntprintf(tszJid, _countof(tszJid), _T("%s/%s"), jid, szResource);
else
_tcsncpy_s(tszJid, jid, _TRUNCATE);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index cd3e8d0d18..f22f0299ed 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -94,7 +94,7 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa param->saveOnlinePassword = IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD);
param->pro->setByte("SaveSessionPassword", param->saveOnlinePassword);
- GetDlgItemText(hwndDlg, IDC_PASSWORD, param->onlinePassword, SIZEOF(param->onlinePassword));
+ GetDlgItemText(hwndDlg, IDC_PASSWORD, param->onlinePassword, _countof(param->onlinePassword));
{
BOOL savePassword = IsDlgButtonChecked(hwndDlg, IDC_SAVE_PERM);
param->pro->setByte("SavePassword", savePassword);
@@ -148,7 +148,7 @@ void ThreadData::xmpp_client_query(void) return;
char temp[256];
- mir_snprintf(temp, SIZEOF(temp), "_xmpp-client._tcp.%s", conn.server);
+ mir_snprintf(temp, _countof(temp), "_xmpp-client._tcp.%s", conn.server);
DNS_RECORDA *results = NULL;
DNS_STATUS status = DnsQuery_A(temp, DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, (PDNS_RECORD *)&results, NULL);
@@ -250,7 +250,7 @@ void CJabberProto::ServerThread(JABBER_CONN_DATA *param) _tcsncpy_s(info.conn.username, tszValue, _TRUNCATE);
if (*rtrimt(info.conn.username) == '\0') {
- DWORD dwSize = SIZEOF(info.conn.username);
+ DWORD dwSize = _countof(info.conn.username);
if (GetUserName(info.conn.username, &dwSize))
setTString("LoginName", info.conn.username);
else
@@ -278,7 +278,7 @@ LBL_FatalError: }
if (m_options.HostNameAsResource) {
- DWORD dwCompNameLen = SIZEOF(info.resource) - 1;
+ DWORD dwCompNameLen = _countof(info.resource) - 1;
if (!GetComputerName(info.resource, &dwCompNameLen))
mir_tstrcpy(info.resource, _T("Miranda"));
}
@@ -290,7 +290,7 @@ LBL_FatalError: }
TCHAR jidStr[512];
- mir_sntprintf(jidStr, SIZEOF(jidStr), _T("%s@%S/%s"), info.conn.username, info.conn.server, info.resource);
+ mir_sntprintf(jidStr, _countof(jidStr), _T("%s@%S/%s"), info.conn.username, info.conn.server, info.resource);
_tcsncpy_s(info.fullJID, jidStr, _TRUNCATE);
if (m_options.UseDomainLogin) // in the case of NTLM auth we have no need in password
@@ -299,7 +299,7 @@ LBL_FatalError: if (m_savedPassword != NULL)
_tcsncpy_s(info.conn.password, m_savedPassword, _TRUNCATE);
else {
- mir_sntprintf(jidStr, SIZEOF(jidStr), _T("%s@%S"), info.conn.username, info.conn.server);
+ mir_sntprintf(jidStr, _countof(jidStr), _T("%s@%S"), info.conn.username, info.conn.server);
JabberPasswordDlgParam param;
param.pro = this;
@@ -971,7 +971,7 @@ void CJabberProto::OnProcessPubsubEvent(HXML node) szLengthInTime[0] = 0;
if (szLength) {
int nLength = _ttoi(szLength);
- mir_sntprintf(szLengthInTime, SIZEOF(szLengthInTime), _T("%02d:%02d:%02d"),
+ mir_sntprintf(szLengthInTime, _countof(szLengthInTime), _T("%02d:%02d:%02d"),
nLength / 3600, (nLength / 60) % 60, nLength % 60);
}
@@ -1289,7 +1289,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_ROSTER_EXCHANGE) &&
item != NULL && (item->subscription == SUB_BOTH || item->subscription == SUB_TO)) {
TCHAR chkJID[JABBER_MAX_JID_LEN] = _T("@");
- JabberStripJid(from, chkJID + 1, SIZEOF(chkJID) - 1);
+ JabberStripJid(from, chkJID + 1, _countof(chkJID) - 1);
for (int i = 1;; i++) {
HXML iNode = xmlGetNthChild(xNode, _T("item"), i);
if (iNode == NULL)
@@ -1496,9 +1496,9 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) MCONTACT hContact;
BOOL bSelfPresence = FALSE;
TCHAR szBareFrom[JABBER_MAX_JID_LEN];
- JabberStripJid(from, szBareFrom, SIZEOF(szBareFrom));
+ JabberStripJid(from, szBareFrom, _countof(szBareFrom));
TCHAR szBareOurJid[JABBER_MAX_JID_LEN];
- JabberStripJid(info->fullJID, szBareOurJid, SIZEOF(szBareOurJid));
+ JabberStripJid(info->fullJID, szBareOurJid, _countof(szBareOurJid));
if (!mir_tstrcmpi(szBareFrom, szBareOurJid))
bSelfPresence = TRUE;
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 93ef27846b..cff0711614 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -176,7 +176,7 @@ static HTREEITEM sttFillInfoLine(HWND hwndTree, HTREEITEM htiRoot, HICON hIcon, if (title) mir_sntprintf(buf, _T("%s: %s"), title, value); else - mir_tstrncpy(buf, value, SIZEOF(buf)); + mir_tstrncpy(buf, value, _countof(buf)); TVINSERTSTRUCT tvis = {0}; tvis.hParent = htiRoot; @@ -251,20 +251,20 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti // Resource priority TCHAR szPriority[128]; - mir_sntprintf(szPriority, SIZEOF(szPriority), _T("%d"), (int)r->m_iPriority); + mir_sntprintf(szPriority, _countof(szPriority), _T("%d"), (int)r->m_iPriority); sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("Resource priority"), szPriority, sttInfoLineId(resource, INFOLINE_PRIORITY)); // Idle if (r->m_dwIdleStartTime > 0) { - mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), SIZEOF(buf)); + mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), _countof(buf)); size_t len = mir_tstrlen(buf); if (len > 0) buf[len-1] = 0; } else if (!r->m_dwIdleStartTime) - mir_tstrncpy(buf, TranslateT("unknown"), SIZEOF(buf)); + mir_tstrncpy(buf, TranslateT("unknown"), _countof(buf)); else - mir_tstrncpy(buf, TranslateT("<not specified>"), SIZEOF(buf)); + mir_tstrncpy(buf, TranslateT("<not specified>"), _countof(buf)); sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("Idle since"), buf, sttInfoLineId(resource, INFOLINE_IDLE)); @@ -279,7 +279,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti if (jcb & g_JabberFeatCapPairs[i].jcbCap) { TCHAR szDescription[ 1024 ]; if (g_JabberFeatCapPairs[i].tszDescription) - mir_sntprintf(szDescription, SIZEOF(szDescription), _T("%s (%s)"), TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature); + mir_sntprintf(szDescription, _countof(szDescription), _T("%s (%s)"), TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature); else _tcsncpy_s(szDescription, g_JabberFeatCapPairs[i].szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); @@ -289,7 +289,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti if (jcb & ppro->m_lstJabberFeatCapPairsDynamic[j]->jcbCap) { TCHAR szDescription[ 1024 ]; if (ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription) - mir_sntprintf(szDescription, SIZEOF(szDescription), _T("%s (%s)"), TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature); + mir_sntprintf(szDescription, _countof(szDescription), _T("%s (%s)"), TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature); else _tcsncpy_s(szDescription, ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); @@ -365,15 +365,15 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM // logoff JABBER_RESOURCE_STATUS *r = item->getTemp(); if (r->m_dwIdleStartTime > 0) { - mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), SIZEOF(buf)); + mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), _countof(buf)); size_t len = mir_tstrlen(buf); if (len > 0) buf[len-1] = 0; } else if (!r->m_dwIdleStartTime) - mir_tstrncpy(buf, TranslateT("unknown"), SIZEOF(buf)); + mir_tstrncpy(buf, TranslateT("unknown"), _countof(buf)); else - mir_tstrncpy(buf, TranslateT("<not specified>"), SIZEOF(buf)); + mir_tstrncpy(buf, TranslateT("<not specified>"), _countof(buf)); sttFillInfoLine(hwndTree, htiRoot, NULL, (item->jid && _tcschr(item->jid, _T('@'))) ? TranslateT("Last logoff time") : TranslateT("Uptime"), buf, @@ -384,9 +384,9 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM // activity if (item->m_pLastSeenResource) - mir_tstrncpy(buf, item->m_pLastSeenResource->m_tszResourceName, SIZEOF(buf)); + mir_tstrncpy(buf, item->m_pLastSeenResource->m_tszResourceName, _countof(buf)); else - mir_tstrncpy(buf, TranslateT("<no information available>"), SIZEOF(buf)); + mir_tstrncpy(buf, TranslateT("<no information available>"), _countof(buf)); sttFillInfoLine(hwndTree, htiRoot, NULL, TranslateT("Last active resource"), buf, sttInfoLineId(0, INFOLINE_LASTACTIVE)); @@ -537,7 +537,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa TVITEMEX tvi = { 0 }; tvi.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_STATE; tvi.hItem = hItem; - tvi.cchTextMax = SIZEOF(szBuffer); + tvi.cchTextMax = _countof(szBuffer); tvi.pszText = szBuffer; if (TreeView_GetItem(hwndTree, &tvi)) { if (TCHAR *str = _tcsstr(szBuffer, _T(": "))) diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 059015f155..a709bc492c 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -542,8 +542,8 @@ int __stdcall JabberGetPacketID(HXML n) {
const TCHAR *str = xmlGetAttrValue(n, _T("id"));
if (str)
- if (!_tcsncmp(str, _T(JABBER_IQID), SIZEOF(JABBER_IQID) - 1))
- return _ttoi(str + SIZEOF(JABBER_IQID) - 1);
+ if (!_tcsncmp(str, _T(JABBER_IQID), _countof(JABBER_IQID) - 1))
+ return _ttoi(str + _countof(JABBER_IQID) - 1);
return -1;
}
@@ -941,7 +941,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) if (getByte(ai.hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) {
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(ai.hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(ai.hContact, tszFileName, _countof(tszFileName));
DeleteFile(tszFileName);
}
@@ -958,7 +958,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) ptrA cmpsha(getStringA(ai.hContact, "AvatarSaved"));
if (cmpsha == NULL || strnicmp(cmpsha, buffer, sizeof(buffer))) {
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(ai.hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(ai.hContact, tszFileName, _countof(tszFileName));
_tcsncpy_s(ai.filename, tszFileName, _TRUNCATE);
FILE* out = _tfopen(tszFileName, _T("wb"));
if (out != NULL) {
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 510abac8ac..d98e163758 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -288,9 +288,9 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR dat->ppro->m_szPhotoFileName[0] = '\0';
}
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE);
- dat->ppro->GetAvatarFileName(NULL, szAvatarFileName, SIZEOF(szAvatarFileName));
+ dat->ppro->GetAvatarFileName(NULL, szAvatarFileName, _countof(szAvatarFileName));
if (_taccess(szAvatarFileName, 0) == 0) {
- if (GetTempPath(SIZEOF(szTempPath), szTempPath) <= 0)
+ if (GetTempPath(_countof(szTempPath), szTempPath) <= 0)
mir_tstrcpy(szTempPath, _T(".\\"));
if (GetTempFileName(szTempPath, _T("jab"), 0, szTempFileName) > 0) {
dat->ppro->debugLog(_T("Temp file = %s"), szTempFileName);
@@ -334,7 +334,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDC_LOAD:
TCHAR szFilter[512], szFileName[MAX_PATH];
- Bitmap_GetFilter(szFilter, SIZEOF(szFilter));
+ Bitmap_GetFilter(szFilter, _countof(szFilter));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
@@ -354,7 +354,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR MessageBox(hwndDlg, TranslateT("Only JPG, GIF, and BMP image files smaller than 40 KB are supported."), TranslateT("Jabber vCard"), MB_OK | MB_SETFOREGROUND);
break;
}
- if (GetTempPath(SIZEOF(szTempPath), szTempPath) <= 0)
+ if (GetTempPath(_countof(szTempPath), szTempPath) <= 0)
mir_tstrcpy(szTempPath, _T(".\\"));
if (GetTempFileName(szTempPath, _T("jab"), 0, szTempFileName) > 0) {
@@ -579,7 +579,7 @@ static INT_PTR CALLBACK EditEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, }
TCHAR text[128];
- GetDlgItemText(hwndDlg, IDC_EMAIL, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_EMAIL, text, _countof(text));
mir_snprintf(idstr, "e-mail%d", dat->id);
dat->ppro->setTString(idstr, text);
{
@@ -650,7 +650,7 @@ static INT_PTR CALLBACK EditPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, }
char text[128];
- GetDlgItemTextA(hwndDlg, IDC_PHONE, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, IDC_PHONE, text, _countof(text));
mir_snprintf(idstr, "Phone%d", dat->id);
dat->ppro->setString(idstr, text);
@@ -733,7 +733,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP ptrT email( ppro->getTStringA(idstr));
if (email == NULL) break;
- mir_sntprintf(number, SIZEOF(number), _T("%d"), i+1);
+ mir_sntprintf(number, _countof(number), _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
@@ -754,7 +754,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP ptrT phone( ppro->getTStringA(idstr));
if (phone == NULL) break;
- mir_sntprintf(number, SIZEOF(number), _T("%d"), i+1);
+ mir_sntprintf(number, _countof(number), _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
@@ -921,40 +921,40 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) // Page 0: Personal
switch (iPage) {
case 0:
- GetDlgItemText(hwndPage, IDC_FULLNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_FULLNAME, text, _countof(text));
setTString("FullName", text);
- GetDlgItemText(hwndPage, IDC_NICKNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_NICKNAME, text, _countof(text));
setTString("Nick", text);
- GetDlgItemText(hwndPage, IDC_FIRSTNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_FIRSTNAME, text, _countof(text));
setTString("FirstName", text);
- GetDlgItemText(hwndPage, IDC_MIDDLE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_MIDDLE, text, _countof(text));
setTString("MiddleName", text);
- GetDlgItemText(hwndPage, IDC_LASTNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_LASTNAME, text, _countof(text));
setTString("LastName", text);
- GetDlgItemText(hwndPage, IDC_BIRTH, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_BIRTH, text, _countof(text));
setTString("BirthDate", text);
switch (SendDlgItemMessage(hwndPage, IDC_GENDER, CB_GETCURSEL, 0, 0)) {
case 0: setString("GenderString", "Male"); break;
case 1: setString("GenderString", "Female"); break;
default: setString("GenderString", ""); break;
}
- GetDlgItemText(hwndPage, IDC_OCCUPATION, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_OCCUPATION, text, _countof(text));
setTString("Role", text);
- GetDlgItemText(hwndPage, IDC_HOMEPAGE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_HOMEPAGE, text, _countof(text));
setTString("Homepage", text);
break;
// Page 1: Home
case 1:
- GetDlgItemText(hwndPage, IDC_ADDRESS1, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ADDRESS1, text, _countof(text));
setTString("Street", text);
- GetDlgItemText(hwndPage, IDC_ADDRESS2, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ADDRESS2, text, _countof(text));
setTString("Street2", text);
- GetDlgItemText(hwndPage, IDC_CITY, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_CITY, text, _countof(text));
setTString("City", text);
- GetDlgItemText(hwndPage, IDC_STATE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_STATE, text, _countof(text));
setTString("State", text);
- GetDlgItemText(hwndPage, IDC_ZIP, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ZIP, text, _countof(text));
setTString("ZIP", text);
{
int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0);
@@ -966,21 +966,21 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) // Page 2: Work
case 2:
- GetDlgItemText(hwndPage, IDC_COMPANY, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_COMPANY, text, _countof(text));
setTString("Company", text);
- GetDlgItemText(hwndPage, IDC_DEPARTMENT, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_DEPARTMENT, text, _countof(text));
setTString("CompanyDepartment", text);
- GetDlgItemText(hwndPage, IDC_TITLE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_TITLE, text, _countof(text));
setTString("CompanyPosition", text);
- GetDlgItemText(hwndPage, IDC_ADDRESS1, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ADDRESS1, text, _countof(text));
setTString("CompanyStreet", text);
- GetDlgItemText(hwndPage, IDC_ADDRESS2, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ADDRESS2, text, _countof(text));
setTString("CompanyStreet2", text);
- GetDlgItemText(hwndPage, IDC_CITY, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_CITY, text, _countof(text));
setTString("CompanyCity", text);
- GetDlgItemText(hwndPage, IDC_STATE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_STATE, text, _countof(text));
setTString("CompanyState", text);
- GetDlgItemText(hwndPage, IDC_ZIP, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ZIP, text, _countof(text));
setTString("CompanyZIP", text);
{
int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0);
@@ -995,7 +995,7 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) // Page 4: Note
case 4:
- GetDlgItemText(hwndPage, IDC_DESC, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_DESC, text, _countof(text));
setTString("About", text);
break;
}
@@ -1105,7 +1105,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) }
TCHAR szAvatarName[MAX_PATH], *szFileName;
- GetAvatarFileName(NULL, szAvatarName, SIZEOF(szAvatarName));
+ GetAvatarFileName(NULL, szAvatarName, _countof(szAvatarName));
if (bPhotoChanged)
szFileName = szPhotoFileName;
else
@@ -1159,7 +1159,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) if (bPhotoChanged) {
DeleteFile(szAvatarName);
- GetAvatarFileName(NULL, szAvatarName, SIZEOF(szAvatarName));
+ GetAvatarFileName(NULL, szAvatarName, _countof(szAvatarName));
CopyFile(szFileName, szAvatarName, FALSE);
}
diff --git a/protocols/JabberG/src/jabber_ws.cpp b/protocols/JabberG/src/jabber_ws.cpp index 2abed513d4..62e9da7501 100644 --- a/protocols/JabberG/src/jabber_ws.cpp +++ b/protocols/JabberG/src/jabber_ws.cpp @@ -29,7 +29,7 @@ BOOL CJabberProto::WsInit(void) m_lastTicks = ::GetTickCount();
TCHAR name[128];
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY;
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 61585a59f2..947d047537 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -345,7 +345,7 @@ BOOL CJabberDlgPepSimple::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) break;
}
}
- else mir_tstrncpy(text, mode->m_title, SIZEOF(text));
+ else mir_tstrncpy(text, mode->m_title, _countof(text));
DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 2, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2, mode->m_hIcon, 16, 16, 0, NULL, DI_NORMAL);
TextOut(lpdis->hDC, lpdis->rcItem.left + 23, (lpdis->rcItem.top + lpdis->rcItem.bottom - tm.tmHeight) / 2, text, (int)mir_tstrlen(text));
@@ -680,7 +680,7 @@ void CPepMood::SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szTe if (szMood) {
char* p = mir_t2a(szMood);
- for (int i = 1; i < SIZEOF(g_arrMoods); i++)
+ for (int i = 1; i < _countof(g_arrMoods); i++)
if (!mir_strcmp(g_arrMoods[i].szTag, p)) {
mood = i;
break;
@@ -701,7 +701,7 @@ void CPepMood::SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szTe if (m_proto->m_pInfoFrame) {
if (mood >= 0) {
- mir_sntprintf(title, SIZEOF(title), TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
+ mir_sntprintf(title, _countof(title), TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", g_MoodIcons.GetIcolibHandle(g_arrMoods[mood].szTag), TranslateTS(g_arrMoods[mood].szName));
}
else {
@@ -739,7 +739,7 @@ void CPepMood::ShowSetDialog(BYTE bQuiet) {
if (!bQuiet) {
CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Mood"));
- for (int i = 1; i < SIZEOF(g_arrMoods); i++)
+ for (int i = 1; i < _countof(g_arrMoods); i++)
dlg.AddStatusMode(i, g_arrMoods[i].szTag, g_MoodIcons.GetIcon(g_arrMoods[i].szTag), TranslateTS(g_arrMoods[i].szName));
dlg.SetActiveStatus(m_mode, m_text);
@@ -916,7 +916,7 @@ char* returnActivity(int id) char* ActivityGetFirst(int id)
{
- if (id >= SIZEOF(g_arrActivities) - 1)
+ if (id >= _countof(g_arrActivities) - 1)
return NULL;
while (id >= 0) {
@@ -932,7 +932,7 @@ char *ActivityGetFirst(char *szId) {
if (!szId) return NULL;
- int id = SIZEOF(g_arrActivities) - 1;
+ int id = _countof(g_arrActivities) - 1;
bool found_second = false;
while (id >= 0) {
@@ -953,7 +953,7 @@ char *ActivityGetSecond(int id) TCHAR *ActivityGetFirstTitle(int id)
{
- if (id >= SIZEOF(g_arrActivities) - 1)
+ if (id >= _countof(g_arrActivities) - 1)
return NULL;
while (id >= 0) {
@@ -1078,7 +1078,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec }
TCHAR activityTitle[128];
- ActivityBuildTitle(activity, activityTitle, SIZEOF(activityTitle));
+ ActivityBuildTitle(activity, activityTitle, _countof(activityTitle));
if (!hContact) {
m_mode = activity;
@@ -1089,7 +1089,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec if (m_proto->m_pInfoFrame) {
if (activity >= 0) {
- mir_sntprintf(title, SIZEOF(title), TranslateT("Activity: %s"), activityTitle);
+ mir_sntprintf(title, _countof(title), TranslateT("Activity: %s"), activityTitle);
m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", g_ActivityIcons.GetIcolibHandle(returnActivity(activity)), activityTitle);
}
else {
@@ -1113,7 +1113,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec void CPepActivity::ShowSetDialog(BYTE)
{
CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Activity"));
- for (int i=0; i < SIZEOF(g_arrActivities); i++)
+ for (int i=0; i < _countof(g_arrActivities); i++)
if (g_arrActivities[i].szFirst || g_arrActivities[i].szSecond)
dlg.AddStatusMode(i, ActivityGetId(i), g_ActivityIcons.GetIcon(returnActivity(i)), TranslateTS(g_arrActivities[i].szTitle), (g_arrActivities[i].szSecond != NULL));
@@ -1162,7 +1162,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusIcon(WPARAM wParam, LPARAM lParam) if (!wParam)
wParam = ((CPepMood*)m_pepServices.Find(JABBER_FEAT_USER_MOOD))->m_mode;
- if (wParam < 1 || wParam >= SIZEOF(g_arrMoods))
+ if (wParam < 1 || wParam >= _countof(g_arrMoods))
return 0;
int flags = 0;
@@ -1227,7 +1227,7 @@ void CJabberProto::SetContactTune(MCONTACT hContact, LPCTSTR szArtist, LPCTSTR s setTString(hContact, "ListeningTo", szListeningTo);
char tuneIcon[128];
- mir_snprintf(tuneIcon, SIZEOF(tuneIcon), "%s_%s", m_szModuleName, "main");
+ mir_snprintf(tuneIcon, _countof(tuneIcon), "%s_%s", m_szModuleName, "main");
WriteAdvStatus(hContact, ADVSTATUS_TUNE, _T("listening_to"), tuneIcon, TranslateT("Listening To"), szListeningTo);
mir_free(szListeningTo);
@@ -1292,7 +1292,7 @@ INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam) szTmp++;
}
}
- mir_sntprintf(szLengthInSec, SIZEOF(szLengthInSec), _T("%d"), result);
+ mir_sntprintf(szLengthInSec, _countof(szLengthInSec), _T("%d"), result);
}
SendPepTune(szArtist, szLength ? szLengthInSec : NULL, szSource, szTitle, szTrack, NULL);
@@ -1354,7 +1354,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam) if (pData->flags & CSSF_MASK_NAME) {
if (pData->flags & CSSF_DEFAULT_NAME) {
DWORD dwXStatus = (pData->wParam == NULL) ? pepMood->m_mode : *pData->wParam;
- if (dwXStatus >= SIZEOF(g_arrMoods))
+ if (dwXStatus >= _countof(g_arrMoods))
return 1;
if (pData->flags & CSSF_UNICODE)
@@ -1404,7 +1404,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam) if (pData->flags & CSSF_STATUSES_COUNT)
if (pData->wParam)
- *pData->wParam = SIZEOF(g_arrMoods);
+ *pData->wParam = _countof(g_arrMoods);
if (pData->flags & CSSF_STR_SIZES) {
if (pData->wParam) *pData->wParam = STATUS_TITLE_MAX;
@@ -1425,7 +1425,7 @@ INT_PTR __cdecl CJabberProto::OnSetXStatusEx(WPARAM, LPARAM lParam) CPepMood *pepMood = (CPepMood*)m_pepServices.Find(JABBER_FEAT_USER_MOOD);
int status = (pData->flags & CSSF_MASK_STATUS) ? *pData->status : pepMood->m_mode;
- if (status >= 0 && status < SIZEOF(g_arrMoods)) {
+ if (status >= 0 && status < _countof(g_arrMoods)) {
pepMood->m_mode = status;
pepMood->m_text = (pData->flags & CSSF_MASK_MESSAGE) ? JabberStrFixLines(pData->ptszMessage) : NULL;
pepMood->LaunchSetGui(1);
@@ -1509,18 +1509,18 @@ TCHAR* CJabberProto::ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, cons void g_XstatusIconsInit()
{
TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, SIZEOF(szFile));
+ GetModuleFileName(hInst, szFile, _countof(szFile));
if (TCHAR *p = _tcsrchr(szFile, '\\'))
mir_tstrcpy(p + 1, _T("..\\Icons\\xstatus_jabber.dll"));
TCHAR szSection[100];
mir_tstrcpy(szSection, _T("Protocols/Jabber/")LPGENT("Moods"));
- for (int i = 1; i < SIZEOF(g_arrMoods); i++)
+ for (int i = 1; i < _countof(g_arrMoods); i++)
g_MoodIcons.RegisterIcon(g_arrMoods[i].szTag, szFile, -(200 + i), szSection, TranslateTS(g_arrMoods[i].szName));
mir_tstrcpy(szSection, _T("Protocols/Jabber/")LPGENT("Activities"));
- for (int k = 0; k < SIZEOF(g_arrActivities); k++) {
+ for (int k = 0; k < _countof(g_arrActivities); k++) {
if (g_arrActivities[k].szFirst)
g_ActivityIcons.RegisterIcon(g_arrActivities[k].szFirst, szFile, g_arrActivities[k].iconid, szSection, TranslateTS(g_arrActivities[k].szTitle));
if (g_arrActivities[k].szSecond)
|