summaryrefslogtreecommitdiff
path: root/protocols/MSN/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
commit4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch)
tree9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /protocols/MSN/src
parentf0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (diff)
SIZEOF replaced with more secure analog - _countof
git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MSN/src')
-rw-r--r--protocols/MSN/src/msn_auth.cpp8
-rw-r--r--protocols/MSN/src/msn_avatar.cpp2
-rw-r--r--protocols/MSN/src/msn_chat.cpp14
-rw-r--r--protocols/MSN/src/msn_commands.cpp54
-rw-r--r--protocols/MSN/src/msn_errors.cpp4
-rw-r--r--protocols/MSN/src/msn_ftold.cpp6
-rw-r--r--protocols/MSN/src/msn_lists.cpp4
-rw-r--r--protocols/MSN/src/msn_mail.cpp10
-rw-r--r--protocols/MSN/src/msn_menu.cpp8
-rw-r--r--protocols/MSN/src/msn_mime.cpp2
-rw-r--r--protocols/MSN/src/msn_misc.cpp30
-rw-r--r--protocols/MSN/src/msn_natdetect.cpp2
-rw-r--r--protocols/MSN/src/msn_opts.cpp34
-rw-r--r--protocols/MSN/src/msn_p2p.cpp16
-rw-r--r--protocols/MSN/src/msn_proto.cpp8
-rw-r--r--protocols/MSN/src/msn_soapab.cpp14
-rw-r--r--protocols/MSN/src/msn_soapstore.cpp4
-rw-r--r--protocols/MSN/src/msn_svcs.cpp8
18 files changed, 114 insertions, 114 deletions
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp
index c6c9209b89..c866135156 100644
--- a/protocols/MSN/src/msn_auth.cpp
+++ b/protocols/MSN/src/msn_auth.cpp
@@ -153,8 +153,8 @@ int CMsnProto::MSN_GetPassportAuth(void)
time_t ts = time(NULL);
TCHAR szTs1[64], szTs2[64];
- TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts, _T("I"), szTs1, SIZEOF(szTs1), 0);
- TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts + 20 * 60, _T("I"), szTs2, SIZEOF(szTs2), 0);
+ TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts, _T("I"), szTs1, _countof(szTs1), 0);
+ TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts + 20 * 60, _T("I"), szTs2, _countof(szTs2), 0);
CMStringA szAuthInfo(FORMAT, authPacket, int(ts), MyOptions.szEmail, ptrA(HtmlEncode(szPassword)), szTs1, szTs2);
@@ -266,7 +266,7 @@ int CMsnProto::MSN_GetPassportAuth(void)
}
else if (retVal != 3 && retVal != 7) {
char err[512];
- mir_snprintf(err, SIZEOF(err), "Unknown Authentication error: %s", szFault);
+ mir_snprintf(err, _countof(err), "Unknown Authentication error: %s", szFault);
MSN_ShowError(err);
}
}
@@ -954,7 +954,7 @@ const char *CMsnProto::GetSkypeToken(bool bAsAuthHeader)
nlhr.requestType = REQUEST_POST;
nlhr.flags = NLHRF_HTTP11 | NLHRF_DUMPASTEXT | NLHRF_PERSISTENT | NLHRF_REDIRECT;
nlhr.nlc = hHttpsConnection;
- nlhr.headersCount = SIZEOF(headers);
+ nlhr.headersCount = _countof(headers);
nlhr.headers = headers;
nlhr.headers[0].szName = "User-Agent";
nlhr.headers[0].szValue = (char*)MSN_USER_AGENT;
diff --git a/protocols/MSN/src/msn_avatar.cpp b/protocols/MSN/src/msn_avatar.cpp
index 3e268e3b5b..5c8d3985d2 100644
--- a/protocols/MSN/src/msn_avatar.cpp
+++ b/protocols/MSN/src/msn_avatar.cpp
@@ -79,7 +79,7 @@ LBL_Error:
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = fmt;
ai.hContact = p->hContact;
- MSN_GetAvatarFileName(ai.hContact, ai.filename, SIZEOF(ai.filename), szExt);
+ MSN_GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename), szExt);
_tremove(ai.filename);
int fileId = _topen(ai.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp
index 6920312d4f..e1aa017893 100644
--- a/protocols/MSN/src/msn_chat.cpp
+++ b/protocols/MSN/src/msn_chat.cpp
@@ -47,14 +47,14 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p
{
char *szNet, *szEmail;
- _tcsncpy(info->mChatID, _A2T(pszID), SIZEOF(info->mChatID));
+ _tcsncpy(info->mChatID, _A2T(pszID), _countof(info->mChatID));
parseWLID(NEWSTR_ALLOCA(pszID), &szNet, &szEmail, NULL);
info->netId = atoi(szNet);
strncpy(info->szEmail, szEmail, sizeof(info->szEmail));
TCHAR szName[512];
InterlockedIncrement(&m_chatID);
- if (*pszTopic) _tcsncpy(szName, _A2T(pszTopic), SIZEOF(szName));
+ if (*pszTopic) _tcsncpy(szName, _A2T(pszTopic), _countof(szName));
else mir_sntprintf(szName, _T("%s %s%d"),
m_tszUserName, TranslateT("Chat #"), m_chatID);
@@ -67,7 +67,7 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p
GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
- for (int j = 0; j < SIZEOF(m_ptszRoles); j++) {
+ for (int j = 0; j < _countof(m_ptszRoles); j++) {
gce.ptszStatus = m_ptszRoles[j];
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
}
@@ -431,7 +431,7 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case IDC_ADDSCR:
if (param->ppro->msnLoggedIn) {
TCHAR email[MSN_MAX_EMAIL_LEN];
- GetDlgItemText(hwndDlg, IDC_EDITSCR, email, SIZEOF(email));
+ GetDlgItemText(hwndDlg, IDC_EDITSCR, email, _countof(email));
CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
@@ -620,7 +620,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam)
{ LPGENT("&Invite user..."), 10, MENU_ITEM, FALSE },
{ LPGENT("&Leave chat session"), 20, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
@@ -633,7 +633,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam)
{ _T(""), 100, MENU_SEPARATOR, FALSE },
{ LPGENT("&Leave chat session"), 110, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
else {
@@ -653,7 +653,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam)
if (pszRole && !mir_tstrcmpi(pszRole, _T("admin")))
Items[3].pszDesc = LPGENT("&Deop user");
}
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
mir_free(email);
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index c65359a54a..9502935601 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -60,7 +60,7 @@ void CMsnProto::MSN_SetMirVer(MCONTACT hContact, DWORD dwValue, bool always)
else if (dwValue == 0x30000024)
szVersion = "Miranda IM 0.4.x (MSN v.0.4.x)";
else if (always || getByte(hContact, "StdMirVer", 0)) {
- unsigned wlmId = min(dwValue >> 28 & 0xff, SIZEOF(MirVerStr) - 1);
+ unsigned wlmId = min(dwValue >> 28 & 0xff, _countof(MirVerStr) - 1);
szVersion = MirVerStr[wlmId];
}
else
@@ -85,7 +85,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para
struct { char *typeId, *strMsgBytes; } datas;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2) {
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2) {
debugLogA("Invalid %.3s command, ignoring", cmdString);
return;
}
@@ -439,7 +439,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli)
nlhr.flags = NLHRF_GENERATEHOST | NLHRF_PERSISTENT | NLHRF_SMARTAUTHHEADER;
nlhr.szUrl = uri;
nlhr.headers = (NETLIBHTTPHEADER*)&nlbhHeaders;
- nlhr.headersCount = SIZEOF(nlbhHeaders);
+ nlhr.headersCount = _countof(nlbhHeaders);
nlhr.nlc = hHttpsConnection;
mHttpsTS = clock();
@@ -481,7 +481,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli)
sprintf(ft->szInvcookie, "%s/content/imgpsh", uri);
TCHAR tComment[40];
- mir_sntprintf(tComment, SIZEOF(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_sntprintf(tComment, _countof(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
@@ -522,7 +522,7 @@ void CMsnProto::MSN_ProcessYFind(char* buf, size_t len)
const char* szCont = ezxml_attr(cont, "n");
char szEmail[128];
- mir_snprintf(szEmail, SIZEOF(szEmail), "%s@%s", szCont, szDom);
+ mir_snprintf(szEmail, _countof(szEmail), "%s@%s", szCont, szDom);
const char *szNetId = ezxml_attr(cont, "t");
if (msnSearchId != NULL) {
@@ -721,7 +721,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid)
unsigned pCount;
char* p = (char*)szCrntMda;
- for (pCount = 0; pCount < SIZEOF(parts); ++pCount) {
+ for (pCount = 0; pCount < _countof(parts); ++pCount) {
parts[pCount] = p;
char* p1 = strstr(p, "\\0");
@@ -762,7 +762,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid)
for (unsigned i = 4; i < pCount; i++) {
char part[16];
- size_t lenPart = mir_snprintf(part, SIZEOF(part), "{%d}", i - 4);
+ size_t lenPart = mir_snprintf(part, _countof(part), "{%d}", i - 4);
if (parts[i][0] == '\0' && unknown != NULL)
parts[i] = unknown;
size_t lenPartsI = mir_strlen(parts[i]);
@@ -837,13 +837,13 @@ void CMsnProto::MSN_ProcessNotificationMessage(char* buf, size_t len)
const char* acturl = ezxml_attr(xmlact, "url");
if (acturl == NULL || strstr(acturl, "://") == NULL)
- sz += mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "%s", ezxml_attr(xmlnot, "siteurl"));
+ sz += mir_snprintf((fullurl + sz), (_countof(fullurl) - sz), "%s", ezxml_attr(xmlnot, "siteurl"));
- sz += mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "%s", acturl);
+ sz += mir_snprintf((fullurl + sz), (_countof(fullurl) - sz), "%s", acturl);
if (sz != 0 && fullurl[sz - 1] != '?')
- sz += mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "?");
+ sz += mir_snprintf((fullurl + sz), (_countof(fullurl) - sz), "?");
- mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "notification_id=%s&message_id=%s",
+ mir_snprintf((fullurl + sz), (_countof(fullurl) - sz), "notification_id=%s&message_id=%s",
ezxml_attr(xmlnot, "id"), ezxml_attr(xmlmsg, "id"));
SkinPlaySound(alertsoundname);
@@ -896,7 +896,7 @@ int CMsnProto::MSN_HandleCommands(ThreadData* info, char* cmdString)
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2) {
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2) {
LBL_InvalidCommand:
debugLogA("Invalid %.3s command, ignoring", cmdString);
break;
@@ -935,7 +935,7 @@ LBL_InvalidCommand:
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
MimeHeaders tHeader;
@@ -966,7 +966,7 @@ LBL_InvalidCommand:
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
HReadBuffer buf(info, 0);
@@ -1034,7 +1034,7 @@ LBL_InvalidCommand:
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
MimeHeaders tHeader;
@@ -1198,7 +1198,7 @@ LBL_InvalidCommand:
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
HReadBuffer buf(info, 0);
@@ -1271,7 +1271,7 @@ LBL_InvalidCommand:
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
MimeHeaders tHeader;
@@ -1322,7 +1322,7 @@ LBL_InvalidCommand:
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
MimeHeaders tHeader;
@@ -1434,7 +1434,7 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email,
ft->p2p_dest = mir_strdup(email);
TCHAR tComment[40];
- mir_sntprintf(tComment, SIZEOF(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_sntprintf(tComment, _countof(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
@@ -1452,9 +1452,9 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email,
ThreadData* newThread = new ThreadData;
if (inet_addr(IPAddress) != MyConnection.extIP || !IPAddressInt)
- mir_snprintf(newThread->mServer, SIZEOF(newThread->mServer), "%s:%s", IPAddress, Port);
+ mir_snprintf(newThread->mServer, _countof(newThread->mServer), "%s:%s", IPAddress, Port);
else
- mir_snprintf(newThread->mServer, SIZEOF(newThread->mServer), "%s:%u", IPAddressInt, atol(PortXInt) ^ 0x3141);
+ mir_snprintf(newThread->mServer, _countof(newThread->mServer), "%s:%u", IPAddressInt, atol(PortXInt) ^ 0x3141);
newThread->mType = SERVER_FILETRANS;
@@ -1531,7 +1531,7 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email,
if (IPAddress != NULL && Port == NULL && SessionID != NULL && SessionProtocol == NULL) { // netmeeting receive 2
char ipaddr[256];
- mir_snprintf(ipaddr, SIZEOF(ipaddr), "callto://%s", IPAddress);
+ mir_snprintf(ipaddr, _countof(ipaddr), "callto://%s", IPAddress);
ShellExecuteA(NULL, "open", ipaddr, NULL, NULL, SW_SHOW);
}
}
@@ -1548,7 +1548,7 @@ void CMsnProto::MSN_ProcessRemove(char* buf, size_t len)
int listId = atol(ezxml_attr(cont, "l"));
char szEmail[128];
- mir_snprintf(szEmail, SIZEOF(szEmail), "%s@%s", szCont, szDom);
+ mir_snprintf(szEmail, _countof(szEmail), "%s@%s", szCont, szDom);
Lists_Remove(listId, szEmail);
MsnContact* msc = Lists_Get(szEmail);
@@ -1609,7 +1609,7 @@ void CMsnProto::MSN_CustomSmiley(const char* msgBody, char* email, char* nick, i
ptrA smileyName(mir_urlEncode(buf));
TCHAR path[MAX_PATH];
- MSN_GetCustomSmileyFileName(hContact, path, SIZEOF(path), smileyName, iSmileyType);
+ MSN_GetCustomSmileyFileName(hContact, path, _countof(path), smileyName, iSmileyType);
ft->std.tszCurrentFile = mir_tstrdup(path);
if (p2p_IsDlFileOk(ft))
@@ -1644,7 +1644,7 @@ void CMsnProto::MSN_ProcessAdd(char* buf, size_t len)
int netId = atol(ezxml_attr(cont, "t"));
char szEmail[128];
- mir_snprintf(szEmail, SIZEOF(szEmail), "%s@%s", szCont, szDom);
+ mir_snprintf(szEmail, _countof(szEmail), "%s@%s", szCont, szDom);
UrlDecode((char*)szNick);
@@ -2206,7 +2206,7 @@ LBL_InvalidCommand:
newThread->mType = SERVER_SWITCHBOARD;
newThread->mInitialContactWLID = mir_strdup(data.callerEmail);
MSN_HContactFromEmail(data.callerEmail, data.callerNick, true, true);
- mir_snprintf(newThread->mCookie, SIZEOF(newThread->mCookie), "%s %d", data.authChallengeInfo, trid);
+ mir_snprintf(newThread->mCookie, _countof(newThread->mCookie), "%s %d", data.authChallengeInfo, trid);
ReleaseSemaphore(newThread->hWaitEvent, MSN_PACKETS_COMBINE, NULL);
@@ -2354,7 +2354,7 @@ LBL_InvalidCommand:
case ' XUU': // UUX: MSNP11 addition
{
char* tWords[1];
- if (sttDivideWords(params, SIZEOF(tWords), tWords) != SIZEOF(tWords))
+ if (sttDivideWords(params, _countof(tWords), tWords) != _countof(tWords))
goto LBL_InvalidCommand;
int len = atol(tWords[0]);
diff --git a/protocols/MSN/src/msn_errors.cpp b/protocols/MSN/src/msn_errors.cpp
index f67293eb2d..64a79fb45a 100644
--- a/protocols/MSN/src/msn_errors.cpp
+++ b/protocols/MSN/src/msn_errors.cpp
@@ -52,7 +52,7 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString)
struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2) {
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2) {
debugLogA("Invalid %.3s command, ignoring", cmdString);
return 0;
}
@@ -90,7 +90,7 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString)
case ERR_DETAILED_ERR_IN_PAYLOAD:
case ERR_LIST_UNAVAILABLE:
char* tWords[4];
- if (sttDivideWords(cmdString, SIZEOF(tWords), tWords) == SIZEOF(tWords))
+ if (sttDivideWords(cmdString, _countof(tWords), tWords) == _countof(tWords))
HReadBuffer(info, 0).surelyRead(atol(tWords[3]));
return 0;
diff --git a/protocols/MSN/src/msn_ftold.cpp b/protocols/MSN/src/msn_ftold.cpp
index c5f6c3025b..94e257fade 100644
--- a/protocols/MSN/src/msn_ftold.cpp
+++ b/protocols/MSN/src/msn_ftold.cpp
@@ -64,7 +64,7 @@ void CMsnProto::msnftp_invite(filetransfer *ft)
pszFiles = *ft->std.ptszFiles;
char msg[1024];
- mir_snprintf(msg, SIZEOF(msg),
+ mir_snprintf(msg, _countof(msg),
"Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n"
"Application-Name: File Transfer\r\n"
"Application-GUID: {5D3E02AB-6190-11d3-BBBB-00C04F795683}\r\n"
@@ -152,7 +152,7 @@ int CMsnProto::MSN_HandleMSNFTP(ThreadData *info, char *cmdString)
char tCommand[30];
size_t tCommandLen;
- tCommandLen = mir_snprintf(tCommand, SIZEOF(tCommand), "FIL %i\r\n", info->mMsnFtp->std.totalBytes);
+ tCommandLen = mir_snprintf(tCommand, _countof(tCommand), "FIL %i\r\n", info->mMsnFtp->std.totalBytes);
info->send(tCommand, tCommandLen);
break;
@@ -176,7 +176,7 @@ LBL_InvalidCommand:
if (info->mCaller == 0) { //receive
char tCommand[MSN_MAX_EMAIL_LEN + 50];
size_t tCommandLen;
- tCommandLen = mir_snprintf(tCommand, SIZEOF(tCommand), "USR %s %s\r\n", MyOptions.szEmail, info->mCookie);
+ tCommandLen = mir_snprintf(tCommand, _countof(tCommand), "USR %s %s\r\n", MyOptions.szEmail, info->mCookie);
info->send(tCommand, tCommandLen);
}
else if (info->mCaller == 2) { //send
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp
index 35310c1cfb..227f6ff9db 100644
--- a/protocols/MSN/src/msn_lists.cpp
+++ b/protocols/MSN/src/msn_lists.cpp
@@ -243,7 +243,7 @@ void CMsnProto::MSN_CleanupLists(void)
mir_free(sze);
TCHAR title[128];
- mir_sntprintf(title, SIZEOF(title), TranslateT("%s protocol"), m_tszUserName);
+ mir_sntprintf(title, _countof(title), TranslateT("%s protocol"), m_tszUserName);
if (MessageBox(NULL, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES) {
MSN_AddUser(p.hContact, p.email, 0, LIST_LL);
@@ -260,7 +260,7 @@ void CMsnProto::MSN_CleanupLists(void)
if (p.list & (LIST_LL | LIST_FL) && p.hContact) {
TCHAR path[MAX_PATH];
- MSN_GetCustomSmileyFileName(p.hContact, path, SIZEOF(path), "", 0);
+ MSN_GetCustomSmileyFileName(p.hContact, path, _countof(path), "", 0);
if (path[0]) {
SMADD_CONT cont;
cont.cbSize = sizeof(SMADD_CONT);
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp
index 652bb0efcd..312cc2bfd7 100644
--- a/protocols/MSN/src/msn_mail.cpp
+++ b/protocols/MSN/src/msn_mail.cpp
@@ -255,14 +255,14 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial)
wchar_t* mimeSubjectW = tFileInfo.decode(Subject);
- mir_sntprintf(tBuffer2, SIZEOF(tBuffer2), TranslateT("Subject: %s"), mimeSubjectW);
+ mir_sntprintf(tBuffer2, _countof(tBuffer2), TranslateT("Subject: %s"), mimeSubjectW);
TCHAR* msgtxt = _stricmp(From, Fromaddr) ?
TranslateT("Hotmail from %s (%S)") : TranslateT("Hotmail from %s");
- mir_sntprintf(tBuffer, SIZEOF(tBuffer), msgtxt, mimeFromW, Fromaddr);
+ mir_sntprintf(tBuffer, _countof(tBuffer), msgtxt, mimeFromW, Fromaddr);
mir_free(mimeFromW);
mir_free(mimeSubjectW);
ShowPopup = true;
@@ -271,8 +271,8 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial)
const char* MailData = tFileInfo["Mail-Data"];
if (MailData != NULL) processMailData((char*)MailData);
- mir_sntprintf(tBuffer, SIZEOF(tBuffer), m_tszUserName);
- mir_sntprintf(tBuffer2, SIZEOF(tBuffer2), TranslateT("Unread mail is available: %d in Inbox and %d in other folders."), mUnreadMessages, mUnreadJunkEmails);
+ mir_sntprintf(tBuffer, _countof(tBuffer), m_tszUserName);
+ mir_sntprintf(tBuffer2, _countof(tBuffer2), TranslateT("Unread mail is available: %d in Inbox and %d in other folders."), mUnreadMessages, mUnreadJunkEmails);
}
if (UnreadMessages == mUnreadMessages && UnreadJunkEmails == mUnreadJunkEmails && !isInitial)
@@ -390,7 +390,7 @@ void CMsnProto::displayEmailCount(MCONTACT hContact)
rtrimt(name);
TCHAR szNick[128];
- mir_sntprintf(szNick, SIZEOF(szNick),
+ mir_sntprintf(szNick, _countof(szNick),
getByte("DisableHotmailJunk", 0) ? _T("%s [%d]") : _T("%s [%d][%d]"), name, mUnreadMessages, mUnreadJunkEmails);
nickChg = true;
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp
index 3899dc8cf8..e257a86e54 100644
--- a/protocols/MSN/src/msn_menu.cpp
+++ b/protocols/MSN/src/msn_menu.cpp
@@ -93,7 +93,7 @@ INT_PTR CMsnProto::MsnViewProfile(WPARAM hContact, LPARAM)
}
char tUrl[256];
- mir_snprintf(tUrl, SIZEOF(tUrl), "http://cid-%I64X.profiles.live.com", _atoi64(cid));
+ mir_snprintf(tUrl, _countof(tUrl), "http://cid-%I64X.profiles.live.com", _atoi64(cid));
MsnInvokeMyURL(false, tUrl);
return 0;
}
@@ -181,7 +181,7 @@ INT_PTR CMsnProto::MsnSendNetMeeting(WPARAM wParam, LPARAM)
char msg[1024];
- mir_snprintf(msg, SIZEOF(msg),
+ mir_snprintf(msg, _countof(msg),
"Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n"
"Application-Name: NetMeeting\r\n"
"Application-GUID: {44BBA842-CC51-11CF-AAFA-00AA00B6015C}\r\n"
@@ -232,7 +232,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam
CMsnProto *proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (proto->msnLoggedIn) {
TCHAR str[130];
- GetDlgItemText(hwndDlg, IDC_NICKNAME, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_NICKNAME, str, _countof(str));
proto->MSN_SendNickname(str);
}
}
@@ -349,7 +349,7 @@ void CMsnProto::MSN_EnableMenuItems(bool bEnable)
if (!bEnable)
mi.flags |= CMIF_GRAYED;
- for (int i = 0; i < SIZEOF(menuItemsMain); i++)
+ for (int i = 0; i < _countof(menuItemsMain); i++)
if (menuItemsMain[i] != NULL)
Menu_ModifyItem(menuItemsMain[i], &mi);
diff --git a/protocols/MSN/src/msn_mime.cpp b/protocols/MSN/src/msn_mime.cpp
index 1b5651794d..7be06009a9 100644
--- a/protocols/MSN/src/msn_mime.cpp
+++ b/protocols/MSN/src/msn_mime.cpp
@@ -339,7 +339,7 @@ static const struct _tag_cpltbl
static unsigned FindCP(const char* mimecp)
{
unsigned cp = CP_ACP;
- for (unsigned i = 0; i < SIZEOF(cptbl); ++i) {
+ for (unsigned i = 0; i < _countof(cptbl); ++i) {
if (_stricmp(mimecp, cptbl[i].mimecp) == 0) {
cp = cptbl[i].cp;
break;
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 4077447e09..6c5e3a4fcd 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -122,7 +122,7 @@ void CMsnProto::InitCustomFolders(void)
if (InitCstFldRan) return;
TCHAR folder[MAX_PATH];
- mir_sntprintf(folder, SIZEOF(folder), _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
+ mir_sntprintf(folder, _countof(folder), _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
hCustomSmileyFolder = FoldersRegisterCustomPathT(LPGEN("Custom Smileys"), m_szModuleName, folder, m_tszUserName);
InitCstFldRan = true;
@@ -290,10 +290,10 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen)
return fmt;
TCHAR szFileName[MAX_PATH];
- MSN_GetAvatarFileName(NULL, szFileName, SIZEOF(szFileName), NULL);
+ MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), NULL);
_tremove(szFileName);
- MSN_GetAvatarFileName(NULL, szFileName, SIZEOF(szFileName), szExt);
+ MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), szExt);
int fileId = _topen(szFileName, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
if (fileId >= 0) {
@@ -479,7 +479,7 @@ int ThreadData::sendMessage(int, const char *email, int netId, const char *parMs
#ifdef OBSOLETE
if (parFlags & MSG_OFFLINE)
- off += mir_snprintf((buf + off), (SIZEOF(buf) - off), "Dest-Agent: client\r\n");
+ off += mir_snprintf((buf + off), (_countof(buf) - off), "Dest-Agent: client\r\n");
#endif
}
@@ -541,7 +541,7 @@ void ThreadData::sendCaps(void)
char mversion[100], capMsg[1000];
CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(mversion), (LPARAM)mversion);
- mir_snprintf(capMsg, SIZEOF(capMsg),
+ mir_snprintf(capMsg, _countof(capMsg),
"Content-Type: text/x-clientcaps\r\n\r\n"
"Client-Name: Miranda NG %s (MSN v.%s)\r\n",
mversion, __VERSION_STRING_DOTS);
@@ -586,7 +586,7 @@ int ThreadData::sendRawMessage(int msgType, const char* data, int datLen)
void CMsnProto::MSN_SendTyping(ThreadData* info, const char* email, int netId, bool bTyping)
{
char tCommand[1024];
- mir_snprintf(tCommand, SIZEOF(tCommand),
+ mir_snprintf(tCommand, _countof(tCommand),
"Messaging: 2.0\r\n"
"Message-Type: %s\r\n"
"Content-Type: Application/Message\r\n"
@@ -632,7 +632,7 @@ void CMsnProto::MSN_SendStatusMessage(const char*)
size_t sz;
char szMsg[2048];
if (msnCurrentMedia.cbSize == 0) {
- sz = mir_snprintf(szMsg, SIZEOF(szMsg), "<Data><PSM>%s</PSM><CurrentMedia></CurrentMedia><MachineGuid>%s</MachineGuid>"
+ sz = mir_snprintf(szMsg, _countof(szMsg), "<Data><PSM>%s</PSM><CurrentMedia></CurrentMedia><MachineGuid>%s</MachineGuid>"
"<DDP></DDP><SignatureSound></SignatureSound><Scene></Scene><ColorScheme></ColorScheme></Data>",
msgEnc, MyOptions.szMachineGuid);
}
@@ -667,7 +667,7 @@ void CMsnProto::MSN_SendStatusMessage(const char*)
*szPlayer = HtmlEncodeUTF8T(msnCurrentMedia.ptszPlayer),
*szType = HtmlEncodeUTF8T(msnCurrentMedia.ptszType);
- sz = mir_snprintf(szMsg, SIZEOF(szMsg),
+ sz = mir_snprintf(szMsg, _countof(szMsg),
"<Data>"
"<PSM>%s</PSM>"
"<CurrentMedia>%s\\0%s\\01\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0\\0</CurrentMedia>"
@@ -799,7 +799,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus)
char szMsg[2048];
#ifdef OBSOLETE
if (m_iStatus < ID_STATUS_ONLINE) {
- int sz = mir_snprintf(szMsg, SIZEOF(szMsg),
+ int sz = mir_snprintf(szMsg, _countof(szMsg),
"<EndpointData><Capabilities>%u:%u</Capabilities></EndpointData>", myFlags, myFlagsEx);
msnNsThread->sendPacket("UUX", "%d\r\n%s", sz, szMsg);
@@ -820,13 +820,13 @@ void CMsnProto::MSN_SetServerStatus(int newStatus)
szPlace = dbv.pszVal;
else {
TCHAR buf[128] = _T("Miranda");
- DWORD buflen = SIZEOF(buf);
+ DWORD buflen = _countof(buf);
GetComputerName(buf, &buflen);
szPlace = mir_utf8encodeT(buf);
}
char** msgptr = GetStatusMsgLoc(newStatus);
- int sz = mir_snprintf(szMsg, SIZEOF(szMsg),
+ int sz = mir_snprintf(szMsg, _countof(szMsg),
"<user>"
"<sep n=\"PE\" epid=\"%s\"><VER>%s</VER><TYP>11</TYP><Capabilities>0:0</Capabilities></sep>"
"<s n=\"IM\"><Status>%s</Status></s>"
@@ -859,7 +859,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus)
// TODO: Send, MSN_SendStatusMessage anpassen.
#ifdef OBSOLETE
- int sz = mir_snprintf(szMsg, SIZEOF(szMsg),
+ int sz = mir_snprintf(szMsg, _countof(szMsg),
"<PrivateEndpointData>"
"<EpName>%s</EpName>"
"<Idle>%s</Idle>"
@@ -959,7 +959,7 @@ void CMsnProto::MSN_ShowError(const char* msgtext, ...)
TCHAR *buf = Langpack_PcharToTchar(msgtext);
va_start(tArgs, msgtext);
- mir_vsntprintf(tBuffer, SIZEOF(tBuffer), buf, tArgs);
+ mir_vsntprintf(tBuffer, _countof(tBuffer), buf, tArgs);
va_end(tArgs);
mir_free(buf);
@@ -1061,7 +1061,7 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam)
if ((iserr && !pud->proto->MyOptions.ShowErrorsAsPopups) || !ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
if (pud->flags & MSN_ALLOW_MSGBOX) {
TCHAR szMsg[MAX_SECONDLINE + MAX_CONTACTNAME];
- mir_sntprintf(szMsg, SIZEOF(szMsg), _T("%s:\n%s"), pud->title, pud->text);
+ mir_sntprintf(szMsg, _countof(szMsg), _T("%s:\n%s"), pud->title, pud->text);
MessageBox(NULL, szMsg, TranslateT("MSN Protocol"),
MB_OK | (iserr ? MB_ICONERROR : MB_ICONINFORMATION));
}
@@ -1393,7 +1393,7 @@ void MSN_MakeDigest(const char* chl, char* dgst)
md5hash[i] &= 0x7FFFFFFF;
char chlString[128];
- mir_snprintf(chlString, SIZEOF(chlString), "%s%s00000000", chl, msnProductID);
+ mir_snprintf(chlString, _countof(chlString), "%s%s00000000", chl, msnProductID);
chlString[(mir_strlen(chl) + mir_strlen(msnProductID) + 7) & 0xF8] = 0;
LONGLONG high = 0, low = 0;
diff --git a/protocols/MSN/src/msn_natdetect.cpp b/protocols/MSN/src/msn_natdetect.cpp
index 18e3a5746e..6485612496 100644
--- a/protocols/MSN/src/msn_natdetect.cpp
+++ b/protocols/MSN/src/msn_natdetect.cpp
@@ -312,7 +312,7 @@ static bool IsIcfEnabled(void)
if (FAILED(hr)) goto error;
TCHAR szFileName[MAX_PATH];
- GetModuleFileName(NULL, szFileName, SIZEOF(szFileName));
+ GetModuleFileName(NULL, szFileName, _countof(szFileName));
wszFileName = mir_t2u(szFileName);
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp
index c5206af9ed..183252d3db 100644
--- a/protocols/MSN/src/msn_opts.cpp
+++ b/protocols/MSN/src/msn_opts.cpp
@@ -47,19 +47,19 @@ static IconItem iconList[] =
void MsnInitIcons(void)
{
- Icon_Register(hInst, "Protocols/MSN", iconList, SIZEOF(iconList), "MSN");
+ Icon_Register(hInst, "Protocols/MSN", iconList, _countof(iconList), "MSN");
}
HICON LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "MSN_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "MSN_%s", name);
return IcoLib_GetIcon(szSettingName, big);
}
HANDLE GetIconHandle(int iconId)
{
- for (unsigned i = 0; i < SIZEOF(iconList); i++)
+ for (unsigned i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
@@ -69,7 +69,7 @@ HANDLE GetIconHandle(int iconId)
void ReleaseIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "MSN_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "MSN_%s", name);
IcoLib_Release(szSettingName, big);
}
@@ -174,7 +174,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
HWND tEditField = GetDlgItem(hwndDlg, IDC_MAILER_APP);
- GetWindowTextA(tEditField, szFile, SIZEOF(szFile));
+ GetWindowTextA(tEditField, szFile, _countof(szFile));
size_t tSelectLen = 0;
@@ -196,7 +196,7 @@ LBL_Continue:
OPENFILENAMEA ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwndDlg;
- ofn.nMaxFile = SIZEOF(szFile);
+ ofn.nMaxFile = _countof(szFile);
ofn.lpstrFile = szFile;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;
if (GetOpenFileNameA(&ofn) != TRUE)
@@ -204,7 +204,7 @@ LBL_Continue:
if (strchr(szFile, ' ') != NULL) {
char tmpBuf[MAX_PATH + 2];
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "\"%s\"", szFile);
+ mir_snprintf(tmpBuf, _countof(tmpBuf), "\"%s\"", szFile);
mir_strcpy(szFile, tmpBuf);
}
@@ -225,7 +225,7 @@ LBL_Continue:
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, SIZEOF(szEmail));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, _countof(szEmail));
if (mir_strcmp(_strlwr(szEmail), proto->MyOptions.szEmail)) {
reconnectRequired = true;
mir_strcpy(proto->MyOptions.szEmail, szEmail);
@@ -234,7 +234,7 @@ LBL_Continue:
proto->setDword("netId", (proto->MyOptions.netId = proto->GetMyNetID()));
}
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, SIZEOF(password));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, _countof(password));
if (!proto->getString("Password", &dbv)) {
if (mir_strcmp(password, dbv.pszVal)) {
reconnectRequired = true;
@@ -248,7 +248,7 @@ LBL_Continue:
}
#ifdef OBSOLETE
- GetDlgItemText(hwndDlg, IDC_HANDLE2, screenStr, SIZEOF(screenStr));
+ GetDlgItemText(hwndDlg, IDC_HANDLE2, screenStr, _countof(screenStr));
if (!proto->getTString("Nick", &dbv)) {
if (mir_tstrcmp(dbv.ptszVal, screenStr))
proto->MSN_SendNickname(screenStr);
@@ -275,7 +275,7 @@ LBL_Continue:
proto->setByte("RunMailerOnHotmail", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RUN_APP_ON_HOTMAIL));
proto->setByte("ManageServer", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MANAGEGROUPS));
- GetDlgItemText(hwndDlg, IDC_MAILER_APP, screenStr, SIZEOF(screenStr));
+ GetDlgItemText(hwndDlg, IDC_MAILER_APP, screenStr, _countof(screenStr));
proto->setTString("MailerPath", screenStr);
if (reconnectRequired && proto->msnLoggedIn)
@@ -382,13 +382,13 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, str, _countof(str));
if (mir_strcmp(str, MSN_DEFAULT_LOGIN_SERVER))
proto->setString("DirectServer", str);
else
proto->delSetting("DirectServer");
- GetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, str, _countof(str));
if (mir_strcmp(str, MSN_DEFAULT_GATEWAY))
proto->setString("GatewayServer", str);
else
@@ -412,7 +412,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam
proto->setByte("AutoGetHost", (BYTE)gethst);
if (gethst == 0) {
- GetDlgItemTextA(hwndDlg, IDC_YOURHOST, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_YOURHOST, str, _countof(str));
proto->setString("YourHost", str);
}
else proto->delSetting("YourHost");
@@ -551,7 +551,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L
CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, SIZEOF(szEmail));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, _countof(szEmail));
if (mir_strcmp(szEmail, proto->MyOptions.szEmail)) {
mir_strcpy(proto->MyOptions.szEmail, szEmail);
proto->setString("e-mail", szEmail);
@@ -559,7 +559,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L
proto->setDword("netId", (proto->MyOptions.netId = proto->GetMyNetID()));
}
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, SIZEOF(password));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, _countof(password));
if (!proto->getString("Password", &dbv)) {
if (mir_strcmp(password, dbv.pszVal))
proto->setString("Password", password);
@@ -568,7 +568,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L
else proto->setString("Password", password);
TCHAR szPlace[64];
- GetDlgItemText(hwndDlg, IDC_PLACE, szPlace, SIZEOF(szPlace));
+ GetDlgItemText(hwndDlg, IDC_PLACE, szPlace, _countof(szPlace));
if (szPlace[0])
proto->setTString("Place", szPlace);
else
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp
index 12568c3e52..dc965db7dd 100644
--- a/protocols/MSN/src/msn_p2p.cpp
+++ b/protocols/MSN/src/msn_p2p.cpp
@@ -235,7 +235,7 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft)
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = format;
ai.hContact = ft->std.hContact;
- MSN_GetAvatarFileName(ai.hContact, ai.filename, SIZEOF(ai.filename), ext);
+ MSN_GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename), ext);
_trename(ft->std.tszCurrentFile, ai.filename);
@@ -1174,7 +1174,7 @@ void CMsnProto::p2p_InitFileTransfer(
}
if (pictmatch) {
TCHAR szFileName[MAX_PATH];
- MSN_GetAvatarFileName(NULL, szFileName, SIZEOF(szFileName), NULL);
+ MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), NULL);
ft->fileId = _topen(szFileName, O_RDONLY | _O_BINARY, _S_IREAD);
if (ft->fileId == -1) {
p2p_sendStatus(ft, 603);
@@ -1224,7 +1224,7 @@ void CMsnProto::p2p_InitFileTransfer(
ft->std.totalFiles = 1;
TCHAR tComment[40];
- mir_sntprintf(tComment, SIZEOF(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_sntprintf(tComment, _countof(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
@@ -1396,7 +1396,7 @@ void CMsnProto::p2p_startConnect(const char* wlid, const char* szCallID, const c
newThread->mType = SERVER_P2P_DIRECT;
newThread->mInitialContactWLID = mir_strdup(wlid);
strncpy_s(newThread->mCookie, szCallID, _TRUNCATE);
- mir_snprintf(newThread->mServer, SIZEOF(newThread->mServer),
+ mir_snprintf(newThread->mServer, _countof(newThread->mServer),
ipv6 ? "[%s]:%s" : "%s:%s", pAddrTokBeg, pPortTokBeg);
newThread->startThread(&CMsnProto::p2p_fileActiveThread, this);
@@ -1739,7 +1739,7 @@ void CMsnProto::p2p_processMsgV2(ThreadData* info, char* msgbody, const char* wl
if (hdrdata.mRemSize || hdrdata.mTFCode == 0) {
char msgid[128];
- mir_snprintf(msgid, SIZEOF(msgid), "%s_%08x", wlid, hdrdata.mPacketNum);
+ mir_snprintf(msgid, _countof(msgid), "%s_%08x", wlid, hdrdata.mPacketNum);
int idx;
if (hdrdata.mTFCode == 0x01) {
@@ -1830,7 +1830,7 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wlid
if (hdrdata.mPacketLen < hdrdata.mTotalSize) {
char msgid[128];
- mir_snprintf(msgid, SIZEOF(msgid), "%s_%08x", wlid, hdrdata.mID);
+ mir_snprintf(msgid, _countof(msgid), "%s_%08x", wlid, hdrdata.mID);
int idx = addCachedMsg(msgid, msgbody, (size_t)hdrdata.mOffset, hdrdata.mPacketLen,
(size_t)hdrdata.mTotalSize, false);
@@ -2094,7 +2094,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid)
if (ft->p2p_isV2) {
if (cont->places.getCount() && cont->places[0].cap1 & cap_SupportsP2PBootstrap) {
char wlid[128];
- mir_snprintf(wlid, SIZEOF(wlid),
+ mir_snprintf(wlid, _countof(wlid),
mir_strcmp(cont->places[0].id, sttVoidUid) ? "%s;%s" : "%s",
cont->email, cont->places[0].id);
@@ -2145,7 +2145,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid)
if (ft->p2p_isV2 && ft->std.currentFileNumber == 0) {
for (int i = 0; i < cont->places.getCount(); ++i) {
char wlid[128];
- mir_snprintf(wlid, SIZEOF(wlid),
+ mir_snprintf(wlid, _countof(wlid),
mir_strcmp(cont->places[i].id, sttVoidUid) ? "%s;%s" : "%s",
cont->email, cont->places[i].id);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp
index c5709e7fbd..298f1e2892 100644
--- a/protocols/MSN/src/msn_proto.cpp
+++ b/protocols/MSN/src/msn_proto.cpp
@@ -128,7 +128,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) :
nlu1.szSettingsModule = szDbsettings;
nlu1.ptszDescriptiveName = szBuffer;
- mir_snprintf(szDbsettings, SIZEOF(szDbsettings), "%s_HTTPS", m_szModuleName);
+ mir_snprintf(szDbsettings, _countof(szDbsettings), "%s_HTTPS", m_szModuleName);
mir_sntprintf(szBuffer, TranslateT("%s plugin HTTPS connections"), m_tszUserName);
hNetlibUserHttps = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu1);
@@ -494,7 +494,7 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg)
filetransfer* ft = (filetransfer*)arg;
TCHAR filefull[MAX_PATH];
- mir_sntprintf(filefull, SIZEOF(filefull), _T("%s\\%s"), ft->std.tszWorkingDir, ft->std.tszCurrentFile);
+ mir_sntprintf(filefull, _countof(filefull), _T("%s\\%s"), ft->std.tszWorkingDir, ft->std.tszCurrentFile);
replaceStrT(ft->std.tszCurrentFile, filefull);
ResetEvent(ft->hResumeEvt);
@@ -586,7 +586,7 @@ HANDLE __cdecl CMsnProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szP
if ((ft->std.tszWorkingDir = mir_tstrdup(szPath)) == NULL) {
TCHAR szCurrDir[MAX_PATH];
- GetCurrentDirectory(SIZEOF(szCurrDir), szCurrDir);
+ GetCurrentDirectory(_countof(szCurrDir), szCurrDir);
ft->std.tszWorkingDir = mir_tstrdup(szCurrDir);
}
else {
@@ -1226,7 +1226,7 @@ int __cdecl CMsnProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l
case EV_PROTO_ONERASE:
char szDbsettings[64];
- mir_snprintf(szDbsettings, SIZEOF(szDbsettings), "%s_HTTPS", m_szModuleName);
+ mir_snprintf(szDbsettings, _countof(szDbsettings), "%s_HTTPS", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbsettings);
break;
diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp
index a3785c4adf..85395980f5 100644
--- a/protocols/MSN/src/msn_soapab.cpp
+++ b/protocols/MSN/src/msn_soapab.cpp
@@ -76,8 +76,8 @@ ezxml_t CMsnProto::abSoapHdr(const char* service, const char* scenario, ezxml_t&
ezxml_t CMsnProto::getSoapResponse(ezxml_t bdy, const char* service)
{
char resp1[40], resp2[40];
- mir_snprintf(resp1, SIZEOF(resp1), "%sResponse", service);
- mir_snprintf(resp2, SIZEOF(resp2), "%sResult", service);
+ mir_snprintf(resp1, _countof(resp1), "%sResponse", service);
+ mir_snprintf(resp2, _countof(resp2), "%sResult", service);
ezxml_t res = ezxml_get(bdy, "soap:Body", 0, resp1, 0, resp2, -1);
if (res == NULL)
@@ -95,7 +95,7 @@ ezxml_t CMsnProto::getSoapFault(ezxml_t bdy, bool err)
void CMsnProto::UpdateABHost(const char* service, const char* url)
{
char hostname[128];
- mir_snprintf(hostname, SIZEOF(hostname), "ABHost-%s", service);
+ mir_snprintf(hostname, _countof(hostname), "ABHost-%s", service);
if (url)
setString(hostname, url);
@@ -114,7 +114,7 @@ void CMsnProto::UpdateABCacheKey(ezxml_t bdy, bool isSharing)
char* CMsnProto::GetABHost(const char* service, bool isSharing)
{
char hostname[128];
- mir_snprintf(hostname, SIZEOF(hostname), "ABHost-%s", service);
+ mir_snprintf(hostname, _countof(hostname), "ABHost-%s", service);
char* host = (char*)mir_alloc(256);
if (db_get_static(NULL, m_szModuleName, hostname, host, 256)) {
@@ -284,7 +284,7 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse)
}
else if (mir_strcmp(szType, "Phone") == 0) {
netId = NETID_MOB;
- mir_snprintf(email, SIZEOF(email), "tel:%s", ezxml_txt(ezxml_child(memb, "PhoneNumber")));
+ mir_snprintf(email, _countof(email), "tel:%s", ezxml_txt(ezxml_child(memb, "PhoneNumber")));
szEmail = email;
}
else if (mir_strcmp(szType, "Email") == 0) {
@@ -686,7 +686,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas
szMsgUsr = ezxml_txt(ezxml_child(phn, "isMessengerEnabled"));
if (mir_strcmp(szMsgUsr, "true") == 0) {
szEmail = ezxml_txt(ezxml_child(phn, "number"));
- mir_snprintf(email, SIZEOF(email), "tel:%s", szEmail);
+ mir_snprintf(email, _countof(email), "tel:%s", szEmail);
szEmail = email;
netId = NETID_MOB;
break;
@@ -1584,7 +1584,7 @@ void CMsnProto::MSN_ABUpdateDynamicItem(bool allowRecurse)
tm *tmst = gmtime(&timer);
char tmstr[64];
- mir_snprintf(tmstr, SIZEOF(tmstr), "%04u-%02u-%02uT%02u:%02u:%02uZ",
+ mir_snprintf(tmstr, _countof(tmstr), "%04u-%02u-%02uT%02u:%02u:%02uZ",
tmst->tm_year + 1900, tmst->tm_mon + 1, tmst->tm_mday,
tmst->tm_hour, tmst->tm_min, tmst->tm_sec);
diff --git a/protocols/MSN/src/msn_soapstore.cpp b/protocols/MSN/src/msn_soapstore.cpp
index 8dce12549e..fc8a5b96f2 100644
--- a/protocols/MSN/src/msn_soapstore.cpp
+++ b/protocols/MSN/src/msn_soapstore.cpp
@@ -71,7 +71,7 @@ ezxml_t CMsnProto::storeSoapHdr(const char* service, const char* scenario, ezxml
char* CMsnProto::GetStoreHost(const char* service)
{
char hostname[128];
- mir_snprintf(hostname, SIZEOF(hostname), "StoreHost-%s", service);
+ mir_snprintf(hostname, _countof(hostname), "StoreHost-%s", service);
char* host = (char*)mir_alloc(256);
if (db_get_static(NULL, m_szModuleName, hostname, host, 256) || !*host)
@@ -83,7 +83,7 @@ char* CMsnProto::GetStoreHost(const char* service)
void CMsnProto::UpdateStoreHost(const char* service, const char* url)
{
char hostname[128];
- mir_snprintf(hostname, SIZEOF(hostname), "StoreHost-%s", service);
+ mir_snprintf(hostname, _countof(hostname), "StoreHost-%s", service);
setString(hostname, url);
}
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp
index b509b243f8..93144442b1 100644
--- a/protocols/MSN/src/msn_svcs.cpp
+++ b/protocols/MSN/src/msn_svcs.cpp
@@ -78,7 +78,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
}
if (pai->hContact == NULL || _stricmp(cont->email, MyOptions.szEmail) == 0) {
- MSN_GetAvatarFileName(NULL, filename, SIZEOF(filename), NULL);
+ MSN_GetAvatarFileName(NULL, filename, _countof(filename), NULL);
pai->format = ProtoGetAvatarFormat(filename);
if (pai->format != PA_FORMAT_UNKNOWN)
mir_tstrcpy(pai->filename, filename);
@@ -93,7 +93,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
}
else return GAIR_NOAVATAR;
- MSN_GetAvatarFileName(pai->hContact, filename, SIZEOF(filename), NULL);
+ MSN_GetAvatarFileName(pai->hContact, filename, _countof(filename), NULL);
pai->format = ProtoGetAvatarFormat(filename);
if (pai->format != PA_FORMAT_UNKNOWN) {
@@ -139,7 +139,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
ft->std.hContact = pai->hContact;
ft->p2p_object = mir_strdup(szContext);
- MSN_GetAvatarFileName(pai->hContact, filename, SIZEOF(filename), _T("unk"));
+ MSN_GetAvatarFileName(pai->hContact, filename, _countof(filename), _T("unk"));
ft->std.tszCurrentFile = mir_tstrdup(filename);
p2p_invite(MSN_APPID_AVATAR, ft, NULL);
@@ -188,7 +188,7 @@ INT_PTR CMsnProto::SetAvatar(WPARAM, LPARAM lParam)
TCHAR* szFileName = (TCHAR*)lParam;
TCHAR tFileName[MAX_PATH];
- MSN_GetAvatarFileName(NULL, tFileName, SIZEOF(tFileName), NULL);
+ MSN_GetAvatarFileName(NULL, tFileName, _countof(tFileName), NULL);
_tremove(tFileName);
if (szFileName == NULL) {