diff options
author | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-12-09 00:59:27 +0000 |
---|---|---|
committer | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-12-09 00:59:27 +0000 |
commit | 36472b00443e23acf28b0dd26ddc2c2e6216d909 (patch) | |
tree | a526bbc6d309e05f1728b772620c9272f9ab8c4a /plugins/Ping | |
parent | 163ce5127e5c8244bccbdae72107ad101f70575f (diff) |
code cleanup over mir_sntprintf + small bug fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@11295 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Ping')
-rw-r--r-- | plugins/Ping/src/pingthread.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index 1bea794431..d27e151260 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -69,7 +69,7 @@ void SetProtoStatus(TCHAR *pszLabel, char *pszProto, int if_status, int new_stat if(ProtoCallService(pszProto, PS_GETSTATUS, 0, 0) == if_status) {
if(options.logging) {
TCHAR buf[1024];
- mir_sntprintf(buf, 1024, TranslateT("%s - setting status of protocol '%S' (%d)"), pszLabel, pszProto, new_status);
+ mir_sntprintf(buf, SIZEOF(buf), TranslateT("%s - setting status of protocol '%S' (%d)"), pszLabel, pszProto, new_status);
CallService(PLUG "/Log", (WPARAM)buf, 0);
}
ProtoCallService(pszProto, PS_SETSTATUS, new_status, 0);
@@ -105,11 +105,11 @@ DWORD WINAPI sttCheckStatusThreadProc( void *vp) size_t size = data_list.size();
Unlock(&data_list_cs);
- int index = 0;
+ size_t index = 0;
for(; index < size; index++)
{
Lock(&data_list_cs, "ping thread loop start");
- int c = 0;
+ size_t c = 0;
for (pinglist_it i = data_list.begin(); i != data_list.end() && c <= index; ++i, c++)
{
if (c == index)
@@ -205,7 +205,7 @@ DWORD WINAPI sttCheckStatusThreadProc( void *vp) }
if(pa.miss_count == -1 - options.retries && options.logging) {
TCHAR buf[512];
- mir_sntprintf(buf, 512, TranslateT("%s - reply, %d"), pa.pszLabel, pa.round_trip_time);
+ mir_sntprintf(buf, SIZEOF(buf), TranslateT("%s - reply, %d"), pa.pszLabel, pa.round_trip_time);
CallService(PLUG "/Log", (WPARAM)buf, 0);
}
SetProtoStatus(pa.pszLabel, pa.pszProto, pa.get_status, pa.set_status);
@@ -220,7 +220,7 @@ DWORD WINAPI sttCheckStatusThreadProc( void *vp) }
if(pa.miss_count == 1 + options.retries && options.logging) {
TCHAR buf[512];
- mir_sntprintf(buf, 512, TranslateT("%s - timeout"), pa.pszLabel);
+ mir_sntprintf(buf, SIZEOF(buf), TranslateT("%s - timeout"), pa.pszLabel);
CallService(PLUG "/Log", (WPARAM)buf, 0);
}
}
@@ -417,11 +417,11 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if(itemData.status != PS_DISABLED) {
TCHAR buf[256];
if(itemData.responding) {
- mir_sntprintf(buf, 256, TranslateT("%d ms"), itemData.round_trip_time);
+ mir_sntprintf(buf, SIZEOF(buf), TranslateT("%d ms"), itemData.round_trip_time);
GetTextExtentPoint32(dis->hDC, buf, (int)mir_tstrlen(buf), &textSize);
TextOut(dis->hDC,dis->rcItem.right - textSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom -textSize.cy)>>1,buf,(int)mir_tstrlen(buf));
} else if(itemData.miss_count > 0) {
- mir_sntprintf(buf, 256, _T("[%d]"), itemData.miss_count);
+ mir_sntprintf(buf, SIZEOF(buf), _T("[%d]"), itemData.miss_count);
GetTextExtentPoint32(dis->hDC, buf, (int)mir_tstrlen(buf), &textSize);
TextOut(dis->hDC,dis->rcItem.right - textSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom -textSize.cy)>>1,buf,(int)mir_tstrlen(buf));
}
@@ -786,7 +786,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if(options.logging) {
TCHAR buf[1024];
- mir_sntprintf(buf, 1024, _T("%s - %s"), pItemData->pszLabel, (wake ? TranslateT("enabled") : TranslateT("double clicked")));
+ mir_sntprintf(buf, SIZEOF(buf), _T("%s - %s"), pItemData->pszLabel, (wake ? TranslateT("enabled") : TranslateT("double clicked")));
CallService(PLUG "/Log", (WPARAM)buf, 0);
}
|