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/IcqOscarJ/src | |
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/IcqOscarJ/src')
-rw-r--r-- | protocols/IcqOscarJ/src/UI/userinfotab.cpp | 4 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/fam_04message.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/fam_13servclist.cpp | 8 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/fam_15icqserver.cpp | 4 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_clients.cpp | 12 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_firstrun.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_http.cpp | 6 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_xstatus.cpp | 10 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/log.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/oscar_filetransfer.cpp | 2 |
10 files changed, 26 insertions, 26 deletions
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);
|