diff options
author | George Hazan <george.hazan@gmail.com> | 2013-08-14 19:04:55 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-08-14 19:04:55 +0000 |
commit | b67c40f21c0fe0c80a3ddd31b0b09f71bf5d97d7 (patch) | |
tree | fa22404f4a40f81b86447c5bd7def26fd6815722 /protocols/GTalkExt/src | |
parent | c95efb840d744ec332edfe311b69f1c7ac56560a (diff) |
mir_*printf patch for protocols
git-svn-id: http://svn.miranda-ng.org/main/trunk@5690 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/GTalkExt/src')
-rw-r--r-- | protocols/GTalkExt/src/handlers.cpp | 4 | ||||
-rw-r--r-- | protocols/GTalkExt/src/inbox.cpp | 10 | ||||
-rw-r--r-- | protocols/GTalkExt/src/notifications.cpp | 12 | ||||
-rw-r--r-- | protocols/GTalkExt/src/options.cpp | 6 | ||||
-rw-r--r-- | protocols/GTalkExt/src/tipper_items.cpp | 12 |
5 files changed, 23 insertions, 21 deletions
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);
|