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_avatars.cpp | 6 +++--- protocols/Tox/src/tox_chatrooms.cpp | 2 +- protocols/Tox/src/tox_icons.cpp | 14 +++++++------- protocols/Tox/src/tox_menus.cpp | 2 +- protocols/Tox/src/tox_multimedia.cpp | 16 ++++++++-------- protocols/Tox/src/tox_netlib.cpp | 2 +- protocols/Tox/src/tox_network.cpp | 10 +++++----- protocols/Tox/src/tox_options.cpp | 24 ++++++++++++------------ protocols/Tox/src/tox_profile.cpp | 2 +- protocols/Tox/src/tox_search.cpp | 16 ++++++++-------- protocols/Tox/src/tox_transfer.cpp | 2 +- 11 files changed, 48 insertions(+), 48 deletions(-) (limited to 'protocols/Tox') diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp index c95ebad620..fada4ad92c 100644 --- a/protocols/Tox/src/tox_avatars.cpp +++ b/protocols/Tox/src/tox_avatars.cpp @@ -3,7 +3,7 @@ std::tstring CToxProto::GetAvatarFilePath(MCONTACT hContact) { TCHAR path[MAX_PATH]; - mir_sntprintf(path, SIZEOF(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName); + mir_sntprintf(path, _countof(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName); DWORD dwAttributes = GetFileAttributes(path); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) @@ -129,7 +129,7 @@ INT_PTR CToxProto::GetAvatarInfo(WPARAM, LPARAM lParam) std::tstring path = GetAvatarFilePath(pai->hContact); if (IsFileExists(path)) { - mir_tstrncpy(pai->filename, path.c_str(), SIZEOF(pai->filename)); + mir_tstrncpy(pai->filename, path.c_str(), _countof(pai->filename)); pai->format = PA_FORMAT_PNG; return GAIR_SUCCESS; @@ -224,7 +224,7 @@ void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer) } TCHAR path[MAX_PATH]; - mir_sntprintf(path, SIZEOF(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName); + mir_sntprintf(path, _countof(path), _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName); OnFileAllow(transfer->pfts.hContact, transfer, path); } diff --git a/protocols/Tox/src/tox_chatrooms.cpp b/protocols/Tox/src/tox_chatrooms.cpp index 629d46c510..00145f635f 100644 --- a/protocols/Tox/src/tox_chatrooms.cpp +++ b/protocols/Tox/src/tox_chatrooms.cpp @@ -29,7 +29,7 @@ MCONTACT CToxProto::AddChatRoom(int groupNumber) setWord(hContact, TOX_SETTINGS_CHAT_ID, groupNumber); TCHAR title[MAX_PATH]; - mir_sntprintf(title, SIZEOF(title), _T("%s #%d"), TranslateT("Groupchat"), groupNumber); + mir_sntprintf(title, _countof(title), _T("%s #%d"), TranslateT("Groupchat"), groupNumber); setTString(hContact, "Nick", title); DBVARIANT dbv; diff --git a/protocols/Tox/src/tox_icons.cpp b/protocols/Tox/src/tox_icons.cpp index e1b00b2688..3bb4302513 100644 --- a/protocols/Tox/src/tox_icons.cpp +++ b/protocols/Tox/src/tox_icons.cpp @@ -23,10 +23,10 @@ void CToxProto::InitIcons() sid.pszName = szSettingName; sid.section.t = szSectionName; - mir_sntprintf(szSectionName, SIZEOF(szSectionName), _T("%s/%s"), LPGENT("Protocols"), LPGENT(MODULE)); - for (int i = 0; i < SIZEOF(Icons); i++) + mir_sntprintf(szSectionName, _countof(szSectionName), _T("%s/%s"), LPGENT("Protocols"), LPGENT(MODULE)); + for (int i = 0; i < _countof(Icons); i++) { - mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", MODULE, Icons[i].Name); + mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", MODULE, Icons[i].Name); sid.description.t = Icons[i].Description; sid.iDefaultIndex = -Icons[i].IconId; @@ -36,7 +36,7 @@ void CToxProto::InitIcons() HICON CToxProto::GetIcon(const char *name, bool size) { - for (size_t i = 0; i < SIZEOF(Icons); i++) + for (size_t i = 0; i < _countof(Icons); i++) if (mir_strcmpi(Icons[i].Name, name) == 0) return IcoLib_GetIconByHandle(Icons[i].Handle, size); @@ -45,7 +45,7 @@ HICON CToxProto::GetIcon(const char *name, bool size) HANDLE CToxProto::GetIconHandle(const char *name) { - for (size_t i = 0; i < SIZEOF(Icons); i++) + for (size_t i = 0; i < _countof(Icons); i++) if (mir_strcmpi(Icons[i].Name, name) == 0) return Icons[i].Handle; @@ -55,7 +55,7 @@ HANDLE CToxProto::GetIconHandle(const char *name) HANDLE CToxProto::Skin_GetIconHandle(const char *name) { char iconName[100]; - mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, name); + mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, name); HANDLE hIcon = IcoLib_GetIconHandle(iconName); if (hIcon == NULL) hIcon = GetIconHandle(name); @@ -65,6 +65,6 @@ HANDLE CToxProto::Skin_GetIconHandle(const char *name) void CToxProto::UninitIcons() { - for (size_t i = 0; i < SIZEOF(Icons); i++) + for (size_t i = 0; i < _countof(Icons); i++) IcoLib_RemoveIcon(Icons[i].Name); } \ No newline at end of file diff --git a/protocols/Tox/src/tox_menus.cpp b/protocols/Tox/src/tox_menus.cpp index 914920eb9d..db4bd40ef1 100644 --- a/protocols/Tox/src/tox_menus.cpp +++ b/protocols/Tox/src/tox_menus.cpp @@ -29,7 +29,7 @@ int CToxProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) int CToxProto::PrebuildContactMenu(WPARAM hContact, LPARAM lParam) { - for (int i = 0; i < SIZEOF(ContactMenuItems); i++) + for (int i = 0; i < _countof(ContactMenuItems); i++) Menu_ShowItem(ContactMenuItems[i], FALSE); CToxProto *proto = CToxProto::GetContactAccount(hContact); return proto ? proto->OnPrebuildContactMenu(hContact, lParam) : 0; diff --git a/protocols/Tox/src/tox_multimedia.cpp b/protocols/Tox/src/tox_multimedia.cpp index e03e94b6d2..7fa7a9c7b8 100644 --- a/protocols/Tox/src/tox_multimedia.cpp +++ b/protocols/Tox/src/tox_multimedia.cpp @@ -27,7 +27,7 @@ INT_PTR CToxCallDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) void CToxCallDlgBase::SetIcon(const char *name) { char iconName[100]; - mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, name); + mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, name); SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(iconName, false)); SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(iconName, true)); } @@ -56,7 +56,7 @@ void CToxIncomingCall::OnInitDialog() from.SetText(nick); TCHAR title[MAX_PATH]; - mir_sntprintf(title, SIZEOF(title), TranslateT("Incoming call from %s"), nick); + mir_sntprintf(title, _countof(title), TranslateT("Incoming call from %s"), nick); SetTitle(title); SetIcon("audio_ring"); } @@ -98,7 +98,7 @@ void CToxOutgoingCall::OnInitDialog() to.SetText(nick); TCHAR title[MAX_PATH]; - mir_sntprintf(title, SIZEOF(title), TranslateT("Outgoing call to %s"), nick); + mir_sntprintf(title, _countof(title), TranslateT("Outgoing call to %s"), nick); SetTitle(title); SetIcon("audio_end"); } @@ -138,7 +138,7 @@ void CToxOutgoingCall::OnCall(CCtrlBase*) char *message = NULL; TCHAR title[MAX_PATH]; - if (GetWindowText(m_hwnd, title, SIZEOF(title))) + if (GetWindowText(m_hwnd, title, _countof(title))) message = mir_utf8encodeT(title); else message = mir_utf8encode("Outgoing call"); @@ -191,7 +191,7 @@ ToxAvCSettings* CToxProto::GetAudioCSettings() debugLogA(__FUNCTION__": failed to get input device caps (%d)", error); TCHAR errorMessage[MAX_PATH]; - waveInGetErrorText(error, errorMessage, SIZEOF(errorMessage)); + waveInGetErrorText(error, errorMessage, _countof(errorMessage)); CToxProto::ShowNotification( TranslateT("Unable to find input audio device"), errorMessage); @@ -290,7 +290,7 @@ void CToxProto::OnAvInvite(void*, int32_t callId, void *arg) } TCHAR message[MAX_PATH]; - mir_sntprintf(message, SIZEOF(message), TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); + mir_sntprintf(message, _countof(message), TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); T2Utf szMessage(message); PROTORECVEVENT recv = { 0 }; @@ -317,7 +317,7 @@ INT_PTR CToxProto::OnRecvAudioCall(WPARAM hContact, LPARAM lParam) cle.hIcon = IcoLib_GetIconByHandle(GetIconHandle("audio_ring")); TCHAR szTooltip[MAX_PATH]; - mir_sntprintf(szTooltip, SIZEOF(szTooltip), TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); + mir_sntprintf(szTooltip, _countof(szTooltip), TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); cle.ptszTooltip = szTooltip; char szService[MAX_PATH]; @@ -488,7 +488,7 @@ void CToxProto::OnAvStart(void*, int32_t callId, void *arg) toxav_hangup(proto->toxAv, callId); TCHAR errorMessage[MAX_PATH]; - waveInGetErrorText(error, errorMessage, SIZEOF(errorMessage)); + waveInGetErrorText(error, errorMessage, _countof(errorMessage)); CToxProto::ShowNotification( TranslateT("Unable to find output audio device"), errorMessage); diff --git a/protocols/Tox/src/tox_netlib.cpp b/protocols/Tox/src/tox_netlib.cpp index 697e89ffa4..b08bc7ddf9 100644 --- a/protocols/Tox/src/tox_netlib.cpp +++ b/protocols/Tox/src/tox_netlib.cpp @@ -3,7 +3,7 @@ void CToxProto::InitNetlib() { wchar_t name[128]; - mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName); + mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = {0}; nlu.cbSize = sizeof(nlu); diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp index 26958fbeef..e8fa7ef88d 100644 --- a/protocols/Tox/src/tox_network.cpp +++ b/protocols/Tox/src/tox_network.cpp @@ -20,7 +20,7 @@ void CToxProto::BootstrapNode(const char *address, int port, const char *hexKey) void CToxProto::BootstrapNodesFromDb(bool isIPv6) { char module[MAX_PATH]; - mir_snprintf(module, SIZEOF(module), "%s_Nodes", m_szModuleName); + mir_snprintf(module, _countof(module), "%s_Nodes", m_szModuleName); int nodeCount = db_get_w(NULL, module, TOX_SETTINGS_NODE_COUNT, 0); if (nodeCount > 0) { @@ -52,21 +52,21 @@ void CToxProto::BootstrapNodesFromIni(bool isIPv6) 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); ptrA address(mir_strdup(value)); int port = GetPrivateProfileIntA(section, "Port", 33445, fileName); - GetPrivateProfileStringA(section, "PubKey", NULL, value, SIZEOF(value), fileName); + GetPrivateProfileStringA(section, "PubKey", NULL, value, _countof(value), fileName); ptrA pubKey(mir_strdup(value)); BootstrapNode(address, port, pubKey); if (isIPv6) { - GetPrivateProfileStringA(section, "IPv6", NULL, value, SIZEOF(value), fileName); + GetPrivateProfileStringA(section, "IPv6", NULL, value, _countof(value), fileName); address = mir_strdup(value); BootstrapNode(address, port, pubKey); } 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(); diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 4e2f450dfd..93fb9e9929 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -11,7 +11,7 @@ std::tstring CToxProto::GetToxProfilePath(const TCHAR *accountName) { TCHAR profilePath[MAX_PATH]; TCHAR profileRootPath[MAX_PATH]; - FoldersGetCustomPathT(hProfileFolderPath, profileRootPath, SIZEOF(profileRootPath), VARST(_T("%miranda_userdata%"))); + FoldersGetCustomPathT(hProfileFolderPath, profileRootPath, _countof(profileRootPath), VARST(_T("%miranda_userdata%"))); mir_sntprintf(profilePath, MAX_PATH, _T("%s\\%s.tox"), profileRootPath, accountName); return profilePath; } diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index 43162c5f15..54e4e09665 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -73,15 +73,15 @@ void CToxProto::SearchByNameAsync(void *arg) mir_strcpy(fileName, VARS(TOX_INI_PATH)); char *section, sections[MAX_PATH], value[TOX_PUBLIC_KEY_SIZE * 2]; - GetPrivateProfileSectionNamesA(sections, SIZEOF(sections), fileName); + GetPrivateProfileSectionNamesA(sections, _countof(sections), fileName); section = sections; while (*section != NULL) { if (strstr(section, "Dns_") == section) { - GetPrivateProfileStringA(section, "Domain", NULL, value, SIZEOF(value), fileName); + GetPrivateProfileStringA(section, "Domain", NULL, value, _countof(value), fileName); ptrA dnsDomain(mir_strdup(value)); - GetPrivateProfileStringA(section, "PubKey", NULL, value, SIZEOF(value), fileName); + GetPrivateProfileStringA(section, "PubKey", NULL, value, _countof(value), fileName); ToxBinAddress dnsPubKey = value; if (domain == NULL || mir_strcmpi(domain, dnsDomain) == 0) @@ -95,7 +95,7 @@ void CToxProto::SearchByNameAsync(void *arg) { dnsString[length] = 0; char dnsQuery[MAX_PATH * 2]; - mir_snprintf(dnsQuery, SIZEOF(dnsQuery), "_%s._tox.%s", dnsString, dnsDomain); + mir_snprintf(dnsQuery, _countof(dnsQuery), "_%s._tox.%s", dnsString, dnsDomain); ToxHexAddress address = ResolveToxAddressFromDns(dnsQuery); if (!address.IsEmpty()) @@ -106,7 +106,7 @@ void CToxProto::SearchByNameAsync(void *arg) psr.nick.a = mir_strdup(name); char email[MAX_PATH]; - mir_snprintf(email, SIZEOF(email), "%s@%s", name, domain); + mir_snprintf(email, _countof(email), "%s@%s", name, domain); psr.email.a = mir_strdup(email); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr); @@ -123,7 +123,7 @@ void CToxProto::SearchByNameAsync(void *arg) if (resolved == 0 && domain) { char dnsQuery[MAX_PATH]; - mir_snprintf(dnsQuery, SIZEOF(dnsQuery), "%s._tox.%s", name, domain); + mir_snprintf(dnsQuery, _countof(dnsQuery), "%s._tox.%s", name, domain); ToxHexAddress address = ResolveToxAddressFromDns(dnsQuery); if (!address.IsEmpty()) @@ -134,7 +134,7 @@ void CToxProto::SearchByNameAsync(void *arg) psr.nick.a = mir_strdup(name); char email[MAX_PATH]; - mir_snprintf(email, SIZEOF(email), "%s@%s", name, domain); + mir_snprintf(email, _countof(email), "%s@%s", name, domain); psr.email.a = mir_strdup(email); ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr); @@ -184,7 +184,7 @@ HWND CToxProto::OnSearchAdvanced(HWND owner) std::regex regex("^\\s*([A-Fa-f0-9]{76})\\s*$"); TCHAR text[MAX_PATH]; - GetDlgItemText(owner, IDC_SEARCH, text, SIZEOF(text)); + GetDlgItemText(owner, IDC_SEARCH, text, _countof(text)); const std::string query = T2Utf(text); if (std::regex_search(query, match, regex)) diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index b2b0949237..b74ac1ca53 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -76,7 +76,7 @@ HANDLE CToxProto::OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR * // stupid fix TCHAR fullPath[MAX_PATH]; - mir_sntprintf(fullPath, SIZEOF(fullPath), _T("%s\\%s"), transfer->pfts.tszWorkingDir, transfer->pfts.tszCurrentFile); + mir_sntprintf(fullPath, _countof(fullPath), _T("%s\\%s"), transfer->pfts.tszWorkingDir, transfer->pfts.tszCurrentFile); transfer->ChangeName(fullPath); if (!ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, (HANDLE)transfer, (LPARAM)&transfer->pfts)) -- cgit v1.2.3