summaryrefslogtreecommitdiff
path: root/plugins/Ping/src
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-07-25 15:32:06 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-07-25 15:32:06 +0000
commita757184e5db3112d3de0b69eec7d39b937e396bc (patch)
treee903787b3ca3af22a4d95ddf757e178b23da8619 /plugins/Ping/src
parent33ebc5347bee5432ca63efb330acdd5a3b82f3fd (diff)
replace sprintf to mir_snprintf (part 5)
git-svn-id: http://svn.miranda-ng.org/main/trunk@5481 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Ping/src')
-rw-r--r--plugins/Ping/src/pinggraph.cpp24
-rw-r--r--plugins/Ping/src/pinglist.cpp6
-rw-r--r--plugins/Ping/src/pingthread.cpp4
-rw-r--r--plugins/Ping/src/rawping.cpp2
4 files changed, 18 insertions, 18 deletions
diff --git a/plugins/Ping/src/pinggraph.cpp b/plugins/Ping/src/pinggraph.cpp
index b655cdc24f..59947ed7d9 100644
--- a/plugins/Ping/src/pinggraph.cpp
+++ b/plugins/Ping/src/pinggraph.cpp
@@ -190,20 +190,20 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
char buff[64];
if(wd->show_grid)
{
- sprintf(buff, Translate("%d ms"), MARK_TIME);
+ mir_snprintf(buff, SIZEOF(buff), Translate("%d ms"), MARK_TIME);
TextOut(hdc, r.right - 100, r.bottom - (int)(unit_height * MARK_TIME + 0.5f), buff, strlen(buff));
}
if (wd->show_stat)
{
SetTextColor(hdc, RGB(255, 0, 0));
- sprintf(buff, Translate("AVG %.1lf ms"), avg);
+ mir_snprintf(buff, SIZEOF(buff), Translate("AVG %.1lf ms"), avg);
TextOut(hdc, r.left + 10, r.bottom - (int)(avg * unit_height + 0.5f), buff, strlen(buff));
if (max_value != avg)
{
- sprintf(buff, Translate("MAX %hd ms"), max_value);
+ mir_snprintf(buff, SIZEOF(buff), Translate("MAX %hd ms"), max_value);
TextOut(hdc, r.left + 10, r.bottom - (int)(max_value * unit_height + 0.5f), buff, strlen(buff));
- sprintf(buff, Translate("MIN %hd ms"), min_value);
+ mir_snprintf(buff, SIZEOF(buff), Translate("MIN %hd ms"), min_value);
TextOut(hdc, r.left + 10, r.bottom - (int)(min_value * unit_height + 0.5f), buff, strlen(buff));
}
}
@@ -232,7 +232,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
WindowData *wd = (WindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
{
char buff[30];
- sprintf(buff, "pinggraphwnd%d", wd->item_id);
+ mir_snprintf(buff, SIZEOF(buff), "pinggraphwnd%d", wd->item_id);
Utils_SaveWindowPosition(hwnd, 0, PLUG, buff);
}
}
@@ -242,7 +242,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
WindowData *wd = (WindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
{
char buff[30];
- sprintf(buff, "WindowHandle%d", wd->item_id);
+ mir_snprintf(buff, SIZEOF(buff), "WindowHandle%d", wd->item_id);
db_set_dw(0, PLUG, buff, 0);
}
delete wd;
@@ -255,7 +255,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) {
char buff[30];
- sprintf(buff, "WindowHandle%d", (DWORD)wParam);
+ mir_snprintf(buff, SIZEOF(buff), "WindowHandle%d", (DWORD)wParam);
HWND hGraphWnd = (HWND)db_get_dw(0, PLUG, buff, 0);
if(hGraphWnd) {
ShowWindow(hGraphWnd, SW_SHOW);
@@ -299,7 +299,7 @@ INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) {
SetWindowLongPtr(hGraphWnd, GWLP_USERDATA, (LONG_PTR)wd);
- sprintf(buff, "pinggraphwnd%d", wd->item_id);
+ mir_snprintf(buff, SIZEOF(buff), "pinggraphwnd%d", wd->item_id);
Utils_RestoreWindowPosition(hGraphWnd, 0, PLUG, buff);
if(!IsWindowVisible(hGraphWnd))
@@ -315,11 +315,11 @@ void graphs_cleanup() {
HWND hwnd;
for(int i = 0; i < list_size; i++) {
- sprintf(buff, "WindowHandle%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "WindowHandle%d", i);
if(hwnd = (HWND)db_get_dw(0, PLUG, buff, 0)) {
DestroyWindow(hwnd);
db_set_dw(0, PLUG, buff, 0);
- sprintf(buff, "WindowWasOpen%d", i);
+ mir_snprintf(buff, SIZEOF(buff), "WindowWasOpen%d", i);
db_set_b(0, PLUG, buff, 1);
}
}
@@ -331,9 +331,9 @@ void graphs_init() {
char buff[64];
CallService(PLUG "/GetPingList", 0, (LPARAM)&pl);
for(pinglist_it i = pl.begin(); i != pl.end(); ++i) {
- sprintf(buff, "WindowHandle%d", i->item_id); // clean up from possible crash
+ mir_snprintf(buff, SIZEOF(buff), "WindowHandle%d", i->item_id); // clean up from possible crash
db_set_dw(0, PLUG, buff, 0);
- sprintf(buff, "WindowWasOpen%d", i->item_id); // restore windows that were open on shutdown
+ mir_snprintf(buff, SIZEOF(buff), "WindowWasOpen%d", i->item_id); // restore windows that were open on shutdown
if(db_get_b(0, PLUG, buff, 0)) {
db_set_b(0, PLUG, buff, 0);
ShowGraph((WPARAM)i->item_id, (LPARAM)i->pszLabel);
diff --git a/plugins/Ping/src/pinglist.cpp b/plugins/Ping/src/pinglist.cpp
index 517e984490..1151ba37f6 100644
--- a/plugins/Ping/src/pinglist.cpp
+++ b/plugins/Ping/src/pinglist.cpp
@@ -57,7 +57,7 @@ INT_PTR GetListSize(WPARAM wParam, LPARAM lParam)
void write_ping_address(PINGADDRESS &i)
{
char buff[16];
- sprintf(buff, "PING_DEST_%d", i.index);
+ mir_snprintf(buff, SIZEOF(buff), "PING_DEST_%d", i.index);
if(i.item_id == 0) {
i.item_id = NextID++;
@@ -99,7 +99,7 @@ void write_ping_addresses()
do {
found = false;
- sprintf(buff, "PING_DEST_%d", index++);
+ mir_snprintf(buff, SIZEOF(buff), "PING_DEST_%d", index++);
if(db_get_dw(0, buff, "Id", 0) != 0) {
found = true;
db_set_dw(0, buff, "Id", 0);
@@ -111,7 +111,7 @@ bool read_ping_address(PINGADDRESS &pa) {
int index = pa.index;
char buff[16];
- sprintf(buff, "PING_DEST_%d", index);
+ mir_snprintf(buff, SIZEOF(buff), "PING_DEST_%d", index);
// return if not more contacts, or only deleted contacts remaining
if((pa.item_id = db_get_dw(0, buff, "Id", 0)) == 0) return false;
diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp
index bf9372c0fa..2d22d3bd81 100644
--- a/plugins/Ping/src/pingthread.cpp
+++ b/plugins/Ping/src/pingthread.cpp
@@ -334,9 +334,9 @@ void CALLBACK TimerProc(
{
char TBcapt[255];
if (total > 0)
- wsprintf(TBcapt,"Ping (%d/%d)", upCount, total);
+ mir_sntprintf(TBcapt, SIZEOF(TBcapt), "Ping (%d/%d)", upCount, total);
else
- wsprintf(TBcapt,"Ping");
+ mir_sntprintf(TBcapt, SIZEOF(TBcapt), "Ping");
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_TBNAME,frame_id),(LPARAM)TBcapt);
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_TBTIPNAME,frame_id),(LPARAM)TBcapt);
diff --git a/plugins/Ping/src/rawping.cpp b/plugins/Ping/src/rawping.cpp
index 6b0f152d94..65bc99a775 100644
--- a/plugins/Ping/src/rawping.cpp
+++ b/plugins/Ping/src/rawping.cpp
@@ -186,7 +186,7 @@ extern int raw_ping(char *host, int timeout)
if(reply->type == PT_ICMP_SOURCE_QUENCH) {
char buff[1024];
- sprintf(buff, Translate("Host %s requests that you reduce the amount of traffic you are sending."), host);
+ mir_snprintf(buff, SIZEOF(buff), Translate("Host %s requests that you reduce the amount of traffic you are sending."), host);
MessageBox(0, buff, Translate(PLUG " Warning"), MB_OK | MB_ICONWARNING);
}