From b7c74cd5b22618d544a3f4ae124985d4837e3a22 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 4 Jun 2015 22:12:13 +0000 Subject: new mir_snprintf templates without SIZEOF git-svn-id: http://svn.miranda-ng.org/main/trunk@14002 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Ping/src/pinggraph.cpp | 16 ++++++++-------- plugins/Ping/src/pinglist.cpp | 6 +++--- plugins/Ping/src/rawping.cpp | 2 +- plugins/Ping/src/utils.cpp | 14 +++++++------- 4 files changed, 19 insertions(+), 19 deletions(-) (limited to 'plugins/Ping/src') diff --git a/plugins/Ping/src/pinggraph.cpp b/plugins/Ping/src/pinggraph.cpp index 64be901181..3dd8c82452 100644 --- a/plugins/Ping/src/pinggraph.cpp +++ b/plugins/Ping/src/pinggraph.cpp @@ -231,7 +231,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar WindowData *wd = (WindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA); { char buff[30]; - mir_snprintf(buff, SIZEOF(buff), "pinggraphwnd%d", wd->item_id); + mir_snprintf(buff, "pinggraphwnd%d", wd->item_id); Utils_SaveWindowPosition(hwnd, 0, PLUG, buff); } } @@ -241,7 +241,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar WindowData *wd = (WindowData *)GetWindowLongPtr(hwnd, GWLP_USERDATA); { char buff[30]; - mir_snprintf(buff, SIZEOF(buff), "WindowHandle%d", wd->item_id); + mir_snprintf(buff, "WindowHandle%d", wd->item_id); db_set_dw(0, PLUG, buff, 0); } delete wd; @@ -254,7 +254,7 @@ LRESULT CALLBACK GraphWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) { char buff[30]; - mir_snprintf(buff, SIZEOF(buff), "WindowHandle%d", (DWORD)wParam); + mir_snprintf(buff, "WindowHandle%d", (DWORD)wParam); HWND hGraphWnd = (HWND)db_get_dw(0, PLUG, buff, 0); if (hGraphWnd) { ShowWindow(hGraphWnd, SW_SHOW); @@ -298,7 +298,7 @@ INT_PTR ShowGraph(WPARAM wParam, LPARAM lParam) { SetWindowLongPtr(hGraphWnd, GWLP_USERDATA, (LONG_PTR)wd); - mir_snprintf(buff, SIZEOF(buff), "pinggraphwnd%d", wd->item_id); + mir_snprintf(buff, "pinggraphwnd%d", wd->item_id); Utils_RestoreWindowPosition(hGraphWnd, 0, PLUG, buff); if (!IsWindowVisible(hGraphWnd)) @@ -314,11 +314,11 @@ void graphs_cleanup() { HWND hwnd; for (int i = 0; i < list_size; i++) { - mir_snprintf(buff, SIZEOF(buff), "WindowHandle%d", i); + mir_snprintf(buff, "WindowHandle%d", i); if (hwnd = (HWND)db_get_dw(0, PLUG, buff, 0)) { DestroyWindow(hwnd); db_set_dw(0, PLUG, buff, 0); - mir_snprintf(buff, SIZEOF(buff), "WindowWasOpen%d", i); + mir_snprintf(buff, "WindowWasOpen%d", i); db_set_b(0, PLUG, buff, 1); } } @@ -330,9 +330,9 @@ void graphs_init() { char buff[64]; CallService(PLUG "/GetPingList", 0, (LPARAM)&pl); for (pinglist_it i = pl.begin(); i != pl.end(); ++i) { - mir_snprintf(buff, SIZEOF(buff), "WindowHandle%d", i->item_id); // clean up from possible crash + mir_snprintf(buff, "WindowHandle%d", i->item_id); // clean up from possible crash db_set_dw(0, PLUG, buff, 0); - mir_snprintf(buff, SIZEOF(buff), "WindowWasOpen%d", i->item_id); // restore windows that were open on shutdown + mir_snprintf(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 e3a0e7b6bb..cbd590c503 100644 --- a/plugins/Ping/src/pinglist.cpp +++ b/plugins/Ping/src/pinglist.cpp @@ -55,7 +55,7 @@ INT_PTR GetListSize(WPARAM, LPARAM) void write_ping_address(PINGADDRESS &i) { char buff[16]; - mir_snprintf(buff, SIZEOF(buff), "PING_DEST_%d", i.index); + mir_snprintf(buff, "PING_DEST_%d", i.index); if (i.item_id == 0) { i.item_id = NextID++; @@ -97,7 +97,7 @@ void write_ping_addresses() do { found = false; - mir_snprintf(buff, SIZEOF(buff), "PING_DEST_%d", index++); + mir_snprintf(buff, "PING_DEST_%d", index++); if (db_get_dw(0, buff, "Id", 0) != 0) { found = true; db_set_dw(0, buff, "Id", 0); @@ -109,7 +109,7 @@ bool read_ping_address(PINGADDRESS &pa) { int index = pa.index; char buff[16]; - mir_snprintf(buff, SIZEOF(buff), "PING_DEST_%d", index); + mir_snprintf(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/rawping.cpp b/plugins/Ping/src/rawping.cpp index 98cdace9bd..aad13b220e 100644 --- a/plugins/Ping/src/rawping.cpp +++ b/plugins/Ping/src/rawping.cpp @@ -198,7 +198,7 @@ extern int raw_ping(char *host, int timeout) if (reply->type == PT_ICMP_SOURCE_QUENCH) { char buff[1024]; - mir_snprintf(buff, SIZEOF(buff), Translate("Host %s requests that you reduce the amount of traffic you are sending."), host); + mir_snprintf(buff, Translate("Host %s requests that you reduce the amount of traffic you are sending."), host); MessageBoxA(0, buff, Translate(PLUG " Warning"), MB_OK | MB_ICONWARNING); } diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index 84d86718b7..f61f0f9399 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -219,7 +219,7 @@ INT_PTR DblClick(WPARAM wParam, LPARAM lParam) { void import_ping_address(int index, PINGADDRESS &pa) { DBVARIANT dbv; char buf[256]; - mir_snprintf(buf, SIZEOF(buf), "Address%d", index); + mir_snprintf(buf, "Address%d", index); if (!db_get_ts(0, "PingPlug", buf, &dbv)) { mir_tstrncpy(pa.pszName, dbv.ptszVal, SIZEOF(pa.pszName)); db_free(&dbv); @@ -227,7 +227,7 @@ void import_ping_address(int index, PINGADDRESS &pa) { else mir_tstrncpy(pa.pszName, TranslateT("Unknown Address"), SIZEOF(pa.pszName)); - mir_snprintf(buf, SIZEOF(buf), "Label%d", index); + mir_snprintf(buf, "Label%d", index); if (!db_get_ts(0, "PingPlug", buf, &dbv)) { mir_tstrncpy(pa.pszLabel, dbv.ptszVal, SIZEOF(pa.pszLabel)); db_free(&dbv); @@ -235,16 +235,16 @@ void import_ping_address(int index, PINGADDRESS &pa) { else mir_tstrncpy(pa.pszLabel, TranslateT("Unknown"), SIZEOF(pa.pszLabel)); - mir_snprintf(buf, SIZEOF(buf), "Port%d", index); + mir_snprintf(buf, "Port%d", index); pa.port = (int)db_get_dw(0, "PingPlug", buf, -1); - mir_snprintf(buf, SIZEOF(buf), "Proto%d", index); + mir_snprintf(buf, "Proto%d", index); if (!db_get_s(0, "PingPlug", buf, &dbv)) { mir_strncpy(pa.pszProto, dbv.pszVal, SIZEOF(pa.pszProto)); db_free(&dbv); - mir_snprintf(buf, SIZEOF(buf), "Status%d", index); + mir_snprintf(buf, "Status%d", index); pa.set_status = db_get_w(0, "PingPlug", buf, ID_STATUS_ONLINE); - mir_snprintf(buf, SIZEOF(buf), "Status2%d", index); + mir_snprintf(buf, "Status2%d", index); pa.get_status = db_get_w(0, "PingPlug", buf, ID_STATUS_OFFLINE); } else @@ -259,7 +259,7 @@ void import_ping_address(int index, PINGADDRESS &pa) { pa.pszParams[0] = '\0'; pa.item_id = 0; - mir_snprintf(buf, SIZEOF(buf), "Enabled%d", index); + mir_snprintf(buf, "Enabled%d", index); if (db_get_b(0, "PingPlug", buf, 1) == 1) pa.status = PS_NOTRESPONDING; else -- cgit v1.2.3