summaryrefslogtreecommitdiff
path: root/plugins/SplashScreen/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/SplashScreen/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/SplashScreen/src')
-rw-r--r--plugins/SplashScreen/src/debug.h2
-rw-r--r--plugins/SplashScreen/src/main.cpp16
-rw-r--r--plugins/SplashScreen/src/options.cpp16
-rw-r--r--plugins/SplashScreen/src/services.cpp2
-rw-r--r--plugins/SplashScreen/src/splash.cpp8
5 files changed, 22 insertions, 22 deletions
diff --git a/plugins/SplashScreen/src/debug.h b/plugins/SplashScreen/src/debug.h
index f96d0ff728..c60109a533 100644
--- a/plugins/SplashScreen/src/debug.h
+++ b/plugins/SplashScreen/src/debug.h
@@ -17,7 +17,7 @@ int inline _DebugPopup(MCONTACT hContact, TCHAR *fmt, ...)
TCHAR debug[1024];
va_start(va, fmt);
- mir_sntprintf(debug, SIZEOF(debug), fmt, va);
+ mir_sntprintf(debug, _countof(debug), fmt, va);
if(CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) == 1) {
POPUPDATAT ppd = { 0 };
diff --git a/plugins/SplashScreen/src/main.cpp b/plugins/SplashScreen/src/main.cpp
index e08d070729..1633baeccc 100644
--- a/plugins/SplashScreen/src/main.cpp
+++ b/plugins/SplashScreen/src/main.cpp
@@ -66,11 +66,11 @@ void SplashMain()
{
// Retrive path to exe of current running Miranda is located
szMirDir = Utils_ReplaceVarsT(_T("%miranda_path%"));
- mir_sntprintf(szhAdvaimgPath, SIZEOF(szhAdvaimgPath), _T("%s\\plugins\\advaimg.dll"), szMirDir);
+ mir_sntprintf(szhAdvaimgPath, _countof(szhAdvaimgPath), _T("%s\\plugins\\advaimg.dll"), szMirDir);
CallService(MS_SYSTEM_GETVERSIONTEXT, MAX_PATH, (LPARAM)szVersion);
#ifdef _DEBUG
- mir_sntprintf(szLogFile, SIZEOF(szLogFile), _T("%s\\%s.log"), szMirDir, _T(__PLUGIN_NAME));
+ mir_sntprintf(szLogFile, _countof(szLogFile), _T("%s\\%s.log"), szMirDir, _T(__PLUGIN_NAME));
initLog();
TCHAR *mirandaVerString = mir_a2t(szVersion);
logMessage(_T("Miranda version"), mirandaVerString);
@@ -102,13 +102,13 @@ void SplashMain()
mir_tstrcpy(inBuf, _T("splash\\splash.png"));
TCHAR szExpandedSplashFile[MAX_PATH];
- ExpandEnvironmentStrings(inBuf, szExpandedSplashFile, SIZEOF(szExpandedSplashFile));
+ ExpandEnvironmentStrings(inBuf, szExpandedSplashFile, _countof(szExpandedSplashFile));
mir_tstrcpy(inBuf, szExpandedSplashFile);
TCHAR *pos3 = 0;
pos3 = _tcsrchr(inBuf, _T(':'));
if (pos3 == NULL)
- mir_sntprintf(szSplashFile, SIZEOF(szSplashFile), _T("%s\\%s"), szMirDir, inBuf);
+ mir_sntprintf(szSplashFile, _countof(szSplashFile), _T("%s\\%s"), szMirDir, inBuf);
else
mir_tstrcpy(szSplashFile, inBuf);
@@ -121,13 +121,13 @@ void SplashMain()
mir_tstrcpy(inBuf, _T("sounds\\startup.wav"));
TCHAR szExpandedSoundFile[MAX_PATH];
- ExpandEnvironmentStrings(inBuf, szExpandedSoundFile, SIZEOF(szExpandedSoundFile));
+ ExpandEnvironmentStrings(inBuf, szExpandedSoundFile, _countof(szExpandedSoundFile));
mir_tstrcpy(inBuf, szExpandedSoundFile);
TCHAR *pos2;
pos2 = _tcschr(inBuf, _T(':'));
if (pos2 == NULL)
- mir_sntprintf(szSoundFile, SIZEOF(szSoundFile), _T("%s\\%s"), szMirDir, inBuf);
+ mir_sntprintf(szSoundFile, _countof(szSoundFile), _T("%s\\%s"), szMirDir, inBuf);
else
mir_tstrcpy(szSoundFile, inBuf);
@@ -150,7 +150,7 @@ void SplashMain()
p = _tcsrchr(szSplashDir, _T('\\'));
if (p) *p = 0;
// create the search filter
- mir_sntprintf(szSearch, SIZEOF(szSearch), _T("%s\\*.*"), szSplashDir);
+ mir_sntprintf(szSearch, _countof(szSearch), _T("%s\\*.*"), szSplashDir);
// FFFN will return filenames
HANDLE hFind = INVALID_HANDLE_VALUE;
WIN32_FIND_DATA ffd;
@@ -187,7 +187,7 @@ void SplashMain()
int r = 0;
if (filescount) r = (rand() % filescount) + 1;
- mir_sntprintf(szSplashFile, SIZEOF(szSplashFile), _T("%s\\%s"), szSplashDir, files[r - 1]);
+ mir_sntprintf(szSplashFile, _countof(szSplashFile), _T("%s\\%s"), szSplashDir, files[r - 1]);
#ifdef _DEBUG
logMessage(_T("final file"), szSplashFile);
diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp
index 84dd4618e9..5771ec58de 100644
--- a/plugins/SplashScreen/src/options.cpp
+++ b/plugins/SplashScreen/src/options.cpp
@@ -194,7 +194,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
TCHAR tmp[MAX_PATH];
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.png, *.bmp)%c*.png;*.bmp%c%c"), TranslateT("Graphic files"), 0, 0, 0);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (*.png, *.bmp)%c*.png;*.bmp%c%c"), TranslateT("Graphic files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
ofn.hwndOwner = 0;
ofn.lpstrFile = szTempPath;
@@ -258,7 +258,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
TCHAR tmp[MAX_PATH];
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s (*.wav, *.mp3)%c*.wav;*.mp3%c%c"), TranslateT("Sound Files"), 0, 0, 0);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s (*.wav, *.mp3)%c*.wav;*.mp3%c%c"), TranslateT("Sound Files"), 0, 0, 0);
ofn.lpstrFilter = tmp;
ofn.hwndOwner = 0;
ofn.lpstrFile = szTempPath;
@@ -308,25 +308,25 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
{
TCHAR tmp[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_SPLASHPATH, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_SPLASHPATH, tmp, _countof(tmp));
db_set_ts(NULL, MODNAME, "Path", tmp);
- GetDlgItemText(hwndDlg, IDC_SNDPATH, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_SNDPATH, tmp, _countof(tmp));
db_set_ts(NULL, MODNAME, "Sound", tmp);
- GetDlgItemText(hwndDlg, IDC_VERSIONPREFIX, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_VERSIONPREFIX, tmp, _countof(tmp));
db_set_ts(NULL, MODNAME, "VersionPrefix", tmp);
mir_tstrcpy(szPrefix, tmp);
- GetDlgItemText(hwndDlg, IDC_SHOWTIME, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_SHOWTIME, tmp, _countof(tmp));
db_set_dw(NULL, MODNAME, "TimeToShow", _ttoi(tmp));
options.showtime = _ttoi(tmp);
- GetDlgItemText(hwndDlg, IDC_FISTEP, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_FISTEP, tmp, _countof(tmp));
db_set_dw(NULL, MODNAME, "FadeinSpeed", _ttoi(tmp));
options.fisteps = _ttoi(tmp);
- GetDlgItemText(hwndDlg, IDC_FOSTEP, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_FOSTEP, tmp, _countof(tmp));
db_set_dw(NULL, MODNAME, "FadeoutSpeed", _ttoi(tmp));
options.fosteps = _ttoi(tmp);
diff --git a/plugins/SplashScreen/src/services.cpp b/plugins/SplashScreen/src/services.cpp
index ee80c9639f..beecc04357 100644
--- a/plugins/SplashScreen/src/services.cpp
+++ b/plugins/SplashScreen/src/services.cpp
@@ -31,7 +31,7 @@ INT_PTR ShowSplashService(WPARAM wparam, LPARAM lparam)
TCHAR *pos = _tcsrchr(filename, _T(':'));
if (pos == NULL)
- mir_sntprintf(szSplashFile, SIZEOF(szSplashFile), _T("%s\\%s"), szMirDir, filename);
+ mir_sntprintf(szSplashFile, _countof(szSplashFile), _T("%s\\%s"), szMirDir, filename);
else
mir_tstrcpy(szSplashFile, filename);
diff --git a/plugins/SplashScreen/src/splash.cpp b/plugins/SplashScreen/src/splash.cpp
index 8f885a74e9..cfbb7b88b4 100644
--- a/plugins/SplashScreen/src/splash.cpp
+++ b/plugins/SplashScreen/src/splash.cpp
@@ -42,9 +42,9 @@ LRESULT CALLBACK SplashWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
#ifdef _DEBUG
TCHAR b[40];
- mir_sntprintf(b, SIZEOF(b), _T("%d"), wParam);
+ mir_sntprintf(b, _countof(b), _T("%d"), wParam);
logMessage(_T("Timer ID"), b);
- mir_sntprintf(b, SIZEOF(b), _T("%d"), options.showtime);
+ mir_sntprintf(b, _countof(b), _T("%d"), options.showtime);
logMessage(_T("ShowTime value"), b);
#endif
@@ -229,7 +229,7 @@ void __cdecl SplashThread(void *arg)
TCHAR verString[256] = { 0 };
TCHAR *mirandaVerString = mir_a2t(szVersion);
- mir_sntprintf(verString, SIZEOF(verString), _T("%s%s"), szPrefix, mirandaVerString);
+ mir_sntprintf(verString, _countof(verString), _T("%s%s"), szPrefix, mirandaVerString);
mir_free(mirandaVerString);
LOGFONT lf = { 0 };
lf.lfHeight = 14;
@@ -327,7 +327,7 @@ BOOL ShowSplash(BOOL bpreview)
timeout = options.showtime;
#ifdef _DEBUG
TCHAR b[40];
- mir_sntprintf(b, SIZEOF(b), _T("%d"), options.showtime);
+ mir_sntprintf(b, _countof(b), _T("%d"), options.showtime);
logMessage(_T("Timeout"), b);
#endif
}