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 --- protocols/Twitter/src/proto.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'protocols/Twitter/src/proto.cpp') diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 752a3f78a2..c9bd871c80 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -45,7 +45,7 @@ TwitterProto::TwitterProto(const char *proto_name, const TCHAR *username) : // Initialize hotkeys char text[512]; - mir_snprintf(text, SIZEOF(text), "%s/Tweet", m_szModuleName); + mir_snprintf(text, _countof(text), "%s/Tweet", m_szModuleName); HOTKEYDESC hkd = { sizeof(hkd) }; hkd.pszName = text; @@ -332,7 +332,7 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) // Create avatar network connection (TODO: probably remove this) char module[512]; - mir_snprintf(module, SIZEOF(module), "%sAv", m_szModuleName); + mir_snprintf(module, _countof(module), "%sAv", m_szModuleName); nlu.szSettingsModule = module; mir_sntprintf(descr, TranslateT("%s avatar connection"), m_tszUserName); nlu.ptszDescriptiveName = descr; @@ -387,7 +387,7 @@ int TwitterProto::ShowPinDialog() void TwitterProto::ShowPopup(const wchar_t *text, int Error) { POPUPDATAT popup = {}; - mir_sntprintf(popup.lptzContactName, SIZEOF(popup.lptzContactName), TranslateT("%s Protocol"), m_tszUserName); + mir_sntprintf(popup.lptzContactName, _countof(popup.lptzContactName), TranslateT("%s Protocol"), m_tszUserName); wcsncpy_s(popup.lptzText, text, _TRUNCATE); if (Error) { @@ -405,8 +405,8 @@ void TwitterProto::ShowPopup(const wchar_t *text, int Error) void TwitterProto::ShowPopup(const char *text, int Error) { POPUPDATAT popup = {}; - mir_sntprintf(popup.lptzContactName, SIZEOF(popup.lptzContactName), TranslateT("%s Protocol"), m_tszUserName); - mbcs_to_tcs(CP_UTF8, text, popup.lptzText, SIZEOF(popup.lptzText)); + mir_sntprintf(popup.lptzContactName, _countof(popup.lptzContactName), TranslateT("%s Protocol"), m_tszUserName); + mbcs_to_tcs(CP_UTF8, text, popup.lptzText, _countof(popup.lptzText)); if (Error) { popup.iSeconds = -1; popup.colorBack = 0x000000FF; @@ -429,7 +429,7 @@ void TwitterProto::SendTweetWorker(void *p) char *text = static_cast(p); if (mir_strlen(text) > 140) { // looks like the chat max outgoing msg thing doesn't work, so i'll do it here. TCHAR errorPopup[280]; - mir_sntprintf(errorPopup, SIZEOF(errorPopup), _T("Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?"), mir_strlen(text)); + mir_sntprintf(errorPopup, _countof(errorPopup), _T("Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?"), mir_strlen(text)); ShowPopup(errorPopup, 1); return; } @@ -462,7 +462,7 @@ void TwitterProto::UpdateSettings() std::tstring TwitterProto::GetAvatarFolder() { TCHAR path[MAX_PATH]; - mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), VARST(_T("%miranda_avatarcache%")), m_tszUserName); + mir_sntprintf(path, _countof(path), _T("%s\\%s"), VARST(_T("%miranda_avatarcache%")), m_tszUserName); return path; } -- cgit v1.2.3