From 4c814798c7bc7f6a0f92c21b027b26290622aa2f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Jun 2015 19:35:42 +0000 Subject: SIZEOF replaced with more secure analog - _countof git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewXstatusNotify/src/xstatus.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'plugins/NewXstatusNotify/src/xstatus.cpp') diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index e89551ab6c..dcc0640267 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -226,7 +226,7 @@ void BlinkXStatusIcon(XSTATUSCHANGE *xsc) HICON hIcon = NULL; TCHAR str[256] = { 0 }; TCHAR stzType[32]; - mir_sntprintf(str, SIZEOF(str), TranslateT("%s changed %s"), pcli->pfnGetContactDisplayName(xsc->hContact, 0), GetStatusTypeAsString(xsc->type, stzType)); + mir_sntprintf(str, _countof(str), TranslateT("%s changed %s"), pcli->pfnGetContactDisplayName(xsc->hContact, 0), GetStatusTypeAsString(xsc->type, stzType)); if (opt.BlinkIcon_Status) { DBVARIANT dbv; @@ -289,7 +289,7 @@ void LogChangeToDB(XSTATUSCHANGE *xsc) TCHAR stzLastLog[2 * MAX_TEXT_LEN]; CMString stzLogText(ReplaceVars(xsc, Template)); - DBGetStringDefault(xsc->hContact, MODULE, DB_LASTLOG, stzLastLog, SIZEOF(stzLastLog), _T("")); + DBGetStringDefault(xsc->hContact, MODULE, DB_LASTLOG, stzLastLog, _countof(stzLastLog), _T("")); if (opt.XLogToDB) { db_set_ws(xsc->hContact, MODULE, DB_LASTLOG, stzLogText); @@ -322,8 +322,8 @@ void LogChangeToFile(XSTATUSCHANGE *xsc) TCHAR stzDate[32], stzTime[32], stzText[MAX_TEXT_LEN]; - 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)); + GetTimeFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("HH':'mm"), stzTime, _countof(stzTime)); + GetDateFormat(LOCALE_USER_DEFAULT, 0, NULL, _T("dd/MM/yyyy"), stzDate, _countof(stzDate)); TCHAR *Template = _T(""); switch (xsc->action) { @@ -337,7 +337,7 @@ void LogChangeToFile(XSTATUSCHANGE *xsc) Template = templates.LogXMsgRemoved; break; } - mir_sntprintf(stzText, SIZEOF(stzText), _T("%s, %s. %s %s\r\n"), stzDate, stzTime, + mir_sntprintf(stzText, _countof(stzText), _T("%s, %s. %s %s\r\n"), stzDate, stzTime, pcli->pfnGetContactDisplayName(xsc->hContact, 0), ReplaceVars(xsc, Template).GetString()); LogToFile(stzText); @@ -369,8 +369,8 @@ void ExtraStatusChanged(XSTATUSCHANGE *xsc) if (opt.AutoDisable) { char statusIDs[12], statusIDp[12]; WORD myStatus = (WORD)CallProtoService(xsc->szProto, PS_GETSTATUS, 0, 0); - mir_snprintf(statusIDs, SIZEOF(statusIDs), "s%d", myStatus); - mir_snprintf(statusIDp, SIZEOF(statusIDp), "p%d", myStatus); + mir_snprintf(statusIDs, _countof(statusIDs), "s%d", myStatus); + mir_snprintf(statusIDp, _countof(statusIDp), "p%d", myStatus); bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : bEnableSound; bEnablePopup = db_get_b(0, MODULE, statusIDp, 1) ? FALSE : bEnablePopup; } @@ -480,22 +480,22 @@ void AddXStatusEventThread(void *arg) TCHAR stzTitle[MAX_TITLE_LEN], stzText[MAX_TEXT_LEN]; if (ProtoServiceExists(szProto, JS_PARSE_XMPP_URI)) { - GetJabberAdvStatusText(hContact, szProto, "mood", "title", stzTitle, SIZEOF(stzTitle)); + GetJabberAdvStatusText(hContact, szProto, "mood", "title", stzTitle, _countof(stzTitle)); if (stzTitle[0]) { - GetJabberAdvStatusText(hContact, szProto, "mood", "text", stzText, SIZEOF(stzText)); + GetJabberAdvStatusText(hContact, szProto, "mood", "text", stzText, _countof(stzText)); LogXstatusChange(hContact, szProto, TYPE_JABBER_MOOD, stzTitle, stzText); } - GetJabberAdvStatusText(hContact, szProto, "activity", "title", stzTitle, SIZEOF(stzTitle)); + GetJabberAdvStatusText(hContact, szProto, "activity", "title", stzTitle, _countof(stzTitle)); if (stzTitle[0]) { - GetJabberAdvStatusText(hContact, szProto, "activity", "text", stzText, SIZEOF(stzText)); + GetJabberAdvStatusText(hContact, szProto, "activity", "text", stzText, _countof(stzText)); LogXstatusChange(hContact, szProto, TYPE_JABBER_ACTIVITY, stzTitle, stzText); } } else { - GetIcqXStatus(hContact, szProto, "XStatusName", stzTitle, SIZEOF(stzTitle)); + GetIcqXStatus(hContact, szProto, "XStatusName", stzTitle, _countof(stzTitle)); if (stzTitle[0]) { - GetIcqXStatus(hContact, szProto, "XStatusMsg", stzText, SIZEOF(stzText)); + GetIcqXStatus(hContact, szProto, "XStatusMsg", stzText, _countof(stzText)); LogXstatusChange(hContact, szProto, TYPE_ICQ_XSTATUS, stzTitle, stzText); } } -- cgit v1.2.3