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/Weather/src/weather_ini.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/Weather/src/weather_ini.cpp')
-rw-r--r-- | plugins/Weather/src/weather_ini.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index 9e636102dd..c89472cb2c 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -178,12 +178,12 @@ bool LoadWIData(bool dial) // find all *.ini file in the plugin\weather directory
TCHAR szSearchPath[MAX_PATH], FileName[MAX_PATH];
- GetModuleFileName(GetModuleHandle(NULL), szSearchPath, SIZEOF(szSearchPath));
+ GetModuleFileName(GetModuleHandle(NULL), szSearchPath, _countof(szSearchPath));
TCHAR *chop = _tcsrchr(szSearchPath, '\\');
if (chop == NULL)
return false;
*chop = '\0';
- mir_tstrncat(szSearchPath, _T("\\Plugins\\Weather\\*.ini"), SIZEOF(szSearchPath) - mir_tstrlen(szSearchPath));
+ mir_tstrncat(szSearchPath, _T("\\Plugins\\Weather\\*.ini"), _countof(szSearchPath) - mir_tstrlen(szSearchPath));
_tcsncpy(FileName, szSearchPath, MAX_PATH - 1);
WIN32_FIND_DATA fd;
@@ -195,7 +195,7 @@ bool LoadWIData(bool dial) do {
chop = _tcsrchr(FileName, '\\');
chop[1] = '\0';
- mir_tstrncat(FileName, fd.cFileName, SIZEOF(FileName) - mir_tstrlen(FileName));
+ mir_tstrncat(FileName, fd.cFileName, _countof(FileName) - mir_tstrlen(FileName));
if ( mir_tstrcmpi(fd.cFileName, _T("SAMPLE_INI.INI"))) {
WIDATA Data;
LoadStationData(FileName, fd.cFileName, &Data);
@@ -253,7 +253,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data) FILE *pfile = _tfsopen(pszFile, _T("rt"), _SH_DENYWR);
if (pfile != NULL) {
char Line[4096];
- fgets(Line, SIZEOF(Line), pfile);
+ fgets(Line, _countof(Line), pfile);
TrimString(Line);
// make sure it is a valid weather protocol ini file
@@ -274,7 +274,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data) else
{
TCHAR str[4096];
- mir_sntprintf(str, SIZEOF(str), TranslateT("Invalid ini format for: %s"), pszFile);
+ mir_sntprintf(str, _countof(str), TranslateT("Invalid ini format for: %s"), pszFile);
MessageBox(NULL, str, TranslateT("Weather Protocol"), MB_OK|MB_ICONERROR);
fclose(pfile);
return;
@@ -338,7 +338,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data) while (!feof(pfile)) {
// determine current tag
- if (fgets(Line, SIZEOF(Line), pfile) == NULL)
+ if (fgets(Line, _countof(Line), pfile) == NULL)
break;
TrimString(Line);
@@ -563,11 +563,11 @@ INT_PTR CALLBACK DlgProcSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case IDC_STEP2:
{
TCHAR szPath[1024];
- GetModuleFileName(GetModuleHandle(NULL), szPath, SIZEOF(szPath));
+ GetModuleFileName(GetModuleHandle(NULL), szPath, _countof(szPath));
TCHAR *chop = _tcsrchr(szPath, '\\');
if (chop) {
*chop = '\0';
- mir_tstrncat(szPath, _T("\\Plugins\\weather\\"), SIZEOF(szPath) - mir_tstrlen(szPath));
+ mir_tstrncat(szPath, _T("\\Plugins\\weather\\"), _countof(szPath) - mir_tstrlen(szPath));
_tmkdir(szPath);
ShellExecute((HWND)lParam, _T("open"), szPath, _T(""), _T(""), SW_SHOW);
}
|