diff options
Diffstat (limited to 'protocols')
69 files changed, 330 insertions, 352 deletions
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 67aa9ef0b3..7a508dfe29 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -235,7 +235,7 @@ HANDLE FacebookProto::SearchByEmail(const PROTOCHAR* email) HANDLE FacebookProto::SearchByName(const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName)
{
TCHAR arg[200];
- _sntprintf (arg, SIZEOF(arg), _T("%s %s %s"), nick, firstName, lastName);
+ mir_sntprintf (arg, SIZEOF(arg), _T("%s %s %s"), nick, firstName, lastName);
return SearchByEmail(arg); // Facebook is using one search method for everything (except IDs)
}
diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index 46d08fc594..91974a914b 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -81,7 +81,7 @@ void FormatMessageUrl(LPCTSTR format, LPTSTR buf, LPCTSTR mailbox, LPCTSTR tid) {
ULARGE_INTEGER iTid; iTid.QuadPart = _tstoi64(tid);
int l = lstrlen(buf);
- wsprintf(buf, format, mailbox, iTid.HighPart, iTid.LowPart);
+ mir_sntprintf(buf, l, format, mailbox, iTid.HighPart, iTid.LowPart);
assert(l >= lstrlen(buf));
}
@@ -90,7 +90,7 @@ void MakeUrlHex(LPTSTR url, LPCTSTR tid) ULARGE_INTEGER iTid; iTid.QuadPart = _tstoi64(tid);
LPTSTR tidInUrl = _tcsstr(url, tid);
LPTSTR trail = tidInUrl + lstrlen(tid);
- wsprintf(tidInUrl, _T("%x%08x"), iTid.HighPart, iTid.LowPart);
+ wsprintf(tidInUrl, _T("%x%08x"), iTid.HighPart, iTid.LowPart); //!!!!!!!!!!!!
wmemmove(tidInUrl + lstrlen(tidInUrl), trail, lstrlen(trail) + 1);
}
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index 5608a7794f..471431a185 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -92,8 +92,9 @@ LPSTR HttpPost(HANDLE hUser, LPSTR reqUrl, LPSTR reqParams) LPSTR MakeRequest(HANDLE hUser, LPSTR reqUrl, LPSTR reqParamsFormat, LPSTR p1, LPSTR p2)
{
ptrA encodedP1( mir_urlEncode(p1)), encodedP2( mir_urlEncode(p2));
- LPSTR reqParams = (LPSTR)alloca(lstrlenA(reqParamsFormat) + 1 + lstrlenA(encodedP1) + lstrlenA(encodedP2));
- sprintf(reqParams, reqParamsFormat, encodedP1, encodedP2);
+ size_t size = lstrlenA(reqParamsFormat) + 1 + lstrlenA(encodedP1) + lstrlenA(encodedP2);
+ LPSTR reqParams = (LPSTR)alloca(size);
+ mir_snprintf(reqParams, size, reqParamsFormat, encodedP1, encodedP2);
return HttpPost(hUser, reqUrl, reqParams);
}
@@ -120,8 +121,9 @@ LPSTR FindSid(LPSTR resp, LPSTR *LSID) void DoOpenUrl(LPSTR tokenResp, LPSTR url)
{
ptrA encodedUrl( mir_urlEncode(url)), encodedToken( mir_urlEncode(tokenResp));
- LPSTR composedUrl = (LPSTR)alloca(lstrlenA(TOKEN_AUTH_URL) + 1 + lstrlenA(encodedToken) + lstrlenA(encodedUrl));
- sprintf(composedUrl, TOKEN_AUTH_URL, encodedToken, encodedUrl);
+ size_t size = lstrlenA(TOKEN_AUTH_URL) + 1 + lstrlenA(encodedToken) + lstrlenA(encodedUrl);
+ LPSTR composedUrl = (LPSTR)alloca(size);
+ mir_snprintf(composedUrl, size, TOKEN_AUTH_URL, encodedToken, encodedUrl);
CallService(MS_UTILS_OPENURL, 0, (LPARAM)composedUrl);
}
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index c128079ad3..b1d52d0d51 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -125,9 +125,9 @@ static bool DoAddPopup(POPUPDATAT *data) void FormatPseudocontactDisplayName(LPTSTR buff, LPCTSTR jid, LPCTSTR unreadCount)
{
if (lstrcmp(unreadCount, _T("0")))
- wsprintf(buff, _T("%s [%s]"), jid, unreadCount);
+ wsprintf(buff, _T("%s [%s]"), jid, unreadCount); //!!!!!!!!!!!
else
- wsprintf(buff, _T("%s"), jid);
+ wsprintf(buff, _T("%s"), jid); //!!!!!!!!!!!
}
BOOL UsePopups()
@@ -173,7 +173,7 @@ void UnreadMailNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unread POPUPDATAT data = {0};
FormatPseudocontactDisplayName(&data.lptzContactName[0], jid, unreadCount);
- wsprintf(&data.lptzText[0], TranslateT(NUMBER_EMAILS_MESSAGE), unreadCount);
+ mir_sntprintf(&data.lptzText[0], SIZEOF(data.lptzText), TranslateT(NUMBER_EMAILS_MESSAGE), unreadCount);
ShowNotification(acc, &data, jid, url, unreadCount);
}
@@ -187,14 +187,14 @@ void UnreadThreadNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unre LPTSTR currSender = senders;
for (int i = 0; i < SENDER_COUNT && mtn->senders[i].addr; i++) {
- wsprintf(currSender, _T(" %s <%s>\n"), mtn->senders[i].name, mtn->senders[i].addr);
+ mir_sntprintf(currSender, SENDER_COUNT * 100, _T(" %s <%s>\n"), mtn->senders[i].name, mtn->senders[i].addr);
currSender += lstrlen(currSender);
}
if (ReadCheckbox(0, IDC_ADDSNIP, (DWORD)TlsGetValue(itlsSettings)))
- wsprintf(&data.lptzText[0], TranslateTS(FULL_NOTIFICATION_FORMAT), mtn->subj, senders, mtn->snip);
+ mir_sntprintf(&data.lptzText[0], SIZEOF(data.lptzText), TranslateTS(FULL_NOTIFICATION_FORMAT), mtn->subj, senders, mtn->snip);
else
- wsprintf(&data.lptzText[0], TranslateTS(SHORT_NOTIFICATION_FORMAT), mtn->subj, senders);
+ mir_sntprintf(&data.lptzText[0], SIZEOF(data.lptzText), TranslateTS(SHORT_NOTIFICATION_FORMAT), mtn->subj, senders);
free(senders);
diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp index c780fb4f38..6fadfe42bf 100644 --- a/protocols/GTalkExt/src/options.cpp +++ b/protocols/GTalkExt/src/options.cpp @@ -140,8 +140,8 @@ INT_PTR CALLBACK AccOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lPa void ShowTestPopup(HWND wnd)
{
POPUPDATAT data = {0};
- wsprintf(&data.lptzContactName[0], TEST_LETTER_INBOX);
- wsprintf(&data.lptzText[0], TranslateTS(FULL_NOTIFICATION_FORMAT),
+ mir_sntprintf(&data.lptzContactName[0], SIZEOF(data.lptzContactName), TEST_LETTER_INBOX);
+ mir_sntprintf(&data.lptzText[0], SIZEOF(data.lptzText), TranslateTS(FULL_NOTIFICATION_FORMAT),
TEST_LETTER_SUBJECT, TEST_LETTER_SENDER, TEST_LETTER_SNIP);
int len = SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_GETTEXTLENGTH, 0, 0) + 1;
@@ -177,7 +177,7 @@ INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM {
LPTSTR timeout = (LPTSTR)malloc(11 * sizeof(TCHAR));
__try {
- wsprintf(timeout, _T("%d"), db_get_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0));
+ mir_sntprintf(timeout, 11, _T("%d"), db_get_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0));
SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_SETTEXT, 0, (LPARAM)timeout);
}
__finally {
diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp index 36d0cbb0b1..d774cc8401 100644 --- a/protocols/GTalkExt/src/tipper_items.cpp +++ b/protocols/GTalkExt/src/tipper_items.cpp @@ -48,7 +48,7 @@ void ShiftTipperSettings(LPSTR buff, int count, LPSTR format) {
for (int i = count; i > 0; i--) {
DBVARIANT dbv;
- sprintf(buff, format, i - 1);
+ sprintf(buff, format, i - 1); //!!!!!!!!!!!!!!!
if (db_get(0, TIPPER_ITEMS_MOD_NAME, buff, &dbv))
break;
@@ -63,7 +63,7 @@ void ShiftTipperSettings(LPSTR buff, int count, LPSTR format) if (db_get_s(0, TIPPER_ITEMS_MOD_NAME, buff, &dbv))
break;
- sprintf(buff, format, i);
+ sprintf(buff, format, i); //!!!!!!!!!!!!!!!!
db_set(NULL, TIPPER_ITEMS_MOD_NAME, buff, &dbv);
}
__finally {
@@ -74,7 +74,7 @@ void ShiftTipperSettings(LPSTR buff, int count, LPSTR format) void SetLabelProp(int index, LPSTR setting)
{
- sprintf(setting, LABEL_SETTING_PROP, index);
+ sprintf(setting, LABEL_SETTING_PROP, index); //!!!!!!!!!!!!!!
DBVARIANT dbv1 = {0};
if (!db_get_ts(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv1))
@@ -110,7 +110,7 @@ void AddTipperItem() LPSTR setting = (LPSTR)malloc(l * sizeof(TCHAR));
__try {
for (i = 0; i < itemCount; i++) {
- sprintf(setting, VALUE_SETTING_PROP, i);
+ mir_snprintf(setting, l, VALUE_SETTING_PROP, i);
DBVARIANT dbv = {0};
if (!db_get_ts(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv))
@@ -129,10 +129,10 @@ void AddTipperItem() ShiftTipperSettings(setting, itemCount, TipperItemProps[i]);
#define WRITE_TIPPER_PROPS(index, value)\
- sprintf(setting, TipperItemProps[##index##], 0);\
+ mir_snprintf(setting, l, TipperItemProps[##index##], 0);\
db_set_ts(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##)
#define WRITE_TIPPER_PROPB(index, value)\
- sprintf(setting, TipperItemProps[##index##], 0);\
+ mir_snprintf(setting, l, TipperItemProps[##index##], 0);\
db_set_b(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##)
LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL);
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index 9130366d8d..42685a821f 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -118,7 +118,7 @@ char *gg_avatarhash(char *param) mir_sha1_hash((BYTE*)param, (int)strlen(param), digest);
for (i = 0; i < MIR_SHA1_HASH_SIZE; i++)
- sprintf(result + (i<<1), "%02x", digest[i]);
+ mir_snprintf(result + (i<<1), 2, "%02x", digest[i]);
return result;
}
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index f172b5ba8d..701b0508bc 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -276,7 +276,7 @@ char *oauth_generate_nonce() char *result = (char *)mir_alloc(32 + 1);
for (int i = 0; i < 16; i++)
- sprintf(result + (i<<1), "%02x", digest[i]);
+ mir_snprintf(result + (i<<1), 2, "%02x", digest[i]);
return result;
}
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index 6fef25e6d9..80ed636d4e 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -222,7 +222,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) char *AvatarName = strrchr(AvatarURL, '/');
AvatarName++;
char AvatarNameWithTS[128];
- sprintf(AvatarNameWithTS, "%s%s", AvatarName, AvatarTs);
+ mir_snprintf(AvatarNameWithTS, SIZEOF(AvatarNameWithTS), "%s%s", AvatarName, AvatarTs);
AvatarHash = gg_avatarhash(AvatarNameWithTS);
}
diff --git a/protocols/IRCG/src/scripting.cpp b/protocols/IRCG/src/scripting.cpp index 6c67887397..f03b58d252 100644 --- a/protocols/IRCG/src/scripting.cpp +++ b/protocols/IRCG/src/scripting.cpp @@ -220,7 +220,7 @@ INT_PTR __cdecl CIrcProto::Scripting_GetIrcData(WPARAM, LPARAM lparam) gci.pszID = (TCHAR*)S.c_str();
if ( !CallServiceSync( MS_GC_GETINFO, 0, (LPARAM)&gci )) {
TCHAR szTemp[40];
- _sntprintf( szTemp, 35, _T("%u"), gci.iCount);
+ mir_sntprintf(szTemp, 35, _T("%u"), gci.iCount);
sOutput = szTemp;
}
}
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index b0f8ef9625..b59a589a7b 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -26,7 +26,7 @@ BOOL bChatInstalled = FALSE, m_bMbotInstalled = FALSE; void CIrcProto::InitMainMenus(void)
{
char temp[ MAXMODULELABELLENGTH ];
- char *d = temp + sprintf( temp, m_szModuleName );
+ char *d = temp + mir_snprintf(temp, SIZEOF(temp), m_szModuleName);
CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = temp;
@@ -141,7 +141,7 @@ int IrcPrebuildContactMenu( WPARAM wParam, LPARAM lParam ) void InitContactMenus(void)
{
char temp[MAXMODULELABELLENGTH];
- char *d = temp + sprintf(temp, "IRC");
+ char *d = temp + mir_snprintf(temp, SIZEOF(temp), "IRC");
CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = temp;
@@ -202,7 +202,7 @@ INT_PTR __cdecl CIrcProto::OnDoubleclicked(WPARAM, LPARAM lParam) dlg->Show();
HWND hWnd = dlg->GetHwnd();
TCHAR szTemp[500];
- mir_sntprintf( szTemp, SIZEOF(szTemp), TranslateT("%s (%s) is requesting a client-to-client chat connection."),
+ mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("%s (%s) is requesting a client-to-client chat connection."),
pdci->sContactName.c_str(), pdci->sHostmask.c_str());
SetDlgItemText( hWnd, IDC_TEXT, szTemp );
ShowWindow( hWnd, SW_SHOW );
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index 12765cd207..d4dc453e07 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -385,7 +385,7 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) // New dialog title
TCHAR newTitle[255];
- wsprintf( newTitle, TranslateT("%s - Filtered - %d items"), m_title, itemCount );
+ mir_sntprintf(newTitle, SIZEOF(newTitle), TranslateT("%s - Filtered - %d items"), m_title, itemCount);
SetWindowText( m_hwnd, newTitle );
}
else {
diff --git a/protocols/IcqOscarJ/src/UI/loginpassword.cpp b/protocols/IcqOscarJ/src/UI/loginpassword.cpp index 5263af17a2..bf6706dc75 100644 --- a/protocols/IcqOscarJ/src/UI/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/UI/loginpassword.cpp @@ -47,7 +47,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA DWORD dwUin = ppro->getContactUin(NULL);
char pszUIN[MAX_PATH], str[MAX_PATH];
- null_snprintf(pszUIN, 128, ICQTranslateUtfStatic(LPGEN("Enter a password for UIN %u:"), str, MAX_PATH), dwUin);
+ mir_snprintf(pszUIN, 128, ICQTranslateUtfStatic(LPGEN("Enter a password for UIN %u:"), str, MAX_PATH), dwUin);
SetDlgItemTextUtf(hwndDlg, IDC_INSTRUCTION, pszUIN);
SendDlgItemMessage(hwndDlg, IDC_LOGINPW, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0);
diff --git a/protocols/IcqOscarJ/src/UI/userinfotab.cpp b/protocols/IcqOscarJ/src/UI/userinfotab.cpp index ad4a171bc1..e8a8e01b34 100644 --- a/protocols/IcqOscarJ/src/UI/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/UI/userinfotab.cpp @@ -97,7 +97,7 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, HANDLE hContact, {
char szExtra[80];
- null_snprintf(str, 250, "%d", dbv.wVal);
+ mir_snprintf(str, 250, "%d", dbv.wVal);
pstr = str;
if (hContact && ppro->IsDirectConnectionOpen(hContact, DIRECTCONN_STANDARD, 1))
@@ -123,11 +123,11 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, HANDLE hContact, { // give default name
pXName = ICQTranslateUtf(nameXStatus[bXStatus-1]);
}
- null_snprintf(str, sizeof(str), "%s (%s)", pszStatus, pXName);
+ mir_snprintf(str, sizeof(str), "%s (%s)", pszStatus, pXName);
SAFE_FREE((void**)&pXName);
}
else
- null_snprintf(str, sizeof(str), pszStatus);
+ mir_snprintf(str, sizeof(str), pszStatus);
bUtf = 1;
SAFE_FREE(&pszStatus);
@@ -301,7 +301,7 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam) if (!lParam)
{
TCHAR buf[200];
- null_snprintf(buf, SIZEOF(buf), TranslateT("%s Details"), m_tszUserName);
+ mir_sntprintf(buf, SIZEOF(buf), TranslateT("%s Details"), m_tszUserName);
odp.ptszTitle = buf;
odp.position = -1899999999;
diff --git a/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp b/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp index 404777aa97..b25fd627dc 100644 --- a/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/dlgproc.cpp @@ -497,7 +497,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM dat->hUpload[i] = NULL;
for (done = 0, i = 0; i < SIZEOF(dat->hUpload); i++)
done += dat->hUpload[i] == NULL;
- null_snprintf(buf, sizeof(buf), "%s%d%%", ICQTranslateUtfStatic(LPGEN("Upload in progress..."), str, MAX_PATH), 100*done/(SIZEOF(dat->hUpload)));
+ mir_snprintf(buf, sizeof(buf), "%s%d%%", ICQTranslateUtfStatic(LPGEN("Upload in progress..."), str, MAX_PATH), 100*done/(SIZEOF(dat->hUpload)));
SetDlgItemTextUtf(hwndDlg, IDC_UPLOADING, buf);
if (done < SIZEOF(dat->hUpload)) break;
diff --git a/protocols/IcqOscarJ/src/changeinfo/editstring.cpp b/protocols/IcqOscarJ/src/changeinfo/editstring.cpp index 9987ce5223..4f1b33ba46 100644 --- a/protocols/IcqOscarJ/src/changeinfo/editstring.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/editstring.cpp @@ -240,7 +240,7 @@ void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey) else if ((setting[i].displayType & LIM_TYPE) == LI_NUMBER)
{
szValue = str;
- null_snprintf(str, sizeof(str), "%d", settingData[i].value );
+ mir_snprintf(str, sizeof(str), "%d", settingData[i].value );
}
else if (settingData[i].value)
{
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp index 3923e813c5..3e5c091ea8 100644 --- a/protocols/IcqOscarJ/src/fam_01service.cpp +++ b/protocols/IcqOscarJ/src/fam_01service.cpp @@ -823,7 +823,7 @@ void CIcqProto::handleServUINSettings(int nPort, serverthread_info *info) // prepare mood id
if (m_bMoodsEnabled && bXStatus && moodXStatus[bXStatus-1] != -1)
- null_snprintf(szMoodData, SIZEOF(szMoodData), "icqmood%d", moodXStatus[bXStatus-1]);
+ mir_snprintf(szMoodData, SIZEOF(szMoodData), "icqmood%d", moodXStatus[bXStatus-1]);
else
szMoodData[0] = '\0';
diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp index f43166a10c..d11a36b83a 100644 --- a/protocols/IcqOscarJ/src/fam_04message.cpp +++ b/protocols/IcqOscarJ/src/fam_04message.cpp @@ -2650,7 +2650,7 @@ void CIcqProto::handleRecvServMsgError(BYTE *buf, WORD wLen, WORD wFlags, DWORD case 0x0018: // Not while on AOL
default:
if (pszErrorMessage = (char*)_alloca(256))
- null_snprintf(pszErrorMessage, 256, Translate("SNAC(4.1) SENDMSG Error (x%02x)"), wError);
+ mir_snprintf(pszErrorMessage, 256, Translate("SNAC(4.1) SENDMSG Error (x%02x)"), wError);
break;
}
@@ -2958,7 +2958,7 @@ void CIcqProto::handleTypingNotification(BYTE *buf, WORD wLen, WORD wFlags, DWOR char szMsg[MAX_PATH];
char *nick = NickFromHandleUtf(hContact);
- null_snprintf(szMsg, MAX_PATH, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" has closed the message window."), szFormat, MAX_PATH), nick);
+ mir_snprintf(szMsg, MAX_PATH, 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 331fff18ab..e451e63ffc 100644 --- a/protocols/IcqOscarJ/src/fam_13servclist.cpp +++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp @@ -217,7 +217,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, WORD wBufferLength, snac_heade else if (pSnacHeader->wSubtype == ICQ_LISTS_REMOVEFROMLIST)
szChange = "Server removed %u item(s) from list";
- null_snprintf(szLogText, MAX_PATH, szChange, nItems);
+ mir_snprintf(szLogText, MAX_PATH, szChange, nItems);
NetLog_Server("Server sent SNAC(x13,x%02x) - %s", pSnacHeader->wSubtype, szLogText);
}
}
@@ -1487,7 +1487,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou char *nick = NickFromHandleUtf(hContact);
setByte(hContact, "Auth", 0);
- null_snprintf(str, MAX_PATH, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" was authorized in the server list."), msg, MAX_PATH), nick);
+ mir_snprintf(str, MAX_PATH, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" was authorized in the server list."), msg, MAX_PATH), nick);
icq_LogMessage(LOG_WARNING, str);
SAFE_FREE(&nick);
}
@@ -1498,7 +1498,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou char *nick = NickFromHandleUtf(hContact);
setByte(hContact, "Auth", 1);
- null_snprintf(str, MAX_PATH, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" lost its authorization in the server list."), msg, MAX_PATH), nick);
+ mir_snprintf(str, MAX_PATH, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" lost its authorization in the server list."), msg, MAX_PATH), nick);
icq_LogMessage(LOG_WARNING, str);
SAFE_FREE(&nick);
}
@@ -1601,7 +1601,7 @@ void CIcqProto::handleServerCListItemDelete(const char *szRecordName, WORD wGrou char msg[MAX_PATH];
char *nick = NickFromHandleUtf(hContact);
- null_snprintf(str, MAX_PATH, ICQTranslateUtfStatic(LPGEN("User \"%s\" was removed from server list."), msg, MAX_PATH), nick);
+ mir_snprintf(str, MAX_PATH, ICQTranslateUtfStatic(LPGEN("User \"%s\" was removed from server list."), msg, MAX_PATH), 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 15754aac18..3e4a6654ad 100644 --- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp +++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp @@ -594,7 +594,7 @@ int CIcqProto::parseUserInfoRecord(HANDLE hContact, oscar_tlv *pData, UserInfoRe for (int i = 0; i < nRecordDef; i++) {
char szItemKey[MAX_PATH];
- null_snprintf(szItemKey, MAX_PATH, pRecordDef[i].szDbSetting, nRecords);
+ mir_snprintf(szItemKey, MAX_PATH, pRecordDef[i].szDbSetting, nRecords);
switch (pRecordDef[i].dbType) {
case DBVT_UTF8:
@@ -619,7 +619,7 @@ int CIcqProto::parseUserInfoRecord(HANDLE hContact, oscar_tlv *pData, UserInfoRe for (int i = nRecords; i <= nMaxRecords; i++)
for (int j = 0; j < nRecordDef; j++) {
char szItemKey[MAX_PATH];
- null_snprintf(szItemKey, MAX_PATH, pRecordDef[j].szDbSetting, i);
+ mir_snprintf(szItemKey, MAX_PATH, pRecordDef[j].szDbSetting, i);
delSetting(hContact, szItemKey);
}
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index b3f02e8f13..363a9f2884 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -92,7 +92,7 @@ void CIcqProto::InitAvatars() // check if it does make sense
TCHAR tszPath[MAX_PATH * 2];
- null_snprintf(tszPath, MAX_PATH * 2, _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
+ mir_sntprintf(tszPath, MAX_PATH * 2, _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
hAvatarsFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), m_szModuleName, tszPath, m_tszUserName);
}
@@ -134,7 +134,7 @@ void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, TCHAR *pszDest, if (CallService(MS_FOLDERS_GET_PATH, (WPARAM)hAvatarsFolder, (LPARAM)&fgd))
{
TCHAR *tmpPath = Utils_ReplaceVarsT(_T("%miranda_avatarcache%"));
- null_snprintf(szPath, MAX_PATH * 2, _T("%s\\%S\\"), tmpPath, m_szModuleName);
+ mir_sntprintf(szPath, MAX_PATH * 2, _T("%s\\%S\\"), tmpPath, m_szModuleName);
mir_free(tmpPath);
}
else
diff --git a/protocols/IcqOscarJ/src/icq_clients.cpp b/protocols/IcqOscarJ/src/icq_clients.cpp index 46b504b3cb..cfdc74da93 100644 --- a/protocols/IcqOscarJ/src/icq_clients.cpp +++ b/protocols/IcqOscarJ/src/icq_clients.cpp @@ -34,11 +34,11 @@ const capstr capShortCaps = {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 0x8 static const char* makeClientVersion(char *szBuf, const char *szClient, unsigned v1, unsigned v2, unsigned v3, unsigned v4)
{
if (v4)
- null_snprintf(szBuf, 64, "%s%u.%u.%u.%u", szClient, v1, v2, v3, v4);
+ mir_snprintf(szBuf, 64, "%s%u.%u.%u.%u", szClient, v1, v2, v3, v4);
else if (v3)
- null_snprintf(szBuf, 64, "%s%u.%u.%u", szClient, v1, v2, v3);
+ mir_snprintf(szBuf, 64, "%s%u.%u.%u", szClient, v1, v2, v3);
else
- null_snprintf(szBuf, 64, "%s%u.%u", szClient, v1, v2);
+ mir_snprintf(szBuf, 64, "%s%u.%u", szClient, v1, v2);
return szBuf;
}
@@ -248,7 +248,7 @@ const char* CIcqProto::detectUserClient(HANDLE hContact, int nIsICQ, WORD wUserC szClient = "&RQ";
else if (dwFT1 == 0xFFFFF666) {
// this is R&Q (Rapid Edition)
- null_snprintf(szClientBuf, 64, "R&Q %u", (unsigned)dwFT2);
+ mir_snprintf(szClientBuf, 64, "R&Q %u", (unsigned)dwFT2);
szClient = szClientBuf;
}
else if (dwFT1 == 0xFFFFFFAB)
@@ -479,7 +479,7 @@ const char* CIcqProto::detectUserClient(HANDLE hContact, int nIsICQ, WORD wUserC strcpy(szClientBuf, "QIP Infium");
if (dwFT1) {
- null_snprintf(ver, 10, " (%d)", dwFT1);
+ mir_snprintf(ver, 10, " (%d)", dwFT1);
strcat(szClientBuf, ver);
}
if (dwFT2 == 0x0B)
@@ -490,7 +490,7 @@ const char* CIcqProto::detectUserClient(HANDLE hContact, int nIsICQ, WORD wUserC else if (MatchCapability(caps, wLen, &capQip2010, 12)) {
strcpy(szClientBuf, "QIP 2010");
if (dwFT1) {
- null_snprintf(ver, 10, " (%d)", dwFT1);
+ mir_snprintf(ver, 10, " (%d)", dwFT1);
strcat(szClientBuf, ver);
}
@@ -499,7 +499,7 @@ const char* CIcqProto::detectUserClient(HANDLE hContact, int nIsICQ, WORD wUserC else if (MatchCapability(caps, wLen, &capQip2012, 12)) {
strcpy(szClientBuf, "QIP 2012");
if (dwFT1) {
- null_snprintf(ver, 10, " (%d)", dwFT1);
+ mir_snprintf(ver, 10, " (%d)", dwFT1);
strcat(szClientBuf, ver);
}
@@ -511,9 +511,9 @@ const char* CIcqProto::detectUserClient(HANDLE hContact, int nIsICQ, WORD wUserC else
null_strcpy(ver, (char*)(*capId) + 11, 5);
- null_snprintf(szClientBuf, 64, cliQip, ver);
+ mir_snprintf(szClientBuf, 64, cliQip, ver);
if (dwFT1 && dwFT2 == 0x0E) {
- null_snprintf(ver, 10, " (%d%d%d%d)", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF, (dwFT1 >> 0x08) & 0xFF, dwFT1 & 0xFF);
+ mir_snprintf(ver, 10, " (%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(HANDLE hContact, int nIsICQ, WORD wUserC if (dwFT2 == 0x0FFFF0011 && dwFT3 == 0x1100FFFF && (dwFT1 >> 0x18)) {
char ver[16];
- null_snprintf(ver, 10, " %d.%d", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF);
+ mir_snprintf(ver, 10, " %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(HANDLE hContact, int nIsICQ, WORD wUserC capstr* capId;
if (capId = MatchCapability(caps, wLen, &capMimPack, 4)) {
char szPack[16];
- null_snprintf(szPack, 16, " [%.12s]", (*capId)+4);
+ mir_snprintf(szPack, 16, " [%.12s]", (*capId)+4);
// make sure client string is not constant
if (szClient != szClientBuf) {
diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp index 4893bbc813..075f07122c 100644 --- a/protocols/IcqOscarJ/src/icq_direct.cpp +++ b/protocols/IcqOscarJ/src/icq_direct.cpp @@ -982,7 +982,7 @@ int DecryptDirectPacket(directconnect* dc, PBYTE buf, WORD wLen) char* pszBuf;
- titleLineLen = null_snprintf(szTitleLine, 128, "DECRYPTED\n");
+ titleLineLen = mir_snprintf(szTitleLine, 128, "DECRYPTED\n");
szBuf = (char*)_alloca(titleLineLen + ((wLen+15)>>4) * 76 + 1);
CopyMemory(szBuf, szTitleLine, titleLineLen);
pszBuf = szBuf + titleLineLen;
@@ -990,10 +990,10 @@ int DecryptDirectPacket(directconnect* dc, PBYTE buf, WORD wLen) for (line = 0; ; line += 16)
{
colsInLine = min(16, wLen - line);
- pszBuf += wsprintfA(pszBuf, "%08X: ", line);
+ pszBuf += wsprintfA(pszBuf, "%08X: ", line); //!!!!!!!!!!!!!
for (col = 0; col<colsInLine; col++)
- pszBuf += wsprintfA(pszBuf, "%02X%c", buf[line+col], (col&3)==3 && col!=15?'-':' ');
+ pszBuf += wsprintfA(pszBuf, "%02X%c", buf[line+col], (col&3)==3 && col!=15?'-':' '); //!!!!!!!!!!!!!
for (; col<16; col++)
{
diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index f92eaf24a0..9a5d6bbe11 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -36,7 +36,7 @@ static void accountLoadDetails(CIcqProto *ppro, HWND hwndDlg) DWORD dwUIN = ppro->getContactUin(NULL);
if (dwUIN)
{
- null_snprintf(pszUIN, 20, "%u", dwUIN);
+ mir_snprintf(pszUIN, 20, "%u", dwUIN);
SetDlgItemTextA(hwndDlg, IDC_UIN, pszUIN);
}
diff --git a/protocols/IcqOscarJ/src/icq_http.cpp b/protocols/IcqOscarJ/src/icq_http.cpp index 3e50db43ed..6e9fedf896 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);
- null_snprintf(szSid, 33, "%08x%08x%08x%08x", dwSid1, dwSid2, dwSid3, dwSid4);
+ mir_snprintf(szSid, 33, "%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;
- null_snprintf(szHttpGetUrl, 300, "http://%s/monitor?sid=%s", szHttpServer, szSid);
- null_snprintf(szHttpPostUrl, 300, "http://%s/data?sid=%s&seq=", szHttpServer, szSid);
+ mir_snprintf(szHttpGetUrl, 300, "http://%s/monitor?sid=%s", szHttpServer, szSid);
+ mir_snprintf(szHttpPostUrl, 300, "http://%s/data?sid=%s&seq=", szHttpServer, szSid);
return CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi);
}
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index aba1581956..d8fc2ebb3b 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -174,7 +174,7 @@ CIcqProto::CIcqProto( const char* aProtoName, const TCHAR* aUserName ) : // Register netlib users
NETLIBUSER nlu = {0};
TCHAR szBuffer[MAX_PATH + 64];
- null_snprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s server connection"), m_tszUserName);
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s server connection"), m_tszUserName);
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.ptszDescriptiveName = szBuffer;
@@ -188,8 +188,8 @@ CIcqProto::CIcqProto( const char* aProtoName, const TCHAR* aUserName ) : m_hServerNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
char szP2PModuleName[MAX_PATH];
- null_snprintf(szP2PModuleName, SIZEOF(szP2PModuleName), "%sP2P", m_szModuleName);
- null_snprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s client-to-client connections"), m_tszUserName);
+ mir_snprintf(szP2PModuleName, SIZEOF(szP2PModuleName), "%sP2P", m_szModuleName);
+ mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s client-to-client connections"), m_tszUserName);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR;
nlu.ptszDescriptiveName = szBuffer;
nlu.szSettingsModule = szP2PModuleName;
@@ -276,9 +276,9 @@ int CIcqProto::OnModulesLoaded( WPARAM wParam, LPARAM lParam ) char pszSrvGroupsName[MAX_PATH];
char* modules[5] = {0,0,0,0,0};
- null_snprintf(pszP2PName, SIZEOF(pszP2PName), "%sP2P", m_szModuleName);
- null_snprintf(pszGroupsName, SIZEOF(pszGroupsName), "%sGroups", m_szModuleName);
- null_snprintf(pszSrvGroupsName, SIZEOF(pszSrvGroupsName), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(pszP2PName, SIZEOF(pszP2PName), "%sP2P", m_szModuleName);
+ mir_snprintf(pszGroupsName, SIZEOF(pszGroupsName), "%sGroups", m_szModuleName);
+ mir_snprintf(pszSrvGroupsName, SIZEOF(pszSrvGroupsName), "%sSrvGroups", m_szModuleName);
modules[0] = m_szModuleName;
modules[1] = pszP2PName;
modules[2] = pszGroupsName;
@@ -1437,7 +1437,7 @@ HANDLE __cdecl CIcqProto::SendFile( HANDLE hContact, const TCHAR* szDescription, }
else
{
- null_snprintf(szFiles, SIZEOF(szFiles), ICQTranslateUtfStatic("%d Files", tmp, SIZEOF(tmp)), ft->dwFileCount);
+ mir_snprintf(szFiles, SIZEOF(szFiles), ICQTranslateUtfStatic("%d Files", tmp, SIZEOF(tmp)), ft->dwFileCount);
pszFiles = szFiles;
}
@@ -2261,11 +2261,11 @@ int __cdecl CIcqProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l {
char szDbSetting[MAX_PATH];
- null_snprintf(szDbSetting, sizeof(szDbSetting), "%sP2P", m_szModuleName);
+ mir_snprintf(szDbSetting, sizeof(szDbSetting), "%sP2P", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbSetting);
- null_snprintf(szDbSetting, sizeof(szDbSetting), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szDbSetting, sizeof(szDbSetting), "%sSrvGroups", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbSetting);
- null_snprintf(szDbSetting, sizeof(szDbSetting), "%sGroups", m_szModuleName);
+ mir_snprintf(szDbSetting, sizeof(szDbSetting), "%sGroups", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbSetting);
break;
}
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index f76e1b3f72..de62755301 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -983,7 +983,7 @@ void CIcqProto::LoadServerIDs() int nStart = nServerIDListCount;
char szModule[MAX_PATH];
- null_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
GroupReserveIdsEnumParam param = { this, szModule };
dbces.pfnEnumProc = &GroupReserveIdsEnumProc;
@@ -1352,7 +1352,7 @@ int CIcqProto::IsServerGroupsDefined() char szModule[MAX_PATH];
// flush obsolete linking data
- null_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
+ mir_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szModule);
iRes = 0; // no groups defined, or older version
@@ -1368,7 +1368,7 @@ void CIcqProto::FlushSrvGroupsCache() {
char szModule[MAX_PATH];
- null_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szModule);
}
@@ -1462,7 +1462,7 @@ void CIcqProto::removeGroupPathLinks(WORD wGroupID) char szModule[MAX_PATH];
char* pars[3];
- null_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
+ mir_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
pars[0] = NULL;
pars[1] = (char*)wGroupID;
@@ -1500,7 +1500,7 @@ char *CIcqProto::getServListGroupName(WORD wGroupID) return NULL;
}
- null_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
_itoa(wGroupID, szGroup, 0x10);
if (!CheckServerID(wGroupID, 0))
@@ -1525,7 +1525,7 @@ void CIcqProto::setServListGroupName(WORD wGroupID, const char *szGroupName) return;
}
- null_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
_itoa(wGroupID, szGroup, 0x10);
if (szGroupName)
@@ -1544,7 +1544,7 @@ WORD CIcqProto::getServListGroupLinkID(const char *szPath) char szModule[MAX_PATH];
WORD wGroupId;
- null_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
+ mir_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
wGroupId = db_get_w(NULL, szModule, szPath, 0);
@@ -1563,7 +1563,7 @@ void CIcqProto::setServListGroupLinkID(const char *szPath, WORD wGroupID) {
char szModule[MAX_PATH];
- null_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
+ mir_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
if (wGroupID)
db_set_w(NULL, szModule, szPath, wGroupID);
@@ -1798,7 +1798,7 @@ char* CIcqProto::getServListUniqueGroupName(const char *szGroupName, int bAlloce szGroupNameBase = null_strdup(szGroupName);
null_strcut(szGroupNameBase, m_wServerListRecordNameMaxLength);
- null_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
do {
pars[0] = (char*)this;
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index cbd548094f..255cfb161c 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -60,7 +60,7 @@ DWORD CIcqProto::sendXStatusDetailsRequest(HANDLE hContact, int bForced) int nNotifyLen = 94 + UINMAXLEN;
char *szNotify = (char*)_alloca(nNotifyLen);
- null_snprintf(szNotify, nNotifyLen, "<srv><id>cAwaySrv</id><req><id>AwayStat</id><trans>1</trans><senderId>%d</senderId></req></srv>", m_dwLocalUIN);
+ mir_snprintf(szNotify, nNotifyLen, "<srv><id>cAwaySrv</id><req><id>AwayStat</id><trans>1</trans><senderId>%d</senderId></req></srv>", m_dwLocalUIN);
dwCookie = SendXtrazNotifyRequest(hContact, "<Q><PluginID>srvMng</PluginID></Q>", szNotify, bForced);
}
@@ -417,7 +417,7 @@ void CIcqProto::handleXStatusCaps(DWORD dwUIN, char *szUID, HANDLE hContact, BYT null_strcpy(szMoodData, moods, moodsize);
if (moodXStatus[i] == -1) continue;
- null_snprintf(szMoodId, SIZEOF(szMoodId), "0icqmood%d", moodXStatus[i]);
+ mir_snprintf(szMoodId, SIZEOF(szMoodId), "0icqmood%d", moodXStatus[i]);
if ( !strcmpnull(szMoodId, szMoodData)) {
BYTE bXStatusId = (BYTE)(i+1);
char str[MAX_PATH];
@@ -509,7 +509,7 @@ void CIcqProto::updateServerCustomStatus(int fullUpdate) // prepare mood id
if (m_bMoodsEnabled && bXStatus && moodXStatus[bXStatus-1] != -1)
- null_snprintf(szMoodData, SIZEOF(szMoodData), "0icqmood%d", moodXStatus[bXStatus-1]);
+ mir_snprintf(szMoodData, SIZEOF(szMoodData), "0icqmood%d", moodXStatus[bXStatus-1]);
else
szMoodData[0] = '\0';
@@ -703,7 +703,7 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara char buf[MAX_PATH];
char *format = GetWindowTextUtf(hwndDlg);
- null_snprintf(str, sizeof(str), format, dat->bXStatus?ICQTranslateUtfStatic(nameXStatus[dat->bXStatus-1], buf, MAX_PATH):"");
+ mir_snprintf(str, sizeof(str), format, dat->bXStatus?ICQTranslateUtfStatic(nameXStatus[dat->bXStatus-1], buf, MAX_PATH):"");
SetWindowTextUtf(hwndDlg, str);
SAFE_FREE(&format);
}
@@ -715,7 +715,7 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara break;
}
- null_snprintf(str,sizeof(str),dat->okButtonFormat,dat->countdown);
+ mir_snprintf(str,sizeof(str),dat->okButtonFormat,dat->countdown);
SetDlgItemTextUtf(hwndDlg,IDOK,str);
dat->countdown--;
break;
@@ -741,14 +741,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);
- null_snprintf(szSetting, 64, "XStatus%dMsg", dat->bXStatus);
+ mir_snprintf(szSetting, 64, "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);
- null_snprintf(szSetting, 64, "XStatus%dName", dat->bXStatus);
+ mir_snprintf(szSetting, 64, "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);
@@ -794,13 +794,13 @@ void CIcqProto::setXStatusEx(BYTE bXStatus, BYTE bQuiet) char *szName = NULL, *szMsg = NULL;
if (m_bXStatusEnabled) {
- null_snprintf(szSetting, 64, "XStatus%dName", bXStatus);
+ mir_snprintf(szSetting, 64, "XStatus%dName", bXStatus);
szName = getSettingStringUtf(NULL, szSetting, ICQTranslateUtfStatic(nameXStatus[bXStatus-1], str, MAX_PATH));
}
- null_snprintf(szSetting, 64, "XStatus%dMsg", bXStatus);
+ mir_snprintf(szSetting, 64, "XStatus%dMsg", bXStatus);
szMsg = getSettingStringUtf(NULL, szSetting, "");
- null_snprintf(szSetting, 64, "XStatus%dStat", bXStatus);
+ mir_snprintf(szSetting, 64, "XStatus%dStat", bXStatus);
if (!bQuiet && !getByte(szSetting, 0)) {
InitXStatusData init;
init.ppro = this;
@@ -855,7 +855,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) if (m_bHideXStatusUI || m_bHideXStatusMenu)
return;
- null_snprintf(szItem, sizeof(szItem), Translate("%s Custom Status"), m_szModuleName);
+ mir_snprintf(szItem, sizeof(szItem), Translate("%s Custom Status"), m_szModuleName);
CLISTMENUITEM mi = { sizeof(mi) };
mi.pszPopupName = szItem;
@@ -863,7 +863,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) mi.position = 2000040000;
for (int i = 0; i <= XSTATUS_COUNT; i++) {
- null_snprintf(srvFce, sizeof(srvFce), "%s/menuXStatus%d", m_szModuleName, i);
+ mir_snprintf(srvFce, sizeof(srvFce), "%s/menuXStatus%d", m_szModuleName, i);
mi.position++;
@@ -895,7 +895,7 @@ void InitXStatusIcons() for (int i = 0; i < XSTATUS_COUNT; i++) {
char szTemp[100];
- null_snprintf(szTemp, sizeof(szTemp), "icq_xstatus%d", i);
+ mir_snprintf(szTemp, sizeof(szTemp), "icq_xstatus%d", i);
sid.pszName = szTemp;
sid.pszDescription = (LPSTR)nameXStatus[i];
sid.iDefaultIndex = -(IDI_XSTATUS1+i);
diff --git a/protocols/IcqOscarJ/src/icq_xtraz.cpp b/protocols/IcqOscarJ/src/icq_xtraz.cpp index 6a746c2e57..7b3115213d 100644 --- a/protocols/IcqOscarJ/src/icq_xtraz.cpp +++ b/protocols/IcqOscarJ/src/icq_xtraz.cpp @@ -94,7 +94,7 @@ void CIcqProto::handleXtrazNotify(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD w int nResponseLen = 212 + strlennull(szXName) + strlennull(szXMsg) + UINMAXLEN + 2;
char *szResponse = (char*)_alloca(nResponseLen + 1);
// send response
- null_snprintf(szResponse, nResponseLen,
+ mir_snprintf(szResponse, nResponseLen,
"<ret event=\"OnRemoteNotification\">"
"<srv><id>cAwaySrv</id>"
"<val srv_id=\"cAwaySrv\"><Root>"
@@ -415,7 +415,7 @@ DWORD CIcqProto::SendXtrazNotifyRequest(HANDLE hContact, char* szQuery, char* sz szNotifyBody = MangleXml(szNotify, strlennull(szNotify));
nBodyLen = strlennull(szQueryBody) + strlennull(szNotifyBody) + 41;
szBody = (char*)_alloca(nBodyLen);
- nBodyLen = null_snprintf(szBody, nBodyLen, "<N><QUERY>%s</QUERY><NOTIFY>%s</NOTIFY></N>", szQueryBody, szNotifyBody);
+ nBodyLen = mir_snprintf(szBody, nBodyLen, "<N><QUERY>%s</QUERY><NOTIFY>%s</NOTIFY></N>", szQueryBody, szNotifyBody);
SAFE_FREE((void**)&szQueryBody);
SAFE_FREE((void**)&szNotifyBody);
@@ -446,7 +446,7 @@ void CIcqProto::SendXtrazNotifyResponse(DWORD dwUin, DWORD dwMID, DWORD dwMID2, return; // Contact does not support xtraz, do not send anything
}
- nBodyLen = null_snprintf(szBody, nBodyLen, "<NR><RES>%s</RES></NR>", szResBody);
+ nBodyLen = mir_snprintf(szBody, nBodyLen, "<NR><RES>%s</RES></NR>", szResBody);
SAFE_FREE(&szResBody);
// Was request received thru DC and have we a open DC, send through that
diff --git a/protocols/IcqOscarJ/src/log.cpp b/protocols/IcqOscarJ/src/log.cpp index 38857473a5..1c7aef736f 100644 --- a/protocols/IcqOscarJ/src/log.cpp +++ b/protocols/IcqOscarJ/src/log.cpp @@ -138,7 +138,7 @@ void CIcqProto::icq_LogUsingErrorCode(int level, DWORD dwError, const char *szMs }
}
- null_snprintf(szBuf, sizeof(szBuf), "%s%s%s (%s %d)",
+ mir_snprintf(szBuf, sizeof(szBuf), "%s%s%s (%s %d)",
szMsg ? ICQTranslateUtfStatic(szMsg, str, 1024) : "",
szMsg ? "\r\n\r\n" : "",
ICQTranslateUtfStatic(pszErrorMsg, szErrorMsg, 512),
@@ -156,6 +156,6 @@ void CIcqProto::icq_LogFatalParam(const char *szMsg, WORD wError) char str[MAX_PATH];
char buf[MAX_PATH];
- null_snprintf(buf, MAX_PATH, ICQTranslateUtfStatic(szMsg, str, MAX_PATH), wError);
+ mir_snprintf(buf, MAX_PATH, ICQTranslateUtfStatic(szMsg, str, MAX_PATH), wError);
icq_LogMessage(LOG_FATAL, buf);
}
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index 15b85bb475..69e7dfc4c8 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -544,7 +544,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz pszFileName = (char*)_alloca(64);
char tmp[64];
- null_snprintf(pszFileName, 64, ICQTranslateUtfStatic(LPGEN("%d Files"), tmp, SIZEOF(tmp)), ft->wFilesCount);
+ mir_snprintf(pszFileName, 64, ICQTranslateUtfStatic(LPGEN("%d Files"), tmp, SIZEOF(tmp)), ft->wFilesCount);
}
}
// Total Size TLV (ICQ 6 and AIM 6)
@@ -1835,7 +1835,7 @@ int CIcqProto::oft_handleFileData(oscar_connection *oc, BYTE *buf, int len) char *pszMsg = ICQTranslateUtf(LPGEN("The checksum of file \"%s\" does not match, the file is probably damaged."));
char szBuf[MAX_PATH];
- null_snprintf(szBuf, MAX_PATH, pszMsg, ExtractFileName(ft->szThisFile));
+ mir_snprintf(szBuf, MAX_PATH, pszMsg, ExtractFileName(ft->szThisFile));
icq_LogMessage(LOG_ERROR, szBuf);
SAFE_FREE(&pszMsg);
diff --git a/protocols/IcqOscarJ/src/stdpackets.cpp b/protocols/IcqOscarJ/src/stdpackets.cpp index 69d9fd2ac1..35bae4ca14 100644 --- a/protocols/IcqOscarJ/src/stdpackets.cpp +++ b/protocols/IcqOscarJ/src/stdpackets.cpp @@ -1510,7 +1510,7 @@ DWORD CIcqProto::icq_sendSMSServ(const char *szPhoneNumber, const char *szMsg) if (szBuffer = (char *)_alloca(nBufferSize))
{
- wBufferLen = null_snprintf(szBuffer, nBufferSize,
+ wBufferLen = mir_snprintf(szBuffer, nBufferSize,
"<icq_sms_message>"
"<destination>"
"%s" /* phone number */
@@ -1874,8 +1874,9 @@ void CIcqProto::oft_sendFileRequest(DWORD dwUin, char *szUid, oscar_filetransfer {
icq_packet packet;
- char *szCoolStr = (char*)_alloca(strlennull(ft->szDescription)+strlennull(pszFiles) + 160);
- sprintf(szCoolStr, "<ICQ_COOL_FT><FS>%s</FS><S>%I64u</S><SID>1</SID><DESC>%s</DESC></ICQ_COOL_FT>", pszFiles, ft->qwTotalSize, ft->szDescription);
+ size_t size = strlennull(ft->szDescription)+strlennull(pszFiles) + 160;
+ char *szCoolStr = (char *)_alloca(size);
+ mir_snprintf(szCoolStr, size, "<ICQ_COOL_FT><FS>%s</FS><S>%I64u</S><SID>1</SID><DESC>%s</DESC></ICQ_COOL_FT>", pszFiles, ft->qwTotalSize, ft->szDescription);
szCoolStr = MangleXml(szCoolStr, strlennull(szCoolStr));
WORD wDataLen = 93 + strlennull(szCoolStr) + strlennull(pszFiles);
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 9d8aa40321..a3fb13398c 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -688,31 +688,6 @@ char* __fastcall strstrnull(const char *str, const char *substr) return NULL;
}
-int null_snprintf(char *buffer, size_t count, const char *fmt, ...)
-{
- va_list va;
- int len;
-
- ZeroMemory(buffer, count);
- va_start(va, fmt);
- len = _vsnprintf(buffer, count-1, fmt, va);
- va_end(va);
- return len;
-}
-
-int null_snprintf(WCHAR *buffer, size_t count, const WCHAR *fmt, ...)
-{
- va_list va;
- int len;
-
- ZeroMemory(buffer, count * sizeof(WCHAR));
- va_start(va, fmt);
- len = _vsnwprintf(buffer, count, fmt, va);
- va_end(va);
- return len;
-}
-
-
char* __fastcall null_strdup(const char *string)
{
if (string)
diff --git a/protocols/IcqOscarJ/src/utilities.h b/protocols/IcqOscarJ/src/utilities.h index fe01ea8c34..de1274081b 100644 --- a/protocols/IcqOscarJ/src/utilities.h +++ b/protocols/IcqOscarJ/src/utilities.h @@ -75,13 +75,11 @@ int __fastcall strlennull(const char *string); int __fastcall strcmpnull(const char *str1, const char *str2);
int __fastcall stricmpnull(const char *str1, const char *str2);
char* __fastcall strstrnull(const char *str, const char *substr);
-int null_snprintf(char *buffer, size_t count, const char *fmt, ...);
char* __fastcall null_strdup(const char *string);
char* __fastcall null_strcpy(char *dest, const char *src, size_t maxlen);
int __fastcall null_strcut(char *string, int maxlen);
int __fastcall strlennull(const WCHAR *string);
-int null_snprintf(WCHAR *buffer, size_t count, const WCHAR *fmt, ...);
WCHAR* __fastcall null_strdup(const WCHAR *string);
WCHAR* __fastcall null_strcpy(WCHAR *dest, const WCHAR *src, size_t maxlen);
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index 3275897273..c300136881 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -160,7 +160,7 @@ int CJabberProto::AdHoc_OnJAHMCommandListResult(HWND hwndDlg, HXML iqNode, Jabbe code = xmlGetAttrValue(errorNode, _T("code"));
description = xmlGetText(errorNode);
}
- _sntprintf(buff, SIZEOF(buff), TranslateT("Error %s %s"), (code) ? code : _T(""), (description) ? description : _T(""));
+ mir_sntprintf(buff, SIZEOF(buff), TranslateT("Error %s %s"), (code) ? code : _T(""), (description) ? description : _T(""));
JabberFormSetInstruction(hwndDlg, buff);
}
else if ( !_tcscmp(type, _T("result"))) {
@@ -288,7 +288,7 @@ int CJabberProto::AdHoc_OnJAHMProcessResult(HWND hwndDlg, HXML workNode, JabberA code = xmlGetAttrValue(errorNode, _T("code"));
description = xmlGetText(errorNode);
}
- _sntprintf(buff,SIZEOF(buff),TranslateT("Error %s %s"),code ? code : _T(""),description?description:_T(""));
+ mir_sntprintf(buff, SIZEOF(buff), TranslateT("Error %s %s"), code ? code : _T(""), description ? description : _T(""));
JabberFormSetInstruction(hwndDlg,buff);
}
JabberAdHoc_RefreshFrameScroll(hwndDlg, dat);
@@ -397,8 +397,8 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA if ( !pStartupParams->m_szNode) {
dat->proto->AdHoc_RequestListOfCommands(pStartupParams->m_szJid, hwndDlg);
- TCHAR Caption[ 512 ];
- _sntprintf(Caption, SIZEOF(Caption), _T("%s %s"), TranslateT("Jabber Ad-Hoc commands at"), dat->ResponderJID);
+ TCHAR Caption[512];
+ mir_sntprintf(Caption, SIZEOF(Caption), _T("%s %s"), TranslateT("Jabber Ad-Hoc commands at"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
else
@@ -413,8 +413,8 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA EnableDlgItem(hwndDlg, IDC_SUBMIT, FALSE);
SetDlgItemText(hwndDlg, IDC_SUBMIT, TranslateT("OK"));
- TCHAR Caption[ 512 ];
- _sntprintf(Caption, SIZEOF(Caption), _T("%s %s"), TranslateT("Sending Ad-Hoc command to"), dat->ResponderJID);
+ TCHAR Caption[512];
+ mir_sntprintf(Caption, SIZEOF(Caption), _T("%s %s"), TranslateT("Sending Ad-Hoc command to"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index 7b8282754c..aed856545a 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -297,8 +297,9 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) if (pFileName != NULL) {
int id = SerialNext();
if (ft->iqId) mir_free(ft->iqId);
- ft->iqId = (TCHAR*)mir_alloc(sizeof(TCHAR)*(strlen(JABBER_IQID)+20));
- wsprintf(ft->iqId, _T(JABBER_IQID)_T("%d"), id);
+ size_t size = strlen(JABBER_IQID) + 20;
+ ft->iqId = (TCHAR *)mir_alloc(sizeof(TCHAR) * size);
+ mir_sntprintf(ft->iqId, size, _T(JABBER_IQID)_T("%d"), id);
char *myAddr = NULL;
DBVARIANT dbv;
@@ -317,8 +318,8 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) mir_free(myAddr);
int len = lstrlen(ptszResource) + lstrlen(ft->jid) + 2;
- TCHAR *fulljid = (TCHAR*)alloca(sizeof(TCHAR)*len);
- wsprintf(fulljid, _T("%s/%s"), ft->jid, ptszResource);
+ TCHAR *fulljid = (TCHAR *)alloca(sizeof(TCHAR) * len);
+ mir_sntprintf(fulljid, len, _T("%s/%s"), ft->jid, ptszResource);
XmlNodeIq iq(_T("set"), id, fulljid);
HXML query = iq << XQUERY(JABBER_FEAT_OOB);
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index cc445c421d..a9f1f5be19 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -277,8 +277,8 @@ static HICON LoadTransportIcon(char *filename,int i,char *IconName,TCHAR *SectNa GetModuleFileNameA(NULL, szPath, MAX_PATH);
str=strrchr(szPath,'\\');
if (str != NULL) *str=0;
- _snprintf(szMyPath, sizeof(szMyPath), "%s\\Icons\\%s", szPath, filename);
- _snprintf(szFullPath, sizeof(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i);
+ mir_snprintf(szMyPath, sizeof(szMyPath), "%s\\Icons\\%s", szPath, filename);
+ mir_snprintf(szFullPath, sizeof(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i);
BOOL nf;
HICON hi=ExtractIconFromPath(szFullPath,&nf);
if (hi) has_proto_icon=TRUE;
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index dfacdd5bba..24d72a83f6 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -118,7 +118,6 @@ typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); #define StringCchCopy(x,y,z) lstrcpyn((x),(z),(y))
#define StringCchCat(x,y,z) lstrcat((x),(z))
-#define StringCchPrintf mir_sntprintf
// slightly modified sample from MSDN
BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE)
@@ -339,7 +338,7 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) TCHAR buf[80];
- StringCchPrintf(buf, 80, TEXT(" (build %d)"), osvi.dwBuildNumber);
+ mir_sntprintf(buf, 80, TEXT(" (build %d)"), osvi.dwBuildNumber);
StringCchCat(pszOS, BUFSIZE, buf);
return TRUE;
@@ -780,7 +779,7 @@ BOOL CJabberProto::AddClistHttpAuthEvent(CJabberHttpAuthParams *pParams) {
CLISTEVENT cle = {0};
char szService[256];
- mir_snprintf(szService, sizeof(szService),"%s%s", m_szModuleName, JS_HTTP_AUTH);
+ mir_snprintf(szService, sizeof(szService), "%s%s", m_szModuleName, JS_HTTP_AUTH);
cle.cbSize = sizeof(CLISTEVENT);
cle.hIcon = (HICON) LoadIconEx("openid");
cle.flags = CLEF_PROTOCOLGLOBAL | CLEF_TCHAR;
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 60517cc113..f584333bbe 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -791,13 +791,13 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) if (nEmail == 0)
strcpy(text, "e-mail");
else
- sprintf(text, "e-mail%d", nEmail-1);
+ mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail - 1);
}
- else sprintf(text, "e-mail%d", nEmail);
+ else mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail);
setTString(hContact, text, xmlGetText(m));
if (hContact == NULL) {
- sprintf(text, "e-mailFlag%d", nEmail);
+ mir_snprintf(text, SIZEOF(text), "e-mailFlag%d", nEmail);
int nFlag = 0;
if (xmlGetChild(n, "HOME") != NULL) nFlag |= JABBER_VCEMAIL_HOME;
if (xmlGetChild(n, "WORK") != NULL) nFlag |= JABBER_VCEMAIL_WORK;
@@ -963,11 +963,11 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) }
}
else {
- char text[ 100 ];
- sprintf(text, "Phone%d", nPhone);
+ char text[100];
+ mir_snprintf(text, SIZEOF(text), "Phone%d", nPhone);
setTString(text, xmlGetText(m));
- sprintf(text, "PhoneFlag%d", nPhone);
+ mir_snprintf(text, SIZEOF(text), "PhoneFlag%d", nPhone);
int nFlag = 0;
if (xmlGetChild(n,"HOME") != NULL) nFlag |= JABBER_VCTEL_HOME;
if (xmlGetChild(n,"WORK") != NULL) nFlag |= JABBER_VCTEL_WORK;
@@ -1049,8 +1049,8 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) if (nEmail <= 0)
delSetting(hContact, "e-mail");
else {
- char text[ 100 ];
- sprintf(text, "e-mail%d", nEmail-1);
+ char text[100];
+ mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail - 1);
if ( db_get_s(hContact, m_szModuleName, text, &dbv)) break;
db_free(&dbv);
delSetting(hContact, text);
@@ -1060,12 +1060,12 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) }
else {
while (true) {
- char text[ 100 ];
- sprintf(text, "e-mail%d", nEmail);
+ char text[100];
+ mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail);
if ( getString(text, &dbv)) break;
db_free(&dbv);
delSetting(text);
- sprintf(text, "e-mailFlag%d", nEmail);
+ mir_snprintf(text, SIZEOF(text), "e-mailFlag%d", nEmail);
delSetting(text);
nEmail++;
} }
@@ -1093,12 +1093,12 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode) }
else {
while (true) {
- char text[ 100 ];
- sprintf(text, "Phone%d", nPhone);
+ char text[100];
+ mir_snprintf(text, SIZEOF(text), "Phone%d", nPhone);
if ( getString(text, &dbv)) break;
db_free(&dbv);
delSetting(text);
- sprintf(text, "PhoneFlag%d", nPhone);
+ mir_snprintf(text, SIZEOF(text), "PhoneFlag%d", nPhone);
delSetting(text);
nPhone++;
} }
@@ -1474,14 +1474,14 @@ LBL_ErrFormat: setByte(hContact, "AvatarType", pictureType);
- char buffer[ 41 ];
+ char buffer[41];
mir_sha1_byte_t digest[20];
mir_sha1_ctx sha;
mir_sha1_init(&sha);
mir_sha1_append(&sha, (mir_sha1_byte_t*)(char*)body, resultLen);
mir_sha1_finish(&sha, digest);
for (int i=0; i<20; i++)
- sprintf(buffer+(i<<1), "%02x", digest[i]);
+ mir_snprintf(buffer + (i << 1), 2, "%02x", digest[i]);
GetAvatarFileName(hContact, tszFileName, SIZEOF(tszFileName));
_tcsncpy(AI.filename, tszFileName, SIZEOF(AI.filename));
diff --git a/protocols/JabberG/src/jabber_proxy.cpp b/protocols/JabberG/src/jabber_proxy.cpp index 8f7308fff8..1bcf6d7e32 100644 --- a/protocols/JabberG/src/jabber_proxy.cpp +++ b/protocols/JabberG/src/jabber_proxy.cpp @@ -55,7 +55,7 @@ int JabberHttpGatewayInit(HANDLE /*hConn*/, NETLIBOPENCONNECTION* /*nloc*/, NETL unpackDWord(&buf, &dwSid2);
unpackDWord(&buf, &dwSid3);
unpackDWord(&buf, &dwSid4);
- sprintf(szSid, "%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 (responseBytes < 30 + wIpLen || wIpLen == 0 || wIpLen > sizeof(szHttpServer) - 1)
{
@@ -70,8 +70,8 @@ int JabberHttpGatewayInit(HANDLE /*hConn*/, NETLIBOPENCONNECTION* /*nloc*/, NETL nlhpi.szHttpGetUrl = szHttpGetUrl;
nlhpi.szHttpPostUrl = szHttpPostUrl;
nlhpi.firstPostSequence = 1;
- sprintf(szHttpGetUrl, "http://%s/monitor?sid=%s", szHttpServer, szSid);
- sprintf(szHttpPostUrl, "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);
#endif
return 1;
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 0dd007b05c..5990dad83b 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -587,8 +587,8 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo* pInfo, CJabberAdhocSe time_t ltime = (time_t)dbei.timestamp;
struct tm *gmt = gmtime(<ime);
- TCHAR stime[ 512 ];
- wsprintf(stime, _T("%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ"), gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
+ TCHAR stime[512];
+ mir_sntprintf(stime, SIZEOF(stime), _T("%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ"), gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
msg << XCHILDNS(_T("delay"), _T("urn:xmpp:delay")) << XATTR(_T("stamp"), stime);
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index 49f946cd42..5393322265 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -191,7 +191,7 @@ void CJabberProto::OnIqResultGetSearchFields(HXML iqNode) code = xmlGetAttrValue(errorNode, _T("code"));
description = xmlGetText(errorNode);
}
- _sntprintf(buff,SIZEOF(buff),TranslateT("Error %s %s\r\nPlease select other server"),code ? code : _T(""),description?description:_T(""));
+ mir_sntprintf(buff, SIZEOF(buff), TranslateT("Error %s %s\r\nPlease select other server"), code ? code : _T(""), description ? description : _T(""));
SetDlgItemText(searchHandleDlg,IDC_INSTRUCTIONS,buff);
}
else SetDlgItemText(searchHandleDlg, IDC_INSTRUCTIONS, TranslateT("Error Unknown reply recieved\r\nPlease select other server"));
@@ -269,7 +269,7 @@ void CJabberProto::SearchReturnResults(HANDLE id, void * pvUsersInfo, U_TCHAR_M int k=0;
while (nickfields[k] && !nick) nick=pmUserData->operator [](nickfields[k++]);
if (_tcsicmp(nick, Results.jsr.jid))
- _sntprintf(buff,SIZEOF(buff),_T("%s (%s)"),nick, Results.jsr.jid);
+ mir_sntprintf(buff, SIZEOF(buff), _T("%s (%s)"), nick, Results.jsr.jid);
else
_tcsncpy(buff, nick, SIZEOF(buff));
Results.jsr.hdr.nick = nick ? buff : NULL;
@@ -378,7 +378,7 @@ void CJabberProto::OnIqResultAdvancedSearch(HXML iqNode) description = xmlGetText(errorNode);
}
- _sntprintf(buff,SIZEOF(buff),TranslateT("Error %s %s\r\nTry to specify more detailed"),code ? code : _T(""),description?description:_T(""));
+ mir_sntprintf(buff, SIZEOF(buff), TranslateT("Error %s %s\r\nTry to specify more detailed"), code ? code : _T(""), description ? description : _T(""));
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)id, 0);
if (searchHandleDlg)
SetDlgItemText(searchHandleDlg,IDC_INSTRUCTIONS,buff);
@@ -486,20 +486,20 @@ void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, BOOL deleteLastFr char key[30];
//search in recent
for (int i=0; i<10; i++) {
- sprintf(key,"RecentlySearched_%d",i);
+ mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i);
if ( !getTString(key, &dbv)) {
if ( !_tcsicmp(szAddr, dbv.ptszVal)) {
db_free(&dbv);
for (int j=i; j<10; j++) {
- sprintf(key, "RecentlySearched_%d", j+1);
+ mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j + 1);
if ( !getTString(key, &dbv)) {
- sprintf(key,"RecentlySearched_%d",j);
+ mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j);
setTString(NULL,key,dbv.ptszVal);
db_free(&dbv);
}
else {
if (deleteLastFromDB) {
- sprintf(key,"RecentlySearched_%d",j);
+ mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j);
delSetting(NULL,key);
}
break;
@@ -515,14 +515,14 @@ void CJabberProto::SearchAddToRecent(const TCHAR *szAddr, HWND hwndDialog) char key[30];
SearchDeleteFromRecent(szAddr);
for (int j=9; j > 0; j--) {
- sprintf(key, "RecentlySearched_%d", j-1);
+ mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j - 1);
if ( !getTString(key, &dbv)) {
- sprintf(key,"RecentlySearched_%d",j);
+ mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j);
setTString(NULL,key,dbv.ptszVal);
db_free(&dbv);
} }
- sprintf(key, "RecentlySearched_%d", 0);
+ mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", 0);
setTString(key, szAddr);
if (hwndDialog)
JabberSearchAddUrlToRecentCombo(hwndDialog, szAddr);
@@ -555,7 +555,7 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR DBVARIANT dbv;
for (i=0; i < 10; i++) {
char key[30];
- sprintf(key,"RecentlySearched_%d",i);
+ mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i);
if ( !dat->ppro->getTString(key, &dbv)) {
JabberSearchAddUrlToRecentCombo(hwndDlg, dbv.ptszVal);
db_free(&dbv);
diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index 251e875fd3..72068c9d95 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -177,7 +177,7 @@ char* TMD5Auth::getChallenge(const TCHAR *challenge) mir_md5_state_t ctx;
CallService(MS_UTILS_GETRANDOM, sizeof(digest), (LPARAM)digest);
- sprintf(cnonce, "%08x%08x%08x%08x", htonl(digest[0]), htonl(digest[1]), htonl(digest[2]), htonl(digest[3]));
+ mir_snprintf(cnonce, SIZEOF(cnonce), "%08x%08x%08x%08x", htonl(digest[0]), htonl(digest[1]), htonl(digest[2]), htonl(digest[3]));
ptrA uname( mir_utf8encodeT(info->username)),
passw( mir_utf8encodeT(info->password)),
@@ -205,15 +205,15 @@ char* TMD5Auth::getChallenge(const TCHAR *challenge) mir_md5_finish(&ctx, (BYTE*)hash2);
mir_md5_init(&ctx);
- sprintf(tmpBuf, "%08x%08x%08x%08x", htonl(hash1[0]), htonl(hash1[1]), htonl(hash1[2]), htonl(hash1[3]));
+ mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "%08x%08x%08x%08x", htonl(hash1[0]), htonl(hash1[1]), htonl(hash1[2]), htonl(hash1[3]));
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)strlen(tmpBuf));
mir_md5_append(&ctx, (BYTE*)":", 1);
mir_md5_append(&ctx, (BYTE*)nonce, (int)strlen(nonce));
- sprintf(tmpBuf, ":%08d:", iCallCount);
+ mir_snprintf(tmpBuf, SIZEOF(tmpBuf), ":%08d:", iCallCount);
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)strlen(tmpBuf));
mir_md5_append(&ctx, (BYTE*)cnonce, (int)strlen(cnonce));
mir_md5_append(&ctx, (BYTE*)":auth:", 6);
- sprintf(tmpBuf, "%08x%08x%08x%08x", htonl(hash2[0]), htonl(hash2[1]), htonl(hash2[2]), htonl(hash2[3]));
+ mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "%08x%08x%08x%08x", htonl(hash2[0]), htonl(hash2[1]), htonl(hash2[2]), htonl(hash2[3]));
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)strlen(tmpBuf));
mir_md5_finish(&ctx, (BYTE*)digest);
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index 60978c69f3..6dd9166276 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -325,7 +325,7 @@ INT_PTR __cdecl CJabberProto::JabberSetAvatar(WPARAM, LPARAM lParam) char buf[MIR_SHA1_HASH_SIZE*2+1];
for (int i=0; i<MIR_SHA1_HASH_SIZE; i++)
- sprintf(buf+(i<<1), "%02x", digest[i]);
+ mir_snprintf(buf + (i << 1), 2, "%02x", digest[i]);
m_options.AvatarType = ProtoGetBufferFormat(pResult);
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 2a319cd7ea..f9488f09d9 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -350,7 +350,7 @@ char* __stdcall JabberSha1(char* str) char *result = (char*)mir_alloc(41);
if (result)
for (int i=0; i < 20; i++)
- sprintf(result+(i<<1), "%02x", digest[i]);
+ mir_snprintf(result + (i << 1), 2, "%02x", digest[i]);
return result;
}
@@ -442,13 +442,14 @@ TCHAR* __stdcall JabberHttpUrlEncode(const TCHAR *str) TCHAR *p, *q, *res;
if (str == NULL) return NULL;
- res = (TCHAR*) mir_alloc(3*_tcslen(str) + 1);
+ size_t size = 3 * _tcslen(str) + 1;
+ res = (TCHAR *)mir_alloc(size);
for (p = (TCHAR*)str, q = res; *p!='\0'; p++,q++) {
if ((*p>='A' && *p<='Z') || (*p>='a' && *p<='z') || (*p>='0' && *p<='9') || strchr("$-_.+!*'(),", *p) != NULL) {
*q = *p;
}
else {
- wsprintf(q, _T("%%%02X"), *p);
+ mir_sntprintf(q, size, _T("%%%02X"), *p);
q += 2;
}
}
@@ -886,7 +887,7 @@ void __stdcall JabberStringAppend(char* *str, int *sizeAlloced, const char* fmt, p = *str + len;
va_start(vararg, fmt);
- while (_vsnprintf(p, size, fmt, vararg) == -1) {
+ while (mir_vsnprintf(p, size, fmt, vararg) == -1) {
size += 2048;
(*sizeAlloced) += 2048;
*str = (char*)mir_realloc(*str, *sizeAlloced);
@@ -1651,7 +1652,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) mir_sha1_append(&sha, (mir_sha1_byte_t*)res->pData, res->dataLength);
mir_sha1_finish(&sha, digest);
for (int i=0; i<20; i++)
- sprintf(buffer+(i<<1), "%02x", digest[i]);
+ mir_snprintf(buffer + (i << 1), 2, "%02x", digest[i]);
ptrA cmpsha( getStringA(AI.hContact, "AvatarSaved"));
if (cmpsha == NULL || strnicmp(cmpsha, buffer, sizeof(buffer))) {
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 08b1e70b13..d916441f3c 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -565,11 +565,11 @@ static INT_PTR CALLBACK EditEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, WORD nFlag;
SetWindowText(hwndDlg, TranslateT("Jabber vCard: Edit Email Address"));
- wsprintfA(idstr, "e-mail%d", dat->id);
+ mir_snprintf(idstr, SIZEOF(idstr), "e-mail%d", dat->id);
if ( !dat->ppro->getString(idstr, &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_EMAIL, dbv.pszVal);
db_free(&dbv);
- wsprintfA(idstr, "e-mailFlag%d", lParam);
+ mir_snprintf(idstr, SIZEOF(idstr), "e-mailFlag%d", lParam);
nFlag = dat->ppro->getWord(idstr, 0);
if (nFlag & JABBER_VCEMAIL_HOME) CheckDlgButton(hwndDlg, IDC_HOME, TRUE);
if (nFlag & JABBER_VCEMAIL_WORK) CheckDlgButton(hwndDlg, IDC_WORK, TRUE);
@@ -631,11 +631,11 @@ static INT_PTR CALLBACK EditPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, WORD nFlag;
SetWindowText(hwndDlg, TranslateT("Jabber vCard: Edit Phone Number"));
- wsprintfA(idstr, "Phone%d", dat->id);
+ mir_snprintf(idstr, SIZEOF(idstr), "Phone%d", dat->id);
if ( !dat->ppro->getString(idstr, &dbv)) {
SetDlgItemTextA(hwndDlg, IDC_PHONE, dbv.pszVal);
db_free(&dbv);
- wsprintfA(idstr, "PhoneFlag%d", dat->id);
+ mir_snprintf(idstr, SIZEOF(idstr), "PhoneFlag%d", dat->id);
nFlag = dat->ppro->getWord(idstr, 0);
if (nFlag & JABBER_VCTEL_HOME) CheckDlgButton(hwndDlg, IDC_HOME, TRUE);
if (nFlag & JABBER_VCTEL_WORK) CheckDlgButton(hwndDlg, IDC_WORK, TRUE);
@@ -663,13 +663,13 @@ static INT_PTR CALLBACK EditPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (dat->id < 0) {
for (dat->id=0;;dat->id++) {
- wsprintfA(idstr, "Phone%d", dat->id);
+ mir_snprintf(idstr, SIZEOF(idstr), "Phone%d", dat->id);
if ( dat->ppro->getString(idstr, &dbv)) break;
db_free(&dbv);
}
}
GetDlgItemTextA(hwndDlg, IDC_PHONE, text, SIZEOF(text));
- wsprintfA(idstr, "Phone%d", dat->id);
+ mir_snprintf(idstr, SIZEOF(idstr), "Phone%d", dat->id);
dat->ppro->setString(idstr, text);
nFlag = 0;
if (IsDlgButtonChecked(hwndDlg, IDC_HOME)) nFlag |= JABBER_VCTEL_HOME;
@@ -684,7 +684,7 @@ static INT_PTR CALLBACK EditPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (IsDlgButtonChecked(hwndDlg, IDC_MODEM)) nFlag |= JABBER_VCTEL_MODEM;
if (IsDlgButtonChecked(hwndDlg, IDC_ISDN)) nFlag |= JABBER_VCTEL_ISDN;
if (IsDlgButtonChecked(hwndDlg, IDC_PCS)) nFlag |= JABBER_VCTEL_PCS;
- wsprintfA(idstr, "PhoneFlag%d", dat->id);
+ mir_snprintf(idstr, SIZEOF(idstr), "PhoneFlag%d", dat->id);
dat->ppro->setWord(idstr, nFlag);
}
// fall through
@@ -746,9 +746,9 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP lvi.iSubItem = 0;
lvi.iItem = 0;
for (i=0;;i++) {
- wsprintfA(idstr, "e-mail%d", i);
+ mir_snprintf(idstr, SIZEOF(idstr), "e-mail%d", i);
if ( ppro->getTString(idstr, &dbv)) break;
- wsprintf(number, _T("%d"), i+1);
+ mir_sntprintf(number, SIZEOF(number), _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
@@ -765,9 +765,9 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP lvi.iSubItem = 0;
lvi.iItem = 0;
for (i=0;;i++) {
- wsprintfA(idstr, "Phone%d", i);
+ mir_snprintf(idstr, SIZEOF(idstr), "Phone%d", i);
if ( ppro->getTString(idstr, &dbv)) break;
- wsprintf(number, _T("%d"), i+1);
+ mir_sntprintf(number, SIZEOF(number), _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
@@ -872,19 +872,19 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP for (i=lvi.lParam;;i++) {
WORD nFlag;
- wsprintfA(idstr, szIdTemplate, i+1);
+ mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i + 1);
if (ppro->getString(idstr, &dbv)) break;
- wsprintfA(idstr,szIdTemplate,i);
+ mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i);
ppro->setString(idstr, dbv.pszVal);
- wsprintfA(idstr, szFlagTemplate, i+1);
+ mir_snprintf(idstr, SIZEOF(idstr), szFlagTemplate, i + 1);
db_free(&dbv);
nFlag = ppro->getWord(idstr, 0);
- wsprintfA(idstr, szFlagTemplate, i);
+ mir_snprintf(idstr, SIZEOF(idstr), szFlagTemplate, i);
ppro->setWord(idstr, nFlag);
}
- wsprintfA(idstr, szIdTemplate, i);
+ mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, i);
ppro->delSetting(idstr);
- wsprintfA(idstr, szFlagTemplate, i);
+ mir_snprintf(idstr, SIZEOF(idstr), szFlagTemplate, i);
ppro->delSetting(idstr);
SendMessage(hwndDlg, M_REMAKELISTS, 0, 0);
ppro->m_vCardUpdates |= (1UL<<iPageId);
@@ -1057,7 +1057,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) AppendVcardFromDB(v, "GENDER", "GenderString");
for (i=0;;i++) {
- wsprintfA(idstr, "e-mail%d", i);
+ mir_snprintf(idstr, SIZEOF(idstr), "e-mail%d", i);
if ( getTString(idstr, &dbv))
break;
@@ -1065,7 +1065,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) db_free(&dbv);
AppendVcardFromDB(e, "USERID", idstr);
- wsprintfA(idstr, "e-mailFlag%d", i);
+ mir_snprintf(idstr, SIZEOF(idstr), "e-mailFlag%d", i);
nFlag = getWord(idstr, 0);
if (nFlag & JABBER_VCEMAIL_HOME) e << XCHILD(_T("HOME"));
if (nFlag & JABBER_VCEMAIL_WORK) e << XCHILD(_T("WORK"));
@@ -1105,14 +1105,14 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) AppendVcardFromDB(v, "DESC", "About");
for (i=0;;i++) {
- wsprintfA(idstr, "Phone%d", i);
+ mir_snprintf(idstr, SIZEOF(idstr), "Phone%d", i);
if ( getTString(idstr, &dbv)) break;
db_free(&dbv);
n = v << XCHILD(_T("TEL"));
AppendVcardFromDB(n, "NUMBER", idstr);
- wsprintfA(idstr, "PhoneFlag%d", i);
+ mir_snprintf(idstr, SIZEOF(idstr), "PhoneFlag%d", i);
nFlag = getWord(idstr, 0);
if (nFlag & JABBER_VCTEL_HOME) n << XCHILD(_T("HOME"));
if (nFlag & JABBER_VCTEL_WORK) n << XCHILD(_T("WORK"));
@@ -1179,7 +1179,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) char buf[MIR_SHA1_HASH_SIZE*2+1];
for (int j=0; j<MIR_SHA1_HASH_SIZE; j++)
- sprintf(buf+(j<<1), "%02x", digest[j]);
+ mir_snprintf(buf + (j << 1), 2, "%02x", digest[j]);
m_options.AvatarType = ProtoGetBufferFormat(buffer);
diff --git a/protocols/MSN/src/msn_mime.cpp b/protocols/MSN/src/msn_mime.cpp index e511d2017b..2549927254 100644 --- a/protocols/MSN/src/msn_mime.cpp +++ b/protocols/MSN/src/msn_mime.cpp @@ -170,7 +170,7 @@ char* MimeHeaders::writeToBuffer(char* dest) *dest = 0;
}
else
- dest += sprintf(dest, "%s: %s\r\n", H.name, H.value);
+ dest += sprintf(dest, "%s: %s\r\n", H.name, H.value); //!!!!!!!!!!!!
}
if (mCount)
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index b765ff5e59..8f2f26401e 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -126,7 +126,7 @@ void CMsnProto::MSN_DebugLog(const char *fmt, ...) va_list vararg;
va_start(vararg, fmt);
- if (_vsnprintf(str, sizeof(str), fmt, vararg) != 0)
+ if (mir_vsnprintf(str, sizeof(str), fmt, vararg) != 0)
{
str[sizeof(str)-1] = 0;
CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, (LPARAM)str);
@@ -714,7 +714,7 @@ int ThreadData::sendPacket(const char* cmd, const char* fmt,...) va_start(vararg, fmt);
int paramStart = mir_snprintf(str, strsize, "%s %d ", cmd, thisTrid);
- while (_vsnprintf(str+paramStart, strsize-paramStart-3, fmt, vararg) == -1)
+ while (mir_vsnprintf(str+paramStart, strsize-paramStart-3, fmt, vararg) == -1)
str = (char*)mir_realloc(str, strsize += 512);
str[strsize-3] = 0;
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index a67a378f16..03f0b74a16 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -326,7 +326,7 @@ void CMsnProto::p2p_sendMsg(ThreadData* info, const char *wlid, unsigned appId, // add message header
p += msgType == 1 ? sizeof(unsigned) :
- sprintf(p, hdrdata.isV2Hdr() ? sttP2PheaderV2 : sttP2Pheader, wlid, MyOptions.szEmail, MyOptions.szMachineGuidP2P);
+ sprintf(p, hdrdata.isV2Hdr() ? sttP2PheaderV2 : sttP2Pheader, wlid, MyOptions.szEmail, MyOptions.szMachineGuidP2P); //!!!!!!!!!!!
if (hdrdata.isV2Hdr())
{
@@ -524,14 +524,14 @@ void CMsnProto::p2p_sendSlp(int iKind, filetransfer *ft, MimeHeaders &pHeaders, switch (iKind)
{
- case -3: p += sprintf(p, "ACK MSNMSGR:%s MSNSLP/1.0", wlid); break;
- case -2: p += sprintf(p, "INVITE MSNMSGR:%s MSNSLP/1.0", wlid); break;
- case -1: p += sprintf(p, "BYE MSNMSGR:%s MSNSLP/1.0", wlid); break;
- case 200: p += sprintf(p, "MSNSLP/1.0 200 OK"); break;
- case 481: p += sprintf(p, "MSNSLP/1.0 481 No Such Call"); break;
- case 500: p += sprintf(p, "MSNSLP/1.0 500 Internal Error"); break;
- case 603: p += sprintf(p, "MSNSLP/1.0 603 DECLINE"); break;
- case 1603: p += sprintf(p, "MSNSLP/1.0 603 Decline"); break;
+ case -3: p += sprintf(p, "ACK MSNMSGR:%s MSNSLP/1.0", wlid); break; //!!!!!!!!!!!!!!!!!!
+ case -2: p += sprintf(p, "INVITE MSNMSGR:%s MSNSLP/1.0", wlid); break; //!!!!!!!!!!!!!!!!!!
+ case -1: p += sprintf(p, "BYE MSNMSGR:%s MSNSLP/1.0", wlid); break; //!!!!!!!!!!!!!!!!!!
+ case 200: p += sprintf(p, "MSNSLP/1.0 200 OK"); break; //!!!!!!!!!!!!!!!!!!
+ case 481: p += sprintf(p, "MSNSLP/1.0 481 No Such Call"); break; //!!!!!!!!!!!!!!!!!!
+ case 500: p += sprintf(p, "MSNSLP/1.0 500 Internal Error"); break; //!!!!!!!!!!!!!!!!!!
+ case 603: p += sprintf(p, "MSNSLP/1.0 603 DECLINE"); break; //!!!!!!!!!!!!!!!!!!
+ case 1603: p += sprintf(p, "MSNSLP/1.0 603 Decline"); break; //!!!!!!!!!!!!!!!!!!
default: return;
}
@@ -547,7 +547,7 @@ void CMsnProto::p2p_sendSlp(int iKind, filetransfer *ft, MimeHeaders &pHeaders, "\r\nTo: <msnmsgr:%s>\r\n"
"From: <msnmsgr:%s;%s>\r\n"
"Via: MSNSLP/1.0/TLP ;branch=%s\r\n",
- wlid, MyOptions.szEmail, MyOptions.szMachineGuidP2P, ft->p2p_branch);
+ wlid, MyOptions.szEmail, MyOptions.szMachineGuidP2P, ft->p2p_branch); //!!!!!!!!!!!!!!!!!!
}
else
{
@@ -555,7 +555,7 @@ void CMsnProto::p2p_sendSlp(int iKind, filetransfer *ft, MimeHeaders &pHeaders, "\r\nTo: <msnmsgr:%s>\r\n"
"From: <msnmsgr:%s>\r\n"
"Via: MSNSLP/1.0/TLP ;branch=%s\r\n",
- wlid, MyOptions.szEmail, ft->p2p_branch);
+ wlid, MyOptions.szEmail, ft->p2p_branch); //!!!!!!!!!!!!!!!!!!
}
p = pHeaders.writeToBuffer(p);
@@ -901,7 +901,7 @@ LONG CMsnProto::p2p_sendPortion(filetransfer* ft, ThreadData* T, bool isV2) // Fill data size for direct transfer
if (T->mType != SERVER_P2P_DIRECT)
- p += sprintf(p, isV2 ? sttP2PheaderV2 : sttP2Pheader, ft->p2p_dest, MyOptions.szEmail, MyOptions.szMachineGuidP2P);
+ p += sprintf(p, isV2 ? sttP2PheaderV2 : sttP2Pheader, ft->p2p_dest, MyOptions.szEmail, MyOptions.szMachineGuidP2P); //!!!!!!!!!!!!!!!!!!
else
p += sizeof(unsigned);
diff --git a/protocols/Tlen/src/jabber_iqid.cpp b/protocols/Tlen/src/jabber_iqid.cpp index 4e39b0fe06..3a6cb87ec5 100644 --- a/protocols/Tlen/src/jabber_iqid.cpp +++ b/protocols/Tlen/src/jabber_iqid.cpp @@ -54,7 +54,7 @@ void JabberIqResultAuth(TlenProtocol *proto, XmlNode *iqNode) char text[128];
JabberSend(proto, "</s>");
- _snprintf(text, sizeof(text), "%s %s@%s.", TranslateT("Authentication failed for"), proto->threadData->username, proto->threadData->server);
+ mir_snprintf(text, sizeof(text), "%s %s@%s.", TranslateT("Authentication failed for"), proto->threadData->username, proto->threadData->server);
MessageBoxA(NULL, text, Translate("Tlen Authentication"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
proto->threadData = NULL; // To disallow auto reconnect
@@ -257,9 +257,9 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) if ((jid=JabberXmlGetAttrValue(itemNode, "jid")) != NULL) {
if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) return;
if (strchr(jid, '@') != NULL) {
- sprintf(text, "%s", jid);
+ mir_snprintf(text, SIZEOF(text), "%s", jid);
} else {
- sprintf(text, "%s@%s", jid, dbv.pszVal); // Add @tlen.pl
+ mir_snprintf(text, SIZEOF(text), "%s@%s", jid, dbv.pszVal); // Add @tlen.pl
}
db_free(&dbv);
if ((hContact=JabberHContactFromJID(proto, text)) == NULL) {
@@ -419,9 +419,9 @@ void JabberIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) if (!strcmp(itemNode->name, "item")) {
if ((jid=JabberXmlGetAttrValue(itemNode, "jid")) != NULL) {
if (strchr(jid, '@') != NULL) {
- _snprintf(jsr.jid, sizeof(jsr.jid), "%s", jid);
+ mir_snprintf(jsr.jid, sizeof(jsr.jid), "%s", jid);
} else {
- _snprintf(jsr.jid, sizeof(jsr.jid), "%s@%s", jid, dbv.pszVal);
+ mir_snprintf(jsr.jid, sizeof(jsr.jid), "%s@%s", jid, dbv.pszVal);
}
jsr.jid[sizeof(jsr.jid)-1] = '\0';
jsr.hdr.id = mir_a2t(jid);
@@ -467,9 +467,9 @@ void JabberIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) if (proto->searchJID != NULL) {
if (!found) {
if (strchr(proto->searchJID, '@') != NULL) {
- _snprintf(jsr.jid, sizeof(jsr.jid), "%s", proto->searchJID);
+ mir_snprintf(jsr.jid, sizeof(jsr.jid), "%s", proto->searchJID);
} else {
- _snprintf(jsr.jid, sizeof(jsr.jid), "%s@%s", proto->searchJID, dbv.pszVal);
+ mir_snprintf(jsr.jid, sizeof(jsr.jid), "%s@%s", proto->searchJID, dbv.pszVal);
}
jsr.jid[sizeof(jsr.jid)-1] = '\0';
jsr.hdr.nick = mir_tstrdup(TEXT(""));
diff --git a/protocols/Tlen/src/jabber_opt.cpp b/protocols/Tlen/src/jabber_opt.cpp index 7201c3d2b5..ccdb6369d9 100644 --- a/protocols/Tlen/src/jabber_opt.cpp +++ b/protocols/Tlen/src/jabber_opt.cpp @@ -636,7 +636,7 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, } else {
delay=GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE);
}
- _snprintf(title, sizeof(title), Translate("%s mail"), proto->m_szModuleName);
+ mir_snprintf(title, sizeof(title), Translate("%s mail"), proto->m_szModuleName);
MailPopupPreview((DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0),
(DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0),
title,
diff --git a/protocols/Tlen/src/jabber_thread.cpp b/protocols/Tlen/src/jabber_thread.cpp index 67499c7995..ab6130d1c5 100644 --- a/protocols/Tlen/src/jabber_thread.cpp +++ b/protocols/Tlen/src/jabber_thread.cpp @@ -72,7 +72,7 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- sprintf(text, "%s %s", Translate("Enter password for"), (char *) lParam);
+ mir_snprintf(text, SIZEOF(text), "%s %s", Translate("Enter password for"), (char *) lParam);
SetDlgItemTextA(hwndDlg, IDC_JID, text);
return TRUE;
case WM_COMMAND:
@@ -204,7 +204,7 @@ void __cdecl JabberServerThread(ThreadData *info) return;
}
- _snprintf(jidStr, sizeof(jidStr), "%s@%s", info->username, info->server);
+ mir_snprintf(jidStr, sizeof(jidStr), "%s@%s", info->username, info->server);
db_set_s(NULL, info->proto->m_szModuleName, "jid", jidStr);
if (!db_get(NULL, info->proto->m_szModuleName, "ManualHost", &dbv)) {
@@ -401,7 +401,7 @@ static void TlenSendAuth(TlenProtocol *proto) { char *str;
char text[128];
str = TlenPasswordHash(proto->threadData->password);
- sprintf(text, "%s%s", proto->threadData->streamId, str);
+ mir_snprintf(text, SIZEOF(text), "%s%s", proto->threadData->streamId, str);
mir_free(str);
str = JabberSha1(text);
if ((p=JabberTextEncode(proto->threadData->username)) != NULL) {
@@ -624,8 +624,9 @@ static void JabberProcessMessage(XmlNode *node, ThreadData *info) if ((bodyNode=JabberXmlGetChild(node, "body")) != NULL) {
if (bodyNode->text != NULL) {
if ((subjectNode=JabberXmlGetChild(node, "subject")) != NULL && subjectNode->text != NULL && subjectNode->text[0] != '\0') {
- p = (char *) mir_alloc(strlen(subjectNode->text)+strlen(bodyNode->text)+5);
- sprintf(p, "%s\r\n%s", subjectNode->text, bodyNode->text);
+ int size = strlen(subjectNode->text)+strlen(bodyNode->text)+5;
+ p = (char *)mir_alloc(size);
+ mir_snprintf(p, size, "%s\r\n%s", subjectNode->text, bodyNode->text);
localMessage = JabberTextDecode(p);
mir_free(p);
} else {
@@ -962,7 +963,7 @@ static void TlenProcessW(XmlNode *node, ThreadData *info) if ((f=JabberXmlGetAttrValue(node, "f")) != NULL) {
char webContactName[128];
- sprintf(webContactName, Translate("%s Web Messages"), info->proto->m_szModuleName);
+ mir_snprintf(webContactName, SIZEOF(webContactName), Translate("%s Web Messages"), info->proto->m_szModuleName);
if ((hContact=JabberHContactFromJID(info->proto, webContactName)) == NULL) {
hContact = JabberDBCreateContact(info->proto, webContactName, webContactName, TRUE);
}
@@ -1260,7 +1261,7 @@ static void TlenProcessP(XmlNode *node, ThreadData *info) } else {
n = mir_strdup(Translate("Private conference"));// JabberNickFromJID(f);
}
- sprintf(jid, "%s/%s", f, info->username);
+ mir_snprintf(jid, SIZEOF(jid), "%s/%s", f, info->username);
// if (!db_get(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
// always real username
// sprintf(jid, "%s/%s", f, dbv.pszVal);
@@ -1290,9 +1291,9 @@ static void TlenProcessV(XmlNode *node, ThreadData *info) if ((from=JabberXmlGetAttrValue(node, "f")) != NULL) {
if (strchr(from, '@') == NULL) {
- _snprintf(jid, sizeof(jid), "%s@%s", from, info->server);
+ mir_snprintf(jid, sizeof(jid), "%s@%s", from, info->server);
} else {
- _snprintf(jid, sizeof(jid), "%s", from);
+ mir_snprintf(jid, sizeof(jid), "%s", from);
}
if ((e=JabberXmlGetAttrValue(node, "e")) != NULL) {
if (!strcmp(e, "1")) {
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index aeb79f6927..9e1f4bc1d4 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -242,7 +242,7 @@ INT_PTR TlenMenuHandleInbox(void *ptr, LPARAM wParam, LPARAM lParam) }
mir_free(login);
mir_free(password);
- _snprintf(szFileName, sizeof(szFileName), "http://poczta.o2.pl/login.html?sid=%s", cookie);
+ mir_snprintf(szFileName, sizeof(szFileName), "http://poczta.o2.pl/login.html?sid=%s", cookie);
CallService(MS_UTILS_OPENURL, (WPARAM) 1, (LPARAM) szFileName);
return 0;
}
@@ -258,11 +258,11 @@ int TlenOnModulesLoaded(void *ptr, WPARAM wParam, LPARAM lParam) db_set_w(hContact, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE);
TlenMUCInit(proto);
- sprintf(str, "%s", LPGEN("Incoming mail"));
+ mir_snprintf(str, SIZEOF(str), "%s", LPGEN("Incoming mail"));
SkinAddNewSoundEx("TlenMailNotify", proto->m_szModuleName, str);
- sprintf(str, "%s", LPGEN("Alert"));
+ mir_snprintf(str, SIZEOF(str), "%s", LPGEN("Alert"));
SkinAddNewSoundEx("TlenAlertNotify", proto->m_szModuleName, str);
- sprintf(str, "%s", LPGEN("Voice chat"));
+ mir_snprintf(str, SIZEOF(str), "%s", LPGEN("Voice chat"));
SkinAddNewSoundEx("TlenVoiceNotify", proto->m_szModuleName, str);
HookEventObj_Ex(ME_USERINFO_INITIALISE, proto, TlenUserInfoInit);
@@ -305,7 +305,7 @@ static void initMenuItems(TlenProtocol *proto) proto->hMenuChats = NULL;
if (ServiceExists(MS_MUCC_NEW_WINDOW))
{
- sprintf(text, "%s/MainMenuChats", proto->m_szModuleName);
+ mir_snprintf(text, SIZEOF(text), "%s/MainMenuChats", proto->m_szModuleName);
CreateServiceFunction_Ex(text, proto, TlenMUCMenuHandleChats);
mi.pszName = LPGEN("Tlen Chats");
mi.position = 2000050001;
@@ -316,7 +316,7 @@ static void initMenuItems(TlenProtocol *proto) }
// "Multi-User Conference"
- sprintf(text, "%s/MainMenuMUC", proto->m_szModuleName);
+ mir_snprintf(text, SIZEOF(text), "%s/MainMenuMUC", proto->m_szModuleName);
CreateServiceFunction_Ex(text, proto, TlenMUCMenuHandleMUC);
mi.pszName = LPGEN("Multi-User Conference");
mi.position = 2000050002;
@@ -325,7 +325,7 @@ static void initMenuItems(TlenProtocol *proto) proto->hMenuMUC = Menu_AddMainMenuItem(&mi);
Menu_ModifyItem(proto->hMenuMUC, &clmi);
- sprintf(text, "%s/MainMenuInbox", proto->m_szModuleName);
+ mir_snprintf(text, SIZEOF(text), "%s/MainMenuInbox", proto->m_szModuleName);
CreateServiceFunction_Ex(text, proto, TlenMenuHandleInbox);
mi.pszName = LPGEN("Tlen Mail");
mi.position = 2000050003;
@@ -336,7 +336,7 @@ static void initMenuItems(TlenProtocol *proto) mi.hParentMenu = NULL;
// "Send picture"
- sprintf(text, "%s/SendPicture", proto->m_szModuleName);
+ mir_snprintf(text, SIZEOF(text), "%s/SendPicture", proto->m_szModuleName);
CreateServiceFunction_Ex(text, proto, TlenContactMenuHandleSendPicture);
mi.pszName = LPGEN("Send picture");
mi.position = -2000019030;
@@ -345,7 +345,7 @@ static void initMenuItems(TlenProtocol *proto) proto->hMenuPicture = Menu_AddContactMenuItem(&mi);
// "Invite to MUC"
- sprintf(text, "%s/ContactMenuMUC", proto->m_szModuleName);
+ mir_snprintf(text, SIZEOF(text), "%s/ContactMenuMUC", proto->m_szModuleName);
CreateServiceFunction_Ex(text, proto, TlenMUCContactMenuHandleMUC);
mi.pszName = LPGEN("Multi-User Conference");
mi.position = -2000019020;
@@ -354,7 +354,7 @@ static void initMenuItems(TlenProtocol *proto) proto->hMenuContactMUC = Menu_AddContactMenuItem(&mi);
// "Invite to voice chat"
- sprintf(text, "%s/ContactMenuVoice", proto->m_szModuleName);
+ mir_snprintf(text, SIZEOF(text), "%s/ContactMenuVoice", proto->m_szModuleName);
CreateServiceFunction_Ex(text, proto, TlenVoiceContactMenuHandleVoice);
mi.pszName = LPGEN("Voice Chat");
mi.position = -2000019010;
@@ -363,7 +363,7 @@ static void initMenuItems(TlenProtocol *proto) proto->hMenuContactVoice = Menu_AddContactMenuItem(&mi);
// "Request authorization"
- sprintf(text, "%s/RequestAuth", proto->m_szModuleName);
+ mir_snprintf(text, SIZEOF(text), "%s/RequestAuth", proto->m_szModuleName);
CreateServiceFunction_Ex(text, proto, TlenContactMenuHandleRequestAuth);
mi.pszName = LPGEN("Request authorization");
mi.position = -2000001001;
@@ -372,7 +372,7 @@ static void initMenuItems(TlenProtocol *proto) proto->hMenuContactRequestAuth = Menu_AddContactMenuItem(&mi);
// "Grant authorization"
- sprintf(text, "%s/GrantAuth", proto->m_szModuleName);
+ mir_snprintf(text, SIZEOF(text), "%s/GrantAuth", proto->m_szModuleName);
CreateServiceFunction_Ex(text, proto, TlenContactMenuHandleGrantAuth);
mi.pszName = LPGEN("Grant authorization");
mi.position = -2000001000;
diff --git a/protocols/Tlen/src/tlen_muc.cpp b/protocols/Tlen/src/tlen_muc.cpp index 9498f12ead..507a4fa6cc 100644 --- a/protocols/Tlen/src/tlen_muc.cpp +++ b/protocols/Tlen/src/tlen_muc.cpp @@ -73,7 +73,7 @@ static char *getDisplayName(TlenProtocol *proto, const char *id) HANDLE hContact;
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- _snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
+ mir_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
db_free(&dbv);
if (((hContact=JabberHContactFromJID(proto, jid)) != NULL) || !strcmp(id, proto->threadData->username)) {
ZeroMemory(&ci, sizeof(ci));
@@ -248,7 +248,7 @@ static int TlenMUCHandleEvent(void *ptr, WPARAM wParam, LPARAM lParam) if (!isSelf(proto, mucce->pszID, nick)) {
if (nick[0] == '~' || item->nick != NULL) {
char str[256];
- sprintf(str, "%s/%s", mucce->pszID, nick);
+ mir_snprintf(str, SIZEOF(str), "%s/%s", mucce->pszID, nick);
hContact = JabberDBCreateContact(proto, str, nick, TRUE); //(char *)mucce->pszUID
db_set_b(hContact, proto->m_szModuleName, "bChat", TRUE);
CallService(MS_MSG_SENDMESSAGE, (WPARAM) hContact, (LPARAM) NULL);
@@ -256,7 +256,7 @@ static int TlenMUCHandleEvent(void *ptr, WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
char str[512];
- _snprintf(str, sizeof(str), "%s@%s", nick, dbv.pszVal);
+ mir_snprintf(str, sizeof(str), "%s@%s", nick, dbv.pszVal);
db_free(&dbv);
hContact = JabberDBCreateContact(proto, str, nick, TRUE);
CallService(MS_MSG_SENDMESSAGE, (WPARAM) hContact, (LPARAM) NULL);
@@ -289,7 +289,7 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r char jid[256];
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- _snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
+ mir_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
db_free(&dbv);
} else {
strcpy(jid, from);
@@ -301,7 +301,7 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r JABBER_LIST_ITEM *item;
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- _snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
+ mir_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
db_free(&dbv);
} else {
strcpy(jid, from);
@@ -361,7 +361,7 @@ int TlenMUCRecvPresence(TlenProtocol *proto, const char *from, int status, int f if (flags & USER_FLAGS_REGISTERED) mucce.dwFlags |= MUCC_EF_USER_REGISTERED;
if (status == ID_STATUS_OFFLINE && mucce.bIsMe && kick != NULL) {
mucce.iType = MUCC_EVENT_ERROR;
- sprintf(str, Translate("You have been kicked. Reason: %s "), kick);
+ mir_snprintf(str, SIZEOF(str), Translate("You have been kicked. Reason: %s "), kick);
mucce.pszText = str;
}
CallService(MS_MUCC_EVENT, 0, (LPARAM) &mucce);
@@ -458,45 +458,45 @@ int TlenMUCRecvError(TlenProtocol *proto, const char *from, XmlNode *errorNode) errCode = atoi(JabberXmlGetAttrValue(errorNode, "code"));
switch (errCode) {
case 403:
- sprintf(str, Translate("You cannot join this chat room, because you are banned."));
+ mir_snprintf(str, SIZEOF(str), Translate("You cannot join this chat room, because you are banned."));
break;
case 404:
- sprintf(str, Translate("Chat room not found."));
+ mir_snprintf(str, SIZEOF(str), Translate("Chat room not found."));
break;
case 407:
- sprintf(str, Translate("This is a private chat room and you are not one of the members."));
+ mir_snprintf(str, SIZEOF(str), Translate("This is a private chat room and you are not one of the members."));
break;
case 408:
- sprintf(str, Translate("You cannot send any message unless you join this chat room."));
+ mir_snprintf(str, SIZEOF(str), Translate("You cannot send any message unless you join this chat room."));
break;
case 410:
- sprintf(str, Translate("Chat room with already created."));
+ mir_snprintf(str, SIZEOF(str), Translate("Chat room with already created."));
break;
case 411:
- sprintf(str, Translate("Nickname '%s' is already registered."),
+ mir_snprintf(str, SIZEOF(str), Translate("Nickname '%s' is already registered."),
JabberXmlGetAttrValue(errorNode, "n"));
break;
case 412:
- sprintf(str, Translate("Nickname already in use, please try another one. Hint: '%s' is free."),
+ mir_snprintf(str, SIZEOF(str), Translate("Nickname already in use, please try another one. Hint: '%s' is free."),
JabberXmlGetAttrValue(errorNode, "free"));
break;
case 413:
- sprintf(str, Translate("You cannot register more than %s nicknames."),
+ mir_snprintf(str, SIZEOF(str), Translate("You cannot register more than %s nicknames."),
JabberXmlGetAttrValue(errorNode, "num"));
break;
case 414:
- sprintf(str, Translate("You cannot create more than %s chat rooms."),
+ mir_snprintf(str, SIZEOF(str), Translate("You cannot create more than %s chat rooms."),
JabberXmlGetAttrValue(errorNode, "num"));
break;
case 415:
- sprintf(str, Translate("You cannot join more than %s chat rooms."),
+ mir_snprintf(str, SIZEOF(str), Translate("You cannot join more than %s chat rooms."),
JabberXmlGetAttrValue(errorNode, "num"));
break;
case 601:
- sprintf(str, Translate("Anonymous nicknames are not allowed in this chat room."));
+ mir_snprintf(str, SIZEOF(str), Translate("Anonymous nicknames are not allowed in this chat room."));
break;
default:
- sprintf(str, Translate("Unknown error code : %d"), errCode);
+ mir_snprintf(str, SIZEOF(str), Translate("Unknown error code : %d"), errCode);
break;
}
mucce.pszText = str;
@@ -549,9 +549,9 @@ static int TlenMUCSendPresence(TlenProtocol *proto, const char *roomID, const ch return 1;
}
if (nick != NULL) {
- _snprintf(str, sizeof(str), "%s/%s", roomID, nick);
+ mir_snprintf(str, sizeof(str), "%s/%s", roomID, nick);
} else {
- _snprintf(str, sizeof(str), "%s", roomID);
+ mir_snprintf(str, sizeof(str), "%s", roomID);
}
if ((jid = JabberTextEncode(str)) != NULL) {
switch (desiredStatus) {
@@ -625,7 +625,7 @@ static int TlenMUCSendQuery(TlenProtocol *proto, int type, const char *parent, i if (type == 3) { // find chat room by name
char serialId[32];
JABBER_LIST_ITEM *item;
- sprintf(serialId, JABBER_IQID"%d", JabberSerialNext(proto));
+ mir_snprintf(serialId, SIZEOF(serialId), JABBER_IQID"%d", JabberSerialNext(proto));
item = JabberListAdd(proto, LIST_SEARCH, serialId);
item->roomName = mir_strdup(parent);
JabberSend(proto, "<iq to='c' type='3' n='%s' id='%s'/>", parent, serialId);
@@ -1056,7 +1056,7 @@ INT_PTR TlenMUCContactMenuHandleMUC(void *ptr, LPARAM wParam, LPARAM lParam) if ((hContact=(HANDLE) wParam) != NULL && proto->isOnline) {
if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
char serialId[32];
- sprintf(serialId, JABBER_IQID"%d", JabberSerialNext(proto));
+ mir_snprintf(serialId, SIZEOF(serialId), JABBER_IQID"%d", JabberSerialNext(proto));
item = JabberListAdd(proto, LIST_INVITATIONS, serialId);
item->nick = mir_strdup(dbv.pszVal);
JabberSend(proto, "<p to='c' tp='c' id='%s'/>", serialId);
diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp index 41a5315480..f6d896aa2e 100644 --- a/protocols/Tlen/src/tlen_picture.cpp +++ b/protocols/Tlen/src/tlen_picture.cpp @@ -34,7 +34,7 @@ static void LogPictureMessage(TlenProtocol *proto, const char *jid, const char * {
char message[1024];
const char *msg = isSent ? LPGEN("Image sent file://%s") : LPGEN("Image received file://%s");
- _snprintf(message, sizeof(message), Translate(msg), filename);
+ mir_snprintf(message, sizeof(message), Translate(msg), filename);
TlenLogMessage(proto, JabberHContactFromJID(proto, jid), isSent ? DBEF_SENT : 0, message);
}
@@ -49,7 +49,7 @@ static void TlenPsPostThread(void *ptr) { DWORD ret;
item->ft->s = socket;
item->ft->hFileEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- _snprintf(header, sizeof(header), "<pic auth='%s' t='p' to='%s' size='%d' idt='%s'/>", proto->threadData->username, item->ft->jid, item->ft->fileTotalSize, item->jid);
+ mir_snprintf(header, sizeof(header), "<pic auth='%s' t='p' to='%s' size='%d' idt='%s'/>", proto->threadData->username, item->ft->jid, item->ft->fileTotalSize, item->jid);
JabberWsSend(proto, socket, header, (int)strlen(header));
ret = WaitForSingleObject(item->ft->hFileEvent, 1000 * 60 * 5);
if (ret == WAIT_OBJECT_0) {
@@ -58,7 +58,7 @@ static void TlenPsPostThread(void *ptr) { int i;
char header[512];
char fileBuffer[2048];
- _snprintf(header, sizeof(header), "<pic st='%s' idt='%s'/>", item->ft->iqId, item->jid);
+ mir_snprintf(header, sizeof(header), "<pic st='%s' idt='%s'/>", item->ft->iqId, item->jid);
JabberWsSend(proto, socket, header, (int)strlen(header));
JabberLog(proto, "Sending picture data...");
for (i = item->ft->filesSize[0]; i > 0; ) {
@@ -114,7 +114,7 @@ static void TlenPsGetThread(void *ptr) { char header[512];
char fileBuffer[2048];
JabberXmlInitState(&xmlState);
- _snprintf(header, sizeof(header), "<pic auth='%s' t='g' to='%s' pid='1001' idt='%s' rt='%s'/>", proto->threadData->username, item->ft->jid, item->jid, item->ft->id2);
+ mir_snprintf(header, sizeof(header), "<pic auth='%s' t='g' to='%s' pid='1001' idt='%s' rt='%s'/>", proto->threadData->username, item->ft->jid, item->jid, item->ft->id2);
JabberWsSend(proto, socket, header, (int)strlen(header));
JabberLog(proto, "Reveiving picture data...");
{
@@ -221,7 +221,7 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) { char fileName[MAX_PATH];
char *ext = JabberXmlGetAttrValue(node, "ext");
char *tmpPath = Utils_ReplaceVars( "%miranda_userdata%" );
- int tPathLen = mir_snprintf( fileName, MAX_PATH, "%s\\Images\\Tlen", tmpPath );
+ int tPathLen = mir_snprintf(fileName, MAX_PATH, "%s\\Images\\Tlen", tmpPath);
long oldSize = 0, lSize = atol(size);
DWORD dwAttributes = GetFileAttributesA( fileName );
if ( dwAttributes == 0xffffffff || ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ) == 0 )
@@ -284,7 +284,7 @@ BOOL SendPicture(TlenProtocol *proto, HANDLE hContact) { char idStr[10];
char fileBuffer[2048];
int id = JabberSerialNext(proto);
- _snprintf(idStr, sizeof(idStr), "%d", id);
+ mir_snprintf(idStr, sizeof(idStr), "%d", id);
item = JabberListAdd(proto, LIST_PICTURE, idStr);
item->ft = TlenFileCreateFT(proto, jid);
item->ft->files = (char **) mir_alloc(sizeof(char *));
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index 6dacafe655..ccf735ead5 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -516,7 +516,7 @@ static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft) }
{
char ttt[2048];
- sprintf(ttt, "%s %d %d ", statusTxt, ft->proto->framesAvailableForPlayback, ft->proto->availOverrunValue);
+ mir_snprintf(ttt, SIZEOF(ttt), "%s %d %d ", statusTxt, ft->proto->framesAvailableForPlayback, ft->proto->availOverrunValue);
SetDlgItemTextA(ft->proto->voiceDlgHWND, IDC_STATUS, ttt);
}
TlenP2PPacketFree(packet);
@@ -710,7 +710,7 @@ INT_PTR TlenVoiceContactMenuHandleVoice(void *ptr, LPARAM wParam, LPARAM lParam) if ((hContact=(HANDLE) wParam) != NULL) {
if (!db_get(hContact, proto->m_szModuleName, "jid", &dbv)) {
char serialId[32];
- sprintf(serialId, "%d", JabberSerialNext(proto));
+ mir_snprintf(serialId, SIZEOF(serialId), "%d", JabberSerialNext(proto));
if ((item = JabberListAdd(proto, LIST_VOICE, serialId)) != NULL) {
ft = TlenFileCreateFT(proto, dbv.pszVal);
ft->iqId = mir_strdup(serialId);
@@ -871,7 +871,7 @@ static INT_PTR CALLBACK TlenVoiceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, } else {
fv = 0;
}
- sprintf(str, "%.1f kB/s", fv / 1024);
+ mir_snprintf(str, SIZEOF(str), "%.1f kB/s", fv / 1024);
SetDlgItemTextA(hwndDlg, IDC_BYTESOUT, str);
if (proto->playbackControl != NULL) {
fv = (float)proto->playbackControl->bytesSum;
@@ -879,7 +879,7 @@ static INT_PTR CALLBACK TlenVoiceDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, } else {
fv = 0;
}
- sprintf(str, "%.1f kB/s", fv / 1024);
+ mir_snprintf(str, SIZEOF(str), "%.1f kB/s", fv / 1024);
SetDlgItemTextA(hwndDlg, IDC_BYTESIN, str);
}
break;
@@ -954,7 +954,7 @@ static char *getDisplayName(TlenProtocol *proto, const char *id) HANDLE hContact;
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- _snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
+ mir_snprintf(jid, sizeof(jid), "%s@%s", id, dbv.pszVal);
db_free(&dbv);
if ((hContact=JabberHContactFromJID(proto, jid)) != NULL) {
return mir_strdup((char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0));
@@ -1035,7 +1035,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) char jid[256];
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- _snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
+ mir_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
db_free(&dbv);
} else {
strcpy(jid, from);
@@ -1046,7 +1046,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) char jid[256];
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- _snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
+ mir_snprintf(jid, sizeof(jid), "%s@%s", from, dbv.pszVal);
db_free(&dbv);
} else {
strcpy(jid, from);
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index bf51ca0687..7e63610d23 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -169,7 +169,7 @@ bool TwitterProto::NegotiateConnection() // this looks like bad code.. can someone clean this up please? or confirm that it's ok
wchar_t buf[1024] = {};
- swprintf_s(buf, SIZEOF(buf), AuthorizeUrl.c_str(), oauthToken.c_str());
+ mir_snwprintf(buf, SIZEOF(buf), AuthorizeUrl.c_str(), oauthToken.c_str());
WLOG( _T("**NegotiateConnection - Launching %s"), buf);
ShellExecute(NULL, L"open", buf, NULL, NULL, SW_SHOWNORMAL);
diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp index 2a245455be..ecfc3f9576 100644 --- a/protocols/Twitter/src/utility.cpp +++ b/protocols/Twitter/src/utility.cpp @@ -158,7 +158,7 @@ INT_PTR mir_twitter::LOG(const char *fmt,...) INT_PTR mir_twitter::WLOG(const char* first, const std::wstring last)
{
char *str1 = new char[1024*96];
- sprintf(str1,"%ls", last.c_str());
+ mir_snprintf(str1, 1024*96, "%ls", last.c_str());
return LOG(first, str1);
}
diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index 21d3513e62..ee658f8e77 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -162,7 +162,7 @@ INT_PTR CALLBACK WhatsAppInputBoxProc( HWND hwnd, UINT message, WPARAM wparam, L ib = reinterpret_cast<input_box*>(GetWindowLongPtr(hwnd,GWLP_USERDATA));
size_t len = SendDlgItemMessage(hwnd,IDC_VALUE,WM_GETTEXTLENGTH,0,0);
TCHAR str[4];
- _sntprintf( str, 4, TEXT( "%d" ), ib->limit - len );
+ mir_sntprintf(str, 4, TEXT("%d"), ib->limit - len);
//SetDlgItemText(hwnd,IDC_CHARACTERS,str);
EnableWindow(GetDlgItem( hwnd, IDC_OK ), len > 0);
diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp index ff18001f25..a2923968da 100644 --- a/protocols/Xfire/src/Xfire_base.cpp +++ b/protocols/Xfire/src/Xfire_base.cpp @@ -100,7 +100,7 @@ void Xfire_base::readStringfromDB(char*name,unsigned int dbid,char**to) return;
//wert aus der dblesen
- sprintf_s(temp,128,"%s_%i",name,dbid);
+ mir_snprintf(temp, 128, "%s_%i", name, dbid);
if(!db_get_s(NULL, protocolname, temp,&dbv))
{
//string setzen
@@ -118,7 +118,7 @@ void Xfire_base::readStringfromDB(char*name,unsigned int dbid,int id,char**to) return;
//wert aus der dblesen
- sprintf_s(temp,128,"%s_%i_%i",name,dbid,id);
+ mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
if(!db_get_s(NULL, protocolname, temp,&dbv))
{
//string setzen
@@ -136,7 +136,7 @@ void Xfire_base::readUtf8StringfromDB(char*name,unsigned int dbid,char**to) return;
//wert aus der dblesen
- sprintf_s(temp,128,"%s_%i",name,dbid);
+ mir_snprintf(temp, 128, "%s_%i", name, dbid);
if(!db_get_utf(NULL, protocolname, temp,&dbv))
{
//string setzen
@@ -154,7 +154,7 @@ void Xfire_base::readUtf8StringfromDB(char*name,unsigned int dbid,int id,char**t return;
//wert aus der dblesen
- sprintf_s(temp,128,"%s_%i_%i",name,dbid,id);
+ mir_snprintf(temp, 128, "%s_%i_%i", name, dbid, id);
if(!db_get_utf(NULL, protocolname, temp,&dbv))
{
//string setzen
diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp index 78a616ca04..7e378759ff 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
- sprintf_s(portstr,6,"%d",port);
+ mir_snprintf(portstr,6,"%d",port);
str_replace(mynetworkparams,"%UA_GAME_HOST_NAME%",ip);
str_replace(mynetworkparams,"%UA_GAME_HOST_PORT%",portstr);
@@ -443,7 +443,7 @@ void Xfire_game::createMenuitem(unsigned int pos,int dbid) mi.pszPopupName = Translate("Start game");
mi.pszContactOwner=protocolname;
- sprintf(temp,servicefunction,this->id);
+ mir_snprintf(temp, SIZEOF(temp), servicefunction, this->id);
//wenn die servicefunktion schon exisitert vernichten, hehe
if(ServiceExists(temp))
DestroyServiceFunction(temp);
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index 8025b9a7e0..17891ac6ec 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -428,7 +428,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { for(int i=0;i<claninv->numberOfInv;i++)
{
char msg[XFIRE_MAX_STATIC_STRING_LEN];
- sprintf(msg,Translate("%s (Nickname: %s) has invited you to join the %s clan. Message: %s%sPlease go to the XFireclan-Site to accept the Invitation."),claninv->invitefromusername[i].c_str(),
+ mir_snprintf(msg, SIZEOF(msg), Translate("%s (Nickname: %s) has invited you to join the %s clan. Message: %s%sPlease go to the XFireclan-Site to accept the Invitation."),claninv->invitefromusername[i].c_str(),
claninv->invitefrom[i].c_str(),
claninv->clanname[i].c_str(),
claninv->invitemsg[i].c_str(),"\n");
@@ -648,10 +648,10 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { for(int i=0;i<clan->count;i++)
{
- sprintf(temp,"Clan_%d",clan->clanid[i]);
+ mir_snprintf(temp, SIZEOF(temp), "Clan_%d", clan->clanid[i]);
db_set_s(NULL, protocolname, temp, (char*)clan->name[i].c_str());
- sprintf(temp,"ClanUrl_%d",clan->clanid[i]);
+ mir_snprintf(temp, SIZEOF(temp), "ClanUrl_%d", clan->clanid[i]);
db_set_s(NULL, protocolname, temp, (char*)clan->url[i].c_str());
if(!db_get_b(NULL,protocolname,"noclangroups",0)) {
@@ -691,7 +691,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { //recprotoverchg
if(db_get_w(NULL,protocolname,"recprotoverchg",0)==0)
{
- sprintf_s(temp,255,Translate("The protocol version is too old. Changed current version from %d to %d. You can reconnect now."),client->protocolVersion,version->newversion);
+ mir_snprintf(temp, SIZEOF(temp), Translate("The protocol version is too old. Changed current version from %d to %d. You can reconnect now."),client->protocolVersion,version->newversion);
MSGBOXE(temp);
}
else
@@ -702,7 +702,7 @@ void XFireClient::sendmsg(char*usr,char*cmsg) { }
else
{
- sprintf_s(temp,255,Translate("The protocol version is too old. Cannot detect a new version number."));
+ mir_snprintf(temp, SIZEOF(temp), Translate("The protocol version is too old. Cannot detect a new version number."));
MSGBOXE(temp);
SetStatus(ID_STATUS_OFFLINE,NULL);
}
@@ -867,7 +867,7 @@ INT_PTR UrlCall(WPARAM wparam,LPARAM lparam) { if(strlen(g)>25) //zugroße abschneiden
*(g+25)=0;
- sprintf_s(temp,100,Translate("Do you really want to add %s to your friend list?"),g);
+ mir_snprintf(temp, SIZEOF(temp), Translate("Do you really want to add %s to your friend list?"),g);
//Nutzer vorher fragen, ob er wirklich user xyz adden möchte
if(MessageBoxA(NULL,temp,"Miranda XFire Protocol Plugin",MB_YESNO|MB_ICONQUESTION)==IDYES)
{
@@ -2067,7 +2067,7 @@ static INT_PTR GetIPPort(WPARAM wParam,LPARAM lParam) if(db_get_s((HANDLE)wParam, protocolname, "ServerIP",&dbv))
return 0;
- sprintf(temp,"%s:%d",dbv.pszVal,db_get_w((HANDLE)wParam, protocolname, "Port", -1));
+ mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w((HANDLE)wParam, protocolname, "Port", -1));
db_free(&dbv);
@@ -2100,7 +2100,7 @@ static INT_PTR GetVIPPort(WPARAM wParam,LPARAM lParam) if(db_get_s((HANDLE)wParam, protocolname, "VServerIP",&dbv))
return 0;
- sprintf(temp,"%s:%d",dbv.pszVal,db_get_w((HANDLE)wParam, protocolname, "VPort", -1));
+ mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w((HANDLE)wParam, protocolname, "VPort", -1));
db_free(&dbv);
@@ -2142,7 +2142,7 @@ static INT_PTR GotoXFireClanSite(WPARAM wParam,LPARAM lParam) { char temp[64]="";
int clanid=db_get_dw((HANDLE)wParam, protocolname, "Clan",-1);
- sprintf(temp,"ClanUrl_%d",clanid);
+ mir_snprintf(temp, SIZEOF(temp), "ClanUrl_%d", clanid);
if(db_get_s(NULL, protocolname, temp,&dbv))
return 0;
@@ -2524,7 +2524,7 @@ void gamedetectiont(LPVOID lparam) myClient->Status(statusmessage[1]);
}
- sprintf(temp,Translate("Last game: %s playtime: %.2d:%.2d:%.2d"),currentgame->name,mytm->tm_hour,mytm->tm_min,mytm->tm_sec);
+ mir_snprintf(temp, SIZEOF(temp), Translate("Last game: %s playtime: %.2d:%.2d:%.2d"), currentgame->name, mytm->tm_hour, mytm->tm_min, mytm->tm_sec);
db_set_s(NULL, protocolname, "LastGame", temp);
if(currentgame->noicqstatus!=TRUE&&db_get_b(NULL,protocolname,"autosetstatusmsg",0))
@@ -2582,7 +2582,7 @@ void gamedetectiont(LPVOID lparam) if(packet->ip[3]!=0)
{
- sprintf(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);
+ 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, "ServerIP", temp);
XFireLog("Got IPPort: %s",temp);
}
@@ -2922,7 +2922,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) {
if((unsigned char)gameob->ip[3]!=0) // wenn ip, dann speichern
{
- sprintf(temp,"%d.%d.%d.%d",(unsigned char)gameob->ip[3],(unsigned char)gameob->ip[2],(unsigned char)gameob->ip[1],(unsigned char)gameob->ip[0]);
+ mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d", (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0]);
db_set_s(hContact, protocolname, "VServerIP", temp);
db_set_w(hContact, protocolname, "VPort", (unsigned long)gameob->port);
}
@@ -2962,7 +2962,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) if(db_get_b(NULL,protocolname,"gamepopup",0)==1) {
char temp[256]="";
- sprintf(temp,Translate("%s is playing %s."),
+ mir_snprintf(temp, SIZEOF(temp), Translate("%s is playing %s."),
//ist ein nick gesetzt?
(entry->nick.length()==0?
//nein dann username
@@ -2975,7 +2975,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) {
if((unsigned char)gameob->ip[3]!=0)
{
- sprintf(temp,Translate("%s is playing %s on server %d.%d.%d.%d:%d."),
+ mir_snprintf(temp, SIZEOF(temp), Translate("%s is playing %s on server %d.%d.%d.%d:%d."),
//ist ein nick gesetzt?
(entry->nick.length()==0?
//nein dann username
@@ -3025,7 +3025,7 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) if((unsigned char)gameob->ip[3]!=0)
{
//ip und port in kontakt speichern
- sprintf(temp,"%d.%d.%d.%d",(unsigned char)gameob->ip[3],(unsigned char)gameob->ip[2],(unsigned char)gameob->ip[1],(unsigned char)gameob->ip[0]);
+ mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d", (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0]);
db_set_s(hContact, protocolname, "ServerIP", temp);
db_set_w(hContact, protocolname, "Port", (unsigned long)gameob->port);
@@ -3141,11 +3141,11 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) {
char temp[256];
DBVARIANT dbv;
- sprintf_s(temp,256,"%d",val-1);
+ mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
db_get_s(NULL,"CListGroups",temp,&dbv);
if(dbv.pszVal!=NULL)
{
- sprintf_s(temp,256,"%s\\%s",&dbv.pszVal[1],group);
+ mir_snprintf(temp, SIZEOF(temp), "%s\\%s", &dbv.pszVal[1], group);
db_set_s(entry->hcontact, "CList", "Group", temp);
db_free(&dbv);
}
@@ -3164,11 +3164,11 @@ HANDLE handlingBuddys(BuddyListEntry *entry, int clan,char*group,BOOL dontscan) {
char temp[256];
DBVARIANT dbv;
- sprintf_s(temp,256,"%d",val-1);
+ mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
db_get_s(NULL,"CListGroups",temp,&dbv);
if(dbv.pszVal!=NULL)
{
- sprintf_s(temp,256,"%s\\%s",&dbv.pszVal[1],group);
+ mir_snprintf(temp, SIZEOF(temp), "%s\\%s", &dbv.pszVal[1], group);
db_set_s(entry->hcontact, "CList", "Group", temp);
db_free(&dbv);
}
@@ -3274,11 +3274,11 @@ void CreateGroup(char*grpn,char*field) { {
char temp[255];
DBVARIANT dbv;
- sprintf_s(temp,255,"%d",val-1);
+ mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
db_get_s(NULL,"CListGroups",temp,&dbv);
if(dbv.pszVal!=NULL)
{
- sprintf_s((char*)grp,255,"%s\\%s",&dbv.pszVal[1],(char*)grpn);
+ mir_snprintf((char*)grp, 255, "%s\\%s", &dbv.pszVal[1], (char*)grpn);
db_free(&dbv);
}
else //gruppe existiert nciht mehr, auf root alles legen
@@ -3294,7 +3294,7 @@ void CreateGroup(char*grpn,char*field) { int i=0;
for (i = 0;; i++)
{
- sprintf(temp,"%d",i);
+ mir_snprintf(temp, SIZEOF(temp), "%d", i);
if (db_get_s(NULL, "CListGroups", temp, &dbv))
{
i--;
@@ -3309,7 +3309,7 @@ void CreateGroup(char*grpn,char*field) { strcpy_s(group,255,"D");
strcat_s(group,255,(char*)grp);
group[0]= 1 | GROUPF_EXPANDED;
- sprintf(temp,"%d",i+1);
+ mir_snprintf(temp, SIZEOF(temp), "%d", i + 1);
db_set_s(NULL, "CListGroups", temp, group);
CallServiceSync(MS_CLUI_GROUPADDED, i + 1, 0);
}
@@ -3455,7 +3455,7 @@ INT_PTR RemoveFriend(WPARAM wParam,LPARAM lParam) { if(!db_get_s((HANDLE)wParam, protocolname, "Username",&dbv))
{
- sprintf(temp,Translate("Do you really want delete your friend %s?"),dbv.pszVal);
+ mir_snprintf(temp, SIZEOF(temp), Translate("Do you really want delete your friend %s?"), dbv.pszVal);
if(MessageBoxA(NULL,temp,Translate("Confirm Delete"),MB_YESNO|MB_ICONQUESTION)==IDYES)
{
if(myClient!=NULL)
@@ -3561,7 +3561,7 @@ int doneQuery( WPARAM wParam, LPARAM lParam ) { db_set_s(bud->hcontact, protocolname, "ServerName", gameinfo->name);
db_set_s(bud->hcontact, protocolname, "GameType", gameinfo->gametype);
db_set_s(bud->hcontact, protocolname, "Map", gameinfo->map);
- sprintf(temp,"(%d/%d)",gameinfo->players,gameinfo->maxplayers);
+ mir_snprintf(temp, SIZEOF(temp), "(%d/%d)", gameinfo->players, gameinfo->maxplayers);
db_set_s(bud->hcontact, protocolname, "Players", temp);
db_set_b(bud->hcontact, protocolname, "Passworded", gameinfo->password);
diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp index 96d1557630..2d1fc9ea2e 100644 --- a/protocols/Xfire/src/options.cpp +++ b/protocols/Xfire/src/options.cpp @@ -186,7 +186,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR }
char temp[255]="";
- sprintf(temp,"%d",db_get_b(NULL,protocolname,"protover",0x5b));
+ mir_snprintf(temp, SIZEOF(temp), "%d", db_get_b(NULL, protocolname, "protover", 0x5b));
SetDlgItemText(hwndDlg,IDC_PVER,temp);
EnableWindow(GetDlgItem(hwndDlg,IDC_LASTGAME),FALSE);
@@ -388,11 +388,11 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendDlgItemMessage( hwndDlg, IDC_CLANGROUP, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Root Group>" ));
SendDlgItemMessage( hwndDlg, IDC_FOFGROUP, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Root Group>" ));
- sprintf_s(temp,8,"%d",gruppen_id);
+ mir_snprintf(temp, SIZEOF(temp), "%d", gruppen_id);
while(!db_get_s(NULL,"CListGroups",temp,&dbv))
{
gruppen_id++;
- sprintf_s(temp,8,"%d",gruppen_id);
+ mir_snprintf(temp, SIZEOF(temp), "%d", gruppen_id);
if(dbv.pszVal!=NULL) {
SendDlgItemMessage( hwndDlg, IDC_CLANGROUP, CB_ADDSTRING, 0, (LPARAM)&dbv.pszVal[1]);
@@ -791,7 +791,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR for(int i=0;i<found;i++)
{
//id auslesen
- sprintf_s(temp,XFIRE_MAXSIZEOFGAMENAME,"gameid_%d",i);
+ mir_snprintf(temp, SIZEOF(temp), "gameid_%d", i);
int gameid=db_get_w(NULL,protocolname,temp,0);
//spielnamen auslesen
xgamelist.getGamename(gameid,temp,XFIRE_MAXSIZEOFGAMENAME);
@@ -1000,18 +1000,18 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //gameskip wert setzen
char temp[64]="";
- sprintf_s(temp,64,"gameskip_%d",gameid);
+ mir_snprintf(temp, SIZEOF(temp), "gameskip_%d", gameid);
CheckDlgButton(hwndDlg,IDC_DONTDETECT,db_get_b(NULL,protocolname,temp,0));
- sprintf_s(temp,64,"gamenostatus_%d",gameid);
+ mir_snprintf(temp, SIZEOF(temp), "gamenostatus_%d", gameid);
CheckDlgButton(hwndDlg,IDC_NOSTATUSMSG,db_get_b(NULL,protocolname,temp,0));
- sprintf_s(temp,64,"notinstartmenu_%d",gameid);
+ mir_snprintf(temp, SIZEOF(temp), "notinstartmenu_%d", gameid);
CheckDlgButton(hwndDlg,IDC_NOTINSTARTMENU,db_get_b(NULL,protocolname,temp,0));
//extra parameter auslesen, aber nur, wenn das spiel auch sowas unterstützt
if(xgtemp && xgtemp->haveExtraGameArgs())
{
EnableDlgItem(hwndDlg, IDC_EXTRAPARAMS, TRUE);
- sprintf_s(temp,64,"gameextraparams_%d",gameid);
+ mir_snprintf(temp, SIZEOF(temp), "gameextraparams_%d", gameid);
DBVARIANT dbv;
if(!db_get(NULL,protocolname,temp,&dbv))
{
diff --git a/protocols/Xfire/src/searching4games.cpp b/protocols/Xfire/src/searching4games.cpp index 2a0ab3b8ea..9ecf80e71b 100644 --- a/protocols/Xfire/src/searching4games.cpp +++ b/protocols/Xfire/src/searching4games.cpp @@ -254,9 +254,9 @@ void Scan4Games( LPVOID lparam ) {
//2 gameids?
if(split)
- sprintf(temp,"%i_%i",i,i2);
+ mir_snprintf(temp, SIZEOF(temp), "%i_%i", i, i2);
else
- sprintf(temp,"%i",i);
+ mir_snprintf(temp, SIZEOF(temp), "%i", i);
//MessageBoxA(0,temp,temp,0);
@@ -468,7 +468,7 @@ void Scan4Games( LPVOID lparam ) multiexe=FALSE;
for(int i=1;i<9;i++)
{
- sprintf(ret,"DetectExe[%d]",i);
+ mir_snprintf(ret, SIZEOF(ret), "DetectExe[%d]", i);
if(xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath))
{
char* pos=strrchr(path,'\\');
@@ -551,7 +551,7 @@ void Scan4Games( LPVOID lparam ) newgame->setString(ret2,&newgame->launchparams);
//soll alle string, welche nicht in der commandline eines spiels sein soll in einen string pakcen semikolon getrennt
- sprintf(ret,"CommandLineMustNotContain[0]");
+ mir_snprintf(ret, SIZEOF(ret), "CommandLineMustNotContain[0]");
int i=0;
while(xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath))
@@ -562,7 +562,7 @@ void Scan4Games( LPVOID lparam ) newgame->appendString(ret2,&newgame->notcontain);
i++;
- sprintf(ret,"CommandLineMustNotContain[%d]",i);
+ mir_snprintf(ret, SIZEOF(ret), "CommandLineMustNotContain[%d]", i);
}
newgame->setNameandIcon();
@@ -653,7 +653,7 @@ void Scan4Games( LPVOID lparam ) newgame->setstatusmsg=atoi(ret2);
//soll alle string, welche nicht in der commandline eines spiels sein soll in einen string pakcen semikolon getrennt
- sprintf(ret,"CommandLineMustNotContain[0]");
+ mir_snprintf(ret, SIZEOF(ret), "CommandLineMustNotContain[0]");
int i=0;
while(xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath))
@@ -664,7 +664,7 @@ void Scan4Games( LPVOID lparam ) newgame->appendString(ret2,&newgame->notcontain);
i++;
- sprintf(ret,"CommandLineMustNotContain[%d]",i);
+ mir_snprintf(ret, SIZEOF(ret), "CommandLineMustNotContain[%d]", i);
}
newgame->setNameandIcon();
@@ -726,7 +726,7 @@ void Scan4Games( LPVOID lparam ) int p=strlen(gamelist)-2;
if(p>-1)
gamelist[p]=0; //letztes koma killen
- sprintf(ret,Translate("Games found:%s%s"),"\r\n\r\n",gamelist);
+ mir_snprintf(ret, SIZEOF(ret), Translate("Games found:%s%s"), "\r\n\r\n", gamelist);
MSGBOX(ret);
}
diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index d5a0010ff4..e4edd7cc3d 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -53,7 +53,7 @@ void CALLBACK ConferenceRequestCB(PVOID dwParam); void ext_yahoo_got_conf_invite(int id, const char *me, const char *who, const char *room, const char *msg, YList *members)
{
char z[1024];
- _snprintf(z, sizeof(z), Translate("[miranda] Got conference invite to room: %s with msg: %s"), room ?room:"", msg ?msg:"");
+ mir_snprintf(z, sizeof(z), Translate("[miranda] Got conference invite to room: %s with msg: %s"), room ?room:"", msg ?msg:"");
LOG(("[ext_yahoo_got_conf_invite] %s", z));
CYahooProto* ppro = getProtoById(id);
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index 4c74801976..b629e39a7b 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;
- snprintf(z, 1024, "%s (%lu)\r\n", fi->filename, fi->filesize);
+ mir_snprintf(z, 1024, "%s (%lu)\r\n", fi->filename, fi->filesize);
lstrcatA(fn, z);
fc++;
}
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index 0fb7aa160a..5fc8f536e0 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -40,7 +40,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons if (stat == 2) {
char z[1024];
- snprintf(z, sizeof z, "Error sending message to %s", who);
+ mir_snprintf(z, SIZEOF(z), "Error sending message to %s", who);
LOG((z));
ShowError( TranslateT("Yahoo Error"), _A2T(z));
return;
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index f2e3ecda7a..668a6cfe06 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -28,7 +28,7 @@ int CYahooProto::DebugLog( const char *fmt, ... ) va_list vararg;
va_start( vararg, fmt );
- int tBytes = _vsnprintf( str, sizeof( str ), fmt, vararg );
+ int tBytes = mir_vsnprintf(str, sizeof(str), fmt, vararg);
if ( tBytes > 0)
str[ tBytes ] = 0;
@@ -45,7 +45,7 @@ int DebugLog( const char *fmt, ... ) va_list vararg;
va_start( vararg, fmt );
- int tBytes = _vsnprintf( str, sizeof( str ), fmt, vararg );
+ int tBytes = mir_vsnprintf(str, sizeof(str), fmt, vararg);
if ( tBytes > 0)
str[ tBytes ] = 0;
@@ -203,7 +203,7 @@ extern PLUGININFOEX pluginInfo; void CYahooProto::YAHOO_utils_logversion()
{
char str[256];
- _snprintf(str, sizeof(str), "Yahoo v%d.%d.%d.%d", (pluginInfo.version >> 24) & 0xFF, (pluginInfo.version >> 16) & 0xFF,
+ mir_snprintf(str, sizeof(str), "Yahoo v%d.%d.%d.%d", (pluginInfo.version >> 24) & 0xFF, (pluginInfo.version >> 16) & 0xFF,
(pluginInfo.version >> 8) & 0xFF, pluginInfo.version & 0xFF);
DebugLog(str);
}
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 4191ab03c1..71b9359b99 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -1440,7 +1440,7 @@ char * CYahooProto::ext_send_https_request(struct yahoo_data *yd, const char *ho char z[4096], *result=NULL;
int i;
- wsprintfA(z, "https://%s%s", host, path);
+ mir_snprintf(z, SIZEOF(z), "https://%s%s", host, path);
nlhr.cbSize = sizeof(nlhr);
nlhr.requestType= REQUEST_GET;
nlhr.flags = NLHRF_HTTP11 | NLHRF_NODUMPSEND | NLHRF_DUMPASTEXT; /* Use HTTP/1.1 and don't dump the requests to the log */
@@ -1511,7 +1511,7 @@ void CYahooProto::ext_login(enum yahoo_status login_mode) NETLIBHTTPREQUEST nlhr={0},*nlhrReply;
char z[4096];
- wsprintfA(z, "http://%s%s", getByte("YahooJapan",0) != 0 ? "cs1.msg.vip.ogk.yahoo.co.jp" : "vcs.msg.yahoo.com", "/capacity");
+ mir_snprintf(z, SIZEOF(z), "http://%s%s", getByte("YahooJapan",0) != 0 ? "cs1.msg.vip.ogk.yahoo.co.jp" : "vcs.msg.yahoo.com", "/capacity");
nlhr.cbSize = sizeof(nlhr);
nlhr.requestType= REQUEST_GET;
nlhr.flags = NLHRF_HTTP11;
@@ -1548,7 +1548,7 @@ void CYahooProto::ext_login(enum yahoo_status login_mode) db_free(&dbv);
}
else {
- snprintf(host, sizeof(host), "%s",
+ mir_snprintf(host, sizeof(host), "%s",
getByte("YahooJapan",0) != 0 ? YAHOO_DEFAULT_JAPAN_LOGIN_SERVER :
YAHOO_DEFAULT_LOGIN_SERVER
);
|