summaryrefslogtreecommitdiff
path: root/protocols/AimOscar/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/AimOscar/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/AimOscar/src')
-rw-r--r--protocols/AimOscar/src/avatars.cpp2
-rw-r--r--protocols/AimOscar/src/chat.cpp6
-rw-r--r--protocols/AimOscar/src/client.cpp2
-rw-r--r--protocols/AimOscar/src/file.cpp4
-rw-r--r--protocols/AimOscar/src/popup.cpp4
-rw-r--r--protocols/AimOscar/src/proto.cpp4
-rw-r--r--protocols/AimOscar/src/server.cpp18
-rw-r--r--protocols/AimOscar/src/services.cpp6
-rw-r--r--protocols/AimOscar/src/theme.cpp20
-rw-r--r--protocols/AimOscar/src/ui.cpp34
-rw-r--r--protocols/AimOscar/src/utility.cpp14
11 files changed, 57 insertions, 57 deletions
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp
index 2de60d0ed4..298a11f899 100644
--- a/protocols/AimOscar/src/avatars.cpp
+++ b/protocols/AimOscar/src/avatars.cpp
@@ -104,7 +104,7 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* /*hash*/, c
if (data_len > 0) {
const TCHAR *type;
ai.format = ProtoGetBufferFormat(data, &type);
- get_avatar_filename(ai.hContact, ai.filename, SIZEOF(ai.filename), type);
+ get_avatar_filename(ai.hContact, ai.filename, _countof(ai.filename), type);
int fileId = _topen(ai.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
if (fileId >= 0) {
diff --git a/protocols/AimOscar/src/chat.cpp b/protocols/AimOscar/src/chat.cpp
index 0188d4609f..09ab42eecc 100644
--- a/protocols/AimOscar/src/chat.cpp
+++ b/protocols/AimOscar/src/chat.cpp
@@ -197,7 +197,7 @@ int CAimProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{ TranslateT("&Invite user..."), 10, MENU_ITEM, FALSE },
{ TranslateT("&Leave chat session"), 20, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
else if ( gcmi->Type == MENU_ON_NICKLIST )
@@ -211,7 +211,7 @@ int CAimProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{ _T(""), 100, MENU_SEPARATOR, FALSE },
{ TranslateT("&Leave chat session"), 110, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
else {
@@ -219,7 +219,7 @@ int CAimProto::OnGCMenuHook(WPARAM, LPARAM lParam)
{ TranslateT("User &details"), 10, MENU_ITEM, FALSE },
{ TranslateT("User &history"), 20, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
mir_free(sn);
diff --git a/protocols/AimOscar/src/client.cpp b/protocols/AimOscar/src/client.cpp
index 169003f94c..b17a0cdd39 100644
--- a/protocols/AimOscar/src/client.cpp
+++ b/protocols/AimOscar/src/client.cpp
@@ -53,7 +53,7 @@ int CAimProto::aim_auth_request(HANDLE hServerConn,unsigned short &seqno,const c
char client_id[64], mirver[64];
CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(mirver), (LPARAM)mirver);
- int client_id_len = mir_snprintf(client_id, SIZEOF(client_id), "Miranda AIM, version %s", mirver);
+ int client_id_len = mir_snprintf(client_id, _countof(client_id), "Miranda AIM, version %s", mirver);
char* buf=(char*)alloca(SNAC_SIZE+TLV_HEADER_SIZE*14+MD5_HASH_LENGTH+mir_strlen(username)+client_id_len+30+mir_strlen(language)+mir_strlen(country));
diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp
index d47aa56b02..f98060d924 100644
--- a/protocols/AimOscar/src/file.cpp
+++ b/protocols/AimOscar/src/file.cpp
@@ -94,7 +94,7 @@ void CAimProto::report_file_error(TCHAR *fname)
{
TCHAR errmsg[512];
TCHAR* error = mir_a2t(_strerror(NULL));
- mir_sntprintf(errmsg, SIZEOF(errmsg), TranslateT("Failed to open file: %s : %s"), fname, error);
+ mir_sntprintf(errmsg, _countof(errmsg), TranslateT("Failed to open file: %s : %s"), fname, error);
mir_free(error);
ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP);
}
@@ -347,7 +347,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET
mir_free(buf);
TCHAR fname[256];
- mir_sntprintf(fname, SIZEOF(fname), _T("%s%s"), ft->pfts.tszWorkingDir, name);
+ mir_sntprintf(fname, _countof(fname), _T("%s%s"), ft->pfts.tszWorkingDir, name);
mir_free(name);
mir_free(ft->pfts.tszCurrentFile);
ft->pfts.tszCurrentFile = mir_tstrdup(fname);
diff --git a/protocols/AimOscar/src/popup.cpp b/protocols/AimOscar/src/popup.cpp
index 61ecaa9d17..01eec9d9b2 100644
--- a/protocols/AimOscar/src/popup.cpp
+++ b/protocols/AimOscar/src/popup.cpp
@@ -65,7 +65,7 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url)
{
POPUPDATAT ppd = {0};
- mir_sntprintf(ppd.lptzContactName, SIZEOF(ppd.lptzContactName), TranslateT("%s Protocol"), m_tszUserName);
+ mir_sntprintf(ppd.lptzContactName, _countof(ppd.lptzContactName), TranslateT("%s Protocol"), m_tszUserName);
if (flags & ERROR_POPUP)
{
@@ -88,7 +88,7 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url)
if (flags & MAIL_POPUP)
{
size_t len = mir_tstrlen(ppd.lptzText);
- mir_sntprintf(&ppd.lptzText[len], SIZEOF(ppd.lptzText) - len, _T(" %s"), TranslateT("Open mail account?"));
+ mir_sntprintf(&ppd.lptzText[len], _countof(ppd.lptzText) - len, _T(" %s"), TranslateT("Open mail account?"));
if (MessageBox(NULL, ppd.lptzText, ppd.lptzContactName, MB_YESNO | MB_ICONINFORMATION) == IDYES)
ShellExecuteA(NULL, "open", url, NULL, NULL, SW_SHOW);
}
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp
index 91618cf53e..5df30f65a6 100644
--- a/protocols/AimOscar/src/proto.cpp
+++ b/protocols/AimOscar/src/proto.cpp
@@ -57,7 +57,7 @@ CAimProto::CAimProto(const char* aProtoName, const TCHAR* aUserName) :
m_hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
char szP2P[128];
- mir_snprintf(szP2P, SIZEOF(szP2P), "%sP2P", m_szModuleName);
+ mir_snprintf(szP2P, _countof(szP2P), "%sP2P", m_szModuleName);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR;
mir_sntprintf(descr, TranslateT("%s Client-to-client connection"), m_tszUserName);
nlu.szSettingsModule = szP2P;
@@ -701,7 +701,7 @@ int __cdecl CAimProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l
case EV_PROTO_ONERASE:
{
char szDbsettings[64];
- mir_snprintf(szDbsettings, SIZEOF(szDbsettings), "%sP2P", m_szModuleName);
+ mir_snprintf(szDbsettings, _countof(szDbsettings), "%sP2P", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbsettings);
}
break;
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp
index 5cb097c4ac..15d9e4babe 100644
--- a/protocols/AimOscar/src/server.cpp
+++ b/protocols/AimOscar/src/server.cpp
@@ -316,7 +316,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
char f =cap[13];
char g =cap[14];
char h =cap[15];
- mir_snprintf(client,SIZEOF(client),CLIENT_OSCARJ,a&0x7f,b,c,d,alpha_cap_str(a),e&0x7f,f,g,h,alpha_cap_str(e));
+ mir_snprintf(client,_countof(client),CLIENT_OSCARJ,a&0x7f,b,c,d,alpha_cap_str(a),e&0x7f,f,g,h,alpha_cap_str(e));
}
else if (memcmp(cap, "MirandaA", 8) == 0)
{
@@ -328,7 +328,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
char f =cap[13];
char g =cap[14];
char h =cap[15];
- mir_snprintf(client,SIZEOF(client),CLIENT_AIMOSCAR,a,b,c,d,e,f,g,h);
+ mir_snprintf(client,_countof(client),CLIENT_AIMOSCAR,a,b,c,d,e,f,g,h);
}
if (memcmp(cap, "sinj", 4) == 0)
{
@@ -340,7 +340,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
char f =cap[9];
char g =cap[10];
char h =cap[11];
- mir_snprintf(client,SIZEOF(client),CLIENT_OSCARSN,a&0x7f,b,c,d,alpha_cap_str(a),e&0x7f,f,g,h,alpha_cap_str(e),secure_cap_str(&cap[12]));
+ mir_snprintf(client,_countof(client),CLIENT_OSCARSN,a&0x7f,b,c,d,alpha_cap_str(a),e&0x7f,f,g,h,alpha_cap_str(e),secure_cap_str(&cap[12]));
}
if (memcmp(cap, "icqp", 4) == 0)
{
@@ -352,7 +352,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003
char f =cap[9];
char g =cap[10];
char h =cap[11];
- mir_snprintf(client,SIZEOF(client),CLIENT_OSCARPL,a&0x7f,b,c,d,alpha_cap_str(a),e&0x7f,f,g,h,alpha_cap_str(e),secure_cap_str(&cap[12]));
+ mir_snprintf(client,_countof(client),CLIENT_OSCARPL,a&0x7f,b,c,d,alpha_cap_str(a),e&0x7f,f,g,h,alpha_cap_str(e),secure_cap_str(&cap[12]));
}
else if (memcmp(cap, "Kopete ICQ", 10) == 0)
{
@@ -1584,7 +1584,7 @@ void CAimProto::snac_list_modification_ack(SNAC &snac)//family 0x0013
default:
char msg[64];
- mir_snprintf(msg, SIZEOF(msg), "Error removing buddy from list. Error code %#x", code);
+ mir_snprintf(msg, _countof(msg), "Error removing buddy from list. Error code %#x", code);
ShowPopup(msg, ERROR_POPUP);
break;
}
@@ -1619,7 +1619,7 @@ void CAimProto::snac_list_modification_ack(SNAC &snac)//family 0x0013
default:
char msg[64];
- mir_snprintf(msg, SIZEOF(msg), Translate("Unknown error when adding buddy to list. Error code %#x"), code);
+ mir_snprintf(msg, _countof(msg), Translate("Unknown error when adding buddy to list. Error code %#x"), code);
ShowPopup(msg, ERROR_POPUP);
break;
}
@@ -1639,7 +1639,7 @@ void CAimProto::snac_list_modification_ack(SNAC &snac)//family 0x0013
default:
char msg[64];
- mir_snprintf(msg, SIZEOF(msg), Translate("Unknown error when attempting to modify a group. Error code %#x"), code);
+ mir_snprintf(msg, _countof(msg), Translate("Unknown error when attempting to modify a group. Error code %#x"), code);
ShowPopup(msg, ERROR_POPUP);
break;
}
@@ -1813,12 +1813,12 @@ void CAimProto::snac_mail_response(SNAC &snac)//family 0x0018
{
TCHAR msg[1024];
- int len = mir_sntprintf(msg, SIZEOF(msg), _T("%S@%S (%d)\r\n%s "), sn, address, num_msgs,
+ int len = mir_sntprintf(msg, _countof(msg), _T("%S@%S (%d)\r\n%s "), sn, address, num_msgs,
TranslateT("You've got mail! Checked at")) ;
SYSTEMTIME stLocal;
GetLocalTime(&stLocal);
- GetTimeFormat(LOCALE_USER_DEFAULT, 0, &stLocal, NULL, msg + len, SIZEOF(msg) - len);
+ GetTimeFormat(LOCALE_USER_DEFAULT, 0, &stLocal, NULL, msg + len, _countof(msg) - len);
ShowPopup((char*)msg, MAIL_POPUP | TCHAR_POPUP, url);
}
diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp
index 9d5b86d317..cfa55973a1 100644
--- a/protocols/AimOscar/src/services.cpp
+++ b/protocols/AimOscar/src/services.cpp
@@ -346,7 +346,7 @@ INT_PTR CAimProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
if (getByte(AIM_KEY_DA, 0)) return GAIR_NOAVATAR;
- switch (get_avatar_filename(pai->hContact, pai->filename, SIZEOF(pai->filename), NULL))
+ switch (get_avatar_filename(pai->hContact, pai->filename, _countof(pai->filename), NULL))
{
case GAIR_SUCCESS:
if (!(wParam & GAIF_FORCE) || state != 1 )
@@ -479,12 +479,12 @@ INT_PTR CAimProto::SetAvatar(WPARAM, LPARAM lParam)
TCHAR tFileName[MAX_PATH];
TCHAR *ext = _tcsrchr(szFileName, '.');
- get_avatar_filename(NULL, tFileName, SIZEOF(tFileName), ext);
+ get_avatar_filename(NULL, tFileName, _countof(tFileName), ext);
int fileId = _topen(tFileName, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
if (fileId < 0)
{
char errmsg[512];
- mir_snprintf(errmsg, SIZEOF(errmsg), "Cannot store avatar. File '%s' could not be created/overwritten", tFileName);
+ mir_snprintf(errmsg, _countof(errmsg), "Cannot store avatar. File '%s' could not be created/overwritten", tFileName);
ShowPopup(errmsg, ERROR_POPUP);
return 1;
}
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp
index 6d99b8d563..ed7bbf2c48 100644
--- a/protocols/AimOscar/src/theme.cpp
+++ b/protocols/AimOscar/src/theme.cpp
@@ -63,13 +63,13 @@ void InitIcons(void)
HICON LoadIconEx(const char *name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "AIM_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "AIM_%s", name);
return IcoLib_GetIcon(szSettingName, big);
}
HANDLE GetIconHandle(const char *name)
{
- for (int i=0; i < SIZEOF(iconList); i++)
+ for (int i=0; i < _countof(iconList); i++)
if ( !mir_strcmp(iconList[i].szName, name))
return iconList[i].hIcolib;
@@ -79,7 +79,7 @@ HANDLE GetIconHandle(const char *name)
void ReleaseIconEx(const char *name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName ), "%s_%s", "AIM", name);
+ mir_snprintf(szSettingName, _countof(szSettingName ), "%s_%s", "AIM", name);
IcoLib_Release(szSettingName, big);
}
@@ -239,21 +239,21 @@ void CAimProto::InitMainMenus(void)
mi.hParentMenu = hRoot;
mi.flags = CMIF_CHILDPOPUP;
- mir_snprintf(service_name, SIZEOF(service_name), "%s%s", m_szModuleName, "/ManageAccount");
+ mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/ManageAccount");
CreateProtoService("/ManageAccount", &CAimProto::ManageAccount);
mi.position = 201001;
mi.icolibItem = GetIconHandle("aim");
mi.pszName = LPGEN("Manage Account");
hMainMenu[0] = Menu_AddProtoMenuItem(&mi);
- mir_snprintf(service_name, SIZEOF(service_name), "%s%s", m_szModuleName, "/InstantIdle");
+ mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/InstantIdle");
CreateProtoService("/InstantIdle",&CAimProto::InstantIdle);
mi.position = 201002;
mi.icolibItem = GetIconHandle("idle");
mi.pszName = LPGEN("Instant Idle");
hMainMenu[1] = Menu_AddProtoMenuItem(&mi);
- mir_snprintf(service_name, SIZEOF(service_name), "%s%s", m_szModuleName, "/JoinChatRoom");
+ mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/JoinChatRoom");
CreateProtoService("/JoinChatRoom", &CAimProto::JoinChatUI);
mi.position = 201003;
mi.icolibItem = GetIconHandle("aol");
@@ -270,7 +270,7 @@ void CAimProto::InitContactMenus(void)
mi.pszService = service_name;
mi.pszContactOwner = m_szModuleName;
- mir_snprintf(service_name, SIZEOF(service_name), "%s%s", m_szModuleName, "/GetHTMLAwayMsg");
+ mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/GetHTMLAwayMsg");
CreateProtoService("/GetHTMLAwayMsg",&CAimProto::GetHTMLAwayMsg);
mi.position = -2000006000;
mi.icolibItem = GetIconHandle("away");
@@ -278,7 +278,7 @@ void CAimProto::InitContactMenus(void)
mi.flags = CMIF_NOTOFFLINE | CMIF_HIDDEN;
hHTMLAwayContextMenuItem = Menu_AddContactMenuItem(&mi);
- mir_snprintf(service_name, SIZEOF(service_name), "%s%s", m_szModuleName, "/GetProfile");
+ mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/GetProfile");
CreateProtoService("/GetProfile", &CAimProto::GetProfile);
mi.position = -2000005090;
mi.icolibItem = GetIconHandle("profile");
@@ -286,7 +286,7 @@ void CAimProto::InitContactMenus(void)
mi.flags = CMIF_NOTOFFLINE;
hReadProfileMenuItem = Menu_AddContactMenuItem(&mi);
- mir_snprintf(service_name, SIZEOF(service_name), "%s%s", m_szModuleName, "/AddToServerList");
+ mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/AddToServerList");
CreateProtoService("/AddToServerList", &CAimProto::AddToServerList);
mi.position = -2000005080;
mi.icolibItem = GetIconHandle("add");
@@ -294,7 +294,7 @@ void CAimProto::InitContactMenus(void)
mi.flags = CMIF_NOTONLINE | CMIF_HIDDEN;
hAddToServerListContextMenuItem = Menu_AddContactMenuItem(&mi);
- mir_snprintf(service_name, SIZEOF(service_name), "%s%s", m_szModuleName, "/BlockCommand");
+ mir_snprintf(service_name, _countof(service_name), "%s%s", m_szModuleName, "/BlockCommand");
CreateProtoService("/BlockCommand", &CAimProto::BlockBuddy);
mi.position = -2000005060;
mi.icolibItem = GetIconHandle("block");
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp
index 4904e134eb..d81b65f3c0 100644
--- a/protocols/AimOscar/src/ui.cpp
+++ b/protocols/AimOscar/src/ui.cpp
@@ -631,7 +631,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
break;
char name[64];
- GetDlgItemTextA(hwndDlg, IDC_FNAME, name, SIZEOF(name));
+ GetDlgItemTextA(hwndDlg, IDC_FNAME, name, _countof(name));
if (mir_strlen(trim_str(name)) > 0 && !ppro->getString(AIM_KEY_SN, &dbv)) {
if (mir_strcmp(name, dbv.pszVal))
ppro->aim_admin_format_name(ppro->hAdminConn, ppro->admin_seqno, name);
@@ -639,7 +639,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
}
char email[254];
- GetDlgItemTextA(hwndDlg, IDC_CEMAIL, email, SIZEOF(email));
+ GetDlgItemTextA(hwndDlg, IDC_CEMAIL, email, _countof(email));
if (mir_strlen(trim_str(email)) > 1 && !ppro->getString(AIM_KEY_EM, &dbv)) // Must be greater than 1 or a SNAC error is thrown.
{
if (mir_strcmp(email, dbv.pszVal))
@@ -650,9 +650,9 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
ShowWindow(GetDlgItem(hwndDlg, IDC_PINFO), SW_HIDE);
char cpw[256], npw1[256], npw2[256];
- GetDlgItemTextA(hwndDlg, IDC_CPW, cpw, SIZEOF(cpw));
- GetDlgItemTextA(hwndDlg, IDC_NPW1, npw1, SIZEOF(npw1));
- GetDlgItemTextA(hwndDlg, IDC_NPW2, npw2, SIZEOF(npw2));
+ GetDlgItemTextA(hwndDlg, IDC_CPW, cpw, _countof(cpw));
+ GetDlgItemTextA(hwndDlg, IDC_NPW1, npw1, _countof(npw1));
+ GetDlgItemTextA(hwndDlg, IDC_NPW2, npw2, _countof(npw2));
if (cpw[0] != 0 && npw1[0] != 0 && npw2[0] != 0) {
// AOL only requires that you send the current password and a (single) new password.
// Let's allow the client to type (two) new passwords incase they make a mistake so we
@@ -798,7 +798,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
char str[128];
//SN
- GetDlgItemTextA(hwndDlg, IDC_SN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_SN, str, _countof(str));
if (str[0] != 0)
ppro->setString(AIM_KEY_SN, str);
else
@@ -806,16 +806,16 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
//END SN
//NK
- if (GetDlgItemTextA(hwndDlg, IDC_NK, str, SIZEOF(str)))
+ if (GetDlgItemTextA(hwndDlg, IDC_NK, str, _countof(str)))
ppro->setString(AIM_KEY_NK, str);
else {
- GetDlgItemTextA(hwndDlg, IDC_SN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_SN, str, _countof(str));
ppro->setString(AIM_KEY_NK, str);
}
//END NK
//PW
- GetDlgItemTextA(hwndDlg, IDC_PW, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_PW, str, _countof(str));
if (str[0] != 0)
ppro->setString(AIM_KEY_PW, str);
else
@@ -823,7 +823,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
//END PW
//HN
- GetDlgItemTextA(hwndDlg, IDC_HN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_HN, str, _countof(str));
if (str[0] != 0 && mir_strcmp(str, AIM_DEFAULT_SERVER))
ppro->setString(AIM_KEY_HN, str);
else
@@ -959,12 +959,12 @@ static INT_PTR CALLBACK privacy_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_COMMAND:
if (LOWORD(wParam) == IDC_ALLOWADD) {
char nick[80];
- GetDlgItemTextA(hwndDlg, IDC_ALLOWEDIT, nick, SIZEOF(nick));
+ GetDlgItemTextA(hwndDlg, IDC_ALLOWEDIT, nick, _countof(nick));
SendDlgItemMessageA(hwndDlg, IDC_ALLOWLIST, LB_ADDSTRING, 0, (LPARAM)trim_str(nick));
}
else if (LOWORD(wParam) == IDC_BLOCKADD) {
char nick[80];
- GetDlgItemTextA(hwndDlg, IDC_BLOCKEDIT, nick, SIZEOF(nick));
+ GetDlgItemTextA(hwndDlg, IDC_BLOCKEDIT, nick, _countof(nick));
SendDlgItemMessageA(hwndDlg, IDC_BLOCKLIST, LB_ADDSTRING, 0, (LPARAM)trim_str(nick));
}
else if (LOWORD(wParam) == IDC_ALLOWREMOVE) {
@@ -1106,10 +1106,10 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) {
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_SN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_SN, str, _countof(str));
ppro->setString(AIM_KEY_SN, str);
- GetDlgItemTextA(hwndDlg, IDC_PW, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_PW, str, _countof(str));
ppro->setString(AIM_KEY_PW, str);
return TRUE;
}
@@ -1216,7 +1216,7 @@ INT_PTR CALLBACK join_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
switch (LOWORD(wParam)) {
case IDOK:
char room[128];
- GetDlgItemTextA(hwndDlg, IDC_ROOM, room, SIZEOF(room));
+ GetDlgItemTextA(hwndDlg, IDC_ROOM, room, _countof(room));
if (ppro->state == 1 && room[0] != 0) {
chatnav_param* par = new chatnav_param(room, 4);
ppro->ForkThread(&CAimProto::chatnav_request_thread, par);
@@ -1349,7 +1349,7 @@ INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case IDC_ADDSCR:
if (param->ppro->state == 1) {
TCHAR sn[64];
- GetDlgItemText(hwndDlg, IDC_EDITSCR, sn, SIZEOF(sn));
+ GetDlgItemText(hwndDlg, IDC_EDITSCR, sn, _countof(sn));
CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
@@ -1366,7 +1366,7 @@ INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP
chat_list_item* item = param->ppro->find_chat_by_id(param->id);
if (item) {
char msg[1024];
- GetDlgItemTextA(hwndDlg, IDC_MSG, msg, SIZEOF(msg));
+ GetDlgItemTextA(hwndDlg, IDC_MSG, msg, _countof(msg));
HWND hwndList = GetDlgItem(hwndDlg, IDC_CCLIST);
clist_chat_invite_send(NULL, hwndList, item, param->ppro, msg);
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp
index 174764ee46..004e195359 100644
--- a/protocols/AimOscar/src/utility.cpp
+++ b/protocols/AimOscar/src/utility.cpp
@@ -496,42 +496,42 @@ void BdList::remove_by_id(unsigned short id)
unsigned short CAimProto::getBuddyId(MCONTACT hContact, int i)
{
char item[sizeof(AIM_KEY_BI)+10];
- mir_snprintf(item, SIZEOF(item), AIM_KEY_BI"%d", i);
+ mir_snprintf(item, _countof(item), AIM_KEY_BI"%d", i);
return getWord(hContact, item, 0);
}
void CAimProto::setBuddyId(MCONTACT hContact, int i, unsigned short id)
{
char item[sizeof(AIM_KEY_BI)+10];
- mir_snprintf(item, SIZEOF(item), AIM_KEY_BI"%d", i);
+ mir_snprintf(item, _countof(item), AIM_KEY_BI"%d", i);
setWord(hContact, item, id);
}
int CAimProto::deleteBuddyId(MCONTACT hContact, int i)
{
char item[sizeof(AIM_KEY_BI)+10];
- mir_snprintf(item, SIZEOF(item), AIM_KEY_BI"%d", i);
+ mir_snprintf(item, _countof(item), AIM_KEY_BI"%d", i);
return delSetting(hContact, item);
}
unsigned short CAimProto::getGroupId(MCONTACT hContact, int i)
{
char item[sizeof(AIM_KEY_GI)+10];
- mir_snprintf(item, SIZEOF(item), AIM_KEY_GI"%d", i);
+ mir_snprintf(item, _countof(item), AIM_KEY_GI"%d", i);
return getWord(hContact, item, 0);
}
void CAimProto::setGroupId(MCONTACT hContact, int i, unsigned short id)
{
char item[sizeof(AIM_KEY_GI)+10];
- mir_snprintf(item, SIZEOF(item), AIM_KEY_GI"%d", i);
+ mir_snprintf(item, _countof(item), AIM_KEY_GI"%d", i);
setWord(hContact, item, id);
}
int CAimProto::deleteGroupId(MCONTACT hContact, int i)
{
char item[sizeof(AIM_KEY_GI)+10];
- mir_snprintf(item, SIZEOF(item), AIM_KEY_GI"%d", i);
+ mir_snprintf(item, _countof(item), AIM_KEY_GI"%d", i);
return delSetting(hContact, item);
}
@@ -553,7 +553,7 @@ int CAimProto::open_contact_file(const char*, const TCHAR* file, const char*, TC
if (fid < 0)
{
TCHAR errmsg[512];
- mir_sntprintf(errmsg, SIZEOF(errmsg), TranslateT("Failed to open file: %s %s"), path, __tcserror(NULL));
+ mir_sntprintf(errmsg, _countof(errmsg), TranslateT("Failed to open file: %s %s"), path, __tcserror(NULL));
ShowPopup((char*)errmsg, ERROR_POPUP | TCHAR_POPUP);
}
return fid;