diff options
author | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-12-08 22:13:57 +0000 |
---|---|---|
committer | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-12-08 22:13:57 +0000 |
commit | 13eb83bea655c3302c74a82d826d75bceb9232a2 (patch) | |
tree | ea992cbd9002e078a06e9fe65a73698eec4fbc22 /protocols | |
parent | ef741fcb36d679b094e44d01714f423c34357383 (diff) |
code cleanup around mir_snprintf
git-svn-id: http://svn.miranda-ng.org/main/trunk@11285 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
29 files changed, 86 insertions, 88 deletions
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index f54dda4d3e..c43f9e0dfa 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -61,7 +61,7 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts) *avatarurl = *avatarts = NULL;
char szUrl[128];
- mir_snprintf(szUrl, 128, "http://api.gadu-gadu.pl/avatars/%d/0.xml", uin);
+ mir_snprintf(szUrl, SIZEOF(szUrl), "http://api.gadu-gadu.pl/avatars/%d/0.xml", uin);
NETLIBHTTPREQUEST req = { sizeof(req) };
req.requestType = REQUEST_GET;
@@ -391,7 +391,7 @@ void __cdecl GGPROTO::setavatarthread(void *param) size_t avatarFileB64EncLen = strlen(avatarFileB64Enc);
char dataPrefix[64];
- mir_snprintf(dataPrefix, 64, "uin=%d&photo=", getDword(GG_KEY_UIN, 0));
+ mir_snprintf(dataPrefix, SIZEOF(dataPrefix), "uin=%d&photo=", getDword(GG_KEY_UIN, 0));
size_t dataPrefixLen = strlen(dataPrefix);
size_t dataLen = dataPrefixLen + avatarFileB64EncLen;
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 95c9902def..bc9bcbb0f1 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -439,7 +439,7 @@ void gg_debughandler(int level, const char *format, va_list ap) strncpy(szText + PREFIXLEN, "[libgadu] \0", sizeof(szText) - PREFIXLEN);
char prefix[6];
- mir_snprintf(prefix, PREFIXLEN, "%lu", GetCurrentThreadId());
+ mir_snprintf(prefix, SIZEOF(prefix), "%lu", GetCurrentThreadId());
size_t prefixLen = strlen(prefix);
if (prefixLen < PREFIXLEN) memset(prefix + prefixLen, ' ', PREFIXLEN - prefixLen);
memcpy(szText, prefix, PREFIXLEN);
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 0d80f7aef8..895f81a314 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -43,7 +43,7 @@ int GGPROTO::gc_init() gc_enabled = TRUE;
// create & hook event
- mir_snprintf(service, 64, GG_GC_GETCHAT, m_szModuleName);
+ mir_snprintf(service, SIZEOF(service), GG_GC_GETCHAT, m_szModuleName);
debugLogA("gc_init(): Registered with groupchat plugin.");
}
else debugLogA("gc_init(): Cannot register with groupchat plugin !!!");
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 8b0f8f4a57..79aad2fa80 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -344,7 +344,7 @@ int GGPROTO::oauth_receivetoken() mir_free(str);
str = oauth_uri_escape("http://www.mojageneracja.pl");
- mir_snprintf(szUrl, 256, "callback_url=%s&request_token=%s&uin=%s&password=%s",
+ mir_snprintf(szUrl, SIZEOF(szUrl), "callback_url=%s&request_token=%s&uin=%s&password=%s",
str, token, uin, password);
mir_free(str);
str = mir_strdup(szUrl);
diff --git a/protocols/IcqOscarJ/src/UI/userinfotab.cpp b/protocols/IcqOscarJ/src/UI/userinfotab.cpp index 4808b0ef7e..bc10bc47da 100644 --- a/protocols/IcqOscarJ/src/UI/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/UI/userinfotab.cpp @@ -93,11 +93,11 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac if (dbv.wVal != 0) {
char szExtra[80];
- mir_snprintf(str, 250, "%d", dbv.wVal);
+ mir_snprintf(str, SIZEOF(str), "%d", dbv.wVal);
pstr = str;
if (hContact && ppro->IsDirectConnectionOpen(hContact, DIRECTCONN_STANDARD, 1)) {
- ICQTranslateUtfStatic(LPGEN(" (DC Established)"), szExtra, 80);
+ ICQTranslateUtfStatic(LPGEN(" (DC Established)"), szExtra, SIZEOF(szExtra));
strcat(str, (char*)szExtra);
bUtf = 1;
}
diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp index 2e50ee5b62..fb91e8eafc 100644 --- a/protocols/IcqOscarJ/src/fam_04message.cpp +++ b/protocols/IcqOscarJ/src/fam_04message.cpp @@ -2627,7 +2627,7 @@ void CIcqProto::handleTypingNotification(BYTE *buf, size_t wLen, WORD wFlags, DW char szMsg[MAX_PATH];
char *nick = NickFromHandleUtf(hContact);
- mir_snprintf(szMsg, MAX_PATH, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" has closed the message window."), szFormat, MAX_PATH), nick);
+ mir_snprintf(szMsg, SIZEOF(szMsg), ICQTranslateUtfStatic(LPGEN("Contact \"%s\" has closed the message window."), szFormat, MAX_PATH), nick);
ShowPopupMsg(hContact, ICQTranslateUtfStatic(LPGEN("ICQ Note"), szFormat, MAX_PATH), szMsg, LOG_NOTE);
SAFE_FREE((void**)&nick);
diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp index 7ff96e0b9a..109c58cb79 100644 --- a/protocols/IcqOscarJ/src/fam_13servclist.cpp +++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp @@ -179,7 +179,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, size_t wBufferLength, snac_hea szChange = "Server removed %u item(s) from list"; char szLogText[MAX_PATH]; - mir_snprintf(szLogText, MAX_PATH, szChange, nItems); + mir_snprintf(szLogText, SIZEOF(szLogText), szChange, nItems); debugLogA("Server sent SNAC(x13,x%02x) - %s", pSnacHeader->wSubtype, szLogText); } } @@ -1247,7 +1247,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou char *nick = NickFromHandleUtf(hContact); setByte(hContact, "Auth", 0); - mir_snprintf(str, MAX_PATH, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" was authorized in the server list."), msg, MAX_PATH), nick); + mir_snprintf(str, SIZEOF(str), ICQTranslateUtfStatic(LPGEN("Contact \"%s\" was authorized in the server list."), msg, SIZEOF(msg)), nick); icq_LogMessage(LOG_WARNING, str); SAFE_FREE(&nick); } @@ -1257,7 +1257,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou char *nick = NickFromHandleUtf(hContact); setByte(hContact, "Auth", 1); - mir_snprintf(str, MAX_PATH, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" lost its authorization in the server list."), msg, MAX_PATH), nick); + mir_snprintf(str, SIZEOF(str), ICQTranslateUtfStatic(LPGEN("Contact \"%s\" lost its authorization in the server list."), msg, SIZEOF(msg)), nick); icq_LogMessage(LOG_WARNING, str); SAFE_FREE(&nick); } @@ -1347,7 +1347,7 @@ void CIcqProto::handleServerCListItemDelete(const char *szRecordName, WORD wGrou char msg[MAX_PATH]; char *nick = NickFromHandleUtf(hContact); - mir_snprintf(str, MAX_PATH, ICQTranslateUtfStatic(LPGEN("User \"%s\" was removed from server list."), msg, MAX_PATH), nick); + mir_snprintf(str, SIZEOF(str), ICQTranslateUtfStatic(LPGEN("User \"%s\" was removed from server list."), msg, SIZEOF(msg)), nick); icq_LogMessage(LOG_WARNING, str); SAFE_FREE(&nick); } diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp index c96e527c64..73e3ee06e6 100644 --- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp +++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp @@ -525,7 +525,7 @@ int CIcqProto::parseUserInfoRecord(MCONTACT hContact, oscar_tlv *pData, UserInfo for (int i = 0; i < nRecordDef; i++) {
char szItemKey[MAX_PATH];
- mir_snprintf(szItemKey, MAX_PATH, pRecordDef[i].szDbSetting, nRecords);
+ mir_snprintf(szItemKey, SIZEOF(szItemKey), pRecordDef[i].szDbSetting, nRecords);
switch (pRecordDef[i].dbType) {
case DBVT_UTF8:
@@ -550,7 +550,7 @@ int CIcqProto::parseUserInfoRecord(MCONTACT hContact, oscar_tlv *pData, UserInfo for (int i = nRecords; i <= nMaxRecords; i++)
for (int j = 0; j < nRecordDef; j++) {
char szItemKey[MAX_PATH];
- mir_snprintf(szItemKey, MAX_PATH, pRecordDef[j].szDbSetting, i);
+ mir_snprintf(szItemKey, SIZEOF(szItemKey), pRecordDef[j].szDbSetting, i);
delSetting(hContact, szItemKey);
}
diff --git a/protocols/IcqOscarJ/src/icq_clients.cpp b/protocols/IcqOscarJ/src/icq_clients.cpp index e70066b9ca..c69a4c81aa 100644 --- a/protocols/IcqOscarJ/src/icq_clients.cpp +++ b/protocols/IcqOscarJ/src/icq_clients.cpp @@ -479,7 +479,7 @@ const char* CIcqProto::detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUse strcpy(szClientBuf, "QIP Infium");
if (dwFT1) {
- mir_snprintf(ver, 10, " (%d)", dwFT1);
+ mir_snprintf(ver, SIZEOF(ver), " (%d)", dwFT1);
strcat(szClientBuf, ver);
}
if (dwFT2 == 0x0B)
@@ -490,7 +490,7 @@ const char* CIcqProto::detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUse else if (MatchCapability(caps, wLen, &capQip2010, 12)) {
strcpy(szClientBuf, "QIP 2010");
if (dwFT1) {
- mir_snprintf(ver, 10, " (%d)", dwFT1);
+ mir_snprintf(ver, SIZEOF(ver), " (%d)", dwFT1);
strcat(szClientBuf, ver);
}
@@ -499,7 +499,7 @@ const char* CIcqProto::detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUse else if (MatchCapability(caps, wLen, &capQip2012, 12)) {
strcpy(szClientBuf, "QIP 2012");
if (dwFT1) {
- mir_snprintf(ver, 10, " (%d)", dwFT1);
+ mir_snprintf(ver, SIZEOF(ver), " (%d)", dwFT1);
strcat(szClientBuf, ver);
}
@@ -513,7 +513,7 @@ const char* CIcqProto::detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUse mir_snprintf(szClientBuf, 64, cliQip, ver);
if (dwFT1 && dwFT2 == 0x0E) {
- mir_snprintf(ver, 10, " (%d%d%d%d)", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF, (dwFT1 >> 0x08) & 0xFF, dwFT1 & 0xFF);
+ mir_snprintf(ver, SIZEOF(ver), " (%d%d%d%d)", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF, (dwFT1 >> 0x08) & 0xFF, dwFT1 & 0xFF);
strcat(szClientBuf, ver);
}
szClient = szClientBuf;
@@ -534,7 +534,7 @@ const char* CIcqProto::detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUse if (dwFT2 == 0x0FFFF0011 && dwFT3 == 0x1100FFFF && (dwFT1 >> 0x18)) {
char ver[16];
- mir_snprintf(ver, 10, " %d.%d", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF);
+ mir_snprintf(ver, SIZEOF(ver), " %d.%d", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF);
if ((dwFT1 & 0xFF) == 0x0B)
strcat(ver, " Beta");
strcat(szClientBuf, ver);
@@ -946,7 +946,7 @@ const char* CIcqProto::detectUserClient(MCONTACT hContact, int nIsICQ, WORD wUse capstr* capId;
if (capId = MatchCapability(caps, wLen, &capMimPack, 4)) {
char szPack[16];
- mir_snprintf(szPack, 16, " [%.12s]", (*capId)+4);
+ mir_snprintf(szPack, SIZEOF(szPack), " [%.12s]", (*capId)+4);
// make sure client string is not constant
if (szClient != szClientBuf) {
diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index 1880dd3364..ecb28faa31 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -30,7 +30,7 @@ static void accountLoadDetails(CIcqProto *ppro, HWND hwndDlg) char pszUIN[20];
DWORD dwUIN = ppro->getContactUin(NULL);
if (dwUIN) {
- mir_snprintf(pszUIN, 20, "%u", dwUIN);
+ mir_snprintf(pszUIN, SIZEOF(pszUIN), "%u", dwUIN);
SetDlgItemTextA(hwndDlg, IDC_UIN, pszUIN);
}
diff --git a/protocols/IcqOscarJ/src/icq_http.cpp b/protocols/IcqOscarJ/src/icq_http.cpp index 545d52a7f3..0855bc5cd7 100644 --- a/protocols/IcqOscarJ/src/icq_http.cpp +++ b/protocols/IcqOscarJ/src/icq_http.cpp @@ -54,7 +54,7 @@ int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQU unpackDWord(&buf, &dwSid2);
unpackDWord(&buf, &dwSid3);
unpackDWord(&buf, &dwSid4);
- mir_snprintf(szSid, 33, "%08x%08x%08x%08x", dwSid1, dwSid2, dwSid3, dwSid4);
+ mir_snprintf(szSid, SIZEOF(szSid), "%08x%08x%08x%08x", dwSid1, dwSid2, dwSid3, dwSid4);
unpackWord(&buf, &wIpLen);
if(nlhr->dataLength < 30 + wIpLen || wIpLen == 0 || wIpLen > sizeof(szHttpServer) - 1)
@@ -73,8 +73,8 @@ int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQU nlhpi.szHttpGetUrl = szHttpGetUrl;
nlhpi.szHttpPostUrl = szHttpPostUrl;
nlhpi.firstPostSequence = 1;
- mir_snprintf(szHttpGetUrl, 300, "http://%s/monitor?sid=%s", szHttpServer, szSid);
- mir_snprintf(szHttpPostUrl, 300, "http://%s/data?sid=%s&seq=", szHttpServer, szSid);
+ mir_snprintf(szHttpGetUrl, SIZEOF(szHttpGetUrl), "http://%s/monitor?sid=%s", szHttpServer, szSid);
+ mir_snprintf(szHttpPostUrl, SIZEOF(szHttpPostUrl), "http://%s/data?sid=%s&seq=", szHttpServer, szSid);
return CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi);
}
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index bb3c7d7a46..24b7350a75 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -740,14 +740,14 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara dat->ppro->setByte(DBSETTING_XSTATUS_ID, dat->bXStatus);
char *szValue = GetDlgItemTextUtf(hwndDlg,IDC_XMSG);
- mir_snprintf(szSetting, 64, "XStatus%dMsg", dat->bXStatus);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "XStatus%dMsg", dat->bXStatus);
db_set_utf(NULL, dat->ppro->m_szModuleName, szSetting, szValue);
db_set_utf(NULL, dat->ppro->m_szModuleName, DBSETTING_XSTATUS_MSG, szValue);
SAFE_FREE(&szValue);
if (dat->ppro->m_bXStatusEnabled) {
szValue = GetDlgItemTextUtf(hwndDlg,IDC_XTITLE);
- mir_snprintf(szSetting, 64, "XStatus%dName", dat->bXStatus);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "XStatus%dName", dat->bXStatus);
db_set_utf(NULL, dat->ppro->m_szModuleName, szSetting, szValue);
db_set_utf(NULL, dat->ppro->m_szModuleName, DBSETTING_XSTATUS_NAME, szValue);
SAFE_FREE(&szValue);
@@ -793,13 +793,13 @@ void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet) char *szName = NULL, *szMsg = NULL;
if (m_bXStatusEnabled) {
- mir_snprintf(szSetting, 64, "XStatus%dName", bXStatus);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "XStatus%dName", bXStatus);
szName = getSettingStringUtf(NULL, szSetting, ICQTranslateUtfStatic(nameXStatus[bXStatus-1], str, MAX_PATH));
}
- mir_snprintf(szSetting, 64, "XStatus%dMsg", bXStatus);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "XStatus%dMsg", bXStatus);
szMsg = getSettingStringUtf(NULL, szSetting, "");
- mir_snprintf(szSetting, 64, "XStatus%dStat", bXStatus);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "XStatus%dStat", bXStatus);
if (!bQuiet && !getByte(szSetting, 0)) {
InitXStatusData init;
init.ppro = this;
diff --git a/protocols/IcqOscarJ/src/log.cpp b/protocols/IcqOscarJ/src/log.cpp index 9a51c88ea5..ccc3a1f2e8 100644 --- a/protocols/IcqOscarJ/src/log.cpp +++ b/protocols/IcqOscarJ/src/log.cpp @@ -144,6 +144,6 @@ void CIcqProto::icq_LogFatalParam(const char *szMsg, WORD wError) char str[MAX_PATH];
char buf[MAX_PATH];
- mir_snprintf(buf, MAX_PATH, ICQTranslateUtfStatic(szMsg, str, MAX_PATH), wError);
+ mir_snprintf(buf, SIZEOF(buf), ICQTranslateUtfStatic(szMsg, str, SIZEOF(str)), wError);
icq_LogMessage(LOG_FATAL, buf);
}
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index 02a67bb89d..455b45ef4e 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -1587,7 +1587,7 @@ int CIcqProto::oft_handleFileData(oscar_connection *oc, BYTE *buf, size_t len) char *pszMsg = ICQTranslateUtf(LPGEN("The checksum of file \"%s\" does not match, the file is probably damaged."));
char szBuf[MAX_PATH];
- mir_snprintf(szBuf, MAX_PATH, pszMsg, ExtractFileName(ft->szThisFile));
+ mir_snprintf(szBuf, SIZEOF(szBuf), pszMsg, ExtractFileName(ft->szThisFile));
icq_LogMessage(LOG_ERROR, szBuf);
SAFE_FREE(&pszMsg);
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 304e48f770..bc5cf87266 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -195,8 +195,8 @@ static void sttEmptyBuf(StringBuf *buf) static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent)
{
- char *indentLevel = (char *)mir_alloc(128);
- mir_snprintf(indentLevel, 128, RTF_INDENT_FMT, (int)(indent*200));
+ char indentLevel[128];
+ mir_snprintf(indentLevel, SIZEOF(indentLevel), RTF_INDENT_FMT, (int)(indent*200));
sttAppendBufRaw(buf, RTF_BEGINTAG);
sttAppendBufRaw(buf, indentLevel);
@@ -229,10 +229,9 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent) if (xmlGetText(node)) {
if (xmlGetChildCount(node)) {
sttAppendBufRaw(buf, RTF_BEGINTEXT);
- char *indentTextLevel = (char *)mir_alloc(128);
- mir_snprintf(indentTextLevel, 128, RTF_TEXTINDENT_FMT, (int)((indent + 1) * 200));
+ char indentTextLevel[128];
+ mir_snprintf(indentTextLevel, SIZEOF(indentTextLevel), RTF_TEXTINDENT_FMT, (int)((indent + 1) * 200));
sttAppendBufRaw(buf, indentTextLevel);
- mir_free(indentTextLevel);
}
sttAppendBufT(buf, xmlGetText(node));
@@ -255,7 +254,6 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent) else sttAppendBufRaw(buf, " />");
sttAppendBufRaw(buf, RTF_ENDTAG);
- mir_free(indentLevel);
}
DWORD CALLBACK sttStreamInCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp index 0d39b3db7f..cfda82403b 100644 --- a/protocols/Tlen/src/tlen_picture.cpp +++ b/protocols/Tlen/src/tlen_picture.cpp @@ -221,7 +221,7 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) { char fileName[MAX_PATH];
char *ext = TlenXmlGetAttrValue(node, "ext");
char *tmpPath = Utils_ReplaceVars( "%miranda_userdata%" );
- int tPathLen = mir_snprintf(fileName, MAX_PATH, "%s\\Images\\Tlen", tmpPath);
+ int tPathLen = mir_snprintf(fileName, SIZEOF(fileName), "%s\\Images\\Tlen", tmpPath);
long oldSize = 0, lSize = atol(size);
DWORD dwAttributes = GetFileAttributesA( fileName );
if ( dwAttributes == 0xffffffff || ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ) == 0 )
@@ -229,7 +229,7 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) { mir_free(tmpPath);
fileName[ tPathLen++ ] = '\\';
- mir_snprintf( fileName + tPathLen, MAX_PATH - tPathLen, "%s.%s", crc, ext );
+ mir_snprintf( fileName + tPathLen, SIZEOF(fileName) - tPathLen, "%s.%s", crc, ext );
fp = fopen( fileName, "rb" );
if (fp) {
fseek(fp, 0, SEEK_END);
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index cd5c8ea838..473bc35bee 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -592,7 +592,7 @@ char* CVkProto::GetStickerId(const char* Msg, int &stickerid) char* retMsg = NULL;
iRes = sscanf(Msg, "[sticker:%d]", &stickerid);
if (iRes == 1) {
- mir_snprintf(HeadMsg, 32, "[sticker:%d]", stickerid);
+ mir_snprintf(HeadMsg, SIZEOF(HeadMsg), "[sticker:%d]", stickerid);
size_t retLen = mir_strlen(HeadMsg);
if (retLen < mir_strlen(Msg))
retMsg = mir_strdup(&Msg[retLen]);
diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp index 602a198997..dd924bcff3 100644 --- a/protocols/Xfire/src/Xfire_base.cpp +++ b/protocols/Xfire/src/Xfire_base.cpp @@ -113,7 +113,7 @@ void Xfire_base::readStringfromDB(char*name, unsigned int dbid, char**to) return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
if (!db_get_s(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -131,7 +131,7 @@ void Xfire_base::readStringfromDB(char*name, unsigned int dbid, int id, char**to return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
if (!db_get_s(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -149,7 +149,7 @@ void Xfire_base::readUtf8StringfromDB(char*name, unsigned int dbid, char**to) return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
if (!db_get_utf(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -167,7 +167,7 @@ void Xfire_base::readUtf8StringfromDB(char*name, unsigned int dbid, int id, char return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
if (!db_get_utf(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -186,7 +186,7 @@ void Xfire_base::writeStringtoDB(char*name, unsigned int dbid, int id, char*val) return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
db_set_s(NULL, protocolname, temp, val);
}
@@ -198,7 +198,7 @@ void Xfire_base::writeStringtoDB(char*name, unsigned int dbid, char*val) return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
db_set_s(NULL, protocolname, temp, val);
}
@@ -210,7 +210,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name, unsigned int dbid, int id, char* return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
db_set_utf(NULL, protocolname, temp, val);
}
@@ -222,7 +222,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name, unsigned int dbid, char*val) return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
db_set_utf(NULL, protocolname, temp, val);
}
@@ -235,7 +235,7 @@ void Xfire_base::writeBytetoDB(char*name, unsigned int dbid, int val) return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
db_set_b(NULL, protocolname, temp, val);
}
@@ -247,7 +247,7 @@ void Xfire_base::writeWordtoDB(char*name, unsigned int dbid, int val) return;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
db_set_w(NULL, protocolname, temp, val);
}
@@ -260,7 +260,7 @@ unsigned char Xfire_base::readBytefromDB(char*name, unsigned int dbid, int defau return 0;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
return db_get_b(NULL, protocolname, temp, defaultval);
}
@@ -272,7 +272,7 @@ unsigned int Xfire_base::readWordfromDB(char*name, unsigned int dbid, int defaul return 0;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
return db_get_w(NULL, protocolname, temp, defaultval);
}
@@ -284,7 +284,7 @@ BOOL Xfire_base::removeDBEntry(char*name, unsigned int dbid) return 0;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i", name, dbid);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
//eintrag entfernen
if (!db_get(NULL, protocolname, temp, &dbv))
@@ -305,7 +305,7 @@ BOOL Xfire_base::removeDBEntry(char*name, unsigned int dbid, int id) return 0;
//wert aus der dblesen
- mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
//eintrag entfernen
if (!db_get(NULL, protocolname, temp, &dbv))
@@ -479,7 +479,7 @@ BOOL Xfire_base::getIniValue(unsigned int gameid, unsigned int subid, const char return FALSE; //kein pfad bug?!?!
if (subid == 0) {
- mir_snprintf(idstring, 15, "%d", gameid);
+ mir_snprintf(idstring, SIZEOF(idstring), "%d", gameid);
if (xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
return TRUE;
@@ -487,7 +487,7 @@ BOOL Xfire_base::getIniValue(unsigned int gameid, unsigned int subid, const char subid++;
}
- mir_snprintf(idstring, 15, "%d_%d", gameid, subid);
+ mir_snprintf(idstring, SIZEOF(idstring), "%d_%d", gameid, subid);
if (xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
return TRUE;
@@ -521,8 +521,8 @@ BOOL Xfire_base::getGamename(unsigned int gameid, char* out, int outsize){ {
//customnamen laden, wenn vorhanden
DBVARIANT dbv;
- char dbstr[80] = "";
- mir_snprintf(dbstr, XFIRE_MAXSIZEOFGAMENAME, "customgamename_%d", gameid);
+ char dbstr[XFIRE_MAXSIZEOFGAMENAME];
+ mir_snprintf(dbstr, SIZEOF(dbstr), "customgamename_%d", gameid);
if (!db_get(NULL, protocolname, dbstr, &dbv)) {
strncpy_s(out, outsize, dbv.pszVal, _TRUNCATE);
db_free(&dbv);
diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp index 1486ecaf16..776a6493b7 100644 --- a/protocols/Xfire/src/Xfire_game.cpp +++ b/protocols/Xfire/src/Xfire_game.cpp @@ -57,7 +57,7 @@ BOOL Xfire_game::start_game(char*ip, unsigned int port, char*pw) { //port begrenzen
port = port % 65535;
//port in string wandeln
- mir_snprintf(portstr, 6, "%d", port);
+ mir_snprintf(portstr, SIZEOF(portstr), "%d", port);
str_replace(mynetworkparams, "%UA_GAME_HOST_NAME%", ip);
str_replace(mynetworkparams, "%UA_GAME_HOST_PORT%", portstr);
diff --git a/protocols/Xfire/src/Xfire_icon_mng.cpp b/protocols/Xfire/src/Xfire_icon_mng.cpp index 74028196f2..b469e44595 100644 --- a/protocols/Xfire/src/Xfire_icon_mng.cpp +++ b/protocols/Xfire/src/Xfire_icon_mng.cpp @@ -135,9 +135,9 @@ Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) { //dll konnte geladen werden
if (hIconDll) {
- char resourcename[255] = "";
+ char resourcename[255];
//kurznamen des spiels uppercasen und .ICO anhängen
- mir_snprintf(resourcename, 255, "XF_%s.ICO", shortname);
+ mir_snprintf(resourcename, SIZEOF(resourcename), "XF_%s.ICO", shortname);
Xfire_base::strtoupper(resourcename);
//versuche die resource zufinden
diff --git a/protocols/Xfire/src/Xfire_voicechat.cpp b/protocols/Xfire/src/Xfire_voicechat.cpp index 66454c026e..1d970d05ce 100644 --- a/protocols/Xfire/src/Xfire_voicechat.cpp +++ b/protocols/Xfire/src/Xfire_voicechat.cpp @@ -141,7 +141,7 @@ void Xfire_voicechat::resetSendGameStatus2Packet(SendGameStatus2Packet* packet) //schreibt derzetigen status in die mirandadb für variables usw
void Xfire_voicechat::writeToDatabase(SendGameStatus2Packet* packet) {
//für sprintf
- char temp[32] = "";
+ char temp[32];
if (packet == NULL || packet->gameid == XFIREVOICECHAT_NOVOICE) {
//einträge aus der db entfernen
@@ -151,7 +151,7 @@ void Xfire_voicechat::writeToDatabase(SendGameStatus2Packet* packet) { return;
}
//ip speichern
- mir_snprintf(temp, 32, "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0], packet->port);
+ mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0], packet->port);
db_set_s(NULL, protocolname, "VServerIP", temp);
//namen jeh nach id schreiben
switch (packet->gameid) {
diff --git a/protocols/Xfire/src/addgamedialog.cpp b/protocols/Xfire/src/addgamedialog.cpp index be2fae8617..7d1aefb1c0 100644 --- a/protocols/Xfire/src/addgamedialog.cpp +++ b/protocols/Xfire/src/addgamedialog.cpp @@ -144,12 +144,12 @@ static void FillGameList(LPVOID hwndDlg) { if (z2 != zahlbuffer2)
{
listentry.gameid = MAKELONG(gameid, atoi(zahlbuffer2));
- mir_snprintf(gameidtemp, 10, "%d_%d", gameid, atoi(zahlbuffer2));
+ mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d_%d", gameid, atoi(zahlbuffer2));
}
else
{
listentry.gameid = gameid;
- mir_snprintf(gameidtemp, 10, "%d", gameid);
+ mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid);
}
@@ -345,13 +345,13 @@ INT_PTR CALLBACK DlgAddGameProc(HWND hwndDlg, int gameid2 = HIWORD(gameids);
if (gameid2 != 0)
- mir_snprintf(gameidtemp, 10, "%d_%d", gameid1, gameid2);
+ mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d_%d", gameid1, gameid2);
else
- mir_snprintf(gameidtemp, 10, "%d", gameid1);
+ mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid1);
//spielnamen holen
if (xfire_GetPrivateProfileString(gameidtemp, "LongName", "", ret, 512, inipath)) {
- mir_snprintf(gameidtemp, 10, "%d", gameid1);
+ mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid1);
//einige felder vorbelegen
SetDlgItemTextA(hPage, IDC_ADD_NAME, ret);
@@ -389,9 +389,9 @@ INT_PTR CALLBACK DlgAddGameProc(HWND hwndDlg, char ret[512];
if (gameid2 != 0)
- mir_snprintf(gameidtemp, 10, "%d_%d", gameid1, gameid2);
+ mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d_%d", gameid1, gameid2);
else
- mir_snprintf(gameidtemp, 10, "%d", gameid1);
+ mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid1);
//neuen gameeintrag anlegen
Xfire_game* newgame = new Xfire_game();
diff --git a/protocols/Xfire/src/all_statusmsg.cpp b/protocols/Xfire/src/all_statusmsg.cpp index e542806744..46ec481c85 100644 --- a/protocols/Xfire/src/all_statusmsg.cpp +++ b/protocols/Xfire/src/all_statusmsg.cpp @@ -63,8 +63,8 @@ BOOL BackupStatusMsg() { statusid = CallProtoService(temp[i]->szModuleName, PS_GETSTATUS, 0, 0);
XFireLog("Get Status of %s ...", temp[i]->szModuleName);
- char ttemp[128] = "";
- mir_snprintf(ttemp, 128, "%s%s", temp[i]->szModuleName, PS_SETAWAYMSG);
+ char ttemp[128];
+ mir_snprintf(ttemp, SIZEOF(ttemp), "%s%s", temp[i]->szModuleName, PS_SETAWAYMSG);
//xfire wird geskipped, offline prots und invs prots auch, und locked status prots auch
if (!temp[i]->bIsEnabled || statusid == ID_STATUS_INVISIBLE || statusid == ID_STATUS_OFFLINE || !mir_strcmpi(temp[i]->szModuleName, protocolname) || !ServiceExists(ttemp) || db_get_b(NULL, temp[i]->szModuleName, "LockMainStatus", 0) == 1)
diff --git a/protocols/Xfire/src/buddylist.cpp b/protocols/Xfire/src/buddylist.cpp index 315c3e2a6e..ac3bfbf608 100644 --- a/protocols/Xfire/src/buddylist.cpp +++ b/protocols/Xfire/src/buddylist.cpp @@ -146,7 +146,7 @@ namespace xfirelib { /* ## buddies im miranda verarbietn */ char temp[255]; char * dummy; - mir_snprintf(temp,255,"Clan_%d",entry->clanid); + mir_snprintf(temp,SIZEOF(temp),"Clan_%d",entry->clanid); DBVARIANT dbv; if (!db_get(NULL,protocolname,temp,&dbv)) diff --git a/protocols/Xfire/src/iniupdater.cpp b/protocols/Xfire/src/iniupdater.cpp index 2f8ebe6ea9..f5f1e97aeb 100644 --- a/protocols/Xfire/src/iniupdater.cpp +++ b/protocols/Xfire/src/iniupdater.cpp @@ -61,7 +61,7 @@ void UpdateMyXFireIni(LPVOID dummy) { strcat(file2, "xfire_games.ini");
strcat(file3, "xfire_games.old");
- mir_snprintf(request, 1024, "%s%d", INI_URLREQUEST, getfilesize(file2));
+ mir_snprintf(request, SIZEOF(request), "%s%d", INI_URLREQUEST, getfilesize(file2));
if (CheckWWWContent(request))
{
@@ -101,7 +101,7 @@ void UpdateMyIcons(LPVOID dummy) { strcat(file2, "icons.dll");
strcat(file3, "icons.old");
- mir_snprintf(request, 1024, "%s%d", ICO_URLREQUEST, getfilesize(file2));
+ mir_snprintf(request, SIZEOF(request), "%s%d", ICO_URLREQUEST, getfilesize(file2));
if (CheckWWWContent(request))
{
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index 748e007aaa..99be8112ac 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -3081,13 +3081,13 @@ INT_PTR SearchAddtoList(WPARAM wParam, LPARAM lParam) void CreateGroup(char*grpn, char*field) {
DBVARIANT dbv;
- char* grp[255];
+ char grp[255];
int val = db_get_b(NULL, protocolname, field, 0);
if (val == 0)
{
- strcpy_s((char*)grp, 255, grpn);//((char*)clan->name[i].c_str());
+ strcpy_s(grp, SIZEOF(grp), grpn);//((char*)clan->name[i].c_str());
}
else
{
@@ -3097,12 +3097,12 @@ void CreateGroup(char*grpn, char*field) { db_get_s(NULL, "CListGroups", temp, &dbv);
if (dbv.pszVal != NULL)
{
- mir_snprintf((char*)grp, 255, "%s\\%s", &dbv.pszVal[1], (char*)grpn);
+ mir_snprintf(grp, SIZEOF(grp), "%s\\%s", &dbv.pszVal[1], grpn);
db_free(&dbv);
}
else //gruppe existiert nciht mehr, auf root alles legen
{
- strcpy_s((char*)grp, 255, grpn);
+ strcpy_s(grp, SIZEOF(grp), grpn);
db_set_b(NULL, protocolname, field, 0);
}
}
@@ -3126,7 +3126,7 @@ void CreateGroup(char*grpn, char*field) { db_free(&dbv);
}
strcpy_s(group, 255, "D");
- strcat_s(group, 255, (char*)grp);
+ strcat_s(group, 255, grp);
group[0] = 1 | GROUPF_EXPANDED;
mir_snprintf(temp, SIZEOF(temp), "%d", i + 1);
db_set_s(NULL, "CListGroups", temp, group);
diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp index 5134172a2c..7f23afb3c7 100644 --- a/protocols/Xfire/src/userdetails.cpp +++ b/protocols/Xfire/src/userdetails.cpp @@ -380,30 +380,30 @@ char status[256]=""; char game[512]="";
if (!db_get(hContact,"ContactPhoto","File",&dbv))
{
-mir_snprintf(img,256,"<img src=\"%s\">",dbv.pszVal);
+mir_snprintf(img,SIZEOF(img),"<img src=\"%s\">",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"Username",&dbv))
{
-mir_snprintf(username,256,"<b>Username:</b> %s<br>",dbv.pszVal);
+mir_snprintf(username,SIZEOF(username),"<b>Username:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"Nick",&dbv))
{
-mir_snprintf(nick,256,"<b>Nick:</b> %s<br>",dbv.pszVal);
+mir_snprintf(nick,SIZEOF(nick),"<b>Nick:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"XStatusMsg",&dbv))
{
-mir_snprintf(status,256,"<b>Status:</b> %s<br>",dbv.pszVal);
+mir_snprintf(status,SIZEOF(status),"<b>Status:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"RGame",&dbv))
{
-mir_snprintf(game,512,"<fieldset style='border:1px solid #0091d5;background-color:#0d2c3e;margin-bottom:8px;'><legend>Spiel</legend><table><tr><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'><b><u>%s</u></b></td></tr></table></fieldset>",dbv.pszVal);
+mir_snprintf(game,SIZEOF(game),"<fieldset style='border:1px solid #0091d5;background-color:#0d2c3e;margin-bottom:8px;'><legend>Spiel</legend><table><tr><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'><b><u>%s</u></b></td></tr></table></fieldset>",dbv.pszVal);
db_free(&dbv);
}
-mir_snprintf(profil,2056,"mshtml:<div style='position:absolute;top:0;left:0;border:1px solid #0091d5;background-color:#000;padding:6px;width:334px;height:249px'><table><tr><td valign=top>%s</td><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'>%s%s%s</td></tr><tr><td valign=top colspan=\"2\" style='font-family:Arial;font-size:11px;color:#fff;'>%s%s</td></tr></table></div>",img,username,nick,status,game);
+mir_snprintf(profil,SIZEOF(profil),"mshtml:<div style='position:absolute;top:0;left:0;border:1px solid #0091d5;background-color:#000;padding:6px;width:334px;height:249px'><table><tr><td valign=top>%s</td><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'>%s%s%s</td></tr><tr><td valign=top colspan=\"2\" style='font-family:Arial;font-size:11px;color:#fff;'>%s%s</td></tr></table></div>",img,username,nick,status,game);
HWND hWnd = ::CreateWindow("AtlAxWin", profil,
WS_CHILD|WS_VISIBLE, 0, 0, 334, 249, hwndDlg, NULL,
::GetModuleHandle(NULL), NULL);
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index c73b469548..1bc0aa3eb6 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -556,7 +556,7 @@ void CYahooProto::ext_got_files(const char *me, const char *who, const char *ft_ char z[1024];
struct yahoo_file_info *fi = (struct yahoo_file_info *) f->data;
- mir_snprintf(z, 1024, "%s (%lu)\r\n", fi->filename, fi->filesize);
+ mir_snprintf(z, SIZEOF(z), "%s (%lu)\r\n", fi->filename, fi->filesize);
mir_strcat(fn, z);
fc++;
}
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index eb920fe9ba..70541ad599 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -1292,7 +1292,7 @@ void CYahooProto::ext_send_http_request(enum yahoo_connection_type type, const c if (nlhr.requestType == REQUEST_POST) {
httpHeaders[nlhr.headersCount].szName="Content-Length";
- mir_snprintf(z, 1024, "%d", content_length);
+ mir_snprintf(z, SIZEOF(z), "%d", content_length);
httpHeaders[nlhr.headersCount].szValue=z;
nlhr.headersCount++;
|