summaryrefslogtreecommitdiff
path: root/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
commit4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch)
tree9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /plugins/HistoryLinkListPlus/src/linklist_fct.cpp
parentf0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (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/HistoryLinkListPlus/src/linklist_fct.cpp')
-rw-r--r--plugins/HistoryLinkListPlus/src/linklist_fct.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
index 8948ececc7..d7fefdaacb 100644
--- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
+++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp
@@ -115,14 +115,14 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart)
_tcsncpy_s(wordsearch, wordlen, msg + wordStart, (wordlen - 1));
CharLower(wordsearch);
- for (j = 0; j < SIZEOF(hyperlinkPrefixes); j ++) {
+ for (j = 0; j < _countof(hyperlinkPrefixes); j ++) {
if (!_tcsncmp(wordsearch, hyperlinkPrefixes[j], mir_tstrlen(hyperlinkPrefixes[j]))) {
isLink = 1;
break;
}
}
if (!isLink) {
- for (j = 0; j < SIZEOF(hyperlinkSubstrings); j ++) {
+ for (j = 0; j < _countof(hyperlinkSubstrings); j ++) {
if (_tcsstr(wordsearch + 1,hyperlinkSubstrings[j])) {
isLink = 1;
break;
@@ -142,14 +142,14 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart)
_tcsncpy_s(link, _T("http://"), _mstrlen(_T("http://")));
// Link longer than defined max -> cut link to max
if (wordlen > (LINK_MAX - _mstrlen(_T("http://"))))
- _tcsncpy_s((link + _mstrlen(_T("http://"))), (SIZEOF(link) - _mstrlen(_T("http://"))), word, LINK_MAX - _mstrlen(_T("http://")));
+ _tcsncpy_s((link + _mstrlen(_T("http://"))), (_countof(link) - _mstrlen(_T("http://"))), word, LINK_MAX - _mstrlen(_T("http://")));
else
- _tcsncpy_s((link + _mstrlen(_T("http://"))), (SIZEOF(link) - _mstrlen(_T("http://"))), word, wordlen);
+ _tcsncpy_s((link + _mstrlen(_T("http://"))), (_countof(link) - _mstrlen(_T("http://"))), word, wordlen);
} else {
_tcsncpy_s(link, word, ((wordlen > LINK_MAX) ? LINK_MAX : wordlen));
}
- TimeZone_ToStringT(dbei->timestamp, _T("d-t"), dbdate, SIZEOF(dbdate));
+ TimeZone_ToStringT(dbei->timestamp, _T("d-t"), dbdate, _countof(dbdate));
date_ptr = _tcstok_s(dbdate, _T("-"), &tok_ctx);
time_ptr = _tcstok_s(NULL, _T("-"), &tok_ctx);
_tcsncpy_s(date, date_ptr, _TRUNCATE);
@@ -164,7 +164,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart)
if (type == LINK_MAIL && _tcsstr(link, _T("mailto:")) == NULL) {
_tcsncpy_s(templink, link, _TRUNCATE);
_tcsncpy_s(link, _T("mailto:"), _TRUNCATE);
- _tcsncpy_s((link + _mstrlen(_T("mailto:"))), (SIZEOF(link) - _mstrlen(_T("mailto:"))), templink, _TRUNCATE);
+ _tcsncpy_s((link + _mstrlen(_T("mailto:"))), (_countof(link) - _mstrlen(_T("mailto:"))), templink, _TRUNCATE);
}
// Add new Element to list:
@@ -310,7 +310,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc
_tcscpy_s(cf.szFaceName, _T("Arial"));
SendDlgItemMessage( hDlg, IDC_MAIN, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) &cf);
- mir_sntprintf(searchText, SIZEOF(searchText), _T("%s '%s': %d\n\n"), TranslateT("Matches for searchtext"), searchString, listCount);
+ mir_sntprintf(searchText, _countof(searchText), _T("%s '%s': %d\n\n"), TranslateT("Matches for searchtext"), searchString, listCount);
SendDlgItemMessage(hDlg, IDC_MAIN, EM_REPLACESEL, FALSE, (LPARAM)searchText);
linePos += 2;
}
@@ -459,7 +459,7 @@ void WriteLinkList(HWND hDlg, BYTE params, LISTELEMENT *listStart, LPCTSTR searc
type = _T("[UNK ]");
}
- mir_sntprintf(textLine, SIZEOF(textLine), _T("%s%s%s%s%s%s%s\n"),
+ mir_sntprintf(textLine, _countof(textLine), _T("%s%s%s%s%s%s%s\n"),
options.showDirection ? (actualElement->direction==DIRECTION_IN?_T("[in ]"):_T("[out]")) : _T(""),
options.showDirection? _T(" ") : _T(""),
options.showType ? type : _T(""),
@@ -1254,7 +1254,7 @@ BOOL SaveEditAsStream( HWND hDlg )
mir_sntprintf(temp, _T("%s (*.rtf)%c*.rtf%c%s (*.*)%c*.*%c%c"), TranslateT("RTF file"), 0, 0, TranslateT("All files"), 0, 0, 0);
ofn.lpstrFilter = temp;
ofn.lpstrFile = szFilename;
- ofn.nMaxFile = SIZEOF(szFilename);
+ ofn.nMaxFile = _countof(szFilename);
ofn.lpstrTitle = TranslateT("Save RTF File");
ofn.Flags = OFN_OVERWRITEPROMPT;
// Get a filename or quit