From 90e458dac28dc98d60ab00b35ddcfd09fb46811a Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Tue, 23 Jul 2013 19:23:02 +0000 Subject: replace sprintf to mir_snprintf (part 3) git-svn-id: http://svn.miranda-ng.org/main/trunk@5461 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewXstatusNotify/src/main.cpp | 14 +++++++------- plugins/NewXstatusNotify/src/options.cpp | 16 ++++++++-------- plugins/NewXstatusNotify/src/xstatus.cpp | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'plugins/NewXstatusNotify') diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index a9c4473b4f..52b00640c3 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -566,7 +566,7 @@ int StatusModeChanged(WPARAM wParam, LPARAM lParam) if (opt.AutoDisable && (!opt.OnlyGlobalChanges || szProto == NULL)) { if (opt.DisablePopupGlobally && ServiceExists(MS_POPUP_QUERY)) { char szSetting[12]; - wsprintfA(szSetting, "p%d", wParam); + mir_snprintf(szSetting, SIZEOF(szSetting), "p%d", wParam); BYTE hlpDisablePopup = db_get_b(0, MODULE, szSetting, 0); if (hlpDisablePopup != opt.PopupAutoDisabled) { @@ -590,7 +590,7 @@ int StatusModeChanged(WPARAM wParam, LPARAM lParam) if (opt.DisableSoundGlobally) { char szSetting[12]; - wsprintfA(szSetting, "s%d", wParam); + mir_snprintf(szSetting, SIZEOF(szSetting), "s%d", wParam); BYTE hlpDisableSound = db_get_b(0, MODULE, szSetting, 0); if (hlpDisableSound != opt.SoundAutoDisabled) { @@ -650,7 +650,7 @@ void ShowStatusChangePopup(HANDLE hContact, char *szProto, WORD oldStatus, WORD if (opt.ShowPreviousStatus) { TCHAR buff[MAX_STATUSTEXT]; - wsprintf(buff, TranslateTS(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(oldStatus)].lpzStandardText); + mir_sntprintf(buff, SIZEOF(buff), TranslateTS(STRING_SHOWPREVIOUSSTATUS), StatusList[Index(oldStatus)].lpzStandardText); _tcscat(_tcscat(stzStatusText, _T(" ")), buff); } } @@ -807,7 +807,7 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) if (!opt.FromOffline || oldStatus != ID_STATUS_OFFLINE) { // Either it wasn't a change from Offline or we didn't enable that. char buff[8]; - wsprintfA(buff, "%d", newStatus); + mir_snprintf(buff, SIZEOF(buff), "%d", newStatus); if (db_get_b(0, MODULE, buff, 1) == 0) return 0; // "Notify when a contact changes to one of..." is unchecked } @@ -822,8 +822,8 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) // check if that proto from which we received statuschange notification, isn't in autodisable list if (opt.AutoDisable) { char statusIDs[12], statusIDp[12]; - wsprintfA(statusIDs, "s%d", myStatus); - wsprintfA(statusIDp, "p%d", myStatus); + mir_snprintf(statusIDs, SIZEOF(statusIDs), "s%d", myStatus); + mir_snprintf(statusIDp, SIZEOF(statusIDp), "p%d", myStatus); bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : TRUE; bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : TRUE; } @@ -847,7 +847,7 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam) _tcsncpy(stzOldStatus, StatusList[Index(oldStatus)].lpzStandardText, MAX_STATUSTEXT); GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL,_T("HH':'mm"), stzTime, SIZEOF(stzTime)); GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL,_T("dd/MM/yyyy"), stzDate, SIZEOF(stzDate)); - wsprintf(stzText, TranslateT("%s, %s. %s changed to: %s (was: %s).\r\n"), stzDate, stzTime, stzName, stzStatus, stzOldStatus); + mir_sntprintf(stzText, SIZEOF(stzText), TranslateT("%s, %s. %s changed to: %s (was: %s).\r\n"), stzDate, stzTime, stzName, stzStatus, stzOldStatus); LogToFile(stzText); } diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp index 7486715434..ae9b897bed 100644 --- a/plugins/NewXstatusNotify/src/options.cpp +++ b/plugins/NewXstatusNotify/src/options.cpp @@ -183,7 +183,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA char status[8]; for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++) { - wsprintfA(status, "%d", i); + mir_snprintf(status, SIZEOF(status), "%d", i); CheckDlgButton(hwndDlg, i, db_get_b(0, MODULE, status, 1)); } CheckDlgButton(hwndDlg, IDC_CHK_FROMOFFLINE, opt.FromOffline); @@ -266,7 +266,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA char status[8]; for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX2; i++) { - wsprintfA(status, "%d", i); + mir_snprintf(status, SIZEOF(status), "%d", i); db_set_b(NULL, MODULE, status, (BYTE)IsDlgButtonChecked(hwndDlg, i)); } opt.FromOffline = IsDlgButtonChecked(hwndDlg, IDC_CHK_FROMOFFLINE); @@ -442,12 +442,12 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM { ctlColour = SendDlgItemMessage(hwndDlg, (i+2000), CPM_GETCOLOUR, 0, 0); StatusList[Index(i)].colorBack = SendDlgItemMessage(hwndDlg, (i+2000), CPM_GETCOLOUR, 0, 0); - wsprintfA(str, "%ibg", i); + mir_snprintf(str, SIZEOF(str), "%ibg", i); db_set_dw(0, MODULE, str, ctlColour); ctlColour = SendDlgItemMessage(hwndDlg, (i+1000), CPM_GETCOLOUR, 0, 0); StatusList[Index(i)].colorText = ctlColour; - wsprintfA(str, "%itx", i); + mir_snprintf(str, SIZEOF(str), "%itx", i); db_set_dw(0, MODULE, str, ctlColour); } @@ -493,13 +493,13 @@ INT_PTR CALLBACK DlgProcAutoDisableOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L char str[8]; for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) { - wsprintfA(str, "p%d", i); + mir_snprintf(str, SIZEOF(str), "p%d", i); CheckDlgButton(hwndDlg, i, db_get_b(0, MODULE, str, 0)); } for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) { - wsprintfA(str, "s%d", i); + mir_snprintf(str, SIZEOF(str), "s%d", i); CheckDlgButton(hwndDlg, (i+2000),db_get_b(NULL, MODULE, str, 0)); } @@ -517,12 +517,12 @@ INT_PTR CALLBACK DlgProcAutoDisableOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) { - wsprintfA(str, "p%d", i); + mir_snprintf(str, SIZEOF(str), "p%d", i); db_set_b(NULL, MODULE, str, IsDlgButtonChecked(hwndDlg, i)); } for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) { - wsprintfA(str, "s%d", i); + mir_snprintf(str, SIZEOF(str), "s%d", i); db_set_b(NULL, MODULE, str, IsDlgButtonChecked(hwndDlg, i+2000)); } diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 6632802340..60d215cdf3 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -307,7 +307,7 @@ void ExtraStatusChanged(XSTATUSCHANGE *xsc) BOOL bEnablePopup = true, bEnableSound = true; char buff[12] = {0}; - wsprintfA(buff, "%d", ID_STATUS_EXTRASTATUS); + mir_snprintf(buff, SIZEOF(buff), "%d", ID_STATUS_EXTRASTATUS); if (( db_get_b(0, MODULE, buff, 1) == 0) || (db_get_w(xsc->hContact, xsc->szProto, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) @@ -321,8 +321,8 @@ void ExtraStatusChanged(XSTATUSCHANGE *xsc) char statusIDs[12], statusIDp[12]; if (opt.AutoDisable) { WORD myStatus = (WORD)CallProtoService(xsc->szProto, PS_GETSTATUS, 0, 0); - wsprintfA(statusIDs, "s%d", myStatus); - wsprintfA(statusIDp, "p%d", myStatus); + mir_snprintf(statusIDs, SIZEOF(statusIDs), "s%d", myStatus); + mir_snprintf(statusIDp, SIZEOF(statusIDp), "p%d", myStatus); bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : TRUE; bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : TRUE; } -- cgit v1.2.3