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 --- protocols/Tox/src/tox_options.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'protocols/Tox/src/tox_options.cpp') diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index d5cc88a42c..2396638eca 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -109,7 +109,7 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*) void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*) { TCHAR filter[MAX_PATH]; - mir_sntprintf(filter, SIZEOF(filter), _T("%s(*.tox)%c*.tox%c%s(*.*)%c*.*%c%c"), + mir_sntprintf(filter, _countof(filter), _T("%s(*.tox)%c*.tox%c%s(*.*)%c*.*%c%c"), TranslateT("Tox profile"), 0, 0, TranslateT("All files"), 0, 0, 0); TCHAR profilePath[MAX_PATH] = { 0 }; @@ -141,11 +141,11 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*) void CToxOptionsMain::ProfileExport_OnClick(CCtrlButton*) { TCHAR filter[MAX_PATH]; - mir_sntprintf(filter, SIZEOF(filter), _T("%s(*.tox)%c*.tox%c%c"), + mir_sntprintf(filter, _countof(filter), _T("%s(*.tox)%c*.tox%c%c"), TranslateT("Tox profile"), 0, 0, 0); TCHAR profilePath[MAX_PATH]; - mir_tstrncpy(profilePath, _T("tox_save.tox"), SIZEOF(profilePath)); + mir_tstrncpy(profilePath, _T("tox_save.tox"), _countof(profilePath)); OPENFILENAME ofn = { sizeof(ofn) }; ofn.hwndOwner = m_hwnd; @@ -195,7 +195,7 @@ CToxOptionsMultimedia::CToxOptionsMultimedia(CToxProto *proto) bool CToxOptionsMultimedia::GetDeviceFullName(GUID guid, TCHAR *deviceName, DWORD deviceNameLength) { TCHAR registryKey[MAX_PATH]; - mir_sntprintf(registryKey, SIZEOF(registryKey), _T("System\\CurrentControlSet\\Control\\MediaCategories\\{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}"), + mir_sntprintf(registryKey, _countof(registryKey), _T("System\\CurrentControlSet\\Control\\MediaCategories\\{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}"), guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]); HKEY hKey; @@ -220,7 +220,7 @@ void CToxOptionsMultimedia::OnInitDialog() DWORD count = 0; TCHAR deviceName[MAX_PATH]; - DWORD deviceNameLength = SIZEOF(deviceName); + DWORD deviceNameLength = _countof(deviceName); WAVEINCAPS2 wic2; count = waveInGetNumDevs(); @@ -401,22 +401,22 @@ void CToxOptionsNodeList::OnInitDialog() mir_strcpy(fileName, VARS(TOX_INI_PATH)); char *section, sections[MAX_PATH], value[MAX_PATH]; - GetPrivateProfileSectionNamesA(sections, SIZEOF(sections), fileName); + GetPrivateProfileSectionNamesA(sections, _countof(sections), fileName); section = sections; while (*section != NULL) { if (strstr(section, TOX_SETTINGS_NODE_PREFIX) == section) { - GetPrivateProfileStringA(section, "IPv4", NULL, value, SIZEOF(value), fileName); + GetPrivateProfileStringA(section, "IPv4", NULL, value, _countof(value), fileName); iItem = m_nodes.AddItem(mir_a2t(value), -1, NULL, 0); - GetPrivateProfileStringA(section, "IPv6", NULL, value, SIZEOF(value), fileName); + GetPrivateProfileStringA(section, "IPv6", NULL, value, _countof(value), fileName); m_nodes.SetItem(iItem, 1, mir_a2t(value)); - GetPrivateProfileStringA(section, "Port", NULL, value, SIZEOF(value), fileName); + GetPrivateProfileStringA(section, "Port", NULL, value, _countof(value), fileName); m_nodes.SetItem(iItem, 2, mir_a2t(value)); - GetPrivateProfileStringA(section, "PubKey", NULL, value, SIZEOF(value), fileName); + GetPrivateProfileStringA(section, "PubKey", NULL, value, _countof(value), fileName); m_nodes.SetItem(iItem, 3, mir_a2t(value)); } section += mir_strlen(section) + 1; @@ -424,7 +424,7 @@ void CToxOptionsNodeList::OnInitDialog() } char module[MAX_PATH], setting[MAX_PATH]; - mir_snprintf(module, SIZEOF(module), "%s_Nodes", m_proto->m_szModuleName); + mir_snprintf(module, _countof(module), "%s_Nodes", m_proto->m_szModuleName); int nodeCount = db_get_w(NULL, module, TOX_SETTINGS_NODE_COUNT, 0); for (int i = 0; i < nodeCount; i++) { @@ -530,7 +530,7 @@ void CToxOptionsNodeList::OnApply() lvi.pszText = (TCHAR*)mir_alloc(MAX_PATH * sizeof(TCHAR)); char module[MAX_PATH]; - mir_snprintf(module, SIZEOF(module), "%s_Nodes", m_proto->m_szModuleName); + mir_snprintf(module, _countof(module), "%s_Nodes", m_proto->m_szModuleName); int iItem = 0; int itemCount = m_nodes.GetItemCount(); -- cgit v1.2.3