From 36472b00443e23acf28b0dd26ddc2c2e6216d909 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Tue, 9 Dec 2014 00:59:27 +0000 Subject: code cleanup over mir_sntprintf + small bug fix git-svn-id: http://svn.miranda-ng.org/main/trunk@11295 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TrafficCounter/src/TrafficCounter.cpp | 4 ++-- plugins/TrafficCounter/src/misc.cpp | 16 ++++++++-------- plugins/TrafficCounter/src/statistics.cpp | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'plugins/TrafficCounter') diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index d9947000f2..a463bb2f79 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -1142,7 +1142,7 @@ void NotifyOnSend(void) ppd.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); _tcsncpy(ppd.lptzContactName, TranslateT("Traffic counter notification"), MAX_CONTACTNAME); // - mir_sntprintf(ppd.lptzText, MAX_SECONDLINE, TranslateT("%d kilobytes sent"), + mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), TranslateT("%d kilobytes sent"), notify_send_size = OverallInfo.CurrentSentTraffic >> 10); // ppd.colorBack = Traffic_PopupBkColor; @@ -1161,7 +1161,7 @@ void NotifyOnRecv(void) ppd.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); _tcsncpy(ppd.lptzContactName, TranslateT("Traffic counter notification"),MAX_CONTACTNAME); // - mir_sntprintf(ppd.lptzText, MAX_SECONDLINE, TranslateT("%d kilobytes received"), + mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), TranslateT("%d kilobytes received"), notify_recv_size = OverallInfo.CurrentRecvTraffic >> 10); // ppd.colorBack = Traffic_PopupBkColor; diff --git a/plugins/TrafficCounter/src/misc.cpp b/plugins/TrafficCounter/src/misc.cpp index cf1215ec8a..afbc60e841 100644 --- a/plugins/TrafficCounter/src/misc.cpp +++ b/plugins/TrafficCounter/src/misc.cpp @@ -152,7 +152,7 @@ WORD GetFormattedTraffic(DWORD Value, BYTE Unit, TCHAR *Buffer, WORD Size) break; } - mir_sntprintf(Str1, 32, _T("%d.%d"), Value / Divider, Value % Divider); + mir_sntprintf(Str1, SIZEOF(Str1), _T("%d.%d"), Value / Divider, Value % Divider); l = GetNumberFormat(LOCALE_USER_DEFAULT, 0, Str1, &nf, NULL, 0); if (!l) return 0; l += _tcslen(szUnit) + 1; @@ -208,49 +208,49 @@ WORD GetDurationFormatM(DWORD Duration, TCHAR *Format, TCHAR *Buffer, WORD Size) if (!_tcscmp(Token, _T("d"))) { q = Duration / (60 * 60 * 24); - mir_sntprintf(Token, 256, _T("%d"), q); + mir_sntprintf(Token, SIZEOF(Token), _T("%d"), q); Duration -= q * 60 * 60 * 24; } else if (!_tcscmp(Token, _T("h"))) { q = Duration / (60 * 60); - mir_sntprintf(Token, 256, _T("%d"), q); + mir_sntprintf(Token, SIZEOF(Token), _T("%d"), q); Duration -= q * 60 * 60; } else if (!_tcscmp(Token, _T("hh"))) { q = Duration / (60 * 60); - mir_sntprintf(Token, 256, _T("%02d"), q); + mir_sntprintf(Token, SIZEOF(Token), _T("%02d"), q); Duration -= q * 60 * 60; } else if (!_tcscmp(Token, _T("m"))) { q = Duration / 60; - mir_sntprintf(Token, 256, _T("%d"), q); + mir_sntprintf(Token, SIZEOF(Token), _T("%d"), q); Duration -= q * 60; } else if (!_tcscmp(Token, _T("mm"))) { q = Duration / 60; - mir_sntprintf(Token, 256, _T("%02d"), q); + mir_sntprintf(Token, SIZEOF(Token), _T("%02d"), q); Duration -= q * 60; } else if (!_tcscmp(Token, _T("s"))) { q = Duration; - mir_sntprintf(Token, 256, _T("%d"), q); + mir_sntprintf(Token, SIZEOF(Token), _T("%d"), q); Duration -= q; } else if (!_tcscmp(Token, _T("ss"))) { q = Duration; - mir_sntprintf(Token, 256, _T("%02d"), q); + mir_sntprintf(Token, SIZEOF(Token), _T("%02d"), q); Duration -= q; } diff --git a/plugins/TrafficCounter/src/statistics.cpp b/plugins/TrafficCounter/src/statistics.cpp index 8d1e4025df..691adaae03 100644 --- a/plugins/TrafficCounter/src/statistics.cpp +++ b/plugins/TrafficCounter/src/statistics.cpp @@ -319,7 +319,7 @@ void Stat_ReadFile(BYTE n) pszPath = Utils_ReplaceVarsT(_T("%miranda_userdata%\\statistics")); CreateDirectoryTreeT(pszPath); - mir_sntprintf(FileName, MAX_PATH, _T("%s\\%S.stat"), pszPath, ProtoList[n].name); + mir_sntprintf(FileName, SIZEOF(FileName), _T("%s\\%S.stat"), pszPath, ProtoList[n].name); mir_free(pszPath); GetLocalTime(&stNow); ProtoList[n].hFile = CreateFile(FileName, GENERIC_READ | GENERIC_WRITE, -- cgit v1.2.3