summaryrefslogtreecommitdiff
path: root/plugins/SmileyAdd/src
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/SmileyAdd/src
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/SmileyAdd/src')
-rw-r--r--plugins/SmileyAdd/src/dlgboxsubclass.cpp6
-rw-r--r--plugins/SmileyAdd/src/general.cpp2
-rw-r--r--plugins/SmileyAdd/src/options.cpp6
-rw-r--r--plugins/SmileyAdd/src/smileyroutines.cpp2
-rw-r--r--plugins/SmileyAdd/src/smileys.cpp14
5 files changed, 15 insertions, 15 deletions
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
index fb3ecbb303..06fe5e161e 100644
--- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp
+++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp
@@ -149,12 +149,12 @@ public:
{
TCHAR szClassName[32] = _T("");
- GetClassName(hwnd, szClassName, SIZEOF(szClassName));
+ GetClassName(hwnd, szClassName, _countof(szClassName));
if (mir_tstrcmp(szClassName, _T("#32770")))
return false;
if ((REdit = GetDlgItem(hwnd, MI_IDC_LOG)) != NULL) {
- GetClassName(REdit, szClassName, SIZEOF(szClassName));
+ GetClassName(REdit, szClassName, _countof(szClassName));
if (mir_tstrcmp(szClassName, _T("RichEdit20A")) != 0 &&
mir_tstrcmp(szClassName, _T("RichEdit20W")) != 0 &&
mir_tstrcmp(szClassName, _T("RICHEDIT50W")) != 0)
@@ -163,7 +163,7 @@ public:
else return false;
if ((MEdit = GetDlgItem(hwnd, MI_IDC_MESSAGE)) != NULL) {
- GetClassName(MEdit, szClassName, SIZEOF(szClassName));
+ GetClassName(MEdit, szClassName, _countof(szClassName));
if (mir_tstrcmp(szClassName, _T("Edit")) != 0 &&
mir_tstrcmp(szClassName, _T("RichEdit20A")) != 0 &&
mir_tstrcmp(szClassName, _T("RichEdit20W")) != 0 &&
diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp
index 6f2f161101..fd4bca89cc 100644
--- a/plugins/SmileyAdd/src/general.cpp
+++ b/plugins/SmileyAdd/src/general.cpp
@@ -140,7 +140,7 @@ void pathToAbsolute(const CMString& pSrc, CMString& pOut)
TCHAR *szVarPath = Utils_ReplaceVarsT(pSrc.c_str());
if (szVarPath == (TCHAR*)CALLSERVICE_NOTFOUND || szVarPath == NULL) {
TCHAR szExpPath[MAX_PATH];
- ExpandEnvironmentStrings(pSrc.c_str(), szExpPath, SIZEOF(szExpPath));
+ ExpandEnvironmentStrings(pSrc.c_str(), szExpPath, _countof(szExpPath));
PathToAbsoluteT(szExpPath, szOutPath);
}
else {
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp
index d6086dd8f2..779e988246 100644
--- a/plugins/SmileyAdd/src/options.cpp
+++ b/plugins/SmileyAdd/src/options.cpp
@@ -247,7 +247,7 @@ void OptionsDialogType::AddCategory(void)
{
TCHAR cat[30];
- GetDlgItemText(m_hwndDialog, IDC_NEWCATEGORY, cat, SIZEOF(cat));
+ GetDlgItemText(m_hwndDialog, IDC_NEWCATEGORY, cat, _countof(cat));
CMString catd = cat;
if (!catd.IsEmpty()) {
@@ -517,7 +517,7 @@ bool OptionsDialogType::BrowseForSmileyPacks(int item)
TCHAR filename[MAX_PATH] = _T("");
ofn.lpstrFile = filename;
- ofn.nMaxFile = SIZEOF(filename);
+ ofn.nMaxFile = _countof(filename);
CMString inidir;
SmileyCategoryType* smc = tmpsmcat.GetSmileyCategory(item);
@@ -564,7 +564,7 @@ bool OptionsDialogType::BrowseForSmileyPacks(int item)
void OptionsDialogType::FilenameChanged(void)
{
TCHAR str[MAX_PATH];
- GetDlgItemText(m_hwndDialog, IDC_FILENAME, str, SIZEOF(str));
+ GetDlgItemText(m_hwndDialog, IDC_FILENAME, str, _countof(str));
SmileyCategoryType* smc = tmpsmcat.GetSmileyCategory(GetSelProto());
if (smc->GetFilename() != str) {
diff --git a/plugins/SmileyAdd/src/smileyroutines.cpp b/plugins/SmileyAdd/src/smileyroutines.cpp
index 268a65cef4..20b7dcc85d 100644
--- a/plugins/SmileyAdd/src/smileyroutines.cpp
+++ b/plugins/SmileyAdd/src/smileyroutines.cpp
@@ -235,7 +235,7 @@ void ReplaceSmileys(HWND hwnd, SmileyPackType* smp, SmileyPackCType* smcp, const
TextDocument->Freeze(&cnt);
TCHAR classname[20];
- GetClassName(hwnd, classname, SIZEOF(classname));
+ GetClassName(hwnd, classname, _countof(classname));
bool ishpp = (_tcsncmp(classname, _T("THppRichEdit"), 12) == 0) || fireView;
SetRichCallback(hwnd, NULL, false, true);
diff --git a/plugins/SmileyAdd/src/smileys.cpp b/plugins/SmileyAdd/src/smileys.cpp
index 3c568b9735..c2dc9626e6 100644
--- a/plugins/SmileyAdd/src/smileys.cpp
+++ b/plugins/SmileyAdd/src/smileys.cpp
@@ -310,7 +310,7 @@ bool SmileyPackType::LoadSmileyFile(const CMString& filename, bool onlyInfo, boo
if (!noerr) {
static const TCHAR errmsg[] = LPGENT("Smiley pack %s not found.\nSelect correct smiley pack in the Options -> Customize -> Smileys.");
TCHAR msgtxt[1024];
- mir_sntprintf(msgtxt, SIZEOF(msgtxt), TranslateTS(errmsg), modpath.c_str());
+ mir_sntprintf(msgtxt, _countof(msgtxt), TranslateTS(errmsg), modpath.c_str());
ReportError(msgtxt);
}
@@ -473,7 +473,7 @@ bool SmileyPackType::LoadSmileyFileMSL(CMString& tbuf, bool onlyInfo, CMString&
if (!noerr) {
static const TCHAR errmsg[] = LPGENT("Smiley #%u in file %s for smiley pack %s not found.");
TCHAR msgtxt[1024];
- mir_sntprintf(msgtxt, SIZEOF(msgtxt), TranslateTS(errmsg), smnum, resname.c_str(), modpath.c_str());
+ mir_sntprintf(msgtxt, _countof(msgtxt), TranslateTS(errmsg), smnum, resname.c_str(), modpath.c_str());
CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, _T2A(msgtxt));
errorFound = true;
}
@@ -855,7 +855,7 @@ void SmileyCategoryListType::AddAccountAsCategory(PROTOACCOUNT *acc, const CMStr
packnam = "MSN";
char path[MAX_PATH];
- mir_snprintf(path, SIZEOF(path), "Smileys\\nova\\%s.msl", packnam);
+ mir_snprintf(path, _countof(path), "Smileys\\nova\\%s.msl", packnam);
paths = A2T_SM(path);
CMString patha;
@@ -882,7 +882,7 @@ void SmileyCategoryListType::AddProtoAsCategory(char *acc, const CMString& defau
packnam = "MSN";
char path[MAX_PATH];
- mir_snprintf(path, SIZEOF(path), "Smileys\\nova\\%s.msl", packnam);
+ mir_snprintf(path, _countof(path), "Smileys\\nova\\%s.msl", packnam);
CMString paths = A2T_SM(path), patha;
pathToAbsolute(paths, patha);
@@ -953,7 +953,7 @@ void SmileyCategoryListType::AddContactTransportAsCategory(MCONTACT hContact, co
CMString displayName = dbv.ptszVal;
if (packname != NULL) {
char path[MAX_PATH];
- mir_snprintf(path, SIZEOF(path), "Smileys\\nova\\%s.msl", packname);
+ mir_snprintf(path, _countof(path), "Smileys\\nova\\%s.msl", packname);
CMString paths = A2T_SM(path), patha;
pathToAbsolute(paths, patha);
@@ -1033,13 +1033,13 @@ SmileyLookup::SmileyLookup(const CMString& str, const bool regexs, const int ind
matcher->getStartingIndex() != matcher->getEndingIndex());
if (!m_valid) {
static const TCHAR errmsg[] = LPGENT("Regular expression \"%s\" in smiley pack \"%s\" could produce \"empty matches\".");
- mir_sntprintf(msgtxt, SIZEOF(msgtxt), TranslateTS(errmsg), str.c_str(), smpt.c_str());
+ mir_sntprintf(msgtxt, _countof(msgtxt), TranslateTS(errmsg), str.c_str(), smpt.c_str());
}
delete matcher;
}
else {
static const TCHAR errmsg[] = LPGENT("Regular expression \"%s\" in smiley pack \"%s\" malformed.") ;
- mir_sntprintf(msgtxt, SIZEOF(msgtxt), TranslateTS(errmsg), str.c_str(), smpt.c_str());
+ mir_sntprintf(msgtxt, _countof(msgtxt), TranslateTS(errmsg), str.c_str(), smpt.c_str());
}
if (!m_valid)