diff options
author | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-12-01 04:50:22 +0000 |
---|---|---|
committer | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-12-01 04:50:22 +0000 |
commit | 41a7300678e4bb3cd703e2c236e57af4a31962c7 (patch) | |
tree | 36318f807498cf15b405eda5c451fd37bfe1b675 /protocols/MSN/src | |
parent | 97e0ada5c34d6e7eba1cf47a8d8ac029197be6de (diff) |
mir_snprintf(..., sizeof() -> SIZEOF(), ...)
small fixs cleanups
git-svn-id: http://svn.miranda-ng.org/main/trunk@11188 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MSN/src')
-rw-r--r-- | protocols/MSN/src/msn_auth.cpp | 2 | ||||
-rw-r--r-- | protocols/MSN/src/msn_commands.cpp | 32 | ||||
-rw-r--r-- | protocols/MSN/src/msn_contact.cpp | 6 | ||||
-rw-r--r-- | protocols/MSN/src/msn_ftold.cpp | 12 | ||||
-rw-r--r-- | protocols/MSN/src/msn_lists.cpp | 20 | ||||
-rw-r--r-- | protocols/MSN/src/msn_mail.cpp | 2 | ||||
-rw-r--r-- | protocols/MSN/src/msn_menu.cpp | 4 | ||||
-rw-r--r-- | protocols/MSN/src/msn_misc.cpp | 24 | ||||
-rw-r--r-- | protocols/MSN/src/msn_opts.cpp | 8 | ||||
-rw-r--r-- | protocols/MSN/src/msn_p2p.cpp | 8 | ||||
-rw-r--r-- | protocols/MSN/src/msn_proto.cpp | 4 | ||||
-rw-r--r-- | protocols/MSN/src/msn_soapab.cpp | 22 | ||||
-rw-r--r-- | protocols/MSN/src/msn_soapstore.cpp | 12 |
13 files changed, 79 insertions, 77 deletions
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index d0b2830664..271a5de5a3 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -249,7 +249,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, SIZEOF(err), "Unknown Authentication error: %s", szFault);
MSN_ShowError(err);
}
}
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 4c5b24369e..7086b0a042 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -161,9 +161,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, SIZEOF(newThread->mServer), "%s:%s", IPAddress, Port);
else
- mir_snprintf(newThread->mServer, sizeof(newThread->mServer), "%s:%u", IPAddressInt, atol(PortXInt) ^ 0x3141);
+ mir_snprintf(newThread->mServer, SIZEOF(newThread->mServer), "%s:%u", IPAddressInt, atol(PortXInt) ^ 0x3141);
newThread->mType = SERVER_FILETRANS;
@@ -195,7 +195,7 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, Sleep(3000);
char command[1024];
- int nBytes = mir_snprintf(command, sizeof(command),
+ int nBytes = mir_snprintf(command, SIZEOF(command),
"MIME-Version: 1.0\r\n"
"Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n"
"Invitation-Command: ACCEPT\r\n"
@@ -219,7 +219,7 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, mir_free(tszEmail);
if (MessageBox(NULL, text, TranslateT("MSN Protocol"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
- nBytes = mir_snprintf(command, sizeof(command),
+ nBytes = mir_snprintf(command, SIZEOF(command),
"MIME-Version: 1.0\r\n"
"Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n"
"Invitation-Command: ACCEPT\r\n"
@@ -232,7 +232,7 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, Invcookie, MyConnection.GetMyExtIPStr());
}
else {
- nBytes = mir_snprintf(command, sizeof(command),
+ nBytes = mir_snprintf(command, SIZEOF(command),
"MIME-Version: 1.0\r\n"
"Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n"
"Invitation-Command: CANCEL\r\n"
@@ -245,8 +245,8 @@ 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);
+ char ipaddr[256];
+ mir_snprintf(ipaddr, SIZEOF(ipaddr), "callto://%s", IPAddress);
ShellExecuteA(NULL, "open", ipaddr, NULL, NULL, SW_SHOW);
}
}
@@ -582,7 +582,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, SIZEOF(szEmail), "%s@%s", szCont, szDom);
const char *szNetId = ezxml_attr(cont, "t");
if (msnSearchId != NULL) {
@@ -638,7 +638,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, SIZEOF(szEmail), "%s@%s", szCont, szDom);
UrlDecode((char*)szNick);
@@ -685,7 +685,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, SIZEOF(szEmail), "%s@%s", szCont, szDom);
Lists_Remove(listId, szEmail);
MsnContact* msc = Lists_Get(szEmail);
@@ -798,7 +798,7 @@ void CMsnProto::MSN_ProcessStatusMessage(char* buf, unsigned len, const char* wl 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, SIZEOF(part), "{%d}", i - 4);
if (parts[i][0] == '\0' && unknown != NULL)
parts[i] = unknown;
size_t lenPartsI = strlen(parts[i]);
@@ -892,13 +892,13 @@ void CMsnProto::MSN_ProcessNotificationMessage(char* buf, unsigned 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), (SIZEOF(fullurl) - sz), "%s", ezxml_attr(xmlnot, "siteurl"));
- sz += mir_snprintf(fullurl + sz, sizeof(fullurl)-sz, "%s", acturl);
+ sz += mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "%s", acturl);
if (sz != 0 && fullurl[sz - 1] != '?')
- sz += mir_snprintf(fullurl + sz, sizeof(fullurl)-sz, "?");
+ sz += mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "?");
- mir_snprintf(fullurl + sz, sizeof(fullurl)-sz, "notification_id=%s&message_id=%s",
+ mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "notification_id=%s&message_id=%s",
ezxml_attr(xmlnot, "id"), ezxml_attr(xmlmsg, "id"));
SkinPlaySound(alertsoundname);
@@ -1514,7 +1514,7 @@ remove: 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, SIZEOF(newThread->mCookie), "%s %d", data.authChallengeInfo, trid);
ReleaseSemaphore(newThread->hWaitEvent, MSN_PACKETS_COMBINE, NULL);
diff --git a/protocols/MSN/src/msn_contact.cpp b/protocols/MSN/src/msn_contact.cpp index 06f5abe7e5..7f55df3420 100644 --- a/protocols/MSN/src/msn_contact.cpp +++ b/protocols/MSN/src/msn_contact.cpp @@ -88,13 +88,13 @@ void CMsnProto::AddDelUserContList(const char* email, const int list, const int if (list < LIST_RL) {
const char* dom = strchr(email, '@');
if (dom == NULL) {
- sz = mir_snprintf(buf, sizeof(buf),
+ sz = mir_snprintf(buf, SIZEOF(buf),
"<ml><t><c n=\"%s\" l=\"%d\"/></t></ml>",
email, list);
}
else {
*(char*)dom = 0;
- sz = mir_snprintf(buf, sizeof(buf),
+ sz = mir_snprintf(buf, SIZEOF(buf),
"<ml><d n=\"%s\"><c n=\"%s\" l=\"%d\" t=\"%d\"/></d></ml>",
dom + 1, email, list, netId);
*(char*)dom = '@';
@@ -215,7 +215,7 @@ void CMsnProto::MSN_FindYahooUser(const char* email) size_t sz;
*(char*)dom = '\0';
- sz = mir_snprintf(buf, sizeof(buf), "<ml><d n=\"%s\"><c n=\"%s\"/></d></ml>", dom + 1, email);
+ sz = mir_snprintf(buf, SIZEOF(buf), "<ml><d n=\"%s\"><c n=\"%s\"/></d></ml>", dom + 1, email);
*(char*)dom = '@';
msnNsThread->sendPacket("FQY", "%d\r\n%s", sz, buf);
}
diff --git a/protocols/MSN/src/msn_ftold.cpp b/protocols/MSN/src/msn_ftold.cpp index 20284d152a..305e6319b7 100644 --- a/protocols/MSN/src/msn_ftold.cpp +++ b/protocols/MSN/src/msn_ftold.cpp @@ -150,8 +150,9 @@ int CMsnProto::MSN_HandleMSNFTP(ThreadData *info, char *cmdString) }
char tCommand[30];
- mir_snprintf(tCommand, sizeof(tCommand), "FIL %i\r\n", info->mMsnFtp->std.totalBytes);
- info->send(tCommand, strlen(tCommand));
+ size_t tCommandLen;
+ tCommandLen = mir_snprintf(tCommand, SIZEOF(tCommand), "FIL %i\r\n", info->mMsnFtp->std.totalBytes);
+ info->send(tCommand, tCommandLen);
break;
case ' REV': //********* VER
@@ -173,8 +174,9 @@ LBL_InvalidCommand: if (info->mCaller == 0) { //receive
char tCommand[MSN_MAX_EMAIL_LEN + 50];
- mir_snprintf(tCommand, sizeof(tCommand), "USR %s %s\r\n", MyOptions.szEmail, info->mCookie);
- info->send(tCommand, strlen(tCommand));
+ size_t tCommandLen;
+ tCommandLen = mir_snprintf(tCommand, SIZEOF(tCommand), "USR %s %s\r\n", MyOptions.szEmail, info->mCookie);
+ info->send(tCommand, tCommandLen);
}
else if (info->mCaller == 2) { //send
static const char sttCommand[] = "VER MSNFTP\r\n";
@@ -332,7 +334,7 @@ void CMsnProto::msnftp_startFileSend(ThreadData* info, const char* Invcommand, c hostname[0] = 0;
char command[1024];
- int nBytes = mir_snprintf(command, sizeof(command),
+ int nBytes = mir_snprintf(command, SIZEOF(command),
"MIME-Version: 1.0\r\n"
"Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n"
"Invitation-Command: %s\r\n"
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index b94e572aaa..2bc9a1cf65 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -275,7 +275,7 @@ void CMsnProto::MSN_CreateContList(void) char cxml[8192];
- size_t sz = mir_snprintf(cxml, sizeof(cxml), "<ml l=\"1\">");
+ size_t sz = mir_snprintf(cxml, SIZEOF(cxml), "<ml l=\"1\">");
{
mir_cslock lck(m_csLists);
@@ -296,42 +296,42 @@ void CMsnProto::MSN_CreateContList(void) const char *dom = strchr(C.email, '@');
if (dom == NULL && lastds == NULL) {
- if (sz == 0) sz = mir_snprintf(cxml + sz, sizeof(cxml), "<ml l=\"1\">");
+ if (sz == 0) sz = mir_snprintf((cxml + sz), (SIZEOF(cxml) - sz), "<ml l=\"1\">");
if (newdom) {
- sz += mir_snprintf(cxml + sz, sizeof(cxml) - sz, "<t>");
+ sz += mir_snprintf((cxml + sz), (SIZEOF(cxml) - sz), "<t>");
newdom = false;
}
- sz += mir_snprintf(cxml + sz, sizeof(cxml) - sz, "<c n=\"%s\" l=\"%d\"/>", C.email, C.list & ~(LIST_RL | LIST_LL));
+ sz += mir_snprintf((cxml + sz), (SIZEOF(cxml) - sz), "<c n=\"%s\" l=\"%d\"/>", C.email, C.list & ~(LIST_RL | LIST_LL));
used[j] = true;
}
else if (dom != NULL && lastds != NULL && _stricmp(lastds, dom) == 0) {
- if (sz == 0) sz = mir_snprintf(cxml, sizeof(cxml), "<ml l=\"1\">");
+ if (sz == 0) sz = mir_snprintf((cxml + sz), (SIZEOF(cxml) - sz), "<ml l=\"1\">");
if (newdom) {
- sz += mir_snprintf(cxml + sz, sizeof(cxml) - sz, "<d n=\"%s\">", lastds + 1);
+ sz += mir_snprintf((cxml + sz), (SIZEOF(cxml) - sz), "<d n=\"%s\">", lastds + 1);
newdom = false;
}
*(char*)dom = 0;
- sz += mir_snprintf(cxml + sz, sizeof(cxml) - sz, "<c n=\"%s\" l=\"%d\" t=\"%d\"/>", C.email, C.list & ~(LIST_RL | LIST_LL), C.netId);
+ sz += mir_snprintf((cxml + sz), (SIZEOF(cxml) - sz), "<c n=\"%s\" l=\"%d\" t=\"%d\"/>", C.email, C.list & ~(LIST_RL | LIST_LL), C.netId);
*(char*)dom = '@';
used[j] = true;
}
if (used[j] && sz > 7400) {
- sz += mir_snprintf(cxml + sz, sizeof(cxml) - sz, "</%c></ml>", lastds ? 'd' : 't');
+ sz += mir_snprintf((cxml + sz), (SIZEOF(cxml) - sz), "</%c></ml>", lastds ? 'd' : 't');
msnNsThread->sendPacket("ADL", "%d\r\n%s", sz, cxml);
sz = 0;
newdom = true;
}
}
if (!newdom)
- sz += mir_snprintf(cxml + sz, sizeof(cxml) - sz, lastds ? "</d>" : "</t>");
+ sz += mir_snprintf((cxml + sz), (SIZEOF(cxml) - sz), lastds ? "</d>" : "</t>");
}
}
if (sz) {
- sz += mir_snprintf(cxml + sz, sizeof(cxml) - sz, "</ml>");
+ sz += mir_snprintf((cxml + sz), (SIZEOF(cxml) - sz), "</ml>");
msnNsThread->sendPacket("ADL", "%d\r\n%s", sz, cxml);
}
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index 80f45f1211..3158934d8e 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -318,7 +318,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) msgurl = "inbox";
char szUrl[256];
- mir_snprintf(szUrl, sizeof(szUrl), "http://mail.live.com?rru=%s", msgurl);
+ mir_snprintf(szUrl, SIZEOF(szUrl), "http://mail.live.com?rru=%s", msgurl);
MSN_ShowPopup(tBuffer, tBuffer2,
MSN_ALLOW_ENTER | MSN_ALLOW_MSGBOX | MSN_HOTMAIL_POPUP,
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index f4193b4d92..948a5b03e5 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -92,7 +92,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, SIZEOF(tUrl), "http://cid-%I64X.profiles.live.com", _atoi64(cid));
MsnInvokeMyURL(false, tUrl);
return 0;
}
@@ -177,7 +177,7 @@ INT_PTR CMsnProto::MsnSendNetMeeting(WPARAM wParam, LPARAM) char msg[1024];
- mir_snprintf(msg, sizeof(msg),
+ mir_snprintf(msg, SIZEOF(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"
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index f7cf5cd6b4..74458df7bd 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -155,7 +155,7 @@ char* MSN_GetAvatarHash(char* szContext, char** pszUrl) if (i == 0)
strcpy(szSetting, "Url");
else
- mir_snprintf(szSetting, sizeof(szSetting), "Url%d", i);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "Url%d", i);
pszUrlAttr = ezxml_attr(xmli, szSetting);
if (pszUrlAttr == NULL)
break;
@@ -420,7 +420,7 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha char buf[2048];
int off;
- off = mir_snprintf(buf, sizeof(buf), "MIME-Version: 1.0\r\n");
+ off = mir_snprintf(buf, SIZEOF(buf), "MIME-Version: 1.0\r\n");
if ((parFlags & MSG_DISABLE_HDR) == 0) {
char tFontName[100], tFontStyle[3];
@@ -457,10 +457,10 @@ int ThreadData::sendMessage(int msgType, const char* email, int netId, const cha }
if (parFlags & MSG_OFFLINE)
- off += mir_snprintf(buf + off, sizeof(buf) - off, "Dest-Agent: client\r\n");
+ off += mir_snprintf((buf + off), (SIZEOF(buf) - off), "Dest-Agent: client\r\n");
- off += mir_snprintf(buf + off, sizeof(buf) - off, "Content-Type: text/plain; charset=UTF-8\r\n");
- off += mir_snprintf(buf + off, sizeof(buf) - off, "X-MMS-IM-Format: FN=%s; EF=%s; CO=%x; CS=0; PF=31%s\r\n\r\n",
+ off += mir_snprintf((buf + off), (SIZEOF(buf) - off), "Content-Type: text/plain; charset=UTF-8\r\n");
+ off += mir_snprintf((buf + off), (SIZEOF(buf) - off), "X-MMS-IM-Format: FN=%s; EF=%s; CO=%x; CS=0; PF=31%s\r\n\r\n",
tFontName, tFontStyle, tFontColor, (parFlags & MSG_RTL) ? ";RL=1" : "");
}
@@ -480,7 +480,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, SIZEOF(capMsg),
"Content-Type: text/x-clientcaps\r\n\r\n"
"Client-Name: Miranda NG %s (MSN v.%s)\r\n",
mversion, __VERSION_STRING_DOTS);
@@ -524,7 +524,7 @@ int ThreadData::sendRawMessage(int msgType, const char* data, int datLen) void CMsnProto::MSN_SendTyping(ThreadData* info, const char* email, int netId)
{
char tCommand[1024];
- mir_snprintf(tCommand, sizeof(tCommand),
+ mir_snprintf(tCommand, SIZEOF(tCommand),
"Content-Type: text/x-msmsgscontrol\r\n"
"TypingUser: %s\r\n\r\n\r\n", MyOptions.szEmail);
@@ -586,7 +586,7 @@ void CMsnProto::MSN_SendStatusMessage(const char* msg) 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, SIZEOF(szMsg), "<Data><PSM>%s</PSM><CurrentMedia></CurrentMedia><MachineGuid>%s</MachineGuid>"
"<DDP></DDP><SignatureSound></SignatureSound><Scene></Scene><ColorScheme></ColorScheme></Data>",
msgEnc, MyOptions.szMachineGuid);
}
@@ -621,7 +621,7 @@ void CMsnProto::MSN_SendStatusMessage(const char* msg) char *szPlayer = HtmlEncodeUTF8T(msnCurrentMedia.ptszPlayer);
char *szType = HtmlEncodeUTF8T(msnCurrentMedia.ptszType);
- sz = mir_snprintf(szMsg, sizeof szMsg,
+ sz = mir_snprintf(szMsg, SIZEOF(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>"
@@ -718,7 +718,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus) char szMsg[256];
if (m_iStatus < ID_STATUS_ONLINE) {
- int sz = mir_snprintf(szMsg, sizeof(szMsg),
+ int sz = mir_snprintf(szMsg, SIZEOF(szMsg),
"<EndpointData><Capabilities>%u:%u</Capabilities></EndpointData>", myFlags, myFlagsEx);
msnNsThread->sendPacket("UUX", "%d\r\n%s", sz, szMsg);
@@ -743,7 +743,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus) szPlace = mir_utf8encodeT(buf);
}
- int sz = mir_snprintf(szMsg, sizeof(szMsg),
+ int sz = mir_snprintf(szMsg, SIZEOF(szMsg),
"<PrivateEndpointData>"
"<EpName>%s</EpName>"
"<Idle>%s</Idle>"
@@ -1237,7 +1237,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, SIZEOF(chlString), "%s%s00000000", chl, msnProductID);
chlString[(strlen(chl) + strlen(msnProductID) + 7) & 0xF8] = 0;
LONGLONG high = 0, low = 0;
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 6003c2c5e5..f0653b83b0 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -53,7 +53,7 @@ void MsnInitIcons(void) HICON LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, sizeof(szSettingName), "MSN_%s", name);
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "MSN_%s", name);
return Skin_GetIcon(szSettingName, big);
}
@@ -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, SIZEOF(szSettingName), "MSN_%s", name);
Skin_ReleaseIcon(szSettingName, big);
}
@@ -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, SIZEOF(tmpBuf), "\"%s\"", szFile);
strcpy(szFile, tmpBuf);
}
@@ -329,7 +329,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam gethst = 0;
if (gethst == 0)
- mir_snprintf(ipaddr, sizeof(ipaddr), "%s", proto->msnLoggedIn ? proto->MyConnection.GetMyExtIPStr() : "");
+ mir_snprintf(ipaddr, SIZEOF(ipaddr), "%s", proto->msnLoggedIn ? proto->MyConnection.GetMyExtIPStr() : "");
SendDlgItemMessage(hwndDlg, IDC_HOSTOPT, CB_SETCURSEL, gethst, 0);
if (ipaddr[0])
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index f9703ad446..a6cb19e8e0 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -1398,8 +1398,8 @@ void CMsnProto::p2p_startConnect(const char* wlid, const char* szCallID, const c newThread->mType = SERVER_P2P_DIRECT;
newThread->mInitialContactWLID = mir_strdup(wlid);
- mir_snprintf(newThread->mCookie, sizeof(newThread->mCookie), "%s", szCallID);
- mir_snprintf(newThread->mServer, sizeof(newThread->mServer),
+ mir_snprintf(newThread->mCookie, SIZEOF(newThread->mCookie), "%s", szCallID);
+ mir_snprintf(newThread->mServer, SIZEOF(newThread->mServer),
ipv6 ? "[%s]:%s" : "%s:%s", pAddrTokBeg, pPortTokBeg);
newThread->startThread(&CMsnProto::p2p_fileActiveThread, this);
@@ -1742,7 +1742,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, SIZEOF(msgid), "%s_%08x", wlid, hdrdata.mPacketNum);
int idx;
if (hdrdata.mTFCode == 0x01) {
@@ -1833,7 +1833,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, SIZEOF(msgid), "%s_%08x", wlid, hdrdata.mID);
int idx = addCachedMsg(msgid, msgbody, (size_t)hdrdata.mOffset, hdrdata.mPacketLen,
(size_t)hdrdata.mTotalSize, false);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 1442006c20..c4a9461921 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -123,7 +123,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, SIZEOF(szDbsettings), "%s_HTTPS", m_szModuleName);
mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s plugin HTTPS connections"), m_tszUserName);
hNetlibUserHttps = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu1);
@@ -1081,7 +1081,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, SIZEOF(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 a3871d4c37..22b92fe25b 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, SIZEOF(resp1), "%sResponse", service);
+ mir_snprintf(resp2, SIZEOF(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, SIZEOF(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, SIZEOF(hostname), "ABHost-%s", service);
char* host = (char*)mir_alloc(256);
if (db_get_static(NULL, m_szModuleName, hostname, host, 256)) {
@@ -286,7 +286,7 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse) else if (strcmp(szType, "Phone") == 0) {
netId = NETID_MOB;
char email[128];
- mir_snprintf(email, sizeof(email), "tel:%s", ezxml_txt(ezxml_child(memb, "PhoneNumber")));
+ mir_snprintf(email, SIZEOF(email), "tel:%s", ezxml_txt(ezxml_child(memb, "PhoneNumber")));
szEmail = email;
}
else if (strcmp(szType, "Email") == 0) {
@@ -403,7 +403,7 @@ bool CMsnProto::MSN_SharingAddDelMember(const char* szEmail, const int listId, c ezxml_set_txt(node, "MSN.IM.BuddyType");
node = ezxml_add_child(anot, "Value", 0);
- mir_snprintf(buf, sizeof(buf), "%02d:", netId);
+ mir_snprintf(buf, SIZEOF(buf), "%02d:", netId);
ezxml_set_txt(node, buf);
}
@@ -637,8 +637,8 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas }
ezxml_t abinf = ezxml_child(ab, "abInfo");
- mir_snprintf(mycid, sizeof(mycid), "%s", ezxml_txt(ezxml_child(abinf, "OwnerCID")));
- mir_snprintf(mypuid, sizeof(mycid), "%s", ezxml_txt(ezxml_child(abinf, "ownerPuid")));
+ mir_snprintf(mycid, SIZEOF(mycid), "%s", ezxml_txt(ezxml_child(abinf, "OwnerCID")));
+ mir_snprintf(mypuid, SIZEOF(mypuid), "%s", ezxml_txt(ezxml_child(abinf, "ownerPuid")));
if (MyOptions.ManageServer) {
ezxml_t grp = ezxml_get(body, szGroups, 0, "Group", -1);
@@ -688,7 +688,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas szMsgUsr = ezxml_txt(ezxml_child(phn, "isMessengerEnabled"));
if (strcmp(szMsgUsr, "true") == 0) {
szEmail = ezxml_txt(ezxml_child(phn, "number"));
- mir_snprintf(email, sizeof(email), "tel:%s", szEmail);
+ mir_snprintf(email, SIZEOF(email), "tel:%s", szEmail);
szEmail = email;
netId = NETID_MOB;
break;
@@ -1465,8 +1465,8 @@ void CMsnProto::MSN_ABUpdateDynamicItem(bool allowRecurse) time(&timer);
tm *tmst = gmtime(&timer);
- char tmstr[32];
- mir_snprintf(tmstr, sizeof(tmstr), "%04u-%02u-%02uT%02u:%02u:%02uZ",
+ char tmstr[64];
+ mir_snprintf(tmstr, SIZEOF(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 89d8bfe5b1..1028e403cc 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, SIZEOF(hostname), "StoreHost-%s", service);
char* host = (char*)mir_alloc(256);
if (db_get_static(NULL, m_szModuleName, hostname, host, 256))
@@ -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, SIZEOF(hostname), "StoreHost-%s", service);
setString(hostname, url);
}
@@ -257,7 +257,7 @@ bool CMsnProto::MSN_StoreGetProfile(bool allowRecurse) UpdateStoreHost("GetProfile", body ? storeUrl : NULL);
- mir_snprintf(proresid, sizeof(proresid), "%s", ezxml_txt(ezxml_child(body, "ResourceID")));
+ mir_snprintf(proresid, SIZEOF(proresid), "%s", ezxml_txt(ezxml_child(body, "ResourceID")));
ezxml_t expr = ezxml_child(body, "ExpressionProfile");
if (expr == NULL) {
@@ -272,10 +272,10 @@ bool CMsnProto::MSN_StoreGetProfile(bool allowRecurse) const char* szStatus = ezxml_txt(ezxml_child(expr, "PersonalStatus"));
replaceStr(msnLastStatusMsg, szStatus);
- mir_snprintf(expresid, sizeof(expresid), "%s", ezxml_txt(ezxml_child(expr, "ResourceID")));
+ mir_snprintf(expresid, SIZEOF(expresid), "%s", ezxml_txt(ezxml_child(expr, "ResourceID")));
ezxml_t photo = ezxml_child(expr, "Photo");
- mir_snprintf(photoid, sizeof(photoid), "%s", ezxml_txt(ezxml_child(photo, "ResourceID")));
+ mir_snprintf(photoid, SIZEOF(photoid), "%s", ezxml_txt(ezxml_child(photo, "ResourceID")));
ezxml_t docstr = ezxml_get(photo, "DocumentStreams", 0, "DocumentStream", -1);
while (docstr) {
@@ -565,7 +565,7 @@ bool CMsnProto::MSN_StoreCreateDocument(const TCHAR *sztName, const char *szMime if (status == 200) {
ezxml_t xmlm = ezxml_parse_str(tResult, strlen(tResult));
ezxml_t bdy = getSoapResponse(xmlm, "CreateDocument");
- mir_snprintf(photoid, sizeof(photoid), "%s", ezxml_txt(bdy));
+ mir_snprintf(photoid, SIZEOF(photoid), "%s", ezxml_txt(bdy));
ezxml_free(xmlm);
}
else if (status == 500) {
|