summaryrefslogtreecommitdiff
path: root/protocols/IRCG/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 /protocols/IRCG/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 'protocols/IRCG/src')
-rw-r--r--protocols/IRCG/src/clist.cpp2
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp18
-rw-r--r--protocols/IRCG/src/input.cpp10
-rw-r--r--protocols/IRCG/src/irclib.cpp6
-rw-r--r--protocols/IRCG/src/ircproto.cpp10
-rw-r--r--protocols/IRCG/src/options.cpp126
-rw-r--r--protocols/IRCG/src/services.cpp14
-rw-r--r--protocols/IRCG/src/tools.cpp2
-rw-r--r--protocols/IRCG/src/userinfo.cpp8
-rw-r--r--protocols/IRCG/src/windows.cpp66
10 files changed, 131 insertions, 131 deletions
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp
index 8d6fac1a5c..8e403f4198 100644
--- a/protocols/IRCG/src/clist.cpp
+++ b/protocols/IRCG/src/clist.cpp
@@ -69,7 +69,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMString& name, const CMString& hostmask,
cle.hIcon = LoadIconEx(IDI_DCC);
mir_snprintf(szService, "%s/DblClickEvent", m_szModuleName);
cle.pszService = szService;
- mir_sntprintf(szNick, SIZEOF(szNick), TranslateT("CTCP chat request from %s"), name.c_str());
+ mir_sntprintf(szNick, _countof(szNick), TranslateT("CTCP chat request from %s"), name.c_str());
cle.ptszTooltip = szNick;
cle.lParam = (LPARAM)pdci;
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index a5b3f359be..bc4c6ae607 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -70,9 +70,9 @@ VOID CALLBACK KeepAliveTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
TCHAR temp2[270];
if (!ppro->m_info.sServerName.IsEmpty())
- mir_sntprintf(temp2, SIZEOF(temp2), _T("PING %s"), ppro->m_info.sServerName.c_str());
+ mir_sntprintf(temp2, _countof(temp2), _T("PING %s"), ppro->m_info.sServerName.c_str());
else
- mir_sntprintf(temp2, SIZEOF(temp2), _T("PING %u"), time(0));
+ mir_sntprintf(temp2, _countof(temp2), _T("PING %u"), time(0));
if (ppro->IsConnected())
ppro->SendIrcMessage(temp2, false);
@@ -259,7 +259,7 @@ void __cdecl CIrcProto::ResolveIPThread(LPVOID di)
bool CIrcProto::OnIrc_PING(const CIrcMessage* pmsg)
{
TCHAR szResponse[100];
- mir_sntprintf(szResponse, SIZEOF(szResponse), _T("PONG %s"), pmsg->parameters[0].c_str());
+ mir_sntprintf(szResponse, _countof(szResponse), _T("PONG %s"), pmsg->parameters[0].c_str());
SendIrcMessage(szResponse);
return false;
}
@@ -275,7 +275,7 @@ bool CIrcProto::OnIrc_WELCOME(const CIrcMessage* pmsg)
CMString word = GetWord(pmsg->parameters[1].c_str(), i);
while (!word.IsEmpty()) {
if (_tcschr(word.c_str(), '!') && _tcschr(word.c_str(), '@')) {
- mir_tstrncpy(host, word.c_str(), SIZEOF(host));
+ mir_tstrncpy(host, word.c_str(), _countof(host));
TCHAR* p1 = _tcschr(host, '@');
if (p1)
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(_T2A(p1 + 1), IP_AUTO));
@@ -670,7 +670,7 @@ bool CIrcProto::OnIrc_PINGPONG(const CIrcMessage* pmsg)
{
if (pmsg->m_bIncoming && pmsg->sCommand == _T("PING")) {
TCHAR szResponse[100];
- mir_sntprintf(szResponse, SIZEOF(szResponse), _T("PONG %s"), pmsg->parameters[0].c_str());
+ mir_sntprintf(szResponse, _countof(szResponse), _T("PONG %s"), pmsg->parameters[0].c_str());
SendIrcMessage(szResponse);
}
@@ -1194,7 +1194,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage* pmsg)
// if the whois window is visible and the ctcp reply belongs to the user in it, then show the reply in the whois window
if (m_whoisDlg && IsWindowVisible(m_whoisDlg->GetHwnd())) {
- m_whoisDlg->m_InfoNick.GetText(szTemp, SIZEOF(szTemp));
+ m_whoisDlg->m_InfoNick.GetText(szTemp, _countof(szTemp));
if (mir_tstrcmpi(szTemp, pmsg->prefix.sNick.c_str()) == 0) {
if (pmsg->m_bIncoming && (command == _T("version") || command == _T("userinfo") || command == _T("time"))) {
SetActiveWindow(m_whoisDlg->GetHwnd());
@@ -1676,7 +1676,7 @@ bool CIrcProto::OnIrc_WHOIS_OTHER(const CIrcMessage* pmsg)
TCHAR temp[1024], temp2[1024];
m_whoisDlg->m_InfoOther.GetText(temp, 1000);
mir_tstrcat(temp, _T("%s\r\n"));
- mir_sntprintf(temp2, SIZEOF(temp2), temp, pmsg->parameters[2].c_str());
+ mir_sntprintf(temp2, _countof(temp2), temp, pmsg->parameters[2].c_str());
m_whoisDlg->m_InfoOther.SetText(temp2);
}
ShowMessage(pmsg);
@@ -1726,7 +1726,7 @@ bool CIrcProto::OnIrc_WHOIS_IDLE(const CIrcMessage* pmsg)
TCHAR tTimeBuf[128], *tStopStr;
time_t ttTime = _tcstol(pmsg->parameters[3].c_str(), &tStopStr, 10);
_tcsftime(tTimeBuf, 128, _T("%c"), localtime(&ttTime));
- mir_sntprintf(temp3, SIZEOF(temp3), TranslateT("online since %s, idle %s"), tTimeBuf, temp);
+ mir_sntprintf(temp3, _countof(temp3), TranslateT("online since %s, idle %s"), tTimeBuf, temp);
m_whoisDlg->m_AwayTime.SetText(temp3);
}
ShowMessage(pmsg);
@@ -1812,7 +1812,7 @@ bool CIrcProto::OnIrc_NICK_ERR(const CIrcMessage* pmsg)
if (pmsg->m_bIncoming) {
if (nickflag && ((m_alternativeNick[0] != 0)) && (pmsg->parameters.getCount() > 2 && mir_tstrcmp(pmsg->parameters[1].c_str(), m_alternativeNick))) {
TCHAR m[200];
- mir_sntprintf(m, SIZEOF(m), _T("NICK %s"), m_alternativeNick);
+ mir_sntprintf(m, _countof(m), _T("NICK %s"), m_alternativeNick);
if (IsConnected())
SendIrcMessage(m);
}
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index 098c8d1171..95e09dd869 100644
--- a/protocols/IRCG/src/input.cpp
+++ b/protocols/IRCG/src/input.cpp
@@ -121,7 +121,7 @@ CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
for (int index = 1; index < 8; index++) {
TCHAR str[5];
- mir_sntprintf(str, SIZEOF(str), _T("#$%u"), index);
+ mir_sntprintf(str, _countof(str), _T("#$%u"), index);
if (!GetWord(line, index).IsEmpty() && IsChannel(GetWord(line, index)))
S.Replace(str, GetWord(line, index).c_str());
else {
@@ -132,12 +132,12 @@ CMString CIrcProto::DoAlias(const TCHAR *text, TCHAR *window)
}
for (int index2 = 1; index2 < 8; index2++) {
TCHAR str[5];
- mir_sntprintf(str, SIZEOF(str), _T("$%u-"), index2);
+ mir_sntprintf(str, _countof(str), _T("$%u-"), index2);
S.Replace(str, GetWordAddress(line, index2));
}
for (int index3 = 1; index3 < 8; index3++) {
TCHAR str[5];
- mir_sntprintf(str, SIZEOF(str), _T("$%u"), index3);
+ mir_sntprintf(str, _countof(str), _T("$%u"), index3);
S.Replace(str, GetWord(line, index3).c_str());
}
Messageout += GetWordAddress(S.c_str(), 1);
@@ -176,7 +176,7 @@ CMString CIrcProto::DoIdentifiers(CMString text, const TCHAR*)
text.Replace(_T("%me"), m_info.sNick.c_str());
char mirver[100];
- CallService(MS_SYSTEM_GETVERSIONTEXT, SIZEOF(mirver), LPARAM(mirver));
+ CallService(MS_SYSTEM_GETVERSIONTEXT, _countof(mirver), LPARAM(mirver));
text.Replace(_T("%mirver"), _A2T(mirver));
text.Replace(_T("%version"), _T(__VERSION_STRING_DOTS));
@@ -799,7 +799,7 @@ bool CIrcProto::PostIrcMessage(const TCHAR* fmt, ...)
va_list marker;
va_start(marker, fmt);
static TCHAR szBuf[4 * 1024];
- mir_vsntprintf(szBuf, SIZEOF(szBuf), fmt, marker);
+ mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
return PostIrcMessageWnd(NULL, NULL, szBuf);
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp
index 4b2b74112d..e9a8340119 100644
--- a/protocols/IRCG/src/irclib.cpp
+++ b/protocols/IRCG/src/irclib.cpp
@@ -234,7 +234,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info)
CMString m_userID = GetWord(info.sUserID.c_str(), 0);
TCHAR szHostName[MAX_PATH];
- DWORD cbHostName = SIZEOF(szHostName);
+ DWORD cbHostName = _countof(szHostName);
GetComputerName(szHostName, &cbHostName);
CMString HostName = GetWord(szHostName, 0);
if (m_userID.IsEmpty())
@@ -289,7 +289,7 @@ int CIrcProto::NLSend(const TCHAR* fmt, ...)
va_start(marker, fmt);
TCHAR szBuf[1024 * 4];
- mir_vsntprintf(szBuf, SIZEOF(szBuf), fmt, marker);
+ mir_vsntprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
char* buf = mir_t2a_cp(szBuf, getCodepage());
@@ -304,7 +304,7 @@ int CIrcProto::NLSend(const char* fmt, ...)
va_start(marker, fmt);
char szBuf[1024 * 4];
- int cbLen = mir_vsnprintf(szBuf, SIZEOF(szBuf), fmt, marker);
+ int cbLen = mir_vsnprintf(szBuf, _countof(szBuf), fmt, marker);
va_end(marker);
return NLSend((unsigned char*)szBuf, cbLen);
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index 6df0a82319..59a7924475 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -184,15 +184,15 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s server connection"), m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = name;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR;
char szTemp2[256];
- mir_snprintf(szTemp2, SIZEOF(szTemp2), "%s DCC", m_szModuleName);
+ mir_snprintf(szTemp2, _countof(szTemp2), "%s DCC", m_szModuleName);
nlu.szSettingsModule = szTemp2;
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s client-to-client connections"), m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s client-to-client connections"), m_tszUserName);
nlu.ptszDescriptiveName = name;
hNetlibDCC = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
@@ -277,13 +277,13 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM)
if (m_nick[0]) {
TCHAR szBuf[40];
if (mir_tstrlen(m_alternativeNick) == 0) {
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("%s%u"), m_nick, rand() % 9999);
+ mir_sntprintf(szBuf, _countof(szBuf), _T("%s%u"), m_nick, rand() % 9999);
setTString("AlernativeNick", szBuf);
mir_tstrncpy(m_alternativeNick, szBuf, 30);
}
if (mir_tstrlen(m_name) == 0) {
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("Miranda%u"), rand() % 9999);
+ mir_sntprintf(szBuf, _countof(szBuf), _T("Miranda%u"), rand() % 9999);
setTString("Name", szBuf);
mir_tstrncpy(m_name, szBuf, 200);
}
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp
index 5ca6da4826..5d68c0ee30 100644
--- a/protocols/IRCG/src/options.cpp
+++ b/protocols/IRCG/src/options.cpp
@@ -207,12 +207,12 @@ static IconItem iconList[] =
void InitIcons(void)
{
- Icon_Register(hInst, "Protocols/IRC", iconList, SIZEOF(iconList), "IRC");
+ Icon_Register(hInst, "Protocols/IRC", iconList, _countof(iconList), "IRC");
}
HICON LoadIconEx(int iconId, bool big)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return IcoLib_GetIconByHandle(iconList[i].hIcolib, big);
@@ -221,7 +221,7 @@ HICON LoadIconEx(int iconId, bool big)
HANDLE GetIconHandle(int iconId)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
@@ -373,7 +373,7 @@ struct CServerDlg : public CProtoDlgBase<CIrcProto>
void OnOk(CCtrlButton*)
{
- for (int k = 0; k < SIZEOF(sttRequiredFields); k++)
+ for (int k = 0; k < _countof(sttRequiredFields); k++)
if (!GetWindowTextLength(GetDlgItem(m_hwnd, sttRequiredFields[k]))) {
MessageBox(m_hwnd, TranslateT("Please complete all fields"), TranslateT("IRC error"), MB_OK | MB_ICONERROR);
return;
@@ -398,7 +398,7 @@ struct CServerDlg : public CProtoDlgBase<CIrcProto>
pData->m_name = m_server.GetTextA();
char temp[255];
- mir_snprintf(temp, SIZEOF(temp), "%s: %s", pData->m_group, pData->m_name);
+ mir_snprintf(temp, _countof(temp), "%s: %s", pData->m_group, pData->m_name);
mir_free(pData->m_name);
pData->m_name = mir_strdup(temp);
@@ -416,24 +416,24 @@ struct CServerDlg : public CProtoDlgBase<CIrcProto>
static TDbSetting ConnectSettings[] =
{
- { FIELD_OFFSET(CIrcProto, m_userID), "UserID", DBVT_TCHAR, SIZEOF(pZero->m_userID) },
- { FIELD_OFFSET(CIrcProto, m_identSystem), "IdentSystem", DBVT_TCHAR, SIZEOF(pZero->m_identSystem) },
- { FIELD_OFFSET(CIrcProto, m_identPort), "IdentPort", DBVT_TCHAR, SIZEOF(pZero->m_identPort) },
+ { FIELD_OFFSET(CIrcProto, m_userID), "UserID", DBVT_TCHAR, _countof(pZero->m_userID) },
+ { FIELD_OFFSET(CIrcProto, m_identSystem), "IdentSystem", DBVT_TCHAR, _countof(pZero->m_identSystem) },
+ { FIELD_OFFSET(CIrcProto, m_identPort), "IdentPort", DBVT_TCHAR, _countof(pZero->m_identPort) },
- { FIELD_OFFSET(CIrcProto, m_serverName ), "ServerName", DBVT_ASCIIZ, SIZEOF(pZero->m_serverName) },
- { FIELD_OFFSET(CIrcProto, m_portStart ), "PortStart", DBVT_ASCIIZ, SIZEOF(pZero->m_portStart) },
- { FIELD_OFFSET(CIrcProto, m_portEnd ), "PortEnd", DBVT_ASCIIZ, SIZEOF(pZero->m_portEnd ) },
- { FIELD_OFFSET(CIrcProto, m_password ), "Password", DBVT_ASCIIZ, SIZEOF(pZero->m_password ) },
+ { FIELD_OFFSET(CIrcProto, m_serverName ), "ServerName", DBVT_ASCIIZ, _countof(pZero->m_serverName) },
+ { FIELD_OFFSET(CIrcProto, m_portStart ), "PortStart", DBVT_ASCIIZ, _countof(pZero->m_portStart) },
+ { FIELD_OFFSET(CIrcProto, m_portEnd ), "PortEnd", DBVT_ASCIIZ, _countof(pZero->m_portEnd ) },
+ { FIELD_OFFSET(CIrcProto, m_password ), "Password", DBVT_ASCIIZ, _countof(pZero->m_password ) },
{ FIELD_OFFSET(CIrcProto, m_joinOnInvite ), "JoinOnInvite", DBVT_BYTE },
- { FIELD_OFFSET(CIrcProto, m_network ), "Network", DBVT_ASCIIZ, SIZEOF(pZero->m_network ) },
+ { FIELD_OFFSET(CIrcProto, m_network ), "Network", DBVT_ASCIIZ, _countof(pZero->m_network ) },
{ FIELD_OFFSET(CIrcProto, m_iSSL ), "UseSSL", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_onlineNotificationTime) , "OnlineNotificationTime", DBVT_WORD, 0, 30 },
{ FIELD_OFFSET(CIrcProto, m_onlineNotificationLimit) , "OnlineNotificationLimit", DBVT_WORD, 0, 50 },
{ FIELD_OFFSET(CIrcProto, m_channelAwayNotification), "ChannelAwayNotification", DBVT_BYTE, 0, 1 },
- { FIELD_OFFSET(CIrcProto, m_nick), "Nick", DBVT_TCHAR, SIZEOF(pZero->m_nick) },
- { FIELD_OFFSET(CIrcProto, m_pNick), "PNick", DBVT_TCHAR, SIZEOF(pZero->m_pNick) },
- { FIELD_OFFSET(CIrcProto, m_alternativeNick), "AlernativeNick", DBVT_TCHAR, SIZEOF(pZero->m_alternativeNick) },
- { FIELD_OFFSET(CIrcProto, m_name), "Name", DBVT_TCHAR, SIZEOF(pZero->m_name) },
+ { FIELD_OFFSET(CIrcProto, m_nick), "Nick", DBVT_TCHAR, _countof(pZero->m_nick) },
+ { FIELD_OFFSET(CIrcProto, m_pNick), "PNick", DBVT_TCHAR, _countof(pZero->m_pNick) },
+ { FIELD_OFFSET(CIrcProto, m_alternativeNick), "AlernativeNick", DBVT_TCHAR, _countof(pZero->m_alternativeNick) },
+ { FIELD_OFFSET(CIrcProto, m_name), "Name", DBVT_TCHAR, _countof(pZero->m_name) },
{ FIELD_OFFSET(CIrcProto, m_disableDefaultServer), "DisableDefaultServer", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_ident), "Ident", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_identTimer), "IdentTimer", DBVT_BYTE },
@@ -698,10 +698,10 @@ void CConnectPrefsDlg::OnApply()
{
//Save the setting in the CONNECT dialog
if (m_enableServer.GetState()) {
- m_server.GetTextA(m_proto->m_serverName, SIZEOF(m_proto->m_serverName));
- m_port.GetTextA(m_proto->m_portStart, SIZEOF(m_proto->m_portStart));
- m_port2.GetTextA(m_proto->m_portEnd, SIZEOF(m_proto->m_portEnd));
- m_pass.GetTextA(m_proto->m_password, SIZEOF(m_proto->m_password));
+ m_server.GetTextA(m_proto->m_serverName, _countof(m_proto->m_serverName));
+ m_port.GetTextA(m_proto->m_portStart, _countof(m_proto->m_portStart));
+ m_port2.GetTextA(m_proto->m_portEnd, _countof(m_proto->m_portEnd));
+ m_pass.GetTextA(m_proto->m_password, _countof(m_proto->m_password));
}
else m_proto->m_serverName[0] = m_proto->m_portStart[0] = m_proto->m_portEnd[0] = m_proto->m_password[0] = 0;
@@ -709,16 +709,16 @@ void CConnectPrefsDlg::OnApply()
m_proto->m_onlineNotificationLimit = SendDlgItemMessage(m_hwnd, IDC_SPIN2, UDM_GETPOS, 0, 0);
m_proto->m_channelAwayNotification = m_channelAway.GetState();
- m_nick.GetText(m_proto->m_nick, SIZEOF(m_proto->m_nick));
+ m_nick.GetText(m_proto->m_nick, _countof(m_proto->m_nick));
removeSpaces(m_proto->m_nick);
_tcsncpy_s(m_proto->m_pNick, m_proto->m_nick, _TRUNCATE);
- m_nick2.GetText(m_proto->m_alternativeNick, SIZEOF(m_proto->m_alternativeNick));
+ m_nick2.GetText(m_proto->m_alternativeNick, _countof(m_proto->m_alternativeNick));
removeSpaces(m_proto->m_alternativeNick);
- m_userID.GetText(m_proto->m_userID, SIZEOF(m_proto->m_userID));
+ m_userID.GetText(m_proto->m_userID, _countof(m_proto->m_userID));
removeSpaces(m_proto->m_userID);
- m_name.GetText(m_proto->m_name, SIZEOF(m_proto->m_name));
- m_identSystem.GetText(m_proto->m_identSystem, SIZEOF(m_proto->m_identSystem));
- m_identPort.GetText(m_proto->m_identPort, SIZEOF(m_proto->m_identPort));
+ m_name.GetText(m_proto->m_name, _countof(m_proto->m_name));
+ m_identSystem.GetText(m_proto->m_identSystem, _countof(m_proto->m_identSystem));
+ m_identPort.GetText(m_proto->m_identPort, _countof(m_proto->m_identPort));
m_proto->m_disableDefaultServer = !m_enableServer.GetState();
m_proto->m_ident = m_ident.GetState();
m_proto->m_identTimer = m_identTimer.GetState();
@@ -780,9 +780,9 @@ void CConnectPrefsDlg::OnApply()
char TextLine[512];
if (pData->m_iSSL > 0)
- mir_snprintf(TextLine, SIZEOF(TextLine), "SERVER:SSL%u%s:%d-%dGROUP:%s", pData->m_iSSL, pData->m_address, pData->m_portStart, pData->m_portEnd, pData->m_group);
+ mir_snprintf(TextLine, _countof(TextLine), "SERVER:SSL%u%s:%d-%dGROUP:%s", pData->m_iSSL, pData->m_address, pData->m_portStart, pData->m_portEnd, pData->m_group);
else
- mir_snprintf(TextLine, SIZEOF(TextLine), "SERVER:%s:%d-%dGROUP:%s", pData->m_address, pData->m_portStart, pData->m_portEnd, pData->m_group);
+ mir_snprintf(TextLine, _countof(TextLine), "SERVER:%s:%d-%dGROUP:%s", pData->m_address, pData->m_portStart, pData->m_portEnd, pData->m_group);
db_set_s(NULL, SERVERSMODULE, pData->m_name, TextLine);
// combobox might contain new items
@@ -792,7 +792,7 @@ void CConnectPrefsDlg::OnApply()
}
}
- m_proto->WriteSettings(ConnectSettings, SIZEOF(ConnectSettings));
+ m_proto->WriteSettings(ConnectSettings, _countof(ConnectSettings));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -800,14 +800,14 @@ void CConnectPrefsDlg::OnApply()
static TDbSetting CtcpSettings[] =
{
- { FIELD_OFFSET(CIrcProto, m_userInfo), "UserInfo", DBVT_TCHAR, SIZEOF(pZero->m_userInfo) },
+ { FIELD_OFFSET(CIrcProto, m_userInfo), "UserInfo", DBVT_TCHAR, _countof(pZero->m_userInfo) },
{ FIELD_OFFSET(CIrcProto, m_DCCPacketSize), "DccPacketSize", DBVT_WORD, 0, 4096 },
{ FIELD_OFFSET(CIrcProto, m_DCCPassive), "DccPassive", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_DCCMode), "DCCMode", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_manualHost), "ManualHost", DBVT_BYTE },
{ FIELD_OFFSET(CIrcProto, m_IPFromServer), "IPFromServer", DBVT_BYTE, 0, 1 },
{ FIELD_OFFSET(CIrcProto, m_disconnectDCCChats), "DisconnectDCCChats", DBVT_BYTE },
- { FIELD_OFFSET(CIrcProto, m_mySpecifiedHost), "SpecHost", DBVT_ASCIIZ, SIZEOF(pZero->m_mySpecifiedHost) },
+ { FIELD_OFFSET(CIrcProto, m_mySpecifiedHost), "SpecHost", DBVT_ASCIIZ, _countof(pZero->m_mySpecifiedHost) },
{ FIELD_OFFSET(CIrcProto, m_DCCChatAccept), "CtcpChatAccept", DBVT_BYTE, 0, 1 },
{ FIELD_OFFSET(CIrcProto, m_sendNotice), "SendNotice", DBVT_BYTE, 0, 1 }
};
@@ -913,7 +913,7 @@ void CCtcpPrefsDlg::OnClicked(CCtrlData*)
void CCtcpPrefsDlg::OnApply()
{
- m_userInfo.GetText(m_proto->m_userInfo, SIZEOF(m_proto->m_userInfo));
+ m_userInfo.GetText(m_proto->m_userInfo, _countof(m_proto->m_userInfo));
m_proto->m_DCCPacketSize = m_combo.GetInt();
m_proto->m_DCCPassive = m_passive.GetState();
@@ -939,7 +939,7 @@ void CCtcpPrefsDlg::OnApply()
if (m_radio3.GetState())
m_proto->m_DCCChatAccept = 3;
- m_proto->WriteSettings(CtcpSettings, SIZEOF(CtcpSettings));
+ m_proto->WriteSettings(CtcpSettings, _countof(CtcpSettings));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -947,7 +947,7 @@ void CCtcpPrefsDlg::OnApply()
static TDbSetting OtherSettings[] =
{
- { FIELD_OFFSET(CIrcProto, m_quitMessage), "QuitMessage", DBVT_TCHAR, SIZEOF(pZero->m_quitMessage) },
+ { FIELD_OFFSET(CIrcProto, m_quitMessage), "QuitMessage", DBVT_TCHAR, _countof(pZero->m_quitMessage) },
{ FIELD_OFFSET(CIrcProto, m_alias), "Alias", DBVT_TCHAR, -1 },
{ FIELD_OFFSET(CIrcProto, m_codepage), "Codepage", DBVT_DWORD, 0, CP_ACP },
{ FIELD_OFFSET(CIrcProto, m_utfAutodetect), "UtfAutodetect", DBVT_BYTE },
@@ -1055,7 +1055,7 @@ void COtherPrefsDlg::OnInitDialog()
}
}
- for (int i = 0; i < SIZEOF(sttPerformEvents); i++) {
+ for (int i = 0; i < _countof(sttPerformEvents); i++) {
int idx = m_performCombo.InsertString(_A2T(Translate(sttPerformEvents[i])), i);
addPerformComboValue(idx, sttPerformEvents[i]);
}
@@ -1161,7 +1161,7 @@ void COtherPrefsDlg::OnApply()
{
mir_free(m_proto->m_alias);
m_proto->m_alias = m_alias.GetText();
- m_quitMessage.GetText(m_proto->m_quitMessage, SIZEOF(m_proto->m_quitMessage));
+ m_quitMessage.GetText(m_proto->m_quitMessage, _countof(m_proto->m_quitMessage));
int curSel = m_codepage.GetCurSel();
m_proto->m_codepage = m_codepage.GetItemData(curSel);
@@ -1187,7 +1187,7 @@ void COtherPrefsDlg::OnApply()
db_unset(NULL, m_proto->m_szModuleName, pPerf->mSetting.c_str());
}
}
- m_proto->WriteSettings(OtherSettings, SIZEOF(OtherSettings));
+ m_proto->WriteSettings(OtherSettings, _countof(OtherSettings));
}
void COtherPrefsDlg::addPerformComboValue(int idx, const char* szValueName)
@@ -1218,7 +1218,7 @@ CAddIgnoreDlg::CAddIgnoreDlg(CIrcProto* _pro, const TCHAR* mask, CIgnorePrefsDlg
if (mask == NULL)
szOldMask[0] = 0;
else
- _tcsncpy(szOldMask, mask, SIZEOF(szOldMask));
+ _tcsncpy(szOldMask, mask, _countof(szOldMask));
m_Ok.OnClick = Callback(this, &CAddIgnoreDlg::OnOk);
}
@@ -1248,8 +1248,8 @@ void CAddIgnoreDlg::OnOk(CCtrlButton*)
if (IsDlgButtonChecked(m_hwnd, IDC_C) == BST_CHECKED) flags += 'c';
if (IsDlgButtonChecked(m_hwnd, IDC_M) == BST_CHECKED) flags += 'm';
- GetDlgItemText(m_hwnd, IDC_MASK, szMask, SIZEOF(szMask));
- GetDlgItemText(m_hwnd, IDC_NETWORK, szNetwork, SIZEOF(szNetwork));
+ GetDlgItemText(m_hwnd, IDC_MASK, szMask, _countof(szMask));
+ GetDlgItemText(m_hwnd, IDC_NETWORK, szNetwork, _countof(szNetwork));
CMString Mask = GetWord(szMask, 0);
if (Mask.GetLength() != 0) {
@@ -1293,7 +1293,7 @@ static int CALLBACK IgnoreListSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParam
LVITEM lvm;
lvm.mask = LVIF_TEXT;
lvm.iSubItem = 0;
- lvm.cchTextMax = SIZEOF(temp1);
+ lvm.cchTextMax = _countof(temp1);
lvm.iItem = lParam1;
lvm.pszText = temp1;
@@ -1376,7 +1376,7 @@ void CIrcProto::InitIgnore(void)
int idx = 0;
char settingName[40];
for (;;) {
- mir_snprintf(settingName, SIZEOF(settingName), "IGNORE:%d", idx++);
+ mir_snprintf(settingName, _countof(settingName), "IGNORE:%d", idx++);
DBVARIANT dbv;
if (getTString(settingName, &dbv))
@@ -1396,13 +1396,13 @@ void CIrcProto::RewriteIgnoreSettings(void)
int i = 0;
for (;;) {
- mir_snprintf(settingName, SIZEOF(settingName), "IGNORE:%d", i++);
+ mir_snprintf(settingName, _countof(settingName), "IGNORE:%d", i++);
if (db_unset(NULL, m_szModuleName, settingName))
break;
}
for (i = 0; i < m_ignoreItems.getCount(); i++) {
- mir_snprintf(settingName, SIZEOF(settingName), "IGNORE:%d", i);
+ mir_snprintf(settingName, _countof(settingName), "IGNORE:%d", i);
CIrcIgnoreItem& C = m_ignoreItems[i];
setTString(settingName, (C.mask + _T(" ") + C.flags + _T(" ") + C.network).c_str());
@@ -1553,7 +1553,7 @@ void CIgnorePrefsDlg::OnDelete(CCtrlButton*)
TCHAR szMask[512];
int i = m_list.GetSelectionMark();
- m_list.GetItemText(i, 0, szMask, SIZEOF(szMask));
+ m_list.GetItemText(i, 0, szMask, _countof(szMask));
m_proto->RemoveIgnore(szMask);
}
@@ -1570,7 +1570,7 @@ void CIgnorePrefsDlg::OnApply()
m_proto->m_ignore = m_enable.GetState();
m_proto->m_ignoreChannelDefault = m_ignoreChannel.GetState();
m_proto->m_DCCChatIgnore = m_ignoreUnknown.GetState() ? 2 : 1;
- m_proto->WriteSettings(IgnoreSettings, SIZEOF(IgnoreSettings));
+ m_proto->WriteSettings(IgnoreSettings, _countof(IgnoreSettings));
}
void CIgnorePrefsDlg::OnDestroy()
@@ -1581,9 +1581,9 @@ void CIgnorePrefsDlg::OnDestroy()
int i = m_list.GetItemCount();
for (int j = 0; j < i; j++) {
TCHAR szMask[512], szFlags[40], szNetwork[100];
- m_list.GetItemText(j, 0, szMask, SIZEOF(szMask));
- m_list.GetItemText(j, 1, szFlags, SIZEOF(szFlags));
- m_list.GetItemText(j, 2, szNetwork, SIZEOF(szNetwork));
+ m_list.GetItemText(j, 0, szMask, _countof(szMask));
+ m_list.GetItemText(j, 1, szFlags, _countof(szFlags));
+ m_list.GetItemText(j, 2, szNetwork, _countof(szNetwork));
m_proto->m_ignoreItems.insert(new CIrcIgnoreItem(szMask, szFlags, szNetwork));
}
@@ -1694,10 +1694,10 @@ void CIrcProto::InitPrefs(void)
OtherSettings[0].defStr = STR_QUITMESSAGE;
- ReadSettings(ConnectSettings, SIZEOF(ConnectSettings));
- ReadSettings(CtcpSettings, SIZEOF(CtcpSettings));
- ReadSettings(OtherSettings, SIZEOF(OtherSettings));
- ReadSettings(IgnoreSettings, SIZEOF(IgnoreSettings));
+ ReadSettings(ConnectSettings, _countof(ConnectSettings));
+ ReadSettings(CtcpSettings, _countof(CtcpSettings));
+ ReadSettings(OtherSettings, _countof(OtherSettings));
+ ReadSettings(IgnoreSettings, _countof(IgnoreSettings));
int x = getDword("SizeOfListBottom", -1);
if (x != -1) {
@@ -1797,20 +1797,20 @@ struct CDlgAccMgrUI : public CProtoDlgBase<CIrcProto>
virtual void OnApply()
{
m_proto->m_serverComboSelection = m_serverCombo.GetCurSel();
- m_server.GetTextA(m_proto->m_serverName, SIZEOF(m_proto->m_serverName));
- m_port.GetTextA(m_proto->m_portStart, SIZEOF(m_proto->m_portStart));
- m_port2.GetTextA(m_proto->m_portEnd, SIZEOF(m_proto->m_portEnd));
- m_pass.GetTextA(m_proto->m_password, SIZEOF(m_proto->m_password));
+ m_server.GetTextA(m_proto->m_serverName, _countof(m_proto->m_serverName));
+ m_port.GetTextA(m_proto->m_portStart, _countof(m_proto->m_portStart));
+ m_port2.GetTextA(m_proto->m_portEnd, _countof(m_proto->m_portEnd));
+ m_pass.GetTextA(m_proto->m_password, _countof(m_proto->m_password));
- m_nick.GetText(m_proto->m_nick, SIZEOF(m_proto->m_nick));
+ m_nick.GetText(m_proto->m_nick, _countof(m_proto->m_nick));
removeSpaces(m_proto->m_nick);
_tcsncpy_s(m_proto->m_pNick, m_proto->m_nick, _TRUNCATE);
- m_nick2.GetText(m_proto->m_alternativeNick, SIZEOF(m_proto->m_alternativeNick));
+ m_nick2.GetText(m_proto->m_alternativeNick, _countof(m_proto->m_alternativeNick));
removeSpaces(m_proto->m_alternativeNick);
- m_userID.GetText(m_proto->m_userID, SIZEOF(m_proto->m_userID));
+ m_userID.GetText(m_proto->m_userID, _countof(m_proto->m_userID));
removeSpaces(m_proto->m_userID);
- m_name.GetText(m_proto->m_name, SIZEOF(m_proto->m_name));
- m_proto->WriteSettings(ConnectSettings, SIZEOF(ConnectSettings));
+ m_name.GetText(m_proto->m_name, _countof(m_proto->m_name));
+ m_proto->WriteSettings(ConnectSettings, _countof(ConnectSettings));
}
void OnChangeCombo(CCtrlCombo*)
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index c76371ffb6..466e4c35dc 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void CIrcProto::InitMainMenus(void)
{
char temp[MAXMODULELABELLENGTH];
- char *d = temp + mir_snprintf(temp, SIZEOF(temp), m_szModuleName);
+ char *d = temp + mir_snprintf(temp, _countof(temp), m_szModuleName);
CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = temp;
@@ -137,7 +137,7 @@ int IrcPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
void InitContactMenus(void)
{
char temp[MAXMODULELABELLENGTH];
- char *d = temp + mir_snprintf(temp, SIZEOF(temp), "IRC");
+ char *d = temp + mir_snprintf(temp, _countof(temp), "IRC");
CLISTMENUITEM mi = { sizeof(mi) };
mi.pszService = temp;
@@ -459,7 +459,7 @@ static void DoChatFormatting(TCHAR* pszText)
if (p1 - 3 >= pszText && p1[-3] == '\003')
mir_tstrcpy(InsertThis, _T(","));
else if (iFG >= 0)
- mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("\x03%u,"), iFG);
+ mir_sntprintf(InsertThis, _countof(InsertThis), _T("\x03%u,"), iFG);
else
mir_tstrcpy(InsertThis, _T("\x0399,"));
@@ -468,7 +468,7 @@ static void DoChatFormatting(TCHAR* pszText)
case 'F':
if (iFG >= 0)
- mir_sntprintf(InsertThis, SIZEOF(InsertThis), _T("\x03%u,99"), iFG);
+ mir_sntprintf(InsertThis, _countof(InsertThis), _T("\x03%u,99"), iFG);
else
mir_tstrcpy(InsertThis, _T("\x0399,99"));
iRemoveChars = 2;
@@ -853,7 +853,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
if (!mir_strcmpi(gcmi->pszModule, m_szModuleName)) {
if (gcmi->Type == MENU_ON_LOG) {
if (mir_tstrcmpi(gcmi->pszID, SERVERWINDOW)) {
- gcmi->nItems = SIZEOF(logItems);
+ gcmi->nItems = _countof(logItems);
gcmi->Item = logItems;
}
else gcmi->nItems = 0;
@@ -863,7 +863,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
CONTACT user = { (TCHAR*)gcmi->pszUID, NULL, NULL, false, false, false };
MCONTACT hContact = CList_FindContact(&user);
- gcmi->nItems = SIZEOF(nickItems);
+ gcmi->nItems = _countof(nickItems);
gcmi->Item = nickItems;
BOOL bIsInList = (hContact && db_get_b(hContact, "CList", "NotOnList", 0) == 0);
gcmi->Item[gcmi->nItems - 1].bDisabled = bIsInList;
@@ -877,7 +877,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam)
TCHAR stzChanName[100];
const TCHAR* temp = _tcschr(gcmi->pszID, ' ');
- size_t len = min(((temp == NULL) ? mir_tstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), SIZEOF(stzChanName) - 1);
+ size_t len = min(((temp == NULL) ? mir_tstrlen(gcmi->pszID) : (int)(temp - gcmi->pszID + 1)), _countof(stzChanName) - 1);
mir_tstrncpy(stzChanName, gcmi->pszID, len);
stzChanName[len] = 0;
CHANNELINFO *wi = (CHANNELINFO *)DoEvent(GC_EVENT_GETITEMDATA, stzChanName, NULL, NULL, NULL, NULL, NULL, false, false, 0);
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index 55dfc734f5..97b5bcf6d9 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -628,7 +628,7 @@ void CIrcProto::DoUserhostWithReason(int type, CMString reason, bool bSendComman
va_list ap;
va_start(ap, userhostparams);
- mir_vsntprintf(temp, SIZEOF(temp), (S + _T(" ") + userhostparams).c_str(), ap);
+ mir_vsntprintf(temp, _countof(temp), (S + _T(" ") + userhostparams).c_str(), ap);
va_end(ap);
// Add reason
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp
index cbc85fe2c9..c3ed0b36bf 100644
--- a/protocols/IRCG/src/userinfo.cpp
+++ b/protocols/IRCG/src/userinfo.cpp
@@ -100,7 +100,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_BUTTON) {
TCHAR temp[500];
- GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, SIZEOF(temp));
+ GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, _countof(temp));
BYTE bAdvanced = IsDlgButtonChecked(m_hwnd, IDC_RADIO1) ? 0 : 1;
if (bAdvanced) {
@@ -125,7 +125,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
db_free(&dbv);
}
- GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, SIZEOF(temp));
+ GetDlgItemText(m_hwnd, IDC_WILDCARD, temp, _countof(temp));
if (mir_tstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UWildcard", GetWord(temp, 0).c_str());
else
@@ -134,13 +134,13 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM
p->ppro->setByte(p->hContact, "AdvancedMode", bAdvanced);
- GetDlgItemText(m_hwnd, IDC_USER, temp, SIZEOF(temp));
+ GetDlgItemText(m_hwnd, IDC_USER, temp, _countof(temp));
if (mir_tstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UUser", GetWord(temp, 0).c_str());
else
db_unset(p->hContact, p->ppro->m_szModuleName, "UUser");
- GetDlgItemText(m_hwnd, IDC_HOST, temp, SIZEOF(temp));
+ GetDlgItemText(m_hwnd, IDC_HOST, temp, _countof(temp));
if (mir_tstrlen(GetWord(temp, 0).c_str()))
p->ppro->setTString(p->hContact, "UHost", GetWord(temp, 0).c_str());
else
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp
index 0de5d3b1b7..2b40c291fe 100644
--- a/protocols/IRCG/src/windows.cpp
+++ b/protocols/IRCG/src/windows.cpp
@@ -110,21 +110,21 @@ void CWhoisDlg::OnDestroy()
void CWhoisDlg::OnGo(CCtrlButton*)
{
TCHAR szTemp[255];
- m_InfoNick.GetText(szTemp, SIZEOF(szTemp));
+ m_InfoNick.GetText(szTemp, _countof(szTemp));
m_proto->PostIrcMessage(_T("/WHOIS %s %s"), szTemp, szTemp);
}
void CWhoisDlg::OnQuery(CCtrlButton*)
{
TCHAR szTemp[255];
- m_InfoNick.GetText(szTemp, SIZEOF(szTemp));
+ m_InfoNick.GetText(szTemp, _countof(szTemp));
m_proto->PostIrcMessage(_T("/QUERY %s"), szTemp);
}
void CWhoisDlg::OnPing(CCtrlButton*)
{
TCHAR szTemp[255];
- m_InfoNick.GetText(szTemp, SIZEOF(szTemp));
+ m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(_T("/PRIVMSG %s \001PING %u\001"), szTemp, time(0));
}
@@ -132,7 +132,7 @@ void CWhoisDlg::OnPing(CCtrlButton*)
void CWhoisDlg::OnUserInfo(CCtrlButton*)
{
TCHAR szTemp[255];
- m_InfoNick.GetText(szTemp, SIZEOF(szTemp));
+ m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(_T("/PRIVMSG %s \001USERINFO\001"), szTemp);
}
@@ -140,7 +140,7 @@ void CWhoisDlg::OnUserInfo(CCtrlButton*)
void CWhoisDlg::OnTime(CCtrlButton*)
{
TCHAR szTemp[255];
- m_InfoNick.GetText(szTemp, SIZEOF(szTemp));
+ m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(_T("/PRIVMSG %s \001TIME\001"), szTemp);
}
@@ -148,7 +148,7 @@ void CWhoisDlg::OnTime(CCtrlButton*)
void CWhoisDlg::OnVersion(CCtrlButton*)
{
TCHAR szTemp[255];
- m_InfoNick.GetText(szTemp, SIZEOF(szTemp));
+ m_InfoNick.GetText(szTemp, _countof(szTemp));
m_Reply.SetText(TranslateT("Please wait..."));
m_proto->PostIrcMessage(_T("/PRIVMSG %s \001VERSION\001"), szTemp);
}
@@ -229,7 +229,7 @@ void CNickDlg::OnDestroy()
void CNickDlg::OnOk(CCtrlButton*)
{
TCHAR szTemp[255];
- m_Enick.GetText(szTemp, SIZEOF(szTemp));
+ m_Enick.GetText(szTemp, _countof(szTemp));
m_proto->PostIrcMessage(_T("/NICK %s"), szTemp);
CMString S = szTemp;
@@ -304,7 +304,7 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
// Retrieve the input text
TCHAR strFilterText[255];
TCHAR newTitle[255];
- m_filter.GetText(strFilterText, SIZEOF(strFilterText));
+ m_filter.GetText(strFilterText, _countof(strFilterText));
if (strFilterText[0]) {
int itemCount = 0;
@@ -318,7 +318,7 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
LVITEM lvm;
TCHAR text[255];
lvm.pszText = text; // Set buffer for texts
- lvm.cchTextMax = SIZEOF(text);
+ lvm.cchTextMax = _countof(text);
lvm.mask = LVIF_TEXT;
for (int i = 0; i < j; i++) {
lvm.iSubItem = 0; // First column
@@ -376,13 +376,13 @@ INT_PTR CListDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
ShowWindow(m_list.GetHwnd(), SW_HIDE);
// New dialog title
- mir_sntprintf(newTitle, SIZEOF(newTitle), TranslateT("%s - Filtered - %d items"), strFilterText, itemCount);
+ mir_sntprintf(newTitle, _countof(newTitle), TranslateT("%s - Filtered - %d items"), strFilterText, itemCount);
SetWindowText(m_hwnd, newTitle);
}
else {
ShowWindow(m_list.GetHwnd(), SW_SHOW);
ShowWindow(m_list2.GetHwnd(), SW_HIDE);
- mir_sntprintf(newTitle, SIZEOF(newTitle), TranslateT("Channels on server"));
+ mir_sntprintf(newTitle, _countof(newTitle), TranslateT("Channels on server"));
SetWindowText(m_hwnd, newTitle);
}
}
@@ -423,7 +423,7 @@ static int CALLBACK ListViewSort(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSo
lvm.iItem = lParam1;
lvm.iSubItem = param->iSubItem;
lvm.pszText = temp1;
- lvm.cchTextMax = SIZEOF(temp1);
+ lvm.cchTextMax = _countof(temp1);
param->pList->GetItem(&lvm);
lvm.iItem = lParam2;
lvm.pszText = temp2;
@@ -464,7 +464,7 @@ void CListDlg::List_OnColumnClick(CCtrlListView::TEventInfo *ev)
void CListDlg::OnJoin(CCtrlButton*)
{
TCHAR szTemp[255];
- m_filter.GetText(szTemp, SIZEOF(szTemp));
+ m_filter.GetText(szTemp, _countof(szTemp));
if (szTemp[0])
m_list2.GetItemText(m_list2.GetSelectionMark(), 0, szTemp, 255);
@@ -524,7 +524,7 @@ void CJoinDlg::OnDestroy()
void CJoinDlg::OnOk(CCtrlButton*)
{
TCHAR szTemp[255];
- GetDlgItemText(m_hwnd, IDC_ENICK, szTemp, SIZEOF(szTemp));
+ GetDlgItemText(m_hwnd, IDC_ENICK, szTemp, _countof(szTemp));
if (m_proto->IsChannel(szTemp))
m_proto->PostIrcMessage(_T("/JOIN %s"), szTemp);
else
@@ -614,10 +614,10 @@ void CQuickDlg::OnDestroy()
void CQuickDlg::OnOk(CCtrlButton*)
{
- GetDlgItemTextA(m_hwnd, IDC_SERVER, m_proto->m_serverName, SIZEOF(m_proto->m_serverName));
- GetDlgItemTextA(m_hwnd, IDC_PORT, m_proto->m_portStart, SIZEOF(m_proto->m_portStart));
- GetDlgItemTextA(m_hwnd, IDC_PORT2, m_proto->m_portEnd, SIZEOF(m_proto->m_portEnd));
- GetDlgItemTextA(m_hwnd, IDC_PASS, m_proto->m_password, SIZEOF(m_proto->m_password));
+ GetDlgItemTextA(m_hwnd, IDC_SERVER, m_proto->m_serverName, _countof(m_proto->m_serverName));
+ GetDlgItemTextA(m_hwnd, IDC_PORT, m_proto->m_portStart, _countof(m_proto->m_portStart));
+ GetDlgItemTextA(m_hwnd, IDC_PORT2, m_proto->m_portEnd, _countof(m_proto->m_portEnd));
+ GetDlgItemTextA(m_hwnd, IDC_PASS, m_proto->m_password, _countof(m_proto->m_password));
int i = m_serverCombo.GetCurSel();
SERVER_INFO* pData = (SERVER_INFO*)m_serverCombo.GetItemData(i);
@@ -632,7 +632,7 @@ void CQuickDlg::OnOk(CCtrlButton*)
}
TCHAR windowname[20];
- GetWindowText(m_hwnd, windowname, SIZEOF(windowname));
+ GetWindowText(m_hwnd, windowname, _countof(windowname));
if (mir_tstrcmpi(windowname, _T("Miranda IRC")) == 0) {
m_proto->m_serverComboSelection = m_serverCombo.GetCurSel() - 1;
m_proto->setDword("ServerComboSelection", m_proto->m_serverComboSelection);
@@ -908,7 +908,7 @@ void CManagerDlg::OnClose()
}
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
CMString S = _T("");
TCHAR temp[1000];
for (int i = 0; i < 5; i++) {
@@ -966,8 +966,8 @@ void CManagerDlg::OnAdd(CCtrlButton*)
TCHAR temp2[450];
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
- mir_sntprintf(temp2, SIZEOF(temp2), _T("/MODE %s %s %s"), window, mode, _T("%question"));
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
+ mir_sntprintf(temp2, _countof(temp2), _T("/MODE %s %s %s"), window, mode, _T("%question"));
SetDlgItemText(addban_hWnd, IDC_HIDDENEDIT, temp2);
dlg->Activate();
}
@@ -1009,8 +1009,8 @@ void CManagerDlg::OnEdit(CCtrlButton*)
TCHAR temp2[450];
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
- mir_sntprintf(temp2, SIZEOF(temp2), _T("/MODE %s -%s %s%s/MODE %s +%s %s"), window, mode, user.c_str(), _T("%newl"), window, mode, _T("%question"));
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
+ mir_sntprintf(temp2, _countof(temp2), _T("/MODE %s -%s %s%s/MODE %s +%s %s"), window, mode, user.c_str(), _T("%newl"), window, mode, _T("%question"));
SetDlgItemText(addban_hWnd, IDC_HIDDENEDIT, temp2);
dlg->Activate();
}
@@ -1026,7 +1026,7 @@ void CManagerDlg::OnRemove(CCtrlButton*)
m_remove.Disable();
TCHAR temp[100], mode[3];
- TCHAR* m = m_list.GetItemText(i, temp, SIZEOF(temp));
+ TCHAR* m = m_list.GetItemText(i, temp, _countof(temp));
CMString user = GetWord(m, 0);
if (m_radio1.GetState()) {
@@ -1043,7 +1043,7 @@ void CManagerDlg::OnRemove(CCtrlButton*)
}
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
if (MessageBox(m_hwnd, user.c_str(), temp, MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2) == IDYES) {
m_proto->PostIrcMessage(_T("/MODE %s %s %s"), window, mode, user.c_str());
ApplyQuestion();
@@ -1078,7 +1078,7 @@ void CManagerDlg::OnChangeTopic(CCtrlData*)
void CManagerDlg::OnApplyModes(CCtrlButton*)
{
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
CHANNELINFO *wi = (CHANNELINFO *)m_proto->DoEvent(GC_EVENT_GETITEMDATA, window, NULL, NULL, NULL, NULL, NULL, FALSE, FALSE, 0);
if (wi) {
TCHAR toadd[10]; *toadd = '\0';
@@ -1158,7 +1158,7 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
appendixadd += _T(" ");
TCHAR temp[400];
- m_key.GetText(temp, SIZEOF(temp));
+ m_key.GetText(temp, _countof(temp));
appendixadd += temp;
}
@@ -1167,7 +1167,7 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
mir_tstrcat(toremove, _T("l"));
else if (GetWindowTextLength(GetDlgItem(m_hwnd, IDC_LIMIT))) {
TCHAR temp[15];
- GetDlgItemText(m_hwnd, IDC_LIMIT, temp, SIZEOF(temp));
+ GetDlgItemText(m_hwnd, IDC_LIMIT, temp, _countof(temp));
if (wi->pszLimit && mir_tstrcmpi(wi->pszLimit, temp)) {
mir_tstrcat(toadd, _T("l"));
appendixadd += _T(" ") + CMString(temp);
@@ -1179,7 +1179,7 @@ void CManagerDlg::OnApplyModes(CCtrlButton*)
appendixadd += _T(" ");
TCHAR temp[15];
- m_limit.GetText(temp, SIZEOF(temp));
+ m_limit.GetText(temp, _countof(temp));
appendixadd += temp;
}
@@ -1207,8 +1207,8 @@ void CManagerDlg::OnApplyTopic(CCtrlButton*)
{
TCHAR temp[470];
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
- m_topic.GetText(temp, SIZEOF(temp));
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
+ m_topic.GetText(temp, _countof(temp));
m_proto->PostIrcMessage(_T("/TOPIC %s %s"), window, temp);
int i = m_topic.SendMsg(CB_FINDSTRINGEXACT, -1, (LPARAM)temp);
if (i != LB_ERR)
@@ -1243,7 +1243,7 @@ void CManagerDlg::OnRadio(CCtrlData*)
void CManagerDlg::ApplyQuestion()
{
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, _countof(window));
TCHAR mode[3];
mir_tstrcpy(mode, _T("+b"));