diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-19 19:35:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-19 19:35:42 +0000 |
commit | 4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch) | |
tree | 9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /plugins/TabSRMM/src/generic_msghandlers.cpp | |
parent | f0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (diff) |
SIZEOF replaced with more secure analog - _countof
git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/generic_msghandlers.cpp')
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 13e8eaa563..0b0fcc1ac8 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -45,12 +45,12 @@ void TSAPI DM_SaveLogAsRTF(const TWindowData *dat) else if (dat) { TCHAR szFilter[MAX_PATH], szFilename[MAX_PATH]; mir_sntprintf(szFilter, _T("%s%c*.rtf%c%c"), TranslateT("Rich Edit file"), 0, 0, 0); - mir_sntprintf(szFilename, SIZEOF(szFilename), _T("%s.rtf"), dat->cache->getNick()); + mir_sntprintf(szFilename, _countof(szFilename), _T("%s.rtf"), dat->cache->getNick()); Utils::sanitizeFilename(szFilename); TCHAR szInitialDir[MAX_PATH + 2]; - mir_sntprintf(szInitialDir, SIZEOF(szInitialDir), _T("%s%s\\"), M.getDataPath(), _T("\\Saved message logs")); + mir_sntprintf(szInitialDir, _countof(szInitialDir), _T("%s%s\\"), M.getDataPath(), _T("\\Saved message logs")); CreateDirectoryTreeT(szInitialDir); OPENFILENAME ofn = { 0 }; @@ -613,7 +613,7 @@ static INT_PTR CALLBACK DlgProcAbout(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)&v); TCHAR tStr[80]; - mir_sntprintf(tStr, SIZEOF(tStr), _T("%s %d.%d.%d.%d [build %d]"), + mir_sntprintf(tStr, _countof(tStr), _T("%s %d.%d.%d.%d [build %d]"), TranslateT("Version"), __MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM, v[3]); SetDlgItemText(hwndDlg, IDC_HEADERBAR, tStr); } @@ -1001,7 +1001,7 @@ void TSAPI DM_LoadLocale(TWindowData *dat) if (!PluginConfig.m_bDontUseDefaultKbd) { TCHAR szBuf[20]; GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, szBuf, 20); - mir_sntprintf(szKLName, SIZEOF(szKLName), _T("0000%s"), szBuf); + mir_sntprintf(szKLName, _countof(szKLName), _T("0000%s"), szBuf); db_set_ts(dat->hContact, SRMSGMOD_T, "locale", szKLName); } else { @@ -1039,7 +1039,7 @@ void TSAPI DM_UpdateLastMessage(const TWindowData *dat) TCHAR szBuf[100]; if (dat->bShowTyping) { SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]); - mir_sntprintf(szBuf, SIZEOF(szBuf), TranslateT("%s is typing a message..."), dat->cache->getNick()); + mir_sntprintf(szBuf, _countof(szBuf), TranslateT("%s is typing a message..."), dat->cache->getNick()); } else if (dat->sbCustom) { SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, (LPARAM)dat->sbCustom->hIcon); @@ -1050,14 +1050,14 @@ void TSAPI DM_UpdateLastMessage(const TWindowData *dat) SendMessage(dat->pContainer->hwndStatus, SB_SETICON, 0, 0); if (dat->pContainer->dwFlags & CNT_UINSTATUSBAR) - mir_sntprintf(szBuf, SIZEOF(szBuf), _T("UID: %s"), dat->cache->getUIN()); + mir_sntprintf(szBuf, _countof(szBuf), _T("UID: %s"), dat->cache->getUIN()); else if (dat->lastMessage) { TCHAR date[64], time[64]; - TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("d"), date, SIZEOF(date), 0); + TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("d"), date, _countof(date), 0); if (dat->pContainer->dwFlags & CNT_UINSTATUSBAR && mir_tstrlen(date) > 6) date[mir_tstrlen(date) - 5] = 0; - TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("t"), time, SIZEOF(time), 0); - mir_sntprintf(szBuf, SIZEOF(szBuf), TranslateT("Last received: %s at %s"), date, time); + TimeZone_PrintTimeStamp(NULL, dat->lastMessage, _T("t"), time, _countof(time), 0); + mir_sntprintf(szBuf, _countof(szBuf), TranslateT("Last received: %s at %s"), date, time); } else szBuf[0] = 0; } @@ -1377,7 +1377,7 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff) dat->bShowTyping = 2; dat->nTypeSecs = 86400; - mir_sntprintf(dat->szStatusBar, SIZEOF(dat->szStatusBar), TranslateT("%s has entered text."), dat->cache->getNick()); + mir_sntprintf(dat->szStatusBar, _countof(dat->szStatusBar), TranslateT("%s has entered text."), dat->cache->getNick()); if (hwndStatus && dat->pContainer->hwndActive == hwndDlg) SendMessage(hwndStatus, SB_SETTEXT, 0, (LPARAM)dat->szStatusBar); } @@ -1402,7 +1402,7 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff) UpdateStatusBar(dat); } else if (dat->nTypeSecs > 0) { - mir_sntprintf(dat->szStatusBar, SIZEOF(dat->szStatusBar), TranslateT("%s is typing a message"), dat->cache->getNick()); + mir_sntprintf(dat->szStatusBar, _countof(dat->szStatusBar), TranslateT("%s is typing a message"), dat->cache->getNick()); dat->nTypeSecs--; if (hwndStatus && dat->pContainer->hwndActive == hwndDlg) { @@ -1595,7 +1595,7 @@ void TSAPI DM_EventAdded(TWindowData *dat, WPARAM hContact, LPARAM lParam) dat->hQueuedEvents[dat->iNextQueuedEvent++] = hDbEvent; TCHAR szBuf[100]; - mir_sntprintf(szBuf, SIZEOF(szBuf), TranslateT("Auto scrolling is disabled, %d message(s) queued (press F12 to enable it)"), + mir_sntprintf(szBuf, _countof(szBuf), TranslateT("Auto scrolling is disabled, %d message(s) queued (press F12 to enable it)"), dat->iNextQueuedEvent); SetDlgItemText(hwndDlg, IDC_LOGFROZENTEXT, szBuf); RedrawWindow(GetDlgItem(hwndDlg, IDC_LOGFROZENTEXT), NULL, NULL, RDW_INVALIDATE); @@ -1739,7 +1739,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam) if (lParam != 0) { if (PluginConfig.m_bCutContactNameOnTabs) - CutContactName(szNick, newcontactname, SIZEOF(newcontactname)); + CutContactName(szNick, newcontactname, _countof(newcontactname)); else _tcsncpy_s(newcontactname, szNick, _TRUNCATE); @@ -1747,7 +1747,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam) if (mir_tstrlen(newcontactname) != 0) { if (PluginConfig.m_bStatusOnTabs) - mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s (%s)"), newcontactname, dat->szStatus); + mir_sntprintf(newtitle, _countof(newtitle), _T("%s (%s)"), newcontactname, dat->szStatus); else _tcsncpy_s(newtitle, newcontactname, _TRUNCATE); } @@ -1759,11 +1759,11 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam) TCHAR fulluin[256]; if (dat->bIsMeta) - mir_sntprintf(fulluin, SIZEOF(fulluin), + mir_sntprintf(fulluin, _countof(fulluin), TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for user's details\nRight click for metacontact control\nClick dropdown to add or remove user from your favorites."), bHasName ? dat->cache->getUIN() : TranslateT("No UID")); else - mir_sntprintf(fulluin, SIZEOF(fulluin), + mir_sntprintf(fulluin, _countof(fulluin), TranslateT("UID: %s (SHIFT click -> copy to clipboard)\nClick for user's details\nClick dropdown to change this contact's favorite status."), bHasName ? dat->cache->getUIN() : TranslateT("No UID")); @@ -1775,7 +1775,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam) if (dat->idle != dwOldIdle || lParam != 0) { if (item.mask & TCIF_TEXT) { item.pszText = newtitle; - _tcsncpy(dat->newtitle, newtitle, SIZEOF(dat->newtitle)); + _tcsncpy(dat->newtitle, newtitle, _countof(dat->newtitle)); dat->newtitle[127] = 0; if (dat->pWnd) dat->pWnd->updateTitle(dat->cache->getNick()); |