From 4c814798c7bc7f6a0f92c21b027b26290622aa2f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Jun 2015 19:35:42 +0000 Subject: SIZEOF replaced with more secure analog - _countof git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/m_icolib.cpp | 8 ++++---- plugins/MirLua/src/mlua_loader.cpp | 4 ++-- plugins/MirLua/src/mlua_options.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'plugins/MirLua/src') diff --git a/plugins/MirLua/src/m_icolib.cpp b/plugins/MirLua/src/m_icolib.cpp index e3bbe36b54..1ff2b97f53 100644 --- a/plugins/MirLua/src/m_icolib.cpp +++ b/plugins/MirLua/src/m_icolib.cpp @@ -3,10 +3,10 @@ static int lua_AddIcon(lua_State *L) { TCHAR filePath[MAX_PATH]; - GetModuleFileName(g_hInstance, filePath, SIZEOF(filePath)); + GetModuleFileName(g_hInstance, filePath, _countof(filePath)); char iconName[MAX_PATH]; - mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, luaL_checkstring(L, 1)); + mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, luaL_checkstring(L, 1)); SKINICONDESC si = { 0 }; si.flags = SIDF_PATH_TCHAR; @@ -25,7 +25,7 @@ static int lua_AddIcon(lua_State *L) static int lua_GetIcon(lua_State *L) { char iconName[MAX_PATH]; - mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, luaL_checkstring(L, 1)); + mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, luaL_checkstring(L, 1)); HANDLE res = ::IcoLib_GetIconHandle(iconName); lua_pushlightuserdata(L, res); @@ -42,7 +42,7 @@ static int lua_RemoveIcon(lua_State *L) else if (lua_isstring(L, 1)) { char iconName[MAX_PATH]; - mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, lua_tostring(L, 1)); + mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, lua_tostring(L, 1)); ::IcoLib_RemoveIcon(iconName); } else diff --git a/plugins/MirLua/src/mlua_loader.cpp b/plugins/MirLua/src/mlua_loader.cpp index c3b1d2edf2..1e62b2653d 100644 --- a/plugins/MirLua/src/mlua_loader.cpp +++ b/plugins/MirLua/src/mlua_loader.cpp @@ -35,9 +35,9 @@ void CLuaLoader::LoadScripts() { TCHAR scriptDir[MAX_PATH]; - FoldersGetCustomPathT(g_hCommonFolderPath, scriptDir, SIZEOF(scriptDir), VARST(COMMON_SCRIPTS_PATHT)); + FoldersGetCustomPathT(g_hCommonFolderPath, scriptDir, _countof(scriptDir), VARST(COMMON_SCRIPTS_PATHT)); LoadScripts(scriptDir); - FoldersGetCustomPathT(g_hCustomFolderPath, scriptDir, SIZEOF(scriptDir), VARST(CUSTOM_SCRIPTS_PATHT)); + FoldersGetCustomPathT(g_hCustomFolderPath, scriptDir, _countof(scriptDir), VARST(CUSTOM_SCRIPTS_PATHT)); LoadScripts(scriptDir); } \ No newline at end of file diff --git a/plugins/MirLua/src/mlua_options.cpp b/plugins/MirLua/src/mlua_options.cpp index 0b06623bde..8cd86f0f3d 100644 --- a/plugins/MirLua/src/mlua_options.cpp +++ b/plugins/MirLua/src/mlua_options.cpp @@ -50,13 +50,13 @@ void CLuaOptions::OnInitDialog() m_scripts.AddColumn(0, _T("Script"), 300); TCHAR scriptDir[MAX_PATH], relativeScriptDir[MAX_PATH], header[MAX_PATH + 100]; - FoldersGetCustomPathT(g_hCommonFolderPath, scriptDir, SIZEOF(scriptDir), VARST(COMMON_SCRIPTS_PATHT)); + FoldersGetCustomPathT(g_hCommonFolderPath, scriptDir, _countof(scriptDir), VARST(COMMON_SCRIPTS_PATHT)); PathToRelativeT(scriptDir, relativeScriptDir, NULL); mir_sntprintf(header, _T("%s (%s)"), TranslateT("Common scripts"), relativeScriptDir); m_scripts.AddGroup(0, header); LoadScripts(scriptDir, 0); - FoldersGetCustomPathT(g_hCustomFolderPath, scriptDir, SIZEOF(scriptDir), VARST(CUSTOM_SCRIPTS_PATHT)); + FoldersGetCustomPathT(g_hCustomFolderPath, scriptDir, _countof(scriptDir), VARST(CUSTOM_SCRIPTS_PATHT)); PathToRelativeT(scriptDir, relativeScriptDir, NULL); mir_sntprintf(header, _T("%s (%s)"), TranslateT("Custom scripts"), relativeScriptDir); m_scripts.AddGroup(1, header); @@ -71,7 +71,7 @@ void CLuaOptions::OnApply() for (int iItem = 0; iItem < count; iItem++) { TCHAR fileName[MAX_PATH]; - m_scripts.GetItemText(iItem, 0, fileName, SIZEOF(fileName)); + m_scripts.GetItemText(iItem, 0, fileName, _countof(fileName)); if (!m_scripts.GetCheckState(iItem)) db_set_b(NULL, MODULE, _T2A(fileName), 0); else -- cgit v1.2.3