diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-19 19:35:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-19 19:35:42 +0000 |
commit | 4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch) | |
tree | 9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /protocols | |
parent | f0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (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')
256 files changed, 1495 insertions, 1495 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;
diff --git a/protocols/Dummy/src/dummy_options.cpp b/protocols/Dummy/src/dummy_options.cpp index 279140bc29..4ff413d2dd 100644 --- a/protocols/Dummy/src/dummy_options.cpp +++ b/protocols/Dummy/src/dummy_options.cpp @@ -59,10 +59,10 @@ INT_PTR CALLBACK DummyAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: char str[128]; - GetDlgItemTextA(hwndDlg, IDC_ID_TEXT, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_ID_TEXT, str, _countof(str)); ppro->setString(DUMMY_ID_TEXT, str); - GetDlgItemTextA(hwndDlg, IDC_ID_SETTING, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_ID_SETTING, str, _countof(str)); ppro->setString(DUMMY_ID_SETTING, str); } break; diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp index 9beaa10869..15abcdd60f 100644 --- a/protocols/FacebookRM/src/avatars.cpp +++ b/protocols/FacebookRM/src/avatars.cpp @@ -126,7 +126,7 @@ void FacebookProto::UpdateAvatarWorker(void *) std::tstring FacebookProto::GetAvatarFolder()
{
TCHAR path[MAX_PATH];
- mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), VARST(_T("%miranda_avatarcache%")), m_tszUserName);
+ mir_sntprintf(path, _countof(path), _T("%s\\%s"), VARST(_T("%miranda_avatarcache%")), m_tszUserName);
return path;
}
diff --git a/protocols/FacebookRM/src/captcha.cpp b/protocols/FacebookRM/src/captcha.cpp index 4ff4a2faa9..98cc51bd1e 100644 --- a/protocols/FacebookRM/src/captcha.cpp +++ b/protocols/FacebookRM/src/captcha.cpp @@ -85,7 +85,7 @@ static INT_PTR CALLBACK CaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam return TRUE; case IDOK: - GetDlgItemTextA(hwndDlg, IDC_VALUE, params->Result, SIZEOF(params->Result)); + GetDlgItemTextA(hwndDlg, IDC_VALUE, params->Result, _countof(params->Result)); EndDialog(hwndDlg, 1); return TRUE; } diff --git a/protocols/FacebookRM/src/chat.cpp b/protocols/FacebookRM/src/chat.cpp index 2b9af2ddcb..e6e29ddb90 100644 --- a/protocols/FacebookRM/src/chat.cpp +++ b/protocols/FacebookRM/src/chat.cpp @@ -365,7 +365,7 @@ int FacebookProto::OnGCMenuHook(WPARAM, LPARAM lParam) { LPGENT("&Invite user..."), 10, MENU_ITEM, FALSE }, { LPGENT("&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) @@ -379,7 +379,7 @@ int FacebookProto::OnGCMenuHook(WPARAM, LPARAM lParam) { _T(""), 100, MENU_SEPARATOR, FALSE }, { LPGENT("&Leave chat session"), 110, MENU_ITEM, FALSE } }; - gcmi->nItems = SIZEOF(Items); + gcmi->nItems = _countof(Items); gcmi->Item = (gc_item*)Items;*/ gcmi->nItems = 0; gcmi->Item = NULL; @@ -391,7 +391,7 @@ int FacebookProto::OnGCMenuHook(WPARAM, LPARAM lParam) { LPGENT("User &details"), 10, MENU_ITEM, FALSE }, { LPGENT("User &history"), 20, MENU_ITEM, FALSE } }; - gcmi->nItems = SIZEOF(Items); + gcmi->nItems = _countof(Items); gcmi->Item = (gc_item*)Items; } } @@ -415,7 +415,7 @@ void FacebookProto::PrepareNotificationsChatRoom() { MCONTACT hNotificationsChatRoom = ChatIDToHContact(FACEBOOK_NOTIFICATIONS_CHATROOM); if (hNotificationsChatRoom == NULL || getDword(hNotificationsChatRoom, "Status", ID_STATUS_OFFLINE) != ID_STATUS_ONLINE) { TCHAR nameT[200]; - mir_sntprintf(nameT, SIZEOF(nameT), _T("%s: %s"), m_tszUserName, TranslateT("Notifications")); + mir_sntprintf(nameT, _countof(nameT), _T("%s: %s"), m_tszUserName, TranslateT("Notifications")); // Create the group chat session GCSESSION gcw = { sizeof(gcw) }; diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 342845436f..2c50763622 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -546,7 +546,7 @@ NETLIBHTTPHEADER *facebook_client::get_request_headers(int request_type, int *he std::string facebook_client::get_newsfeed_type() { BYTE feed_type = parent->getByte(FACEBOOK_KEY_FEED_TYPE, 0); - if (feed_type >= SIZEOF(feed_types)) + if (feed_type >= _countof(feed_types)) feed_type = 0; std::string ret = "sk="; @@ -559,7 +559,7 @@ std::string facebook_client::get_newsfeed_type() std::string facebook_client::get_server_type() { BYTE server_type = parent->getByte(FACEBOOK_KEY_SERVER_TYPE, 0); - if (server_type >= SIZEOF(server_types)) + if (server_type >= _countof(server_types)) server_type = 0; return server_types[server_type].id; } @@ -567,7 +567,7 @@ std::string facebook_client::get_server_type() std::string facebook_client::get_privacy_type() { BYTE privacy_type = parent->getByte(FACEBOOK_KEY_PRIVACY_TYPE, 0); - if (privacy_type >= SIZEOF(privacy_types)) + if (privacy_type >= _countof(privacy_types)) privacy_type = 0; return privacy_types[privacy_type].id; } diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index d7b575f6ed..184713d917 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -313,7 +313,7 @@ void FacebookProto::LoadChatInfo(facebook_chatroom *fbc) if (fbc->participants.size() > namesUsed) { TCHAR more[200]; - mir_sntprintf(more, SIZEOF(more), TranslateT("%s and more (%d)"), fbc->chat_name.c_str(), fbc->participants.size() - namesUsed); + mir_sntprintf(more, _countof(more), TranslateT("%s and more (%d)"), fbc->chat_name.c_str(), fbc->participants.size() - namesUsed); fbc->chat_name = more; } diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index 3610b5d19f..2cbcfff995 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -88,10 +88,10 @@ INT_PTR CALLBACK FBAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp { char str[128]; - GetDlgItemTextA(hwnd, IDC_UN, str, SIZEOF(str)); + GetDlgItemTextA(hwnd, IDC_UN, str, _countof(str)); db_set_s(NULL, proto->ModuleName(), FACEBOOK_KEY_LOGIN, str); - GetDlgItemTextA(hwnd, IDC_PW, str, SIZEOF(str)); + GetDlgItemTextA(hwnd, IDC_PW, str, _countof(str)); db_set_s(NULL, proto->ModuleName(), FACEBOOK_KEY_PASS, str); return TRUE; } @@ -107,7 +107,7 @@ void RefreshPrivacy(HWND hwnd, post_status_data *data) SendDlgItemMessage(hwnd, IDC_PRIVACY, CB_RESETCONTENT, 0, 0); int wall_id = SendDlgItemMessage(hwnd, IDC_WALL, CB_GETCURSEL, 0, 0); if (data->walls[wall_id]->user_id == data->proto->facy.self_.user_id) { - for (size_t i = 0; i < SIZEOF(privacy_types); i++) + for (size_t i = 0; i < _countof(privacy_types); i++) SendDlgItemMessageA(hwnd, IDC_PRIVACY, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(privacy_types[i].name))); } else { @@ -219,7 +219,7 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara ptrA firstname(data->proto->getStringA(FACEBOOK_KEY_FIRST_NAME)); if (firstname != NULL) { char title[100]; - mir_snprintf(title, SIZEOF(title), Translate("What's on your mind, %s?"), firstname); + mir_snprintf(title, _countof(title), Translate("What's on your mind, %s?"), firstname); SetWindowTextA(hwnd, title); } } @@ -276,9 +276,9 @@ INT_PTR CALLBACK FBMindProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lpara TCHAR urlT[1024]; TCHAR placeT[100]; - GetDlgItemText(hwnd, IDC_MINDMSG, mindMessageT, SIZEOF(mindMessageT)); - GetDlgItemText(hwnd, IDC_PLACE, placeT, SIZEOF(placeT)); - GetDlgItemText(hwnd, IDC_URL, urlT, SIZEOF(urlT)); + GetDlgItemText(hwnd, IDC_MINDMSG, mindMessageT, _countof(mindMessageT)); + GetDlgItemText(hwnd, IDC_PLACE, placeT, _countof(placeT)); + GetDlgItemText(hwnd, IDC_URL, urlT, _countof(urlT)); ShowWindow(hwnd, SW_HIDE); int wall_id = SendDlgItemMessage(hwnd, IDC_WALL, CB_GETCURSEL, 0, 0); @@ -395,13 +395,13 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp { char str[128]; TCHAR tstr[128]; - GetDlgItemTextA(hwnd, IDC_UN, str, SIZEOF(str)); + GetDlgItemTextA(hwnd, IDC_UN, str, _countof(str)); db_set_s(0, proto->ModuleName(), FACEBOOK_KEY_LOGIN, str); - GetDlgItemTextA(hwnd, IDC_PW, str, SIZEOF(str)); + GetDlgItemTextA(hwnd, IDC_PW, str, _countof(str)); proto->setString(FACEBOOK_KEY_PASS, str); - GetDlgItemText(hwnd, IDC_GROUP, tstr, SIZEOF(tstr)); + GetDlgItemText(hwnd, IDC_GROUP, tstr, _countof(tstr)); if (tstr[0] != '\0') { proto->m_tszDefaultGroup = mir_tstrdup(tstr); @@ -496,11 +496,11 @@ INT_PTR CALLBACK FBOptionsEventsProc(HWND hwnd, UINT message, WPARAM wparam, LPA proto = reinterpret_cast<FacebookProto*>(lparam); SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam); - for (size_t i = 0; i < SIZEOF(feed_types); i++) + for (size_t i = 0; i < _countof(feed_types); i++) SendDlgItemMessageA(hwnd, IDC_FEED_TYPE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(feed_types[i].name))); SendDlgItemMessage(hwnd, IDC_FEED_TYPE, CB_SETCURSEL, proto->getByte(FACEBOOK_KEY_FEED_TYPE, 0), 0); - for (size_t i = 0; i < SIZEOF(server_types); i++) + for (size_t i = 0; i < _countof(server_types); i++) SendDlgItemMessageA(hwnd, IDC_URL_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(server_types[i].name))); SendDlgItemMessage(hwnd, IDC_URL_SERVER, CB_SETCURSEL, proto->getByte(FACEBOOK_KEY_SERVER_TYPE, 0), 0); diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index df528d7cc9..d8a43f9255 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -391,7 +391,7 @@ void parseAttachments(FacebookProto *proto, std::string *message_text, const JSO newText = _A2T(type.c_str()); TCHAR title[200]; - mir_sntprintf(title, SIZEOF(title), TranslateT("User sent %s:"), newText.c_str()); + mir_sntprintf(title, _countof(title), TranslateT("User sent %s:"), newText.c_str()); *message_text += T2Utf(title); *message_text += attachments_text; @@ -688,7 +688,7 @@ int facebook_json_parser::parse_messages(std::string *data, std::vector< faceboo StatusTextData st = { 0 }; st.cbSize = sizeof(st); - mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("%s is typing a message..."), name); + mir_sntprintf(st.tszText, _countof(st.tszText), TranslateT("%s is typing a message..."), name); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st); } diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 923a371f0a..b3bfdc93b3 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -277,7 +277,7 @@ HANDLE FacebookProto::SearchByEmail(const TCHAR* email) HANDLE FacebookProto::SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName) { TCHAR arg[200]; - mir_sntprintf(arg, SIZEOF(arg), _T("%s %s %s"), nick, firstName, lastName); + mir_sntprintf(arg, _countof(arg), _T("%s %s %s"), nick, firstName, lastName); return SearchByEmail(arg); // Facebook is using one search method for everything (except IDs) } @@ -531,7 +531,7 @@ int FacebookProto::OnToolbarInit(WPARAM, LPARAM) ttb.dwFlags = TTBBF_SHOWTOOLTIP | TTBBF_VISIBLE; char service[100]; - mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, "/Mind"); + mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, "/Mind"); ttb.pszService = service; ttb.pszTooltipUp = ttb.name = LPGEN("Share status..."); @@ -772,7 +772,7 @@ INT_PTR FacebookProto::CancelFriendship(WPARAM wParam, LPARAM lParam) return 1; TCHAR tstr[256]; - mir_sntprintf(tstr, SIZEOF(tstr), TranslateT("Do you want to cancel your friendship with '%s'?"), tname); + mir_sntprintf(tstr, _countof(tstr), TranslateT("Do you want to cancel your friendship with '%s'?"), tname); if (MessageBox(0, tstr, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2) == IDYES) { ptrA id(getStringA(hContact, FACEBOOK_KEY_ID)); @@ -1124,7 +1124,7 @@ void FacebookProto::MessageRead(MCONTACT hContact) return; TCHAR ttime[64]; - _tcsftime(ttime, SIZEOF(ttime), _T("%X"), localtime(&time)); + _tcsftime(ttime, _countof(ttime), _T("%X"), localtime(&time)); StatusTextData st = { 0 }; st.cbSize = sizeof(st); @@ -1133,10 +1133,10 @@ void FacebookProto::MessageRead(MCONTACT hContact) if (isChatRoom(hContact)) { // Load readers names ptrT treaders(getTStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS)); - mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : _T("???")); + mir_sntprintf(st.tszText, _countof(st.tszText), TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : _T("???")); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st); } else if (!ServiceExists("MessageState/DummyService")){ - mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("Message read: %s"), ttime); + mir_sntprintf(st.tszText, _countof(st.tszText), TranslateT("Message read: %s"), ttime); CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st); } } diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index 96d413b8c3..868593fad7 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -51,12 +51,12 @@ static IconItem icons[] = void InitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/Facebook", icons, SIZEOF(icons), "Facebook");
+ Icon_Register(g_hInstance, "Protocols/Facebook", icons, _countof(icons), "Facebook");
}
HANDLE GetIconHandle(const char* name)
{
- for (size_t i = 0; i < SIZEOF(icons); i++)
+ for (size_t i = 0; i < _countof(icons); i++)
if (mir_strcmp(icons[i].szName, name) == 0)
return icons[i].hIcolib;
diff --git a/protocols/GTalkExt/src/avatar.cpp b/protocols/GTalkExt/src/avatar.cpp index 833bfeef0a..bf6ec8389e 100644 --- a/protocols/GTalkExt/src/avatar.cpp +++ b/protocols/GTalkExt/src/avatar.cpp @@ -33,7 +33,7 @@ LPTSTR CreateAvaFile(HANDLE *hFile)
{
TCHAR name[MAX_PATH + 2];
- if (CallService(MS_DB_GETPROFILENAMET, (WPARAM)SIZEOF(name), (LPARAM)&name))
+ if (CallService(MS_DB_GETPROFILENAMET, (WPARAM)_countof(name), (LPARAM)&name))
return NULL;
TCHAR *p = _tcsrchr(name, '.');
@@ -41,7 +41,7 @@ LPTSTR CreateAvaFile(HANDLE *hFile) *p = 0;
TCHAR path[MAX_PATH + 2];
- if (CallService(MS_DB_GETPROFILEPATHT, (WPARAM)SIZEOF(path), (LPARAM)&path))
+ if (CallService(MS_DB_GETPROFILEPATHT, (WPARAM)_countof(path), (LPARAM)&path))
return NULL;
TCHAR full[MAX_PATH + 2];
diff --git a/protocols/GTalkExt/src/menu.cpp b/protocols/GTalkExt/src/menu.cpp index b640317fe3..50e88caa18 100644 --- a/protocols/GTalkExt/src/menu.cpp +++ b/protocols/GTalkExt/src/menu.cpp @@ -41,7 +41,7 @@ int InitMenus(WPARAM wParam, LPARAM lParam) if (pga != NULL) {
LPCSTR szModuleName = pga->m_japi->GetModuleName();
char szServiceName[100];
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s/%s", szModuleName, MS_GTALKEXT_OPENMAILBOX);
+ mir_snprintf(szServiceName, _countof(szServiceName), "%s/%s", szModuleName, MS_GTALKEXT_OPENMAILBOX);
CreateServiceFunctionParam(szServiceName, OpenMailboxMenuHandler, (LPARAM)szModuleName);
CLISTMENUITEM cmi = { sizeof(cmi) };
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index 9f0dd6dbde..c4e21d177d 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -199,7 +199,7 @@ static MEVENT AddCListNotification(MCONTACT hContact, LPCSTR acc, POPUPDATAT *da dbei.eventType = EVENTTYPE_MESSAGE;
char szEventText[4096];
- dbei.cbBlob = mir_snprintf(szEventText, SIZEOF(szEventText), "%s\r\n%s", szUrl, szText);
+ dbei.cbBlob = mir_snprintf(szEventText, _countof(szEventText), "%s\r\n%s", szUrl, szText);
dbei.pBlob = (PBYTE)szEventText;
return db_event_add(hContact, &dbei);
}
diff --git a/protocols/GTalkExt/src/options.cpp b/protocols/GTalkExt/src/options.cpp index eb5286d7f5..d82087963b 100644 --- a/protocols/GTalkExt/src/options.cpp +++ b/protocols/GTalkExt/src/options.cpp @@ -218,7 +218,7 @@ INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM db_set_dw(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, (DWORD)SendDlgItemMessage(wnd, IDC_BACKCOLORPICKER, CPM_GETCOLOUR, 0, 0));
db_set_dw(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, (DWORD)SendDlgItemMessage(wnd, IDC_TEXTCOLORPICKER, CPM_GETCOLOUR, 0, 0));
- GetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout, SIZEOF(timeout));
+ GetDlgItemText(wnd, IDC_TIMEOUTEDIT, timeout, _countof(timeout));
db_set_dw(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, _ttoi(timeout));
}
return 0;
diff --git a/protocols/GTalkExt/src/tipper_items.cpp b/protocols/GTalkExt/src/tipper_items.cpp index a17127abda..b4f366d743 100644 --- a/protocols/GTalkExt/src/tipper_items.cpp +++ b/protocols/GTalkExt/src/tipper_items.cpp @@ -112,7 +112,7 @@ void AddTipperItem() }
}
- for (i = 0; i < SIZEOF(TipperItemProps); i++)
+ for (i = 0; i < _countof(TipperItemProps); i++)
ShiftTipperSettings(setting, itemCount, TipperItemProps[i]);
#define WRITE_TIPPER_PROPS(index, value)\
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index 4f04649a6a..f054c5e0e9 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -261,7 +261,7 @@ void __cdecl GGPROTO::avatarrequestthread(void*) if (strncmp(resp->pData,"\x89\x50\x4E\x47\x0D\x0A\x1A\x0A",8) == 0) avatarType = PA_FORMAT_PNG;
setByte(data->hContact, GG_KEY_AVATARTYPE, (BYTE)avatarType);
- getAvatarFilename(ai.hContact, ai.filename, SIZEOF(ai.filename));
+ getAvatarFilename(ai.hContact, ai.filename, _countof(ai.filename));
file_fd = _topen(ai.filename, _O_WRONLY | _O_TRUNC | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE);
if (file_fd != -1) {
_write(file_fd, resp->pData, resp->dataLength);
@@ -389,7 +389,7 @@ void __cdecl GGPROTO::setavatarthread(void *param) size_t avatarFileB64EncLen = mir_strlen(avatarFileB64Enc);
char dataPrefix[64];
- mir_snprintf(dataPrefix, SIZEOF(dataPrefix), "uin=%d&photo=", getDword(GG_KEY_UIN, 0));
+ mir_snprintf(dataPrefix, _countof(dataPrefix), "uin=%d&photo=", getDword(GG_KEY_UIN, 0));
size_t dataPrefixLen = mir_strlen(dataPrefix);
size_t dataLen = dataPrefixLen + avatarFileB64EncLen;
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 47b20cb21d..dca61cd88b 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -637,8 +637,8 @@ retry: _tcsncpy_s(strFmt2, pcli->pfnGetStatusModeDescription( status_gg2m(atoi(__status)), 0), _TRUNCATE);
if (__city) {
- mir_sntprintf(strFmt1, SIZEOF(strFmt1), _T(", %s %s"), TranslateT("City:"), __city);
- mir_tstrncat(strFmt2, strFmt1, SIZEOF(strFmt2) - mir_tstrlen(strFmt2));
+ mir_sntprintf(strFmt1, _countof(strFmt1), _T(", %s %s"), TranslateT("City:"), __city);
+ mir_tstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_tstrlen(strFmt2));
}
if (__birthyear) {
time_t t = time(NULL);
@@ -646,8 +646,8 @@ retry: int br = atoi(__birthyear);
if (br < (lt->tm_year + 1900) && br > 1900) {
- mir_sntprintf(strFmt1, SIZEOF(strFmt1), _T(", %s %d"), TranslateT("Age:"), (lt->tm_year + 1900) - br);
- mir_tstrncat(strFmt2, strFmt1, SIZEOF(strFmt2) - mir_tstrlen(strFmt2));
+ mir_sntprintf(strFmt1, _countof(strFmt1), _T(", %s %d"), TranslateT("Age:"), (lt->tm_year + 1900) - br);
+ mir_tstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_tstrlen(strFmt2));
}
}
@@ -975,7 +975,7 @@ retry: if (iIndexes && iIndexes[i])
continue;
- mir_sntprintf(szMsg, SIZEOF(szMsg), _T("%s (%s)"), szText,
+ mir_sntprintf(szMsg, _countof(szMsg), _T("%s (%s)"), szText,
*e->event.multilogon_info.sessions[i].name != '\0' ?
_A2T(e->event.multilogon_info.sessions[i].name) : TranslateT("Unknown client"));
showpopup(m_tszUserName, szMsg, GG_POPUP_MULTILOGON);
@@ -1008,7 +1008,7 @@ retry: {
CLISTEVENT cle = {0};
char service[128];
- mir_snprintf(service, SIZEOF(service), GGS_RECVIMAGE, m_szModuleName);
+ mir_snprintf(service, _countof(service), GGS_RECVIMAGE, m_szModuleName);
cle.cbSize = sizeof(cle);
cle.hContact = hContact;
@@ -1716,7 +1716,7 @@ void GGPROTO::changecontactstatus(uin_t uin, int status, const TCHAR *idescr, in {
char sversion[48];
setDword(hContact, GG_KEY_CLIENTVERSION, (DWORD) version);
- mir_snprintf(sversion, SIZEOF(sversion), "%sGadu-Gadu %s", (version & 0x00ffffff) > 0x2b ? "Nowe " : "", gg_version2string(version));
+ mir_snprintf(sversion, _countof(sversion), "%sGadu-Gadu %s", (version & 0x00ffffff) > 0x2b ? "Nowe " : "", gg_version2string(version));
setString(hContact, "MirVer", sversion);
}
}
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index a142393008..98745341af 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -60,7 +60,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule else if (special == SVS_MONTH) { if (dbv.bVal > 0 && dbv.bVal <= 12) { ptstr = str; - GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1 - 1 + dbv.bVal, str, SIZEOF(str)); + GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVMONTHNAME1 - 1 + dbv.bVal, str, _countof(str)); } else unspecified = 1; } @@ -68,7 +68,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule if (dbv.cVal == -100) unspecified = 1; else { ptstr = str; - mir_sntprintf(str, SIZEOF(str), dbv.cVal ? _T("GMT%+d:%02d") : _T("GMT"), -dbv.cVal / 2, (dbv.cVal & 1) * 30); + mir_sntprintf(str, _countof(str), dbv.cVal ? _T("GMT%+d:%02d") : _T("GMT"), -dbv.cVal / 2, (dbv.cVal & 1) * 30); } } else { unspecified = (special == SVS_ZEROISUNSPEC && dbv.bVal == 0); @@ -82,7 +82,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule unspecified = 1; } else { ptstr = str; - mir_sntprintf(str, SIZEOF(str), _T("%S"), pstr); + mir_sntprintf(str, _countof(str), _T("%S"), pstr); } } else { @@ -100,12 +100,12 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule unspecified = 1; } else { ptstr = str; - mir_sntprintf(str, SIZEOF(str), _T("%S"), pstr); + mir_sntprintf(str, _countof(str), _T("%S"), pstr); } if (dbv.dVal == 0) unspecified = 1; } else if (special == SVS_GGVERSION) { ptstr = str; - mir_sntprintf(str, SIZEOF(str), _T("%S"), (char *)gg_version2string(dbv.dVal)); + mir_sntprintf(str, _countof(str), _T("%S"), (char *)gg_version2string(dbv.dVal)); } else { ptstr = _itot(special == SVS_SIGNED ? dbv.lVal : dbv.dVal, str, 10); } @@ -113,7 +113,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule case DBVT_ASCIIZ: unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); ptstr = str; - mir_sntprintf(str, SIZEOF(str), _T("%S"), dbv.pszVal); + mir_sntprintf(str, _countof(str), _T("%S"), dbv.pszVal); break; case DBVT_TCHAR: unspecified = (special == SVS_ZEROISUNSPEC && dbv.ptszVal[0] == '\0'); @@ -123,7 +123,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); valT = mir_utf8decodeT(dbv.pszVal); ptstr = str; - _tcscpy_s(str, SIZEOF(str), valT); + _tcscpy_s(str, _countof(str), valT); mir_free(valT); break; default: @@ -204,9 +204,9 @@ void GGPROTO::checknewuser(uin_t uin, const char* passwd) static void gg_optsdlgcheck(HWND hwndDlg) { TCHAR text[128]; - GetDlgItemText(hwndDlg, IDC_UIN, text, SIZEOF(text)); + GetDlgItemText(hwndDlg, IDC_UIN, text, _countof(text)); if (text[0]) { - GetDlgItemText(hwndDlg, IDC_EMAIL, text, SIZEOF(text)); + GetDlgItemText(hwndDlg, IDC_EMAIL, text, _countof(text)); if (text[0]) ShowWindow(GetDlgItem(hwndDlg, IDC_CHEMAIL), SW_SHOW); else @@ -337,9 +337,9 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, { char email[128]; uin_t uin; - GetDlgItemTextA(hwndDlg, IDC_UIN, email, SIZEOF(email)); + GetDlgItemTextA(hwndDlg, IDC_UIN, email, _countof(email)); uin = atoi(email); - GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email)); + GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, _countof(email)); if (!mir_strlen(email)) MessageBox(NULL, TranslateT("You need to specify your registration e-mail first."), gg->m_tszUserName, MB_OK | MB_ICONEXCLAMATION); @@ -370,10 +370,10 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, GGUSERUTILDLGDATA dat; int ret; char pass[128], email[128]; - GetDlgItemTextA(hwndDlg, IDC_UIN, pass, SIZEOF(pass)); + GetDlgItemTextA(hwndDlg, IDC_UIN, pass, _countof(pass)); dat.uin = atoi(pass); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass)); - GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, _countof(pass)); + GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, _countof(email)); dat.pass = pass; dat.email = email; dat.gg = gg; @@ -457,15 +457,15 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, uin_t uin; // Write Gadu-Gadu number & password - GetDlgItemTextA(hwndDlg, IDC_UIN, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_UIN, str, _countof(str)); uin = atoi(str); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, _countof(str)); gg->checknewuser(uin, str); gg->setDword(GG_KEY_UIN, uin); gg->setString(GG_KEY_PASSWORD, str); // Write Gadu-Gadu email - GetDlgItemTextA(hwndDlg, IDC_EMAIL, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_EMAIL, str, _countof(str)); gg->setString(GG_KEY_EMAIL, str); // Write checkboxes @@ -564,9 +564,9 @@ static INT_PTR CALLBACK gg_confoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam gg->setWord(GG_KEY_GC_POLICY_UNKNOWN, (WORD)SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_UNKNOWN, CB_GETCURSEL, 0, 0)); gg->setWord(GG_KEY_GC_POLICY_DEFAULT, (WORD)SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_DEFAULT, CB_GETCURSEL, 0, 0)); - GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_TOTAL, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_TOTAL, str, _countof(str)); gg->setWord(GG_KEY_GC_COUNT_TOTAL, (WORD)atoi(str)); - GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_UNKNOWN, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_UNKNOWN, str, _countof(str)); gg->setWord(GG_KEY_GC_COUNT_UNKNOWN, (WORD)atoi(str)); } break; @@ -664,16 +664,16 @@ static INT_PTR CALLBACK gg_advoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, gg->setByte(GG_KEY_FORWARDING, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FORWARDING)); // Write custom servers - GetDlgItemTextA(hwndDlg, IDC_HOST, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_HOST, str, _countof(str)); gg->setString(GG_KEY_SERVERHOSTS, str); // Write direct port - GetDlgItemTextA(hwndDlg, IDC_DIRECTPORT, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_DIRECTPORT, str, _countof(str)); gg->setWord(GG_KEY_DIRECTPORT, (WORD)atoi(str)); // Write forwarding host - GetDlgItemTextA(hwndDlg, IDC_FORWARDHOST, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_FORWARDHOST, str, _countof(str)); gg->setString(GG_KEY_FORWARDHOST, str); - GetDlgItemTextA(hwndDlg, IDC_FORWARDPORT, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_FORWARDPORT, str, _countof(str)); gg->setWord(GG_KEY_FORWARDPORT, (WORD)atoi(str)); break; } @@ -828,19 +828,19 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_WRITE); - GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, SIZEOF(text)); + GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text)); if (mir_tstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, T2Utf(text)); - GetDlgItemText(hwndDlg, IDC_LASTNAME, text, SIZEOF(text)); + GetDlgItemText(hwndDlg, IDC_LASTNAME, text, _countof(text)); if (mir_tstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, T2Utf(text)); - GetDlgItemText(hwndDlg, IDC_NICKNAME, text, SIZEOF(text)); + GetDlgItemText(hwndDlg, IDC_NICKNAME, text, _countof(text)); if (mir_tstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, T2Utf(text)); - GetDlgItemText(hwndDlg, IDC_CITY, text, SIZEOF(text)); + GetDlgItemText(hwndDlg, IDC_CITY, text, _countof(text)); if (mir_tstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_CITY, T2Utf(text)); @@ -856,15 +856,15 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, gg_pubdir50_add(req, GG_PUBDIR50_GENDER, ""); } - GetDlgItemText(hwndDlg, IDC_BIRTHYEAR, text, SIZEOF(text)); + GetDlgItemText(hwndDlg, IDC_BIRTHYEAR, text, _countof(text)); if (mir_tstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, T2Utf(text)); - GetDlgItemText(hwndDlg, IDC_FAMILYNAME, text, SIZEOF(text)); + GetDlgItemText(hwndDlg, IDC_FAMILYNAME, text, _countof(text)); if (mir_tstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_FAMILYNAME, T2Utf(text)); - GetDlgItemText(hwndDlg, IDC_CITYORIGIN, text, SIZEOF(text)); + GetDlgItemText(hwndDlg, IDC_CITYORIGIN, text, _countof(text)); if (mir_tstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_FAMILYCITY, T2Utf(text)); @@ -962,10 +962,10 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP GGUSERUTILDLGDATA dat; int ret; char pass[128], email[128]; - GetDlgItemTextA(hwndDlg, IDC_UIN, pass, SIZEOF(pass)); + GetDlgItemTextA(hwndDlg, IDC_UIN, pass, _countof(pass)); dat.uin = atoi(pass); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass)); - GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, _countof(pass)); + GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, _countof(email)); dat.pass = pass; dat.email = email; dat.gg = gg; @@ -1021,15 +1021,15 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP uin_t uin; // Write Gadu-Gadu number & password - GetDlgItemTextA(hwndDlg, IDC_UIN, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_UIN, str, _countof(str)); uin = atoi(str); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, _countof(str)); gg->checknewuser(uin, str); gg->setDword(GG_KEY_UIN, uin); gg->setString(GG_KEY_PASSWORD, str); // Write Gadu-Gadu email - GetDlgItemTextA(hwndDlg, IDC_EMAIL, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_EMAIL, str, _countof(str)); gg->setString(GG_KEY_EMAIL, str); } } diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 932aa9f94e..7034f31036 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -269,7 +269,7 @@ void __cdecl GGPROTO::dccmainthread(void*) {
PROTOFILETRANSFERSTATUS pfts;
local_dcc->tick = tick;
- mir_snprintf(szFilename, SIZEOF(szFilename), "%s%s", local_dcc->folder, local_dcc->file_info.filename);
+ mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc->file_info.filename);
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (MCONTACT)local_dcc->contact;
@@ -299,7 +299,7 @@ void __cdecl GGPROTO::dccmainthread(void*) if (local_dcc->file_fd != -1)
{
PROTOFILETRANSFERSTATUS pfts;
- mir_snprintf(szFilename, SIZEOF(szFilename), "%s%s", local_dcc->folder, local_dcc->file_info.filename);
+ mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc->file_info.filename);
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (MCONTACT)local_dcc->contact;
@@ -497,7 +497,7 @@ void __cdecl GGPROTO::dccmainthread(void*) {
PROTOFILETRANSFERSTATUS pfts;
local_dcc7->tick = tick;
- mir_snprintf(szFilename, SIZEOF(szFilename), "%s%s", local_dcc->folder, local_dcc7->filename);
+ mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc7->filename);
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (MCONTACT)local_dcc7->contact;
@@ -527,7 +527,7 @@ void __cdecl GGPROTO::dccmainthread(void*) if (local_dcc7->file_fd != -1)
{
PROTOFILETRANSFERSTATUS pfts;
- mir_snprintf(szFilename, SIZEOF(szFilename), "%s%s", local_dcc->folder, local_dcc7->filename);
+ mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc7->filename);
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.hContact = (MCONTACT)local_dcc7->contact;
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index de7203f4d9..5d673107c0 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -64,11 +64,11 @@ TCHAR* ws_strerror(int code) if (code == 0)
{
TCHAR buff[128];
- int len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, buff, SIZEOF(buff), NULL);
+ int len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, buff, _countof(buff), NULL);
if (len == 0)
- mir_sntprintf(err_desc, SIZEOF(err_desc), _T("WinSock %u: Unknown error."), WSAGetLastError());
+ mir_sntprintf(err_desc, _countof(err_desc), _T("WinSock %u: Unknown error."), WSAGetLastError());
else
- mir_sntprintf(err_desc, SIZEOF(err_desc), _T("WinSock %d: %s"), WSAGetLastError(), buff);
+ mir_sntprintf(err_desc, _countof(err_desc), _T("WinSock %d: %s"), WSAGetLastError(), buff);
return err_desc;
}
@@ -155,18 +155,18 @@ void GGPROTO::cleanuplastplugin(DWORD version) debugLogA("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version);
TCHAR avatarsPath[MAX_PATH];
- mir_sntprintf(avatarsPath, SIZEOF(avatarsPath), _T("%s\\%s"), VARST( _T("%miranda_avatarcache%")), m_tszUserName);
+ mir_sntprintf(avatarsPath, _countof(avatarsPath), _T("%s\\%s"), VARST( _T("%miranda_avatarcache%")), m_tszUserName);
debugLog(_T("cleanuplastplugin() 1: miranda_avatarcache = %s"), avatarsPath);
TCHAR spec[MAX_PATH + 10];
- mir_sntprintf(spec, SIZEOF(spec), _T("%s\\*.(null)"), avatarsPath);
+ mir_sntprintf(spec, _countof(spec), _T("%s\\*.(null)"), avatarsPath);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(spec, &ffd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
TCHAR filePathT [2*MAX_PATH + 10];
- mir_sntprintf(filePathT, SIZEOF(filePathT), _T("%s\\%s"), avatarsPath, ffd.cFileName);
+ mir_sntprintf(filePathT, _countof(filePathT), _T("%s\\%s"), avatarsPath, ffd.cFileName);
if (!_taccess(filePathT, 0)){
debugLog(_T("cleanuplastplugin() 1: remove file = %s"), filePathT);
_tremove(filePathT);
@@ -240,7 +240,7 @@ INT_PTR GGPROTO::blockuser(WPARAM hContact, LPARAM lParam) void GGPROTO::block_init()
{
char service[64];
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_BLOCKUSER);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_BLOCKUSER);
CreateProtoService(GGS_BLOCKUSER, &GGPROTO::blockuser);
CLISTMENUITEM mi = { sizeof(mi) };
@@ -435,7 +435,7 @@ void gg_debughandler(int level, const char *format, va_list ap) strncpy(szText + PREFIXLEN, "[libgadu] \0", sizeof(szText) - PREFIXLEN);
char prefix[6];
- mir_snprintf(prefix, SIZEOF(prefix), "%lu", GetCurrentThreadId());
+ mir_snprintf(prefix, _countof(prefix), "%lu", GetCurrentThreadId());
size_t prefixLen = mir_strlen(prefix);
if (prefixLen < PREFIXLEN) memset(prefix + prefixLen, ' ', PREFIXLEN - prefixLen);
memcpy(szText, prefix, PREFIXLEN);
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 509fddb0ff..8a98d9428c 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -40,7 +40,7 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) : // Register m_hNetlibUser user
TCHAR 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);
@@ -392,7 +392,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) // Fetch search data
TCHAR text[64];
- GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text));
if (mir_tstrlen(text))
{
T2Utf firstName_utf8(text);
@@ -401,7 +401,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) }
/* 1 */ szQuery.AppendChar('.');
- GetDlgItemText(hwndDlg, IDC_LASTNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_LASTNAME, text, _countof(text));
if (mir_tstrlen(text))
{
T2Utf lastName_utf8(text);
@@ -410,7 +410,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) }
/* 2 */ szQuery.AppendChar('.');
- GetDlgItemText(hwndDlg, IDC_NICKNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_NICKNAME, text, _countof(text));
if (mir_tstrlen(text))
{
T2Utf nickName_utf8(text);
@@ -419,7 +419,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) }
/* 3 */ szQuery.AppendChar('.');
- GetDlgItemText(hwndDlg, IDC_CITY, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_CITY, text, _countof(text));
if (mir_tstrlen(text))
{
T2Utf city_utf8(text);
@@ -428,7 +428,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) }
/* 4 */ szQuery.AppendChar('.');
- GetDlgItemText(hwndDlg, IDC_AGEFROM, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_AGEFROM, text, _countof(text));
if (mir_tstrlen(text))
{
int yearTo = _tstoi(text);
@@ -438,7 +438,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) int ay = lt->tm_year + 1900;
char age[16];
- GetDlgItemTextA(hwndDlg, IDC_AGETO, age, SIZEOF(age));
+ GetDlgItemTextA(hwndDlg, IDC_AGETO, age, _countof(age));
yearFrom = atoi(age);
// Count & fix ranges
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 279fea7174..d7a3c77528 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -43,7 +43,7 @@ int GGPROTO::gc_init() gc_enabled = TRUE;
// create & hook event
- mir_snprintf(service, SIZEOF(service), GG_GC_GETCHAT, m_szModuleName);
+ mir_snprintf(service, _countof(service), GG_GC_GETCHAT, m_szModuleName);
debugLogA("gc_init(): Registered with groupchat plugin.");
}
else debugLogA("gc_init(): Cannot register with groupchat plugin !!!");
@@ -64,7 +64,7 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot) mi.hParentMenu = hRoot;
// Conferencing
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_OPEN_CONF);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_OPEN_CONF);
CreateProtoService(GGS_OPEN_CONF, &GGPROTO::gc_openconf);
mi.position = 2000050001;
mi.icolibItem = iconList[14].hIcolib;
@@ -73,7 +73,7 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot) hMainMenu[0] = Menu_AddProtoMenuItem(&mi);
// Clear ignored conferences
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_CLEAR_IGNORED);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_CLEAR_IGNORED);
CreateProtoService(GGS_CLEAR_IGNORED, &GGPROTO::gc_clearignored);
mi.position = 2000050002;
mi.icolibItem = iconList[15].hIcolib;
@@ -303,7 +303,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count // Create new chat window
TCHAR status[256];
TCHAR *senderName = sender ? pcli->pfnGetContactDisplayName(getcontact(sender, 1, 0, NULL), 0) : NULL;
- mir_sntprintf(status, SIZEOF(status), (sender) ? TranslateT("%s initiated the conference.") : TranslateT("This is my own conference."), senderName);
+ mir_sntprintf(status, _countof(status), (sender) ? TranslateT("%s initiated the conference.") : TranslateT("This is my own conference."), senderName);
GCSESSION gcwindow = { sizeof(gcwindow) };
gcwindow.iType = GCW_CHATROOM;
diff --git a/protocols/Gadu-Gadu/src/icolib.cpp b/protocols/Gadu-Gadu/src/icolib.cpp index a0b9c291de..c527755058 100644 --- a/protocols/Gadu-Gadu/src/icolib.cpp +++ b/protocols/Gadu-Gadu/src/icolib.cpp @@ -41,23 +41,23 @@ extern IconItem iconList[] = { LPGEN("Concurrent sessions"), "sessions", IDI_SESSIONS }
};
-HANDLE hIconLibItem[SIZEOF(iconList)];
+HANDLE hIconLibItem[_countof(iconList)];
void gg_icolib_init()
{
- Icon_Register(hInstance, "Protocols/" GGDEF_PROTO, iconList, SIZEOF(iconList), GGDEF_PROTO);
+ Icon_Register(hInstance, "Protocols/" GGDEF_PROTO, iconList, _countof(iconList), GGDEF_PROTO);
}
HICON LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", GGDEF_PROTO, name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", GGDEF_PROTO, name);
return IcoLib_GetIcon(szSettingName, 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 hIconLibItem[i];
return NULL;
@@ -66,7 +66,7 @@ HANDLE GetIconHandle(int iconId) void ReleaseIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", GGDEF_PROTO, name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", GGDEF_PROTO, name);
IcoLib_Release(szSettingName, big);
}
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index f92c77fac1..8d6e02cc90 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -69,7 +69,7 @@ int gg_img_remove(GGIMAGEDLGDATA *dat); int GGPROTO::img_init()
{
char service[64];
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_SENDIMAGE);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_SENDIMAGE);
CreateProtoService(GGS_SENDIMAGE, &GGPROTO::img_sendimg);
// Send image contact menu item
@@ -248,10 +248,10 @@ int gg_img_saveimage(HWND hwnd, GGIMAGEENTRY *dat) GGPROTO* gg = ((GGIMAGEDLGDATA *)GetWindowLongPtr(hwnd, GWLP_USERDATA))->gg;
TCHAR szFilter[128];
- gg_img_getfilter(szFilter, SIZEOF(szFilter));
+ gg_img_getfilter(szFilter, _countof(szFilter));
TCHAR szFileName[MAX_PATH];
- _tcsncpy(szFileName, dat->lpszFileName, SIZEOF(szFileName));
+ _tcsncpy(szFileName, dat->lpszFileName, _countof(szFileName));
OPENFILENAME ofn = {0};
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
@@ -677,7 +677,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP TCHAR szFileName[MAX_PATH];
OPENFILENAME ofn = {0};
- gg_img_getfilter(szFilter, SIZEOF(szFilter));
+ gg_img_getfilter(szFilter, _countof(szFilter));
*szFileName = 0;
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
@@ -860,7 +860,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) if (res != 0) {
TCHAR image_msg[MAX_PATH + 11];
- mir_sntprintf(image_msg, SIZEOF(image_msg), _T("[img]%s[/img]"), szPath);
+ mir_sntprintf(image_msg, _countof(image_msg), _T("[img]%s[/img]"), szPath);
T2Utf szMessage(image_msg);
PROTORECVEVENT pre = {0};
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 3c17b89cee..d8a4001f43 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -336,26 +336,26 @@ INT_PTR GGPROTO::import_text(WPARAM wParam, LPARAM lParam) OPENFILENAME ofn = {0};
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- _tcsncpy(filter, TranslateT("Text files"), SIZEOF(filter));
- mir_tstrncat(filter, _T(" (*.txt)"), SIZEOF(filter) - mir_tstrlen(filter));
+ _tcsncpy(filter, TranslateT("Text files"), _countof(filter));
+ mir_tstrncat(filter, _T(" (*.txt)"), _countof(filter) - mir_tstrlen(filter));
pfilter = filter + mir_tstrlen(filter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, _T("*.TXT"), SIZEOF(filter) - (pfilter - filter));
+ _tcsncpy(pfilter, _T("*.TXT"), _countof(filter) - (pfilter - filter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - (pfilter - filter));
- mir_tstrncat(pfilter, _T(" (*)"), SIZEOF(filter) - (pfilter - filter) - mir_tstrlen(pfilter));
+ _tcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter));
+ mir_tstrncat(pfilter, _T(" (*)"), _countof(filter) - (pfilter - filter) - mir_tstrlen(pfilter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, _T("*"), SIZEOF(filter) - (pfilter - filter));
+ _tcsncpy(pfilter, _T("*"), _countof(filter) - (pfilter - filter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
*pfilter = '\0';
@@ -364,7 +364,7 @@ INT_PTR GGPROTO::import_text(WPARAM wParam, LPARAM lParam) ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("txt");
@@ -405,33 +405,33 @@ INT_PTR GGPROTO::export_text(WPARAM wParam, LPARAM lParam) OPENFILENAME ofn = {0};
TCHAR filter[512], *pfilter;
- _tcsncpy(str, TranslateT("contacts"), SIZEOF(str));
- mir_tstrncat(str, _T(".txt"), SIZEOF(str) - mir_tstrlen(str));
+ _tcsncpy(str, TranslateT("contacts"), _countof(str));
+ mir_tstrncat(str, _T(".txt"), _countof(str) - mir_tstrlen(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
- _tcsncpy(filter, TranslateT("Text files"), SIZEOF(filter));
- mir_tstrncat(filter, _T(" (*.txt)"), SIZEOF(filter) - mir_tstrlen(filter));
+ _tcsncpy(filter, TranslateT("Text files"), _countof(filter));
+ mir_tstrncat(filter, _T(" (*.txt)"), _countof(filter) - mir_tstrlen(filter));
pfilter = filter + mir_tstrlen(filter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, _T("*.TXT"), SIZEOF(filter) - (pfilter - filter));
+ _tcsncpy(pfilter, _T("*.TXT"), _countof(filter) - (pfilter - filter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - (pfilter - filter));
- mir_tstrncat(pfilter, _T(" (*)"), SIZEOF(filter) - (pfilter - filter) - mir_tstrlen(pfilter));
+ _tcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter));
+ mir_tstrncat(pfilter, _T(" (*)"), _countof(filter) - (pfilter - filter) - mir_tstrlen(pfilter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
- _tcsncpy(pfilter, _T("*"), SIZEOF(filter) - (pfilter - filter));
+ _tcsncpy(pfilter, _T("*"), _countof(filter) - (pfilter - filter));
pfilter = pfilter + mir_tstrlen(pfilter) + 1;
- if (pfilter >= filter + SIZEOF(filter))
+ if (pfilter >= filter + _countof(filter))
return 0;
*pfilter = '\0';
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
- ofn.nMaxFile = SIZEOF(str);
+ ofn.nMaxFile = _countof(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("txt");
@@ -516,7 +516,7 @@ void GGPROTO::import_init(HGENMENU hRoot) {
// Import from server item
char service[64];
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_IMPORT_SERVER);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_IMPORT_SERVER);
CreateProtoService(GGS_IMPORT_SERVER, &GGPROTO::import_server);
CLISTMENUITEM mi = { sizeof(mi) };
@@ -529,7 +529,7 @@ void GGPROTO::import_init(HGENMENU hRoot) hMainMenu[2] = Menu_AddProtoMenuItem(&mi);
// Import from textfile
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_IMPORT_TEXT);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_IMPORT_TEXT);
CreateProtoService(GGS_IMPORT_TEXT, &GGPROTO::import_text);
mi.position = 2000500002;
@@ -539,7 +539,7 @@ void GGPROTO::import_init(HGENMENU hRoot) hMainMenu[3] = Menu_AddProtoMenuItem(&mi);
// Remove from server
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_REMOVE_SERVER);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_REMOVE_SERVER);
CreateProtoService(GGS_REMOVE_SERVER, &GGPROTO::remove_server);
mi.position = 2000500003;
@@ -549,7 +549,7 @@ void GGPROTO::import_init(HGENMENU hRoot) hMainMenu[4] = Menu_AddProtoMenuItem(&mi);
// Export to server
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_EXPORT_SERVER);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_EXPORT_SERVER);
CreateProtoService(GGS_EXPORT_SERVER, &GGPROTO::export_server);
mi.position = 2005000001;
@@ -559,7 +559,7 @@ void GGPROTO::import_init(HGENMENU hRoot) hMainMenu[5] = Menu_AddProtoMenuItem(&mi);
// Export to textfile
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_EXPORT_TEXT);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_EXPORT_TEXT);
CreateProtoService(GGS_EXPORT_TEXT, &GGPROTO::export_text);
mi.position = 2005000002;
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 8534d0e5cb..773b3ade25 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -248,7 +248,7 @@ char *oauth_auth_header(const char *httpmethod, const char *url, OAUTHSIGNMETHOD case RSASHA1: oauth_setparam(oauth_parameters, "oauth_signature_method", "RSA-SHA1"); break;
default: oauth_setparam(oauth_parameters, "oauth_signature_method", "PLAINTEXT"); break;
};
- mir_snprintf(timestamp, SIZEOF(timestamp), "%ld", time(NULL));
+ mir_snprintf(timestamp, _countof(timestamp), "%ld", time(NULL));
oauth_setparam(oauth_parameters, "oauth_timestamp", timestamp);
oauth_setparam(oauth_parameters, "oauth_nonce", ptrA(oauth_generate_nonce()));
if (token != NULL && *token)
diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index 9343f75bb5..ea440fb6b0 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -87,16 +87,16 @@ void GGPROTO::initpopups() puc.hIcon = CopyIcon(LoadIconEx("main", FALSE));
ReleaseIconEx("main", FALSE);
puc.iSeconds = 4;
- mir_sntprintf(szDescr, SIZEOF(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Notify"));
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", m_szModuleName, "Notify");
+ mir_sntprintf(szDescr, _countof(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Notify"));
+ mir_snprintf(szName, _countof(szName), "%s_%s", m_szModuleName, "Notify");
hPopupNotify = Popup_RegisterClass(&puc);
puc.colorBack = RGB(191, 0, 0); // Red
puc.colorText = RGB(255, 245, 225); // Yellow
puc.iSeconds = 60;
puc.hIcon = (HICON)LoadImage(NULL, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
- mir_sntprintf(szDescr, SIZEOF(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Error"));
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", m_szModuleName, "Error");
+ mir_sntprintf(szDescr, _countof(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Error"));
+ mir_snprintf(szName, _countof(szName), "%s_%s", m_szModuleName, "Error");
hPopupError = Popup_RegisterClass(&puc);
}
@@ -117,9 +117,9 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) ppd.pszClassName = szName;
if (puData->flags & GG_POPUP_ERROR || puData->flags & GG_POPUP_WARNING)
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", gg->m_szModuleName, "Error");
+ mir_snprintf(szName, _countof(szName), "%s_%s", gg->m_szModuleName, "Error");
else
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", gg->m_szModuleName, "Notify");
+ mir_snprintf(szName, _countof(szName), "%s_%s", gg->m_szModuleName, "Notify");
CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
return;
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index 220d71a884..077e9ab556 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -191,7 +191,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) if (!db_get_ts(pai->hContact, "ContactPhoto", "Backup", &dbv)) {
if ((mir_tstrlen(dbv.ptszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)){
debugLogA("getavatarinfo(): Incoming request for avatar information. Contact has assigned Locked ContactPhoto. return GAIR_SUCCESS");
- _tcscpy_s(pai->filename, SIZEOF(pai->filename) ,dbv.ptszVal);
+ _tcscpy_s(pai->filename, _countof(pai->filename) ,dbv.ptszVal);
pai->format = ProtoGetAvatarFormat(pai->filename);
db_free(&dbv);
return GAIR_SUCCESS;
@@ -219,13 +219,13 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) char *AvatarName = strrchr(AvatarURL, '/');
AvatarName++;
char AvatarNameWithTS[128];
- mir_snprintf(AvatarNameWithTS, SIZEOF(AvatarNameWithTS), "%s%s", AvatarName, AvatarTs);
+ mir_snprintf(AvatarNameWithTS, _countof(AvatarNameWithTS), "%s%s", AvatarName, AvatarTs);
AvatarHash = gg_avatarhash(AvatarNameWithTS);
}
ptrA AvatarSavedHash( getStringA(pai->hContact, GG_KEY_AVATARHASH));
if (AvatarHash != NULL && AvatarSavedHash != NULL) {
- getAvatarFilename(pai->hContact, pai->filename, SIZEOF(pai->filename));
+ getAvatarFilename(pai->hContact, pai->filename, _countof(pai->filename));
if (!mir_strcmp(AvatarHash, AvatarSavedHash)) {
if (_taccess(pai->filename, 0) == 0){
debugLogA("getavatarinfo(): Incoming request for avatar information. uin=%d. Avatar hash unchanged. return GAIR_SUCCESS", uin);
@@ -251,7 +251,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) }
else if ((wParam & GAIF_FORCE) != 0) {
if (AvatarHash == NULL && AvatarSavedHash != NULL) {
- getAvatarFilename(pai->hContact, pai->filename, SIZEOF(pai->filename));
+ getAvatarFilename(pai->hContact, pai->filename, _countof(pai->filename));
if (_tremove(pai->filename) != 0){
debugLog(_T("getavatarinfo(): delete. _tremove file %s error. errno=%d: %s"), pai->filename, errno, strerror(errno));
TCHAR error[512];
@@ -334,7 +334,7 @@ INT_PTR GGPROTO::setmyavatar(WPARAM wParam, LPARAM lParam) setByte(GG_KEY_AVATARTYPE, (BYTE)iAvType);
TCHAR szMyFilename[MAX_PATH];
- getAvatarFilename(NULL, szMyFilename, SIZEOF(szMyFilename));
+ getAvatarFilename(NULL, szMyFilename, _countof(szMyFilename));
if ( mir_tstrcmp(szFilename, szMyFilename) && !CopyFile(szFilename, szMyFilename, FALSE)) {
debugLogA("setmyavatar(): Failed to set user avatar. File with type %d could not be created/overwritten.", iAvType);
return -1;
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 07ee15a443..7b74a24c66 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -140,7 +140,7 @@ static BOOL IsOverAction(HWND hwndDlg) ListView_GetSubItemRect(hList, hti.iItem, hti.iSubItem, LVIR_LABEL, &rc);
szText[0] = 0;
- ListView_GetItemText(hList, hti.iItem, hti.iSubItem, szText, SIZEOF(szText));
+ ListView_GetItemText(hList, hti.iItem, hti.iSubItem, szText, _countof(szText));
hdc = GetDC(hList);
GetTextExtentPoint32(hdc, szText, (int)mir_tstrlen(szText), &textSize);
ReleaseDC(hList, hdc);
@@ -167,8 +167,8 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w TCHAR oldTitle[256], newTitle[256];
HANDLE hProtoAckEvent;
- GetWindowText(hwndDlg, oldTitle, SIZEOF(oldTitle));
- mir_sntprintf(newTitle, SIZEOF(newTitle), oldTitle, gg->m_tszUserName);
+ GetWindowText(hwndDlg, oldTitle, _countof(oldTitle));
+ mir_sntprintf(newTitle, _countof(newTitle), oldTitle, gg->m_tszUserName);
SetWindowText(hwndDlg, newTitle);
WindowSetIcon(hwndDlg, "sessions");
@@ -267,7 +267,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w {
TCHAR szText[256];
szText[0] = 0;
- ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, SIZEOF(szText));
+ ListView_GetItemText(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, szText, _countof(szText));
FillRect(nm->nmcd.hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
SetTextColor(nm->nmcd.hdc, RGB(0, 0, 255));
DrawText(nm->nmcd.hdc, szText, -1, &rc, DT_END_ELLIPSIS | DT_CENTER | DT_NOPREFIX | DT_SINGLELINE | DT_TOP);
@@ -327,9 +327,9 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w EmptyClipboard();
szClientName[0] = szIP[0] = szLoginTime[0] = 0;
- ListView_GetItemText(hList, lvhti.iItem, 0, szClientName, SIZEOF(szClientName));
- ListView_GetItemText(hList, lvhti.iItem, 1, szIP, SIZEOF(szIP));
- ListView_GetItemText(hList, lvhti.iItem, 2, szLoginTime, SIZEOF(szLoginTime));
+ ListView_GetItemText(hList, lvhti.iItem, 0, szClientName, _countof(szClientName));
+ ListView_GetItemText(hList, lvhti.iItem, 1, szIP, _countof(szIP));
+ ListView_GetItemText(hList, lvhti.iItem, 2, szLoginTime, _countof(szLoginTime));
mir_sntprintf(szText, _T("%s\t%s\t%s"), szClientName, szIP, szLoginTime);
if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_tstrlen(szText) + 1)) != NULL)
{
@@ -345,8 +345,8 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w {
TCHAR szUrl[256], szIP[64];
szIP[0] = 0;
- ListView_GetItemText(hList, lvhti.iItem, 1, szIP, SIZEOF(szIP));
- mir_sntprintf(szUrl, SIZEOF(szUrl), _T("http://whois.domaintools.com/%s"), szIP);
+ ListView_GetItemText(hList, lvhti.iItem, 1, szIP, _countof(szIP));
+ mir_sntprintf(szUrl, _countof(szUrl), _T("http://whois.domaintools.com/%s"), szIP);
CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)szUrl);
break;
}
@@ -425,7 +425,7 @@ BOOL GGPROTO::sessions_closedlg() void GGPROTO::sessions_menus_init(HGENMENU hRoot)
{
char service[64];
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, GGS_CONCUR_SESS);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, GGS_CONCUR_SESS);
CreateProtoService(GGS_CONCUR_SESS, &GGPROTO::sessions_view);
CLISTMENUITEM mi = { sizeof(mi) };
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index 14dc02b004..6404884486 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -57,7 +57,7 @@ INT_PTR CALLBACK gg_tokendlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l {
case IDOK:
{
- GetDlgItemTextA(hwndDlg, IDC_TOKEN, dat->val, SIZEOF(dat->val));
+ GetDlgItemTextA(hwndDlg, IDC_TOKEN, dat->val, _countof(dat->val));
EndDialog(hwndDlg, IDOK);
break;
}
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index 3f3f06d14c..61ccdd4849 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -224,8 +224,8 @@ INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA {
char pass[128], cpass[128];
BOOL enable;
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass));
- GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, SIZEOF(cpass));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, _countof(pass));
+ GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, _countof(cpass));
enable = mir_strlen(pass) && mir_strlen(cpass) && !mir_strcmp(cpass, pass);
if (dat && dat->mode == GG_USERUTIL_REMOVE)
EnableWindow(GetDlgItem(hwndDlg, IDOK), IsDlgButtonChecked(hwndDlg, IDC_CONFIRM) ? enable : FALSE);
@@ -237,9 +237,9 @@ INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDOK:
{
char pass[128], cpass[128], email[128];
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass));
- GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, SIZEOF(cpass));
- GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, _countof(pass));
+ GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, _countof(cpass));
+ GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, _countof(email));
EndDialog(hwndDlg, IDOK);
// Check dialog box mode
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"));
diff --git a/protocols/IcqOscarJ/src/capabilities.cpp b/protocols/IcqOscarJ/src/capabilities.cpp index b6af33a09c..6e84fbd13f 100644 --- a/protocols/IcqOscarJ/src/capabilities.cpp +++ b/protocols/IcqOscarJ/src/capabilities.cpp @@ -84,7 +84,7 @@ void NetLog_CapabilityChange(CIcqProto *ppro, const char *szChange, DWORD fdwCap if (!fdwCapabilities) return;
- for (int nIndex = 0; nIndex < SIZEOF(CapabilityNames); nIndex++) {
+ for (int nIndex = 0; nIndex < _countof(CapabilityNames); nIndex++) {
// Check if the current capability is present
if ((fdwCapabilities & CapabilityNames[nIndex].capID) == CapabilityNames[nIndex].capID) {
if (mir_strlen(szBuffer))
@@ -182,7 +182,7 @@ DWORD GetCapabilitiesFromBuffer(BYTE *pBuffer, int nLength) DWORD fdwCaps = 0;
// Calculate the number of records
- int nRecordSize = SIZEOF(CapabilityRecord);
+ int nRecordSize = _countof(CapabilityRecord);
// Loop over all capabilities in the buffer and
// compare them to our own record of capabilities
diff --git a/protocols/IcqOscarJ/src/constants.cpp b/protocols/IcqOscarJ/src/constants.cpp index f97298b955..a5543315ee 100644 --- a/protocols/IcqOscarJ/src/constants.cpp +++ b/protocols/IcqOscarJ/src/constants.cpp @@ -128,4 +128,4 @@ const SettingItem setting[] = { LPGEN("Interest areas 4"), LI_STRING, DBVT_UTF8, "Interest3Text" },
};
-const int settingCount = SIZEOF(setting);
+const int settingCount = _countof(setting);
diff --git a/protocols/IcqOscarJ/src/db.cpp b/protocols/IcqOscarJ/src/db.cpp index a17d929da8..cadfd7eab6 100644 --- a/protocols/IcqOscarJ/src/db.cpp +++ b/protocols/IcqOscarJ/src/db.cpp @@ -85,7 +85,7 @@ void ChangeInfoData::LoadSettingsFromDb(int keepChanged) char buf[MAX_PATH];
TCHAR tbuf[MAX_PATH];
- if (utf8_to_tchar_static(GetItemSettingText(i, buf, SIZEOF(buf)), tbuf, SIZEOF(tbuf)))
+ if (utf8_to_tchar_static(GetItemSettingText(i, buf, _countof(buf)), tbuf, _countof(tbuf)))
ListView_SetItemText(hwndList, i, 1, tbuf);
}
}
@@ -136,7 +136,7 @@ static INT_PTR CALLBACK PwConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, {
char szTest[16];
- GetDlgItemTextA(hwndDlg, IDC_OLDPASS, szTest, SIZEOF(szTest));
+ GetDlgItemTextA(hwndDlg, IDC_OLDPASS, szTest, _countof(szTest));
if (mir_strcmp(szTest, dat->ppro->GetUserPassword(TRUE))) {
MessageBox(hwndDlg, TranslateT("The password does not match your current password. Check Caps Lock and try again."), TranslateT("Change ICQ Details"), MB_OK);
@@ -145,7 +145,7 @@ static INT_PTR CALLBACK PwConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, break;
}
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szTest, SIZEOF(szTest));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szTest, _countof(szTest));
if (mir_strcmp(szTest, dat->Pass)) {
MessageBox(hwndDlg, TranslateT("The password does not match the password you originally entered. Check Caps Lock and try again."), TranslateT("Change ICQ Details"), MB_OK);
SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_SETSEL, 0, (LPARAM)-1);
diff --git a/protocols/IcqOscarJ/src/dlgproc.cpp b/protocols/IcqOscarJ/src/dlgproc.cpp index 704764c848..3b0cc7f6ab 100644 --- a/protocols/IcqOscarJ/src/dlgproc.cpp +++ b/protocols/IcqOscarJ/src/dlgproc.cpp @@ -125,7 +125,7 @@ char* ChangeInfoData::GetItemSettingText(int i, char *buf, size_t bufsize) void ChangeInfoData::PaintItemSetting(HDC hdc, RECT *rc, int i, UINT itemState)
{
char str[MAX_PATH];
- char *text = GetItemSettingText(i, str, SIZEOF(str));
+ char *text = GetItemSettingText(i, str, _countof(str));
const SettingItem &si = setting[i];
SettingItemData &sid = settingData[i];
@@ -204,7 +204,7 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TCHAR text[MAX_PATH];
lvi.lParam = lvi.iItem;
lvi.pszText = text;
- utf8_to_tchar_static(setting[lvi.iItem].szDescription, text, SIZEOF(text));
+ utf8_to_tchar_static(setting[lvi.iItem].szDescription, text, _countof(text));
ListView_InsertItem(dat->hwndList, &lvi);
}
}
@@ -467,17 +467,17 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM if (ack->type != ACKTYPE_SETINFO) break;
if (ack->result == ACKRESULT_SUCCESS) {
- for (i = 0; i < SIZEOF(dat->hUpload); i++)
+ for (i = 0; i < _countof(dat->hUpload); i++)
if (dat->hUpload[i] && ack->hProcess == dat->hUpload[i]) break;
- if (i == SIZEOF(dat->hUpload)) break;
+ if (i == _countof(dat->hUpload)) break;
dat->hUpload[i] = NULL;
- for (done = 0, i = 0; i < SIZEOF(dat->hUpload); i++)
+ for (done = 0, i = 0; i < _countof(dat->hUpload); i++)
done += dat->hUpload[i] == NULL;
TCHAR buf[MAX_PATH];
- mir_sntprintf(buf, TranslateT("Upload in progress...%d%%"), 100 * done / (SIZEOF(dat->hUpload)));
+ mir_sntprintf(buf, TranslateT("Upload in progress...%d%%"), 100 * done / (_countof(dat->hUpload)));
SetDlgItemText(hwndDlg, IDC_UPLOADING, buf);
- if (done < SIZEOF(dat->hUpload)) break;
+ if (done < _countof(dat->hUpload)) break;
dat->ClearChangeFlags();
UnhookEvent(dat->hAckHook);
diff --git a/protocols/IcqOscarJ/src/editlist.cpp b/protocols/IcqOscarJ/src/editlist.cpp index df632256d5..dfaebb4c85 100644 --- a/protocols/IcqOscarJ/src/editlist.cpp +++ b/protocols/IcqOscarJ/src/editlist.cpp @@ -175,7 +175,7 @@ void ChangeInfoData::EndListEdit(int save) if (sid.changed) {
char buf[MAX_PATH];
TCHAR tbuf[MAX_PATH];
- if (utf8_to_tchar_static(ICQTranslateUtfStatic(pItem.text, buf, SIZEOF(buf)), tbuf, SIZEOF(buf)))
+ if (utf8_to_tchar_static(ICQTranslateUtfStatic(pItem.text, buf, _countof(buf)), tbuf, _countof(buf)))
ListView_SetItemText(hwndList, iEditItem, 1, tbuf);
EnableDlgItem(GetParent(hwndList), IDC_SAVE, TRUE);
diff --git a/protocols/IcqOscarJ/src/editstring.cpp b/protocols/IcqOscarJ/src/editstring.cpp index 2ea8f8eb1c..1cd3a2f805 100644 --- a/protocols/IcqOscarJ/src/editstring.cpp +++ b/protocols/IcqOscarJ/src/editstring.cpp @@ -79,7 +79,7 @@ static void EscapesToBinary(char *str) memmove(str+1,codeend,mir_strlen(codeend)+1);
continue;
}
- for(int i=0;i<SIZEOF(escapes);i+=2)
+ for(int i=0;i<_countof(escapes);i+=2)
if(str[1]==escapes[i])
{
*str=escapes[i+1];
@@ -117,14 +117,14 @@ char *BinaryToEscapes(char *str) pout=out=(char*)SAFE_REALLOC(out,len);
}
*pout++='\\';
- for(i = 0; i < SIZEOF(escapes); i += 2)
+ for(i = 0; i < _countof(escapes); i += 2)
if (*str==escapes[i+1])
{
*pout++=escapes[i];
extra--;
break;
}
- if(i < SIZEOF(escapes)) continue;
+ if(i < _countof(escapes)) continue;
*pout++='0'; extra--;
if (*str>=8)
{
@@ -325,7 +325,7 @@ void ChangeInfoData::EndStringEdit(int save) if (sid.changed) {
TCHAR tbuf[MAX_PATH];
- GetWindowText(hwndEdit, tbuf, SIZEOF(tbuf));
+ GetWindowText(hwndEdit, tbuf, _countof(tbuf));
ListView_SetItemText(hwndList, iEditItem, 1, tbuf);
EnableDlgItem(hwndDlg, IDC_SAVE, TRUE);
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp index 2f31a8a890..d1361cf9f3 100644 --- a/protocols/IcqOscarJ/src/fam_01service.cpp +++ b/protocols/IcqOscarJ/src/fam_01service.cpp @@ -735,7 +735,7 @@ void CIcqProto::handleServUINSettings(int nPort, serverthread_info *info) // prepare mood id
if (m_bMoodsEnabled && bXStatus && moodXStatus[bXStatus - 1] != -1)
- mir_snprintf(szMoodData, SIZEOF(szMoodData), "icqmood%d", moodXStatus[bXStatus - 1]);
+ mir_snprintf(szMoodData, _countof(szMoodData), "icqmood%d", moodXStatus[bXStatus - 1]);
else
szMoodData[0] = '\0';
diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp index 9715065269..2b9c68bfca 100644 --- a/protocols/IcqOscarJ/src/fam_04message.cpp +++ b/protocols/IcqOscarJ/src/fam_04message.cpp @@ -1517,7 +1517,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, if ((BYTE)*pszMsg == 0xFE) {
*pszMsg = '\0';
pszMsgField[nMsgFields++] = pszMsg + 1;
- if (nMsgFields >= SIZEOF(pszMsgField))
+ if (nMsgFields >= _countof(pszMsgField))
break;
}
}
@@ -2605,7 +2605,7 @@ void CIcqProto::handleTypingNotification(BYTE *buf, size_t wLen) char szMsg[MAX_PATH];
char *nick = NickFromHandleUtf(hContact);
- mir_snprintf(szMsg, SIZEOF(szMsg), ICQTranslateUtfStatic(LPGEN("Contact \"%s\" has closed the message window."), szFormat, MAX_PATH), nick);
+ mir_snprintf(szMsg, _countof(szMsg), ICQTranslateUtfStatic(LPGEN("Contact \"%s\" has closed the message window."), szFormat, MAX_PATH), nick);
ShowPopupMsg(hContact, ICQTranslateUtfStatic(LPGEN("ICQ Note"), szFormat, MAX_PATH), szMsg, LOG_NOTE);
SAFE_FREE((void**)&nick);
diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp index 83e28ffa0f..4d52f6fc21 100644 --- a/protocols/IcqOscarJ/src/fam_13servclist.cpp +++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp @@ -181,7 +181,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, size_t wBufferLength, snac_hea break; char szLogText[MAX_PATH]; - mir_snprintf(szLogText, SIZEOF(szLogText), szChange, nItems); + mir_snprintf(szLogText, _countof(szLogText), szChange, nItems); debugLogA("Server sent SNAC(x13,x%02x) - %s", pSnacHeader->wSubtype, szLogText); } break; @@ -288,7 +288,7 @@ void CIcqProto::handleServerCListRightsReply(BYTE *buf, size_t wLen) for (int i = 0; i < pTLV->wLen / 2; i++) { m_wServerListLimits[i] = (pLimits[i] & 0xFF) << 8 | (pLimits[i] >> 8); - if (i + 1 >= SIZEOF(m_wServerListLimits)) + if (i + 1 >= _countof(m_wServerListLimits)) break; } @@ -1248,7 +1248,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wItem char *nick = NickFromHandleUtf(hContact); setByte(hContact, "Auth", 0); - mir_snprintf(str, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" was authorized in the server list."), msg, SIZEOF(msg)), nick); + mir_snprintf(str, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" was authorized in the server list."), msg, _countof(msg)), nick); icq_LogMessage(LOG_WARNING, str); SAFE_FREE(&nick); } @@ -1258,7 +1258,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wItem char *nick = NickFromHandleUtf(hContact); setByte(hContact, "Auth", 1); - mir_snprintf(str, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" lost its authorization in the server list."), msg, SIZEOF(msg)), nick); + mir_snprintf(str, ICQTranslateUtfStatic(LPGEN("Contact \"%s\" lost its authorization in the server list."), msg, _countof(msg)), nick); icq_LogMessage(LOG_WARNING, str); SAFE_FREE(&nick); } @@ -1348,7 +1348,7 @@ void CIcqProto::handleServerCListItemDelete(const char *szRecordName, WORD wItem char msg[MAX_PATH]; char *nick = NickFromHandleUtf(hContact); - mir_snprintf(str, ICQTranslateUtfStatic(LPGEN("User \"%s\" was removed from server list."), msg, SIZEOF(msg)), nick); + mir_snprintf(str, ICQTranslateUtfStatic(LPGEN("User \"%s\" was removed from server list."), msg, _countof(msg)), nick); icq_LogMessage(LOG_WARNING, str); SAFE_FREE(&nick); } diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp index 7ecfae6408..7c6a406454 100644 --- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp +++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp @@ -525,7 +525,7 @@ int CIcqProto::parseUserInfoRecord(MCONTACT hContact, oscar_tlv *pData, UserInfo for (int i = 0; i < nRecordDef; i++) {
char szItemKey[MAX_PATH];
- mir_snprintf(szItemKey, SIZEOF(szItemKey), pRecordDef[i].szDbSetting, nRecords);
+ mir_snprintf(szItemKey, _countof(szItemKey), pRecordDef[i].szDbSetting, nRecords);
switch (pRecordDef[i].dbType) {
case DBVT_UTF8:
@@ -550,7 +550,7 @@ int CIcqProto::parseUserInfoRecord(MCONTACT hContact, oscar_tlv *pData, UserInfo for (int i = nRecords; i <= nMaxRecords; i++)
for (int j = 0; j < nRecordDef; j++) {
char szItemKey[MAX_PATH];
- mir_snprintf(szItemKey, SIZEOF(szItemKey), pRecordDef[j].szDbSetting, i);
+ mir_snprintf(szItemKey, _countof(szItemKey), pRecordDef[j].szDbSetting, i);
delSetting(hContact, szItemKey);
}
@@ -784,9 +784,9 @@ void CIcqProto::parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain writeDbInfoSettingTLVStringUtf(hContact, "LastName", cDetails, 0x6E);
writeDbInfoSettingTLVStringUtf(hContact, "Nick", cDetails, 0x78);
// Home Address
- parseUserInfoRecord(hContact, cDetails->getTLV(0x96, 1), rAddress, SIZEOF(rAddress), 1);
+ parseUserInfoRecord(hContact, cDetails->getTLV(0x96, 1), rAddress, _countof(rAddress), 1);
// Origin Address
- parseUserInfoRecord(hContact, cDetails->getTLV(0xA0, 1), rOriginAddress, SIZEOF(rOriginAddress), 1);
+ parseUserInfoRecord(hContact, cDetails->getTLV(0xA0, 1), rOriginAddress, _countof(rOriginAddress), 1);
// Phones
pTLV = cDetails->getTLV(0xC8, 1);
if (pTLV && pTLV->wLen >= 2) {
@@ -825,13 +825,13 @@ void CIcqProto::parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain delSetting(hContact, "CompanyFax");
}
// Emails
- parseUserInfoRecord(hContact, cDetails->getTLV(0x8C, 1), rEmail, SIZEOF(rEmail), 4);
+ parseUserInfoRecord(hContact, cDetails->getTLV(0x8C, 1), rEmail, _countof(rEmail), 4);
writeDbInfoSettingTLVByte(hContact, "Timezone", cDetails, 0x17C);
// Company
- parseUserInfoRecord(hContact, cDetails->getTLV(0x118, 1), rCompany, SIZEOF(rCompany), 1);
+ parseUserInfoRecord(hContact, cDetails->getTLV(0x118, 1), rCompany, _countof(rCompany), 1);
// Education
- parseUserInfoRecord(hContact, cDetails->getTLV(0x10E, 1), rEducation, SIZEOF(rEducation), 1);
+ parseUserInfoRecord(hContact, cDetails->getTLV(0x10E, 1), rEducation, _countof(rEducation), 1);
switch (cDetails->getNumber(0x82, 1)) {
case 1:
@@ -853,7 +853,7 @@ void CIcqProto::parseDirectoryUserDetailsData(MCONTACT hContact, oscar_tlv_chain writeDbInfoSettingTLVByte(hContact, "MaritalStatus", cDetails, 0x12C);
// Interests
- parseUserInfoRecord(hContact, cDetails->getTLV(0x122, 1), rInterest, SIZEOF(rInterest), 4);
+ parseUserInfoRecord(hContact, cDetails->getTLV(0x122, 1), rInterest, _countof(rInterest), 4);
writeDbInfoSettingTLVStringUtf(hContact, "About", cDetails, 0x186);
diff --git a/protocols/IcqOscarJ/src/icq_advsearch.cpp b/protocols/IcqOscarJ/src/icq_advsearch.cpp index 647faf6392..1d69353995 100644 --- a/protocols/IcqOscarJ/src/icq_advsearch.cpp +++ b/protocols/IcqOscarJ/src/icq_advsearch.cpp @@ -72,7 +72,7 @@ static void searchPackTLVLNTS(PBYTE *buf, size_t *buflen, HWND hwndDlg, UINT idC {
char str[512];
- GetDlgItemTextA(hwndDlg, idControl, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, idControl, str, _countof(str));
ppackLETLVLNTS(buf, buflen, str, wType, 0);
}
@@ -81,7 +81,7 @@ static void searchPackTLVWordLNTS(PBYTE *buf, size_t *buflen, HWND hwndDlg, UINT {
char str[512];
- GetDlgItemTextA(hwndDlg, idControl, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, idControl, str, _countof(str));
ppackLETLVWordLNTS(buf, buflen, w, str, wType, 0);
}
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index bf14253fca..53caf1b702 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -79,7 +79,7 @@ void CIcqProto::GetAvatarFileName(int dwUin, const char *szUid, TCHAR *pszDest, mir_sntprintf(szPath, _T("%s\\%S\\"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
FOLDERSGETDATA fgd = { sizeof(fgd) };
- fgd.nMaxPathSize = SIZEOF(szPath);
+ fgd.nMaxPathSize = _countof(szPath);
fgd.szPathT = szPath;
fgd.flags = FF_TCHAR;
@@ -1158,7 +1158,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = PA_FORMAT_JPEG; // this is for error only
ai.hContact = pCookieData->hContact;
- mir_tstrncpy(ai.filename, pCookieData->szFile, SIZEOF(ai.filename));
+ mir_tstrncpy(ai.filename, pCookieData->szFile, _countof(ai.filename));
AddAvatarExt(PA_FORMAT_JPEG, ai.filename);
ppro->FreeCookie(pSnacHeader->dwRef);
@@ -1211,11 +1211,11 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, size_t wBufferLen const TCHAR *ptszExt;
int dwPaFormat = ProtoGetBufferFormat(pBuffer, &ptszExt);
TCHAR tszImageFile[MAX_PATH];
- mir_sntprintf(tszImageFile, SIZEOF(tszImageFile), _T("%s%s"), pCookieData->szFile, ptszExt);
+ mir_sntprintf(tszImageFile, _countof(tszImageFile), _T("%s%s"), pCookieData->szFile, ptszExt);
ppro->setByte(pCookieData->hContact, "AvatarType", (BYTE)dwPaFormat);
ai.format = dwPaFormat; // set the format
- mir_tstrncpy(ai.filename, tszImageFile, SIZEOF(ai.filename));
+ mir_tstrncpy(ai.filename, tszImageFile, _countof(ai.filename));
int out = _topen(tszImageFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE);
if (out != -1) {
diff --git a/protocols/IcqOscarJ/src/icq_clients.cpp b/protocols/IcqOscarJ/src/icq_clients.cpp index 275dce0f04..0993175820 100644 --- a/protocols/IcqOscarJ/src/icq_clients.cpp +++ b/protocols/IcqOscarJ/src/icq_clients.cpp @@ -473,7 +473,7 @@ const char* CIcqProto::detectUserClient( else if (MatchCapability(caps, wLen, &capQipInfium)) {
mir_strcpy(szClientBuf, "QIP Infium");
if (dwFT1) {
- mir_snprintf(ver, SIZEOF(ver), " (%d)", dwFT1);
+ mir_snprintf(ver, _countof(ver), " (%d)", dwFT1);
mir_strcat(szClientBuf, ver);
}
if (dwFT2 == 0x0B)
@@ -484,7 +484,7 @@ const char* CIcqProto::detectUserClient( else if (MatchCapability(caps, wLen, &capQip2010, 12)) {
mir_strcpy(szClientBuf, "QIP 2010");
if (dwFT1) {
- mir_snprintf(ver, SIZEOF(ver), " (%d)", dwFT1);
+ mir_snprintf(ver, _countof(ver), " (%d)", dwFT1);
mir_strcat(szClientBuf, ver);
}
@@ -493,7 +493,7 @@ const char* CIcqProto::detectUserClient( else if (MatchCapability(caps, wLen, &capQip2012, 12)) {
mir_strcpy(szClientBuf, "QIP 2012");
if (dwFT1) {
- mir_snprintf(ver, SIZEOF(ver), " (%d)", dwFT1);
+ mir_snprintf(ver, _countof(ver), " (%d)", dwFT1);
mir_strcat(szClientBuf, ver);
}
@@ -507,7 +507,7 @@ const char* CIcqProto::detectUserClient( mir_snprintf(szClientBuf, 64, cliQip, ver);
if (dwFT1 && dwFT2 == 0x0E) {
- mir_snprintf(ver, SIZEOF(ver), " (%d%d%d%d)", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF, (dwFT1 >> 0x08) & 0xFF, dwFT1 & 0xFF);
+ mir_snprintf(ver, _countof(ver), " (%d%d%d%d)", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF, (dwFT1 >> 0x08) & 0xFF, dwFT1 & 0xFF);
mir_strcat(szClientBuf, ver);
}
szClient = szClientBuf;
@@ -528,7 +528,7 @@ const char* CIcqProto::detectUserClient( if (dwFT2 == 0x0FFFF0011 && dwFT3 == 0x1100FFFF && (dwFT1 >> 0x18)) {
char ver[16];
- mir_snprintf(ver, SIZEOF(ver), " %d.%d", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF);
+ mir_snprintf(ver, _countof(ver), " %d.%d", dwFT1 >> 0x18, (dwFT1 >> 0x10) & 0xFF);
if ((dwFT1 & 0xFF) == 0x0B)
mir_strcat(ver, " Beta");
mir_strcat(szClientBuf, ver);
@@ -943,7 +943,7 @@ const char* CIcqProto::detectUserClient( capstr *capId = MatchCapability(caps, wLen, &capMimPack, 4);
if (capId) {
char szPack[16];
- mir_snprintf(szPack, SIZEOF(szPack), " [%.12s]", (*capId) + 4);
+ mir_snprintf(szPack, _countof(szPack), " [%.12s]", (*capId) + 4);
// make sure client string is not constant
if (szClient != szClientBuf) {
diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index cf065c1664..571e4949de 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -30,7 +30,7 @@ static void accountLoadDetails(CIcqProto *ppro, HWND hwndDlg) char pszUIN[20];
DWORD dwUIN = ppro->getContactUin(NULL);
if (dwUIN) {
- mir_snprintf(pszUIN, SIZEOF(pszUIN), "%u", dwUIN);
+ mir_snprintf(pszUIN, _countof(pszUIN), "%u", dwUIN);
SetDlgItemTextA(hwndDlg, IDC_UIN, pszUIN);
}
@@ -86,10 +86,10 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_UIN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_UIN, str, _countof(str));
ppro->setDword(UNIQUEIDSETTING, atoi(str));
- GetDlgItemTextA(hwndDlg, IDC_PW, str, SIZEOF(ppro->m_szPassword));
+ GetDlgItemTextA(hwndDlg, IDC_PW, str, _countof(ppro->m_szPassword));
mir_strcpy(ppro->m_szPassword, str);
ppro->setString("Password", str);
break;
diff --git a/protocols/IcqOscarJ/src/icq_http.cpp b/protocols/IcqOscarJ/src/icq_http.cpp index 3620340f28..6a46f8e35b 100644 --- a/protocols/IcqOscarJ/src/icq_http.cpp +++ b/protocols/IcqOscarJ/src/icq_http.cpp @@ -54,7 +54,7 @@ int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST * unpackDWord(&buf, &dwSid2);
unpackDWord(&buf, &dwSid3);
unpackDWord(&buf, &dwSid4);
- mir_snprintf(szSid, SIZEOF(szSid), "%08x%08x%08x%08x", dwSid1, dwSid2, dwSid3, dwSid4);
+ mir_snprintf(szSid, _countof(szSid), "%08x%08x%08x%08x", dwSid1, dwSid2, dwSid3, dwSid4);
unpackWord(&buf, &wIpLen);
if(nlhr->dataLength < 30 + wIpLen || wIpLen == 0 || wIpLen > sizeof(szHttpServer) - 1)
@@ -73,8 +73,8 @@ int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST * nlhpi.szHttpGetUrl = szHttpGetUrl;
nlhpi.szHttpPostUrl = szHttpPostUrl;
nlhpi.firstPostSequence = 1;
- mir_snprintf(szHttpGetUrl, SIZEOF(szHttpGetUrl), "http://%s/monitor?sid=%s", szHttpServer, szSid);
- mir_snprintf(szHttpPostUrl, SIZEOF(szHttpPostUrl), "http://%s/data?sid=%s&seq=", szHttpServer, szSid);
+ mir_snprintf(szHttpGetUrl, _countof(szHttpGetUrl), "http://%s/monitor?sid=%s", szHttpServer, szSid);
+ mir_snprintf(szHttpPostUrl, _countof(szHttpPostUrl), "http://%s/data?sid=%s&seq=", szHttpServer, szSid);
return CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi);
}
diff --git a/protocols/IcqOscarJ/src/icq_menu.cpp b/protocols/IcqOscarJ/src/icq_menu.cpp index afe7cfedfb..b9c66d361a 100644 --- a/protocols/IcqOscarJ/src/icq_menu.cpp +++ b/protocols/IcqOscarJ/src/icq_menu.cpp @@ -177,7 +177,7 @@ INT_PTR CIcqProto::OpenWebProfile(WPARAM hContact, LPARAM) {
DWORD dwUin = getContactUin(hContact);
char url[256];
- mir_snprintf(url, SIZEOF(url), "http://www.icq.com/people/%d",dwUin);
+ mir_snprintf(url, _countof(url), "http://www.icq.com/people/%d",dwUin);
return CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)url);
}
diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index 14d9e7b629..2559bdfb3b 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -146,7 +146,7 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP char str[128];
ppro->setDword(UNIQUEIDSETTING, GetDlgItemInt(hwndDlg, IDC_ICQNUM, NULL, FALSE));
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(ppro->m_szPassword));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, _countof(ppro->m_szPassword));
if (mir_strlen(str)) {
mir_strcpy(ppro->m_szPassword, str);
ppro->m_bRememberPwd = true;
@@ -154,7 +154,7 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else ppro->m_bRememberPwd = ppro->getByte("RememberPass", 0);
ppro->setString("Password", str);
- GetDlgItemTextA(hwndDlg, IDC_ICQSERVER, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_ICQSERVER, str, _countof(str));
ppro->setString("OscarServer", str);
ppro->setWord("OscarPort", (WORD)GetDlgItemInt(hwndDlg, IDC_ICQPORT, NULL, FALSE));
@@ -195,7 +195,7 @@ static INT_PTR CALLBACK DlgProcIcqPrivacyOpts(HWND hwndDlg, UINT msg, WPARAM wPa int nAddAuth = ppro->getByte("Auth", 1);
if (!ppro->icqOnline()) {
- icq_EnableMultipleControls(hwndDlg, icqPrivacyControls, SIZEOF(icqPrivacyControls), FALSE);
+ icq_EnableMultipleControls(hwndDlg, icqPrivacyControls, _countof(icqPrivacyControls), FALSE);
ShowDlgItem(hwndDlg, IDC_STATIC_NOTONLINE, SW_SHOW);
}
else ShowDlgItem(hwndDlg, IDC_STATIC_NOTONLINE, SW_HIDE);
@@ -352,18 +352,18 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP BOOL byData = ppro->getByte("DirectMessaging", DEFAULT_DCMSG_ENABLED);
CheckDlgButton(hwndDlg, IDC_DCENABLE, byData ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DCPASSIVE, byData == 1 ? BST_CHECKED : BST_UNCHECKED);
- icq_EnableMultipleControls(hwndDlg, icqDCMsgControls, SIZEOF(icqDCMsgControls), byData ? TRUE : FALSE);
+ icq_EnableMultipleControls(hwndDlg, icqDCMsgControls, _countof(icqDCMsgControls), byData ? TRUE : FALSE);
BYTE byXStatusEnabled = ppro->getByte("XStatusEnabled", DEFAULT_XSTATUS_ENABLED);
CheckDlgButton(hwndDlg, IDC_XSTATUSENABLE, byXStatusEnabled ? BST_CHECKED : BST_UNCHECKED);
BYTE byMoodsEnabled = ppro->getByte("MoodsEnabled", DEFAULT_MOODS_ENABLED);
CheckDlgButton(hwndDlg, IDC_MOODSENABLE, byMoodsEnabled ? BST_CHECKED : BST_UNCHECKED);
- icq_EnableMultipleControls(hwndDlg, icqXStatusControls, SIZEOF(icqXStatusControls), byXStatusEnabled);
- icq_EnableMultipleControls(hwndDlg, icqCustomStatusControls, SIZEOF(icqCustomStatusControls), byXStatusEnabled || byMoodsEnabled);
+ icq_EnableMultipleControls(hwndDlg, icqXStatusControls, _countof(icqXStatusControls), byXStatusEnabled);
+ icq_EnableMultipleControls(hwndDlg, icqCustomStatusControls, _countof(icqCustomStatusControls), byXStatusEnabled || byMoodsEnabled);
LoadDBCheckState(ppro, hwndDlg, IDC_XSTATUSAUTO, "XStatusAuto", DEFAULT_XSTATUS_AUTO);
LoadDBCheckState(ppro, hwndDlg, IDC_XSTATUSRESET, "XStatusReset", DEFAULT_XSTATUS_RESET);
LoadDBCheckState(ppro, hwndDlg, IDC_KILLSPAMBOTS, "KillSpambots", DEFAULT_KILLSPAM_ENABLED);
LoadDBCheckState(ppro, hwndDlg, IDC_AIMENABLE, "AimEnabled", DEFAULT_AIM_ENABLED);
- icq_EnableMultipleControls(hwndDlg, icqAimControls, SIZEOF(icqAimControls), ppro->icqOnline() ? FALSE : TRUE);
+ icq_EnableMultipleControls(hwndDlg, icqAimControls, _countof(icqAimControls), ppro->icqOnline() ? FALSE : TRUE);
hCpCombo = GetDlgItem(hwndDlg, IDC_UTFCODEPAGE);
int sCodePage = ppro->getWord("AnsiCodePage", CP_ACP);
@@ -389,13 +389,13 @@ static INT_PTR CALLBACK DlgProcIcqFeaturesOpts(HWND hwndDlg, UINT msg, WPARAM wP OptDlgChanged(hwndDlg);
break;
case IDC_DCENABLE:
- icq_EnableMultipleControls(hwndDlg, icqDCMsgControls, SIZEOF(icqDCMsgControls), IsDlgButtonChecked(hwndDlg, IDC_DCENABLE));
+ icq_EnableMultipleControls(hwndDlg, icqDCMsgControls, _countof(icqDCMsgControls), IsDlgButtonChecked(hwndDlg, IDC_DCENABLE));
OptDlgChanged(hwndDlg);
break;
case IDC_XSTATUSENABLE:
- icq_EnableMultipleControls(hwndDlg, icqXStatusControls, SIZEOF(icqXStatusControls), IsDlgButtonChecked(hwndDlg, IDC_XSTATUSENABLE));
+ icq_EnableMultipleControls(hwndDlg, icqXStatusControls, _countof(icqXStatusControls), IsDlgButtonChecked(hwndDlg, IDC_XSTATUSENABLE));
case IDC_MOODSENABLE:
- icq_EnableMultipleControls(hwndDlg, icqCustomStatusControls, SIZEOF(icqCustomStatusControls), IsDlgButtonChecked(hwndDlg, IDC_XSTATUSENABLE) || IsDlgButtonChecked(hwndDlg, IDC_MOODSENABLE));
+ icq_EnableMultipleControls(hwndDlg, icqCustomStatusControls, _countof(icqCustomStatusControls), IsDlgButtonChecked(hwndDlg, IDC_XSTATUSENABLE) || IsDlgButtonChecked(hwndDlg, IDC_MOODSENABLE));
default:
OptDlgChanged(hwndDlg);
break;
@@ -454,8 +454,8 @@ static INT_PTR CALLBACK DlgProcIcqContactsOpts(HWND hwndDlg, UINT msg, WPARAM wP LoadDBCheckState(ppro, hwndDlg, IDC_AUTOLOADAVATARS, "AvatarsAutoLoad", DEFAULT_LOAD_AVATARS);
LoadDBCheckState(ppro, hwndDlg, IDC_STRICTAVATARCHECK, "StrictAvatarCheck", DEFAULT_AVATARS_CHECK);
- icq_EnableMultipleControls(hwndDlg, icqContactsControls, SIZEOF(icqContactsControls), ppro->getByte("UseServerCList", DEFAULT_SS_ENABLED) ? TRUE : FALSE);
- icq_EnableMultipleControls(hwndDlg, icqAvatarControls, SIZEOF(icqAvatarControls), ppro->getByte("AvatarsEnabled", DEFAULT_AVATARS_ENABLED) ? TRUE : FALSE);
+ icq_EnableMultipleControls(hwndDlg, icqContactsControls, _countof(icqContactsControls), ppro->getByte("UseServerCList", DEFAULT_SS_ENABLED) ? TRUE : FALSE);
+ icq_EnableMultipleControls(hwndDlg, icqAvatarControls, _countof(icqAvatarControls), ppro->getByte("AvatarsEnabled", DEFAULT_AVATARS_ENABLED) ? TRUE : FALSE);
if (ppro->icqOnline()) {
ShowDlgItem(hwndDlg, IDC_OFFLINETOENABLE, SW_SHOW);
@@ -473,14 +473,14 @@ static INT_PTR CALLBACK DlgProcIcqContactsOpts(HWND hwndDlg, UINT msg, WPARAM wP ppro->ShowUploadContactsDialog();
return TRUE;
case IDC_ENABLE:
- icq_EnableMultipleControls(hwndDlg, icqContactsControls, SIZEOF(icqContactsControls), IsDlgButtonChecked(hwndDlg, IDC_ENABLE));
+ icq_EnableMultipleControls(hwndDlg, icqContactsControls, _countof(icqContactsControls), IsDlgButtonChecked(hwndDlg, IDC_ENABLE));
if (ppro->icqOnline())
ShowDlgItem(hwndDlg, IDC_RECONNECTREQD, SW_SHOW);
else
EnableDlgItem(hwndDlg, IDC_UPLOADNOW, FALSE);
break;
case IDC_ENABLEAVATARS:
- icq_EnableMultipleControls(hwndDlg, icqAvatarControls, SIZEOF(icqAvatarControls), IsDlgButtonChecked(hwndDlg, IDC_ENABLEAVATARS));
+ icq_EnableMultipleControls(hwndDlg, icqAvatarControls, _countof(icqAvatarControls), IsDlgButtonChecked(hwndDlg, IDC_ENABLEAVATARS));
break;
}
OptDlgChanged(hwndDlg);
diff --git a/protocols/IcqOscarJ/src/icq_popups.cpp b/protocols/IcqOscarJ/src/icq_popups.cpp index 7c74c31169..8d3239c095 100644 --- a/protocols/IcqOscarJ/src/icq_popups.cpp +++ b/protocols/IcqOscarJ/src/icq_popups.cpp @@ -76,11 +76,11 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR CheckDlgButton(hwndDlg, IDC_USEWINCOLORS, bEnabled ? BST_CHECKED : BST_UNCHECKED);
bEnabled |= ppro->getByte(NULL,"PopupsDefColors",DEFAULT_POPUPS_DEF_COLORS);
CheckDlgButton(hwndDlg, IDC_USEDEFCOLORS, bEnabled ? BST_CHECKED : BST_UNCHECKED);
- icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), bEnabled);
+ icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, _countof(icqPopupColorControls), bEnabled);
CheckDlgButton(hwndDlg, IDC_USESYSICONS, ppro->getByte(NULL,"PopupsSysIcons",DEFAULT_POPUPS_SYS_ICONS) ? BST_CHECKED : BST_UNCHECKED);
bEnabled = ppro->getByte(NULL,"PopupsEnabled",DEFAULT_POPUPS_ENABLED);
CheckDlgButton(hwndDlg, IDC_POPUPS_ENABLED, bEnabled ? BST_CHECKED : BST_UNCHECKED);
- icq_EnableMultipleControls(hwndDlg, icqPopupsControls, SIZEOF(icqPopupsControls), bEnabled);
+ icq_EnableMultipleControls(hwndDlg, icqPopupsControls, _countof(icqPopupsControls), bEnabled);
if (bEnabled)
{
if (IsDlgButtonChecked(hwndDlg, IDC_USEDEFCOLORS))
@@ -94,7 +94,7 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(GetDlgItem(hwndDlg, IDC_USEDEFCOLORS), !WM_ENABLE);
}
}
- icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), bEnabled & (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS) && BST_UNCHECKED == IsDlgButtonChecked(hwndDlg,IDC_USEDEFCOLORS)));
+ icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, _countof(icqPopupColorControls), bEnabled & (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS) && BST_UNCHECKED == IsDlgButtonChecked(hwndDlg,IDC_USEDEFCOLORS)));
bInitDone = true;
return TRUE;
@@ -130,7 +130,7 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(GetDlgItem(hwndDlg, IDC_USEWINCOLORS), !WM_ENABLE);
EnableWindow(GetDlgItem(hwndDlg, IDC_USEDEFCOLORS), !WM_ENABLE);
}
- icq_EnableMultipleControls(hwndDlg, icqPopupsControls, SIZEOF(icqPopupsControls), bEnabled);
+ icq_EnableMultipleControls(hwndDlg, icqPopupsControls, _countof(icqPopupsControls), bEnabled);
case IDC_USEWINCOLORS:
bEnabled = IsDlgButtonChecked(hwndDlg,IDC_POPUPS_ENABLED);
@@ -141,7 +141,7 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR else
EnableWindow(GetDlgItem(hwndDlg, IDC_USEDEFCOLORS), WM_ENABLE);
}
- icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), !IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS));
+ icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, _countof(icqPopupColorControls), !IsDlgButtonChecked(hwndDlg,IDC_USEWINCOLORS));
case IDC_USEDEFCOLORS:
bEnabled = IsDlgButtonChecked(hwndDlg,IDC_POPUPS_ENABLED);
@@ -152,7 +152,7 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR else
EnableWindow(GetDlgItem(hwndDlg, IDC_USEWINCOLORS), WM_ENABLE);
}
- icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, SIZEOF(icqPopupColorControls), !IsDlgButtonChecked(hwndDlg,IDC_USEDEFCOLORS));
+ icq_EnableMultipleControls(hwndDlg, icqPopupColorControls, _countof(icqPopupColorControls), !IsDlgButtonChecked(hwndDlg,IDC_USEDEFCOLORS));
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_POPUP_LOG0_TIMEOUT:
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 7b672381ea..f420108707 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -172,7 +172,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const TCHAR* aUserName) : m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
char szP2PModuleName[MAX_PATH];
- mir_snprintf(szP2PModuleName, SIZEOF(szP2PModuleName), "%sP2P", m_szModuleName);
+ mir_snprintf(szP2PModuleName, _countof(szP2PModuleName), "%sP2P", m_szModuleName);
mir_sntprintf(szBuffer, TranslateT("%s client-to-client connections"), m_tszUserName);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_TCHAR;
nlu.ptszDescriptiveName = szBuffer;
@@ -241,9 +241,9 @@ int CIcqProto::OnModulesLoaded(WPARAM, LPARAM) char pszSrvGroupsName[MAX_PATH];
char* modules[5] = { 0, 0, 0, 0, 0 };
- mir_snprintf(pszP2PName, SIZEOF(pszP2PName), "%sP2P", m_szModuleName);
- mir_snprintf(pszGroupsName, SIZEOF(pszGroupsName), "%sGroups", m_szModuleName);
- mir_snprintf(pszSrvGroupsName, SIZEOF(pszSrvGroupsName), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(pszP2PName, _countof(pszP2PName), "%sP2P", m_szModuleName);
+ mir_snprintf(pszGroupsName, _countof(pszGroupsName), "%sGroups", m_szModuleName);
+ mir_snprintf(pszSrvGroupsName, _countof(pszSrvGroupsName), "%sSrvGroups", m_szModuleName);
modules[0] = m_szModuleName;
modules[1] = pszP2PName;
modules[2] = pszGroupsName;
@@ -1215,7 +1215,7 @@ HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const TCHAR* szDescription }
else {
char tmp[64];
- mir_snprintf(szFiles, SIZEOF(szFiles), ICQTranslateUtfStatic("%d Files", tmp, SIZEOF(tmp)), ft->dwFileCount);
+ mir_snprintf(szFiles, _countof(szFiles), ICQTranslateUtfStatic("%d Files", tmp, _countof(tmp)), ft->dwFileCount);
pszFiles = szFiles;
}
@@ -1857,11 +1857,11 @@ int __cdecl CIcqProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l case EV_PROTO_ONERASE:
{
char szDbSetting[MAX_PATH];
- mir_snprintf(szDbSetting, SIZEOF(szDbSetting), "%sP2P", m_szModuleName);
+ mir_snprintf(szDbSetting, _countof(szDbSetting), "%sP2P", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbSetting);
- mir_snprintf(szDbSetting, SIZEOF(szDbSetting), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szDbSetting, _countof(szDbSetting), "%sSrvGroups", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbSetting);
- mir_snprintf(szDbSetting, SIZEOF(szDbSetting), "%sGroups", m_szModuleName);
+ mir_snprintf(szDbSetting, _countof(szDbSetting), "%sGroups", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbSetting);
}
break;
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index a361615d41..3b7745d7d0 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -850,7 +850,7 @@ void CIcqProto::LoadServerIDs() int nStart = nServerIDListCount;
char szModule[MAX_PATH];
- mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName);
GroupReserveIdsEnumParam param = { this, szModule };
DBCONTACTENUMSETTINGS dbces = { 0 };
@@ -1178,7 +1178,7 @@ int CIcqProto::IsServerGroupsDefined() char szModule[MAX_PATH];
// flush obsolete linking data
- mir_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sGroups", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szModule);
iRes = 0; // no groups defined, or older version
@@ -1193,7 +1193,7 @@ void CIcqProto::FlushSrvGroupsCache() {
char szModule[MAX_PATH];
- mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szModule);
}
@@ -1273,7 +1273,7 @@ void CIcqProto::removeGroupPathLinks(WORD wGroupID) char szModule[MAX_PATH];
char* pars[3];
- mir_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sGroups", m_szModuleName);
pars[0] = NULL;
pars[1] = (char*)wGroupID;
@@ -1308,7 +1308,7 @@ char* CIcqProto::getServListGroupName(WORD wGroupID) return NULL;
}
- mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName);
_itoa(wGroupID, szGroup, 0x10);
if (!CheckServerID(wGroupID, 0)) { // check if valid id, if not give empty and remove
@@ -1330,7 +1330,7 @@ void CIcqProto::setServListGroupName(WORD wGroupID, const char *szGroupName) return;
}
- mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName);
_itoa(wGroupID, szGroup, 0x10);
if (szGroupName)
@@ -1344,7 +1344,7 @@ void CIcqProto::setServListGroupName(WORD wGroupID, const char *szGroupName) WORD CIcqProto::getServListGroupLinkID(const char *szPath)
{
char szModule[MAX_PATH];
- mir_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sGroups", m_szModuleName);
WORD wGroupId = db_get_w(NULL, szModule, szPath, 0);
@@ -1360,7 +1360,7 @@ WORD CIcqProto::getServListGroupLinkID(const char *szPath) void CIcqProto::setServListGroupLinkID(const char *szPath, WORD wGroupID)
{
char szModule[MAX_PATH];
- mir_snprintf(szModule, SIZEOF(szModule), "%sGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sGroups", m_szModuleName);
if (wGroupID)
db_set_w(NULL, szModule, szPath, wGroupID);
@@ -1530,7 +1530,7 @@ char* CIcqProto::getServListUniqueGroupName(const char *szGroupName, int bAlloce szGroupNameBase = null_strdup(szGroupName);
null_strcut(szGroupNameBase, m_wServerListRecordNameMaxLength);
- mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
+ mir_snprintf(szModule, _countof(szModule), "%sSrvGroups", m_szModuleName);
do {
pars[0] = (char*)this;
diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp index d99f10f2bc..edb1b0075d 100644 --- a/protocols/IcqOscarJ/src/icq_uploadui.cpp +++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp @@ -155,7 +155,7 @@ static int GroupEnumIdsEnumProc(const char *szSetting,LPARAM lParam) static void enumServerGroups(CIcqProto* ppro)
{
char szModule[MAX_PATH+9];
- mir_snprintf(szModule, SIZEOF(szModule), "%s%s", ppro->m_szModuleName, "SrvGroups");
+ mir_snprintf(szModule, _countof(szModule), "%s%s", ppro->m_szModuleName, "SrvGroups");
DBCONTACTENUMSETTINGS dbces = { 0 };
dbces.pfnEnumProc = &GroupEnumIdsEnumProc;
@@ -809,7 +809,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg, UINT message, WPARAM wPa hCurrentContact = NULL;
currentState = STATE_REGROUP;
currentAction = ACTION_NONE;
- icq_ShowMultipleControls(hwndDlg, settingsControls, SIZEOF(settingsControls), SW_HIDE);
+ icq_ShowMultipleControls(hwndDlg, settingsControls, _countof(settingsControls), SW_HIDE);
// SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETGREYOUTFLAGS, 0xFFFFFFFF, 0);
// InvalidateRect(GetDlgItem(hwndDlg, IDC_CLIST), NULL, FALSE);
EnableDlgItem(hwndDlg, IDC_CLIST, FALSE);
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index 0e040ddb91..d9d87ad116 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -418,7 +418,7 @@ void CIcqProto::handleXStatusCaps(DWORD dwUIN, char *szUID, MCONTACT hContact, B null_strcpy(szMoodData, moods, moodsize);
if (moodXStatus[i] == -1) continue;
- mir_snprintf(szMoodId, SIZEOF(szMoodId), "0icqmood%d", moodXStatus[i]);
+ mir_snprintf(szMoodId, _countof(szMoodId), "0icqmood%d", moodXStatus[i]);
if (!mir_strcmp(szMoodId, szMoodData)) {
BYTE bXStatusId = (BYTE)(i+1);
char str[MAX_PATH];
@@ -510,7 +510,7 @@ void CIcqProto::updateServerCustomStatus(int fullUpdate) // prepare mood id
if (m_bMoodsEnabled && bXStatus && moodXStatus[bXStatus-1] != -1)
- mir_snprintf(szMoodData, SIZEOF(szMoodData), "0icqmood%d", moodXStatus[bXStatus-1]);
+ mir_snprintf(szMoodData, _countof(szMoodData), "0icqmood%d", moodXStatus[bXStatus-1]);
else
szMoodData[0] = '\0';
@@ -717,7 +717,7 @@ static INT_PTR CALLBACK SetXStatusDlgProc(HWND hwndDlg,UINT message,WPARAM wPara break;
}
- mir_snprintf(str,SIZEOF(str),dat->okButtonFormat,dat->countdown);
+ mir_snprintf(str,_countof(str),dat->okButtonFormat,dat->countdown);
SetDlgItemTextUtf(hwndDlg,IDOK,str);
dat->countdown--;
break;
@@ -857,7 +857,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) if (m_bHideXStatusUI || m_bHideXStatusMenu)
return;
- mir_snprintf(szItem, SIZEOF(szItem), Translate("%s Custom Status"), m_szModuleName);
+ mir_snprintf(szItem, _countof(szItem), Translate("%s Custom Status"), m_szModuleName);
CLISTMENUITEM mi = { sizeof(mi) };
mi.pszPopupName = szItem;
@@ -865,7 +865,7 @@ void CIcqProto::InitXStatusItems(BOOL bAllowStatus) mi.position = 2000040000;
for (int i = 0; i <= XSTATUS_COUNT; i++) {
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuXStatus%d", m_szModuleName, i);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/menuXStatus%d", m_szModuleName, i);
mi.position++;
@@ -893,7 +893,7 @@ void InitXStatusIcons() SKINICONDESC sid = { 0 };
sid.section.a = "Protocols/" ICQ_PROTOCOL_NAME "/"LPGEN("Custom Status");
sid.flags = SIDF_PATH_TCHAR;
- sid.defaultFile.t = InitXStatusIconLibrary(lib, SIZEOF(lib));
+ sid.defaultFile.t = InitXStatusIconLibrary(lib, _countof(lib));
for (int i = 0; i < XSTATUS_COUNT; i++) {
char szTemp[100];
diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp index 6d4b130956..268904a0a1 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp +++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp @@ -352,7 +352,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) GetFullAvatarFileName(dwUIN, szUID, dwPaFormat, tszFile, MAX_PATH * 2);
- mir_tstrncpy(pai->filename, tszFile, SIZEOF(pai->filename)); // Avatar API does not support unicode :-(
+ mir_tstrncpy(pai->filename, tszFile, _countof(pai->filename)); // Avatar API does not support unicode :-(
pai->format = dwPaFormat;
if (!IsAvatarChanged(pai->hContact, dbv.pbVal, dbv.cpbVal)) { // hashes are the same
@@ -370,7 +370,7 @@ INT_PTR CIcqProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) GetAvatarFileName(dwUIN, szUID, tszFile, MAX_PATH * 2);
GetAvatarData(pai->hContact, dwUIN, szUID, dbv.pbVal, dbv.cpbVal, tszFile);
- mir_tstrncpy(pai->filename, tszFile, SIZEOF(pai->filename)); // Avatar API does not support unicode :-(
+ mir_tstrncpy(pai->filename, tszFile, _countof(pai->filename)); // Avatar API does not support unicode :-(
db_free(&dbv);
diff --git a/protocols/IcqOscarJ/src/log.cpp b/protocols/IcqOscarJ/src/log.cpp index cd3b3297de..644fef9e5c 100644 --- a/protocols/IcqOscarJ/src/log.cpp +++ b/protocols/IcqOscarJ/src/log.cpp @@ -119,14 +119,14 @@ void CIcqProto::icq_LogUsingErrorCode(int level, DWORD dwError, const char *szMs default:
TCHAR err[512];
- if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, err, SIZEOF(err), NULL)) {
+ if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, err, _countof(err), NULL)) {
pszErrorMsg = make_utf8_string(err);
bNeedFree = TRUE;
}
break;
}
- mir_snprintf(szBuf, SIZEOF(szBuf), "%s%s%s (%s %d)",
+ mir_snprintf(szBuf, _countof(szBuf), "%s%s%s (%s %d)",
szMsg ? ICQTranslateUtfStatic(szMsg, str, 1024) : "",
szMsg ? "\r\n\r\n" : "",
ICQTranslateUtfStatic(pszErrorMsg, szErrorMsg, 512),
@@ -144,6 +144,6 @@ void CIcqProto::icq_LogFatalParam(const char *szMsg, WORD wError) char str[MAX_PATH];
char buf[MAX_PATH];
- mir_snprintf(buf, ICQTranslateUtfStatic(szMsg, str, SIZEOF(str)), wError);
+ mir_snprintf(buf, ICQTranslateUtfStatic(szMsg, str, _countof(str)), wError);
icq_LogMessage(LOG_FATAL, buf);
}
diff --git a/protocols/IcqOscarJ/src/loginpassword.cpp b/protocols/IcqOscarJ/src/loginpassword.cpp index c7a448b11f..2b19ad07eb 100644 --- a/protocols/IcqOscarJ/src/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/loginpassword.cpp @@ -42,7 +42,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA DWORD dwUin = ppro->getContactUin(NULL);
TCHAR pszUIN[MAX_PATH];
- mir_sntprintf(pszUIN, SIZEOF(pszUIN), TranslateT("Enter a password for UIN %u:"), dwUin);
+ mir_sntprintf(pszUIN, _countof(pszUIN), TranslateT("Enter a password for UIN %u:"), dwUin);
SetDlgItemText(hwndDlg, IDC_INSTRUCTION, pszUIN);
SendDlgItemMessage(hwndDlg, IDC_LOGINPW, EM_LIMITTEXT, PASSWORDMAXLEN - 1, 0);
@@ -66,7 +66,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ppro->m_bRememberPwd = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVEPASS);
ppro->setByte("RememberPass", ppro->m_bRememberPwd);
- GetDlgItemTextA(hwndDlg, IDC_LOGINPW, ppro->m_szPassword, SIZEOF(ppro->m_szPassword));
+ GetDlgItemTextA(hwndDlg, IDC_LOGINPW, ppro->m_szPassword, _countof(ppro->m_szPassword));
ppro->icq_login(ppro->m_szPassword);
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index cb070ec4bd..d378d71dba 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -474,7 +474,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, size_t wLen, DWORD dwUin, char * pszFileName = (char*)_alloca(64);
char tmp[64];
- mir_snprintf(pszFileName, 64, ICQTranslateUtfStatic(LPGEN("%d Files"), tmp, SIZEOF(tmp)), ft->wFilesCount);
+ mir_snprintf(pszFileName, 64, ICQTranslateUtfStatic(LPGEN("%d Files"), tmp, _countof(tmp)), ft->wFilesCount);
}
}
// Total Size TLV (ICQ 6 and AIM 6)
@@ -1586,7 +1586,7 @@ int CIcqProto::oft_handleFileData(oscar_connection *oc, BYTE *buf, size_t len) char *pszMsg = ICQTranslateUtf(LPGEN("The checksum of file \"%s\" does not match, the file is probably damaged."));
char szBuf[MAX_PATH];
- mir_snprintf(szBuf, SIZEOF(szBuf), pszMsg, ExtractFileName(ft->szThisFile));
+ mir_snprintf(szBuf, _countof(szBuf), pszMsg, ExtractFileName(ft->szThisFile));
icq_LogMessage(LOG_ERROR, szBuf);
SAFE_FREE(&pszMsg);
diff --git a/protocols/IcqOscarJ/src/userinfotab.cpp b/protocols/IcqOscarJ/src/userinfotab.cpp index b286579faf..1b475a068b 100644 --- a/protocols/IcqOscarJ/src/userinfotab.cpp +++ b/protocols/IcqOscarJ/src/userinfotab.cpp @@ -97,7 +97,7 @@ static void SetValue(CIcqProto* ppro, HWND hwndDlg, int idCtrl, MCONTACT hContac pstr = str;
if (hContact && ppro->IsDirectConnectionOpen(hContact, DIRECTCONN_STANDARD, 1)) {
- ICQTranslateUtfStatic(LPGEN(" (DC Established)"), szExtra, SIZEOF(szExtra));
+ ICQTranslateUtfStatic(LPGEN(" (DC Established)"), szExtra, _countof(szExtra));
mir_strcat(str, (char*)szExtra);
bUtf = 1;
}
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index 697dcfa3da..a78d4512ef 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -136,7 +136,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) fontid.deffontsettings.charset = DEFAULT_CHARSET;
fontid.deffontsettings.colour = GetSysColor(COLOR_WINDOWTEXT);
fontid.deffontsettings.size = -11;
- mir_tstrncpy(fontid.deffontsettings.szFace, _T("MS Shell Dlg"), SIZEOF(fontid.deffontsettings.szFace));
+ mir_tstrncpy(fontid.deffontsettings.szFace, _T("MS Shell Dlg"), _countof(fontid.deffontsettings.szFace));
fontid.deffontsettings.style = 0;
_tcsncpy_s(fontid.name, LPGENT("Frame title"), _TRUNCATE);
@@ -196,7 +196,7 @@ extern "C" int __declspec(dllexport) Load() WORD v[4];
CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
- mir_sntprintf(szCoreVersion, SIZEOF(szCoreVersion), _T("%d.%d.%d.%d"), v[0], v[1], v[2], v[3]);
+ mir_sntprintf(szCoreVersion, _countof(szCoreVersion), _T("%d.%d.%d.%d"), v[0], v[1], v[2], v[3]);
CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&g_cbCountries, (LPARAM)&g_countries);
diff --git a/protocols/JabberG/src/jabber_adhoc.cpp b/protocols/JabberG/src/jabber_adhoc.cpp index 723b45a43a..348f7cabf5 100644 --- a/protocols/JabberG/src/jabber_adhoc.cpp +++ b/protocols/JabberG/src/jabber_adhoc.cpp @@ -385,7 +385,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA dat->proto->AdHoc_RequestListOfCommands(pStartupParams->m_szJid, hwndDlg);
TCHAR Caption[512];
- mir_sntprintf(Caption, SIZEOF(Caption), TranslateT("Jabber Ad-Hoc commands at %s"), dat->ResponderJID);
+ mir_sntprintf(Caption, _countof(Caption), TranslateT("Jabber Ad-Hoc commands at %s"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
else {
@@ -398,7 +398,7 @@ static INT_PTR CALLBACK JabberAdHoc_CommandDlgProc(HWND hwndDlg, UINT msg, WPARA SetDlgItemText(hwndDlg, IDC_SUBMIT, TranslateT("OK"));
TCHAR Caption[512];
- mir_sntprintf(Caption, SIZEOF(Caption), TranslateT("Sending Ad-Hoc command to %s"), dat->ResponderJID);
+ mir_sntprintf(Caption, _countof(Caption), TranslateT("Sending Ad-Hoc command to %s"), dat->ResponderJID);
SetWindowText(hwndDlg, Caption);
}
@@ -541,8 +541,8 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM hContact, LPARAM lParam) if (selected > 0) {
JABBER_RESOURCE_STATUS *r = item->arResources[selected - 1];
if (r) {
- mir_tstrncat(jid, _T("/"), SIZEOF(jid) - mir_tstrlen(jid));
- mir_tstrncat(jid, r->m_tszResourceName, SIZEOF(jid) - mir_tstrlen(jid));
+ mir_tstrncat(jid, _T("/"), _countof(jid) - mir_tstrlen(jid));
+ mir_tstrncat(jid, r->m_tszResourceName, _countof(jid) - mir_tstrlen(jid));
}
selected = 1;
}
diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index 21e686c742..f12dbd5c4b 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -45,7 +45,7 @@ void CJabberProto::RetrieveMessageArchive(MCONTACT hContact, JABBER_LIST_ITEM *p time_t tmLast = getDword(hContact, "LastCollection", 0);
if (tmLast) {
TCHAR buf[40];
- list << XATTR(_T("start"), time2str(tmLast, buf, SIZEOF(buf)));
+ list << XATTR(_T("start"), time2str(tmLast, buf, _countof(buf)));
}
m_ThreadInfo->send(iq);
}
diff --git a/protocols/JabberG/src/jabber_bookmarks.cpp b/protocols/JabberG/src/jabber_bookmarks.cpp index 6a75105d87..bc33468517 100644 --- a/protocols/JabberG/src/jabber_bookmarks.cpp +++ b/protocols/JabberG/src/jabber_bookmarks.cpp @@ -104,12 +104,12 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM switch (LOWORD(wParam)) {
case IDC_ROOM_JID:
if ((HWND)lParam==GetFocus() && HIWORD(wParam)==EN_CHANGE)
- EnableWindow(GetDlgItem(hwndDlg, IDOK), GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, SIZEOF(text)));
+ EnableWindow(GetDlgItem(hwndDlg, IDOK), GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, _countof(text)));
break;
case IDOK:
{
- GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, _countof(text));
TCHAR *roomJID = NEWTSTR_ALLOCA(text);
if (param->m_item)
@@ -122,13 +122,13 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM else
replaceStrT(item->type, _T("conference"));
- GetDlgItemText(hwndDlg, IDC_NICK, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_NICK, text, _countof(text));
replaceStrT(item->nick, text);
- GetDlgItemText(hwndDlg, IDC_PASSWORD, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_PASSWORD, text, _countof(text));
replaceStrT(item->password, text);
- GetDlgItemText(hwndDlg, IDC_NAME, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_NAME, text, _countof(text));
replaceStrT(item->name, (text[0] == 0) ? roomJID : text);
item->bAutoJoin = (IsDlgButtonChecked(hwndDlg, IDC_CHECK_BM_AUTOJOIN) == BST_CHECKED);
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index 914a528824..fcde4046de 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -94,7 +94,7 @@ void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra) NETLIBCONNINFO connInfo = { sizeof(connInfo) };
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConn, (LPARAM)&connInfo);
- mir_sntprintf(szPort, SIZEOF(szPort), _T("%u"), connInfo.wPort);
+ mir_sntprintf(szPort, _countof(szPort), _T("%u"), connInfo.wPort);
ppro->debugLogA("bytestream_send_connection incoming connection accepted: %s", connInfo.szIpPort);
if ((item = ppro->ListGetItemPtr(LIST_BYTE, szPort)) == NULL) {
@@ -208,7 +208,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt) if (localAddr == NULL)
localAddr = (char*)CallService(MS_NETLIB_ADDRESSTOSTRING, 1, nlb.dwExternalIP);
- mir_sntprintf(szPort, SIZEOF(szPort), _T("%d"), nlb.wPort);
+ mir_sntprintf(szPort, _countof(szPort), _T("%d"), nlb.wPort);
JABBER_LIST_ITEM *item = ListAdd(LIST_BYTE, szPort);
item->jbt = jbt;
hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -406,7 +406,7 @@ void CJabberProto::IqResultStreamActivate(HXML iqNode, CJabberIqInfo*) int id = JabberGetPacketID(iqNode);
TCHAR listJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(listJid, SIZEOF(listJid), _T("ftproxy_%d"), id);
+ mir_sntprintf(listJid, _countof(listJid), _T("ftproxy_%d"), id);
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_FTIQID, listJid);
if (item == NULL)
@@ -555,7 +555,7 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch int iqId = SerialNext();
TCHAR listJid[256];
- mir_sntprintf(listJid, SIZEOF(listJid), _T("ftproxy_%d"), iqId);
+ mir_sntprintf(listJid, _countof(listJid), _T("ftproxy_%d"), iqId);
JABBER_LIST_ITEM *item = ListAdd(LIST_FTIQID, listJid);
item->jbt = jbt;
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp index a68814d7cf..6b0581032a 100644 --- a/protocols/JabberG/src/jabber_caps.cpp +++ b/protocols/JabberG/src/jabber_caps.cpp @@ -183,7 +183,7 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid) return JABBER_RESOURCE_CAPS_NONE;
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(jid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(jid, szBareJid, _countof(szBareJid));
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, szBareJid);
if (item == NULL)
@@ -201,7 +201,7 @@ JabberCapsBits CJabberProto::GetTotalJidCapabilites(const TCHAR *jid) if (item) {
for (int i = 0; i < item->arResources.getCount(); i++) {
TCHAR szFullJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(szFullJid, SIZEOF(szFullJid), _T("%s/%s"), szBareJid, item->arResources[i]->m_tszResourceName);
+ mir_sntprintf(szFullJid, _countof(szFullJid), _T("%s/%s"), szBareJid, item->arResources[i]->m_tszResourceName);
JabberCapsBits jcb = GetResourceCapabilites(szFullJid, FALSE);
if (!(jcb & JABBER_RESOURCE_CAPS_ERROR))
jcbToReturn |= jcb;
@@ -214,7 +214,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen {
TCHAR fullJid[JABBER_MAX_JID_LEN];
if (appendBestResource)
- GetClientJID(jid, fullJid, SIZEOF(fullJid));
+ GetClientJID(jid, fullJid, _countof(fullJid));
else
_tcsncpy_s(fullJid, jid, _TRUNCATE);
@@ -240,7 +240,7 @@ JabberCapsBits CJabberProto::GetResourceCapabilites(const TCHAR *jid, BOOL appen r->m_dwDiscoInfoRequestTime = pInfo->GetRequestTime();
TCHAR queryNode[512];
- mir_sntprintf(queryNode, SIZEOF(queryNode), _T("%s#%s"), r->m_tszCapsNode, r->m_tszCapsVer);
+ mir_sntprintf(queryNode, _countof(queryNode), _T("%s#%s"), r->m_tszCapsNode, r->m_tszCapsVer);
m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY(JABBER_FEAT_DISCO_INFO) << XATTR(_T("node"), queryNode));
bRequestSent = TRUE;
@@ -615,7 +615,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con continue;
TCHAR szExtCap[ 512 ];
- mir_sntprintf(szExtCap, SIZEOF(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
+ mir_sntprintf(szExtCap, _countof(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, g_JabberFeatCapPairsExt[i].szFeature);
if (!mir_tstrcmp(szNode, szExtCap)) {
jcb = g_JabberFeatCapPairsExt[i].jcbCap;
break;
@@ -625,7 +625,7 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con // check features registered through IJabberNetInterface::RegisterFeature() and IJabberNetInterface::AddFeatures()
for (i=0; i < ppro->m_lstJabberFeatCapPairsDynamic.getCount(); i++) {
TCHAR szExtCap[ 512 ];
- mir_sntprintf(szExtCap, SIZEOF(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt);
+ mir_sntprintf(szExtCap, _countof(szExtCap), _T("%s#%s"), JABBER_CAPS_MIRANDA_NODE, ppro->m_lstJabberFeatCapPairsDynamic[i]->szExt);
if (!mir_tstrcmp(szNode, szExtCap)) {
jcb = ppro->m_lstJabberFeatCapPairsDynamic[i]->jcbCap;
break;
@@ -667,8 +667,8 @@ BOOL CJabberClientCapsManager::HandleInfoRequest(HXML, CJabberIqInfo *pInfo, con TCHAR *os = szOsBuffer;
if (ppro->m_options.ShowOSVersion) {
- if (!GetOSDisplayString(szOsBuffer, SIZEOF(szOsBuffer)))
- mir_tstrncpy(szOsBuffer, _T(""), SIZEOF(szOsBuffer));
+ if (!GetOSDisplayString(szOsBuffer, _countof(szOsBuffer)))
+ mir_tstrncpy(szOsBuffer, _T(""), _countof(szOsBuffer));
else {
TCHAR *szOsWindows = _T("Microsoft Windows");
size_t nOsWindowsLength = mir_tstrlen(szOsWindows);
diff --git a/protocols/JabberG/src/jabber_captcha.cpp b/protocols/JabberG/src/jabber_captcha.cpp index 4e9bcc331c..c923fee4a1 100644 --- a/protocols/JabberG/src/jabber_captcha.cpp +++ b/protocols/JabberG/src/jabber_captcha.cpp @@ -93,7 +93,7 @@ INT_PTR CALLBACK JabberCaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, return TRUE;
case IDC_SUBMIT:
- GetDlgItemText(hwndDlg, IDC_VALUE, params->Result, SIZEOF(params->Result));
+ GetDlgItemText(hwndDlg, IDC_VALUE, params->Result, _countof(params->Result));
EndDialog(hwndDlg, 1);
return TRUE;
}
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index e5cdc1e3e0..ee686bddb7 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -120,8 +120,8 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) int i;
// translate string for menus (this can't be done in initializer)
- for (i = 0; i < SIZEOF(sttAffiliationItems); i++) sttAffiliationItems[i].translate();
- for (i = 0; i < SIZEOF(sttRoleItems); i++) sttRoleItems[i].translate();
+ for (i = 0; i < _countof(sttAffiliationItems); i++) sttAffiliationItems[i].translate();
+ for (i = 0; i < _countof(sttRoleItems); i++) sttRoleItems[i].translate();
ptrT szNick(JabberNickFromJID(item->jid));
@@ -163,7 +163,7 @@ int CJabberProto::GcInit(JABBER_LIST_ITEM *item) GCDEST gcd = { m_szModuleName, item->jid, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
- for (i = SIZEOF(sttStatuses) - 1; i >= 0; i--) {
+ for (i = _countof(sttStatuses) - 1; i >= 0; i--) {
gce.ptszStatus = TranslateTS(sttStatuses[i]);
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
}
@@ -355,7 +355,7 @@ void CJabberProto::GcQuit(JABBER_LIST_ITEM *item, int code, HXML reason) if (m_bJabberOnline) {
TCHAR szPresenceTo[JABBER_MAX_JID_LEN];
- mir_sntprintf(szPresenceTo, SIZEOF(szPresenceTo), _T("%s/%s"), item->jid, item->nick);
+ mir_sntprintf(szPresenceTo, _countof(szPresenceTo), _T("%s/%s"), item->jid, item->nick);
m_ThreadInfo->send(
XmlNode(_T("presence")) << XATTR(_T("to"), szPresenceTo) << XATTR(_T("type"), _T("unavailable"))
@@ -524,7 +524,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) if (gcmi->Type == MENU_ON_LOG) {
static TCHAR url_buf[1024] = { 0 };
- gcmi->nItems = SIZEOF(sttLogListItems);
+ gcmi->nItems = _countof(sttLogListItems);
gcmi->Item = sttLogListItems;
static DWORD sttModeratorItems[] = { IDM_LST_PARTICIPANT, 0 };
@@ -539,7 +539,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) TCHAR *bufPtr = url_buf;
for (TCHAR *p = _tcsstr(ptszStatusMsg, _T("http")); p && *p; p = _tcsstr(p + 1, _T("http"))) {
if (!_tcsncmp(p, _T("http://"), 7) || !_tcsncmp(p, _T("https://"), 8)) {
- mir_tstrncpy(bufPtr, p, SIZEOF(url_buf) - (bufPtr - url_buf));
+ mir_tstrncpy(bufPtr, p, _countof(url_buf) - (bufPtr - url_buf));
gc_item *pItem = sttFindGcMenuItem(gcmi, idx);
pItem->pszDesc = bufPtr;
pItem->uType = MENU_POPUPITEM;
@@ -565,7 +565,7 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) }
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
- gcmi->nItems = SIZEOF(sttListItems);
+ gcmi->nItems = _countof(sttListItems);
gcmi->Item = sttListItems;
static DWORD sttRJidItems[] = { IDM_RJID_VCARD, IDM_RJID_ADD, IDM_RJID_COPY, 0 };
@@ -587,20 +587,20 @@ int CJabberProto::JabberGcMenuHook(WPARAM, LPARAM lParam) for (; idx <= IDM_LINK9; ++idx)
sttFindGcMenuItem(gcmi, idx)->uType = 0;
- for (i = 0; i < SIZEOF(sttAffiliationItems); i++) {
+ for (i = 0; i < _countof(sttAffiliationItems); i++) {
gc_item *item = sttFindGcMenuItem(gcmi, sttAffiliationItems[i].id);
item->uType = (him->m_affiliation == sttAffiliationItems[i].value) ? MENU_POPUPCHECK : MENU_POPUPITEM;
item->bDisabled = !(force || sttAffiliationItems[i].check(me, him));
}
- for (i = 0; i < SIZEOF(sttRoleItems); i++) {
+ for (i = 0; i < _countof(sttRoleItems); i++) {
gc_item *item = sttFindGcMenuItem(gcmi, sttRoleItems[i].id);
item->uType = (him->m_role == sttRoleItems[i].value) ? MENU_POPUPCHECK : MENU_POPUPITEM;
item->bDisabled = !(force || sttRoleItems[i].check(me, him));
}
if (him->m_tszRealJid && *him->m_tszRealJid) {
- mir_sntprintf(sttRJidBuf, SIZEOF(sttRJidBuf), TranslateT("Real &JID: %s"), him->m_tszRealJid);
+ mir_sntprintf(sttRJidBuf, _countof(sttRJidBuf), TranslateT("Real &JID: %s"), him->m_tszRealJid);
if (TCHAR *tmp = _tcschr(sttRJidBuf, _T('/'))) *tmp = 0;
if (MCONTACT hContact = HContactFromJID(him->m_tszRealJid)) {
@@ -740,7 +740,7 @@ public: void OnCommand_AddJid(CCtrlButton*)
{
TCHAR buf[JABBER_MAX_JID_LEN];
- m_txtNewJid.GetText(buf, SIZEOF(buf));
+ m_txtNewJid.GetText(buf, _countof(buf));
m_txtNewJid.SetTextA("");
MCONTACT hContact = m_proto->HContactFromJID(buf);
@@ -865,7 +865,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam SetDlgItemText(hwndDlg, IDC_TXT_JID, dat->him->m_tszRealJid ? dat->him->m_tszRealJid : TranslateT("Real JID not available"));
SetDlgItemText(hwndDlg, IDC_TXT_STATUS, dat->him->m_tszStatusMessage);
- for (int i = 0; i < SIZEOF(sttRoleItems); i++) {
+ for (int i = 0; i < _countof(sttRoleItems); i++) {
if ((sttRoleItems[i].value == dat->him->m_role) || sttRoleItems[i].check(dat->me, dat->him)) {
SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETITEMDATA,
idx = SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_ADDSTRING, 0, (LPARAM)sttRoleItems[i].title),
@@ -874,7 +874,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam SendDlgItemMessage(hwndDlg, IDC_TXT_ROLE, CB_SETCURSEL, idx, 0);
}
}
- for (int i = 0; i < SIZEOF(sttAffiliationItems); i++) {
+ for (int i = 0; i < _countof(sttAffiliationItems); i++) {
if ((sttAffiliationItems[i].value == dat->him->m_affiliation) || sttAffiliationItems[i].check(dat->me, dat->him)) {
SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_SETITEMDATA,
idx = SendDlgItemMessage(hwndDlg, IDC_TXT_AFFILIATION, CB_ADDSTRING, 0, (LPARAM)sttAffiliationItems[i].title),
@@ -912,7 +912,7 @@ static INT_PTR CALLBACK sttUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam break;
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(dat->him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(dat->him->m_tszRealJid, szBareJid, _countof(szBareJid));
switch (value) {
case AFFILIATION_NONE:
@@ -1019,7 +1019,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* *p = 0;
mir_sntprintf(buf, _T("%s%s%s"), szMessage, him->m_tszResourceName, p + 2);
}
- else mir_tstrncpy(buf, szMessage, SIZEOF(buf));
+ else mir_tstrncpy(buf, szMessage, _countof(buf));
UnEscapeChatTags(buf);
ppro->m_ThreadInfo->send(
@@ -1087,7 +1087,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if (him->m_affiliation != AFFILIATION_NONE) {
if (him->m_tszRealJid) {
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("jid"), szBareJid, _T("affiliation"), _T("none"));
}
else ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("nick"), him->m_tszResourceName, _T("affiliation"), _T("none"));
@@ -1098,7 +1098,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if (him->m_affiliation != AFFILIATION_MEMBER) {
if (him->m_tszRealJid) {
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("jid"), szBareJid, _T("affiliation"), _T("member"));
}
else ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("nick"), him->m_tszResourceName, _T("affiliation"), _T("member"));
@@ -1109,7 +1109,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if (him->m_affiliation != AFFILIATION_ADMIN) {
if (him->m_tszRealJid) {
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("jid"), szBareJid, _T("affiliation"), _T("admin"));
}
else ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("nick"), him->m_tszResourceName, _T("affiliation"), _T("admin"));
@@ -1120,7 +1120,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if (him->m_affiliation != AFFILIATION_OWNER) {
if (him->m_tszRealJid) {
TCHAR szBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(him->m_tszRealJid, szBareJid, _countof(szBareJid));
ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("jid"), szBareJid, _T("affiliation"), _T("owner"));
}
else ppro->AdminSet(item->jid, JABBER_FEAT_MUC_ADMIN, _T("nick"), him->m_tszResourceName, _T("affiliation"), _T("owner"));
@@ -1131,7 +1131,7 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* if ((GetTickCount() - dwLastBanKickTime) > BAN_KICK_INTERVAL) {
if (him->m_tszRealJid && *him->m_tszRealJid) {
TCHAR szVictimBareJid[JABBER_MAX_JID_LEN];
- JabberStripJid(him->m_tszRealJid, szVictimBareJid, SIZEOF(szVictimBareJid));
+ JabberStripJid(him->m_tszRealJid, szVictimBareJid, _countof(szVictimBareJid));
szBuffer.Format(_T("%s: "), me->m_tszResourceName);
szTitle.Format(TranslateT("Reason to ban %s"), him->m_tszResourceName);
@@ -1357,7 +1357,7 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* g static void sttSendPrivateMessage(CJabberProto *ppro, JABBER_LIST_ITEM *item, const TCHAR *nick)
{
TCHAR szFullJid[JABBER_MAX_JID_LEN];
- mir_sntprintf(szFullJid, SIZEOF(szFullJid), _T("%s/%s"), item->jid, nick);
+ mir_sntprintf(szFullJid, _countof(szFullJid), _T("%s/%s"), item->jid, nick);
MCONTACT hContact = ppro->DBCreateContact(szFullJid, NULL, TRUE, FALSE);
if (hContact != NULL) {
pResourceStatus r(item->findResource(nick));
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 57b968ce96..16de723cc1 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -194,7 +194,7 @@ static void sttEmptyBuf(StringBuf *buf) static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent)
{
char indentLevel[128];
- mir_snprintf(indentLevel, SIZEOF(indentLevel), RTF_INDENT_FMT, (int)(indent*200));
+ mir_snprintf(indentLevel, _countof(indentLevel), RTF_INDENT_FMT, (int)(indent*200));
sttAppendBufRaw(buf, RTF_BEGINTAG);
sttAppendBufRaw(buf, indentLevel);
@@ -228,7 +228,7 @@ static void sttRtfAppendXml(StringBuf *buf, HXML node, DWORD flags, int indent) if (xmlGetChildCount(node)) {
sttAppendBufRaw(buf, RTF_BEGINTEXT);
char indentTextLevel[128];
- mir_snprintf(indentTextLevel, SIZEOF(indentTextLevel), RTF_TEXTINDENT_FMT, (int)((indent + 1) * 200));
+ mir_snprintf(indentTextLevel, _countof(indentTextLevel), RTF_TEXTINDENT_FMT, (int)((indent + 1) * 200));
sttAppendBufRaw(buf, indentTextLevel);
}
@@ -348,7 +348,7 @@ void CJabberDlgConsole::OnInitDialog() *m_proto->m_filterInfo.pattern = 0;
ptrT tszPattern( m_proto->getTStringA("consoleWnd_fpattern"));
if (tszPattern != NULL)
- mir_tstrncpy(m_proto->m_filterInfo.pattern, tszPattern, SIZEOF(m_proto->m_filterInfo.pattern));
+ mir_tstrncpy(m_proto->m_filterInfo.pattern, tszPattern, _countof(m_proto->m_filterInfo.pattern));
sttJabberConsoleRebuildStrings(m_proto, GetDlgItem(m_hwnd, IDC_CB_FILTER));
SetDlgItemText(m_hwnd, IDC_CB_FILTER, m_proto->m_filterInfo.pattern);
@@ -370,7 +370,7 @@ void CJabberDlgConsole::OnInitDialog() { IDC_BTN_FILTER_REFRESH, "Refresh list", "sd_nav_refresh", false, FALSE},
};
- for (int i=0; i < SIZEOF(buttons); i++) {
+ for (int i=0; i < _countof(buttons); i++) {
SendDlgItemMessage(m_hwnd, buttons[i].idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(buttons[i].icon));
SendDlgItemMessage(m_hwnd, buttons[i].idc, BUTTONSETASFLATBTN, TRUE, 0);
SendDlgItemMessage(m_hwnd, buttons[i].idc, BUTTONADDTOOLTIP, (WPARAM)buttons[i].title, 0);
@@ -378,7 +378,7 @@ void CJabberDlgConsole::OnInitDialog() if (buttons[i].pushed) CheckDlgButton(m_hwnd, buttons[i].idc, BST_CHECKED);
}
- for (int i=0; i < SIZEOF(filter_modes); i++)
+ for (int i=0; i < _countof(filter_modes); i++)
if (filter_modes[i].type == m_proto->m_filterInfo.type) {
g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon)));
SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon));
@@ -549,23 +549,23 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) mir_cslock lck(m_proto->m_filterInfo.csPatternLock);
- if (len > SIZEOF(m_proto->m_filterInfo.pattern)) {
+ if (len > _countof(m_proto->m_filterInfo.pattern)) {
TCHAR *buf = (TCHAR *)_alloca(len * sizeof(TCHAR));
SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)buf);
- mir_tstrncpy(m_proto->m_filterInfo.pattern, buf, SIZEOF(m_proto->m_filterInfo.pattern));
+ mir_tstrncpy(m_proto->m_filterInfo.pattern, buf, _countof(m_proto->m_filterInfo.pattern));
}
else SendDlgItemMessage(m_hwnd, IDC_CB_FILTER, CB_GETLBTEXT, idx, (LPARAM)m_proto->m_filterInfo.pattern);
}
else if (HIWORD(wParam) == CBN_EDITCHANGE) {
mir_cslock lck(m_proto->m_filterInfo.csPatternLock);
- GetDlgItemText(m_hwnd, IDC_CB_FILTER, m_proto->m_filterInfo.pattern, SIZEOF(m_proto->m_filterInfo.pattern));
+ GetDlgItemText(m_hwnd, IDC_CB_FILTER, m_proto->m_filterInfo.pattern, _countof(m_proto->m_filterInfo.pattern));
}
break;
case IDC_BTN_FILTER:
int i;
HMENU hMenu = CreatePopupMenu();
- for (i = 0; i < SIZEOF(filter_modes); i++)
+ for (i = 0; i < _countof(filter_modes); i++)
AppendMenu(hMenu,
MF_STRING | ((filter_modes[i].type == m_proto->m_filterInfo.type) ? MF_CHECKED : 0),
filter_modes[i].type + 1, TranslateTS(filter_modes[i].title));
@@ -578,7 +578,7 @@ INT_PTR CJabberDlgConsole::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (res) {
m_proto->m_filterInfo.type = (TFilterInfo::Type)(res - 1);
- for (i = 0; i < SIZEOF(filter_modes); i++) {
+ for (i = 0; i < _countof(filter_modes); i++) {
if (filter_modes[i].type == m_proto->m_filterInfo.type) {
g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon)));
break;
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 425b6a18ef..99658d0a49 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -380,9 +380,9 @@ void CJabberProto::PerformBrowse(HWND hwndDlg) {
TCHAR szJid[JABBER_MAX_JID_LEN];
TCHAR szNode[ 512 ];
- if (!GetDlgItemText(hwndDlg, IDC_COMBO_JID, szJid, SIZEOF(szJid)))
+ if (!GetDlgItemText(hwndDlg, IDC_COMBO_JID, szJid, _countof(szJid)))
szJid[ 0 ] = 0;
- if (!GetDlgItemText(hwndDlg, IDC_COMBO_NODE, szNode, SIZEOF(szNode)))
+ if (!GetDlgItemText(hwndDlg, IDC_COMBO_NODE, szNode, _countof(szNode)))
szNode[ 0 ] = 0;
ComboAddRecentString(hwndDlg, IDC_COMBO_JID, "discoWnd_rcJid", szJid);
@@ -504,7 +504,7 @@ void CJabberProto::ApplyNodeIcon(HTREELISTITEM hItem, CJabberSDNode *pNode) iOverlay = SD_OVERLAY_NONE;
}
- for (int i=0; i < SIZEOF(sttNodeIcons); i++)
+ for (int i=0; i < _countof(sttNodeIcons); i++)
{
if (!sttNodeIcons[i].iconIndex && !sttNodeIcons[i].iconName) continue;
@@ -674,7 +674,7 @@ void CJabberDlgDiscovery::OnInitDialog() TreeList_Create(hwndList);
TreeList_AddIcon(hwndList, m_proto->LoadIconEx("main"), 0);
- for (int i=0; i < SIZEOF(sttNodeIcons); i++)
+ for (int i=0; i < _countof(sttNodeIcons); i++)
{
bool needDestroy = false;
HICON hIcon;
@@ -1201,7 +1201,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM HMENU hMenu = CreatePopupMenu();
BOOL lastSeparator = TRUE;
bool bFilterItems = !GetAsyncKeyState(VK_CONTROL);
- for (int i=0; i < SIZEOF(items); i++) {
+ for (int i=0; i < _countof(items); i++) {
JABBER_LIST_ITEM *rosterItem = NULL;
if (bFilterItems) {
if ((items[i].flags & SD_FLG_NONODE) && pNode->GetNode())
@@ -1325,7 +1325,7 @@ void CJabberProto::ServiceDiscoveryShowMenu(CJabberSDNode *pNode, HTREELISTITEM case SD_ACT_COPYINFO:
{
TCHAR buf[8192];
- pNode->GetTooltipText(buf, SIZEOF(buf));
+ pNode->GetTooltipText(buf, _countof(buf));
JabberCopyText(m_pDlgServiceDiscovery->GetHwnd(), buf);
}
break;
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp index f45074ea30..1eb848004c 100644 --- a/protocols/JabberG/src/jabber_events.cpp +++ b/protocols/JabberG/src/jabber_events.cpp @@ -43,7 +43,7 @@ int CJabberProto::OnContactDeleted(WPARAM hContact, LPARAM) if (ListGetItemPtr(LIST_ROSTER, jid)) {
if (!_tcschr(jid, _T('@'))) {
TCHAR szStrippedJid[JABBER_MAX_JID_LEN];
- JabberStripJid(m_ThreadInfo->fullJID, szStrippedJid, SIZEOF(szStrippedJid));
+ JabberStripJid(m_ThreadInfo->fullJID, szStrippedJid, _countof(szStrippedJid));
TCHAR *szDog = _tcschr(szStrippedJid, _T('@'));
if (szDog && mir_tstrcmpi(szDog + 1, jid))
m_ThreadInfo->send(XmlNodeIq(_T("set"), SerialNext(), jid) << XQUERY(JABBER_FEAT_REGISTER) << XCHILD(_T("remove")));
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index d4bfc3dd61..0160e65e96 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -178,7 +178,7 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/, CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConnection, (LPARAM)&connInfo);
TCHAR szPort[10];
- mir_sntprintf(szPort, SIZEOF(szPort), _T("%d"), connInfo.wPort);
+ mir_sntprintf(szPort, _countof(szPort), _T("%d"), connInfo.wPort);
ppro->debugLogA("File server incoming connection accepted: %s", connInfo.szIpPort);
JABBER_LIST_ITEM *item = ppro->ListGetItemPtr(LIST_FILE, szPort);
@@ -258,7 +258,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) ft->hFileEvent = hEvent;
TCHAR szPort[20];
- mir_sntprintf(szPort, SIZEOF(szPort), _T("%d"), nlb.wPort);
+ mir_sntprintf(szPort, _countof(szPort), _T("%d"), nlb.wPort);
JABBER_LIST_ITEM *item = ListAdd(LIST_FILE, szPort);
item->ft = ft;
@@ -288,7 +288,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) myAddr = (char*)CallService(MS_NETLIB_ADDRESSTOSTRING, 1, nlb.dwExternalIP);
char szAddr[256];
- mir_snprintf(szAddr, SIZEOF(szAddr), "http://%s:%d/%s", myAddr, nlb.wPort, pFileName);
+ mir_snprintf(szAddr, _countof(szAddr), "http://%s:%d/%s", myAddr, nlb.wPort, pFileName);
size_t len = mir_tstrlen(ptszResource) + mir_tstrlen(ft->jid) + 2;
TCHAR *fulljid = (TCHAR *)alloca(sizeof(TCHAR) * len);
@@ -402,7 +402,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer, }
char fileBuffer[2048];
- int bytes = mir_snprintf(fileBuffer, SIZEOF(fileBuffer), "HTTP/1.1 200 OK\r\nContent-Length: %I64u\r\n\r\n", statbuf.st_size);
+ int bytes = mir_snprintf(fileBuffer, _countof(fileBuffer), "HTTP/1.1 200 OK\r\nContent-Length: %I64u\r\n\r\n", statbuf.st_size);
WsSend(s, fileBuffer, bytes, MSG_DUMPASTEXT);
ft->std.flags |= PFTS_SENDING;
@@ -498,7 +498,7 @@ int filetransfer::create() return fileId;
TCHAR filefull[MAX_PATH];
- mir_sntprintf(filefull, SIZEOF(filefull), _T("%s\\%s"), std.tszWorkingDir, std.tszCurrentFile);
+ mir_sntprintf(filefull, _countof(filefull), _T("%s\\%s"), std.tszWorkingDir, std.tszCurrentFile);
replaceStrT(std.tszCurrentFile, filefull);
if (hWaitEvent != INVALID_HANDLE_VALUE)
diff --git a/protocols/JabberG/src/jabber_filterlist.cpp b/protocols/JabberG/src/jabber_filterlist.cpp index 5e769b42a5..0d8ff6e567 100644 --- a/protocols/JabberG/src/jabber_filterlist.cpp +++ b/protocols/JabberG/src/jabber_filterlist.cpp @@ -135,7 +135,7 @@ void CCtrlFilterListView::FilterHighlight(TCHAR *str) bool found = false;
if (str) {
for (int j = 0; j < 10; ++j) {
- GetItemText(i, j, buf, SIZEOF(buf));
+ GetItemText(i, j, buf, _countof(buf));
if (!*buf)
break;
@@ -247,7 +247,7 @@ LRESULT CCtrlFilterListView::CustomWndProc(UINT msg, WPARAM wParam, LPARAM lPara {rc.left+FILTER_BOX_HEIGHT, rc.top+FILTER_BOX_HEIGHT},
{rc.left, rc.top+FILTER_BOX_HEIGHT},
};
- HRGN hrgnFilter = CreatePolygonRgn(pts, SIZEOF(pts), ALTERNATE);
+ HRGN hrgnFilter = CreatePolygonRgn(pts, _countof(pts), ALTERNATE);
HDC hdc = GetWindowDC(m_hwnd);
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index 9b19832a8c..fbc4db5b45 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -100,7 +100,7 @@ void CJabberProto::FtInitiate(TCHAR* jid, filetransfer *ft) filename = p+1;
TCHAR tszJid[ 512 ];
- mir_sntprintf(tszJid, SIZEOF(tszJid), _T("%s/%s"), jid, rs);
+ mir_sntprintf(tszJid, _countof(tszJid), _T("%s/%s"), jid, rs);
XmlNodeIq iq( AddIQ(&CJabberProto::OnFtSiResult, JABBER_IQ_TYPE_SET, tszJid, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_TO, -1, ft));
HXML si = iq << XCHILDNS(_T("si"), JABBER_FEAT_SI) << XATTR(_T("id"), sid)
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 14aadd27d8..fb1e164ece 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -369,7 +369,7 @@ static void sttJoinDlgShowRecentItems(HWND hwndDlg, int newCount) RECT rc;
int ctrls[] = { IDC_BOOKMARKS, IDOK, IDCANCEL };
- for (int i = 0; i < SIZEOF(ctrls); i++) {
+ for (int i = 0; i < _countof(ctrls); i++) {
GetWindowRect(GetDlgItem(hwndDlg, ctrls[i]), &rc);
MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc, 2);
SetWindowPos(GetDlgItem(hwndDlg, ctrls[i]), NULL, rc.left, rc.top + offset, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
@@ -466,7 +466,7 @@ void CJabberDlgGcJoin::OnInitDialog() if (!info.loadRecent(i))
break;
- mir_sntprintf(jid, SIZEOF(jid), _T("%s@%s (%s)"),
+ mir_sntprintf(jid, _countof(jid), _T("%s@%s (%s)"),
info.room, info.server,
info.nick ? info.nick : TranslateT("<no nick>"));
SetDlgItemText(m_hwnd, IDC_RECENT1 + i, jid);
@@ -687,18 +687,18 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) // fall through
case IDOK:
{
- GetDlgItemText(m_hwnd, IDC_SERVER, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_SERVER, text, _countof(text));
TCHAR *server = NEWTSTR_ALLOCA(text), *room;
m_proto->ComboAddRecentString(m_hwnd, IDC_SERVER, "joinWnd_rcSvr", server);
- GetDlgItemText(m_hwnd, IDC_ROOM, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_ROOM, text, _countof(text));
room = NEWTSTR_ALLOCA(text);
- GetDlgItemText(m_hwnd, IDC_NICK, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_NICK, text, _countof(text));
TCHAR *nick = NEWTSTR_ALLOCA(text);
- GetDlgItemText(m_hwnd, IDC_PASSWORD, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_PASSWORD, text, _countof(text));
TCHAR *password = NEWTSTR_ALLOCA(text);
m_proto->GroupchatJoinRoom(server, room, nick, password);
}
@@ -1182,7 +1182,7 @@ public: void OnCommand_Accept(CCtrlButton*)
{
TCHAR text[128];
- GetDlgItemText(m_hwnd, IDC_NICK, text, SIZEOF(text));
+ GetDlgItemText(m_hwnd, IDC_NICK, text, _countof(text));
m_proto->AcceptGroupchatInvite(m_info->roomJid, text, m_info->password);
EndDialog(m_hwnd, 0);
}
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp index 3a5ba46a40..aca69dc538 100644 --- a/protocols/JabberG/src/jabber_icolib.cpp +++ b/protocols/JabberG/src/jabber_icolib.cpp @@ -113,7 +113,7 @@ CIconPool::~CIconPool() void CIconPool::RegisterIcon(const char *name, TCHAR *filename, int iconid, TCHAR *szSection, TCHAR *szDescription)
{
char szSettingName[128];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "jabber_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "jabber_%s", name);
CPoolItem *item = new CPoolItem;
item->m_name = mir_strdup(name);
@@ -167,8 +167,8 @@ CIconPool::CPoolItem *CIconPool::FindItemByName(const char *name) void CJabberProto::IconsInit(void)
{
- m_transportProtoTableStartIndex = (int *)mir_alloc(sizeof(int) * SIZEOF(TransportProtoTable));
- for (int i=0; i < SIZEOF(TransportProtoTable); i++)
+ m_transportProtoTableStartIndex = (int *)mir_alloc(sizeof(int) * _countof(TransportProtoTable));
+ for (int i=0; i < _countof(TransportProtoTable); i++)
m_transportProtoTableStartIndex[i] = -1;
}
@@ -277,8 +277,8 @@ static HICON LoadTransportIcon(char *filename,int i,char *IconName,TCHAR *SectNa GetModuleFileNameA(NULL, szPath, MAX_PATH);
str=strrchr(szPath,'\\');
if (str != NULL) *str=0;
- mir_snprintf(szMyPath, SIZEOF(szMyPath), "%s\\Icons\\%s", szPath, filename);
- mir_snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i);
+ mir_snprintf(szMyPath, _countof(szMyPath), "%s\\Icons\\%s", szPath, filename);
+ mir_snprintf(szFullPath, _countof(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i);
BOOL nf;
HICON hi=ExtractIconFromPath(szFullPath,&nf);
if (hi) has_proto_icon=TRUE;
@@ -316,8 +316,8 @@ int CJabberProto::LoadAdvancedIcons(int iID) int first=-1;
HICON empty=LoadSmallIcon(NULL,MAKEINTRESOURCE(102));
- mir_sntprintf(Group, SIZEOF(Group), LPGENT("Status icons")_T("/%s/%S %s"), m_tszUserName, proto, TranslateT("transport"));
- mir_snprintf(defFile, SIZEOF(defFile), "proto_%s.dll",proto);
+ mir_sntprintf(Group, _countof(Group), LPGENT("Status icons")_T("/%s/%S %s"), m_tszUserName, proto, TranslateT("transport"));
+ mir_snprintf(defFile, _countof(defFile), "proto_%s.dll",proto);
if (!hAdvancedStatusIcon)
hAdvancedStatusIcon=(HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST,0,0);
@@ -326,7 +326,7 @@ int CJabberProto::LoadAdvancedIcons(int iID) BOOL needFree;
int n = skinStatusToJabberStatus[i];
TCHAR *descr = pcli->pfnGetStatusModeDescription(n+ID_STATUS_OFFLINE, 0);
- mir_snprintf(Uname, SIZEOF(Uname), "%s_Transport_%s_%d", m_szModuleName, proto, n);
+ mir_snprintf(Uname, _countof(Uname), "%s_Transport_%s_%d", m_szModuleName, proto, n);
HICON hicon = LoadTransportIcon(defFile,-skinIconStatusToResourceId[i],Uname,Group,descr,-(n+ID_STATUS_OFFLINE),&needFree);
int index = (m_transportProtoTableStartIndex[iID] == -1)?-1:m_transportProtoTableStartIndex[iID]+n;
int added = ImageList_ReplaceIcon(hAdvancedStatusIcon,index,hicon?hicon:empty);
@@ -343,7 +343,7 @@ int CJabberProto::LoadAdvancedIcons(int iID) int CJabberProto::GetTransportProtoID(TCHAR* TransportDomain)
{
- for (int i=0; i<SIZEOF(TransportProtoTable); i++)
+ for (int i=0; i<_countof(TransportProtoTable); i++)
if ( MatchMask(TransportDomain, TransportProtoTable[i].mask))
return i;
@@ -352,7 +352,7 @@ int CJabberProto::GetTransportProtoID(TCHAR* TransportDomain) int CJabberProto::GetTransportStatusIconIndex(int iID, int Status)
{
- if (iID < 0 || iID >= SIZEOF(TransportProtoTable))
+ if (iID < 0 || iID >= _countof(TransportProtoTable))
return -1;
//icons not loaded - loading icons
@@ -374,7 +374,7 @@ int CJabberProto::GetTransportStatusIconIndex(int iID, int Status) int CJabberProto::OnReloadIcons(WPARAM, LPARAM)
{
- for (int i=0; i < SIZEOF(TransportProtoTable); i++)
+ for (int i=0; i < _countof(TransportProtoTable); i++)
if (m_transportProtoTableStartIndex[i] != -1)
LoadAdvancedIcons(i);
@@ -432,7 +432,7 @@ BOOL CJabberProto::DBCheckIsTransportedContact(const TCHAR *jid, MCONTACT hConta if (resourcepos != NULL)
*resourcepos = '\0';
- for (int i=0; i < SIZEOF(TransportProtoTable); i++)
+ for (int i=0; i < _countof(TransportProtoTable); i++)
if (MatchMask(domain, TransportProtoTable[i].mask)) {
GetTransportStatusIconIndex(GetTransportProtoID(domain), ID_STATUS_OFFLINE);
isTransported = TRUE;
@@ -525,29 +525,29 @@ static IconItem sharedIconList4[] = void g_IconsInit()
{
- Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Jabber"), sharedIconList1, SIZEOF(sharedIconList1), GLOBAL_SETTING_PREFIX);
- Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Jabber")"/"LPGEN("Dialogs"), sharedIconList2, SIZEOF(sharedIconList2), GLOBAL_SETTING_PREFIX);
- Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Dialogs")"/"LPGEN("Discovery"), sharedIconList3, SIZEOF(sharedIconList3), GLOBAL_SETTING_PREFIX);
- Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Dialogs")"/"LPGEN("Privacy"), sharedIconList4, SIZEOF(sharedIconList4), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Jabber"), sharedIconList1, _countof(sharedIconList1), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Jabber")"/"LPGEN("Dialogs"), sharedIconList2, _countof(sharedIconList2), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Dialogs")"/"LPGEN("Discovery"), sharedIconList3, _countof(sharedIconList3), GLOBAL_SETTING_PREFIX);
+ Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("Dialogs")"/"LPGEN("Privacy"), sharedIconList4, _countof(sharedIconList4), GLOBAL_SETTING_PREFIX);
}
HANDLE g_GetIconHandle(int iconId)
{
int i;
- for (i=0; i < SIZEOF(sharedIconList1); i++)
+ for (i=0; i < _countof(sharedIconList1); i++)
if (sharedIconList1[i].defIconID == iconId)
return sharedIconList1[i].hIcolib;
- for (i=0; i < SIZEOF(sharedIconList2); i++)
+ for (i=0; i < _countof(sharedIconList2); i++)
if (sharedIconList2[i].defIconID == iconId)
return sharedIconList2[i].hIcolib;
- for (i=0; i < SIZEOF(sharedIconList3); i++)
+ for (i=0; i < _countof(sharedIconList3); i++)
if (sharedIconList3[i].defIconID == iconId)
return sharedIconList3[i].hIcolib;
- for (i=0; i < SIZEOF(sharedIconList4); i++)
+ for (i=0; i < _countof(sharedIconList4); i++)
if (sharedIconList4[i].defIconID == iconId)
return sharedIconList4[i].hIcolib;
@@ -557,7 +557,7 @@ HANDLE g_GetIconHandle(int iconId) HICON g_LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", GLOBAL_SETTING_PREFIX, name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", GLOBAL_SETTING_PREFIX, name);
return IcoLib_GetIcon(szSettingName, big);
}
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index c2b6dc5c67..909f05f939 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -335,8 +335,8 @@ BOOL CJabberProto::OnIqRequestVersion(HXML, CJabberIqInfo *pInfo) if (m_options.ShowOSVersion) {
TCHAR os[256] = { 0 };
- if (!GetOSDisplayString(os, SIZEOF(os)))
- mir_tstrncpy(os, _T("Microsoft Windows"), SIZEOF(os));
+ if (!GetOSDisplayString(os, _countof(os)))
+ mir_tstrncpy(os, _T("Microsoft Windows"), _countof(os));
query << XCHILD(_T("os"), os);
}
@@ -393,10 +393,10 @@ BOOL CJabberProto::OnIqRequestTime(HXML, CJabberIqInfo *pInfo) TCHAR stime[100];
TCHAR szTZ[10];
- TimeZone_PrintDateTime(UTC_TIME_HANDLE, _T("I"), stime, SIZEOF(stime), 0);
+ TimeZone_PrintDateTime(UTC_TIME_HANDLE, _T("I"), stime, _countof(stime), 0);
int nGmtOffset = GetGMTOffset();
- mir_sntprintf(szTZ, SIZEOF(szTZ), _T("%+03d:%02d"), nGmtOffset / 60, nGmtOffset % 60);
+ mir_sntprintf(szTZ, _countof(szTZ), _T("%+03d:%02d"), nGmtOffset / 60, nGmtOffset % 60);
XmlNodeIq iq(_T("result"), pInfo);
HXML timeNode = iq << XCHILDNS(_T("time"), JABBER_FEAT_ENTITY_TIME);
@@ -417,7 +417,7 @@ BOOL CJabberProto::OnIqProcessIqOldTime(HXML, CJabberIqInfo *pInfo) _tzset();
time(<ime);
gmt = gmtime(<ime);
- mir_sntprintf(stime, SIZEOF(stime), _T("%.4i%.2i%.2iT%.2i:%.2i:%.2i"),
+ mir_sntprintf(stime, _countof(stime), _T("%.4i%.2i%.2iT%.2i:%.2i:%.2i"),
gmt->tm_year + 1900, gmt->tm_mon + 1,
gmt->tm_mday, gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
dtime = _tctime(<ime);
@@ -453,7 +453,7 @@ BOOL CJabberProto::OnIqRequestAvatar(HXML, CJabberIqInfo *pInfo) }
TCHAR szFileName[MAX_PATH];
- GetAvatarFileName(NULL, szFileName, SIZEOF(szFileName));
+ GetAvatarFileName(NULL, szFileName, _countof(szFileName));
FILE* in = _tfopen(szFileName, _T("rb"));
if (in == NULL)
@@ -641,7 +641,7 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo) TCHAR *p = str + 7, *q;
if ((q = _tcschr(p, '/')) != NULL) {
TCHAR text[1024];
- if (q - p < SIZEOF(text)) {
+ if (q - p < _countof(text)) {
_tcsncpy_s(text, p, q - p);
text[q - p] = '\0';
if ((p = _tcschr(text, ':')) != NULL) {
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp index 38712cd0c1..3e1b65b3f0 100644 --- a/protocols/JabberG/src/jabber_iqid.cpp +++ b/protocols/JabberG/src/jabber_iqid.cpp @@ -219,7 +219,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo*) JabberShaStrBuf buf;
T2Utf str(m_ThreadInfo->conn.password);
char text[200];
- mir_snprintf(text, SIZEOF(text), "%s%s", m_ThreadInfo->szStreamId, str);
+ mir_snprintf(text, _countof(text), "%s%s", m_ThreadInfo->szStreamId, str);
query << XCHILD(_T("digest"), _A2T(JabberSha1(text, buf)));
}
else if (xmlGetChild(queryNode, "password") != NULL)
@@ -279,7 +279,7 @@ void CJabberProto::OnIqResultBind(HXML iqNode, CJabberIqInfo *pInfo) if (pInfo->GetIqType() == JABBER_IQ_TYPE_RESULT) {
LPCTSTR szJid = XPathT(iqNode, "bind[@xmlns='urn:ietf:params:xml:ns:xmpp-bind']/jid");
if (szJid) {
- if (!_tcsncmp(m_ThreadInfo->fullJID, szJid, SIZEOF(m_ThreadInfo->fullJID)))
+ if (!_tcsncmp(m_ThreadInfo->fullJID, szJid, _countof(m_ThreadInfo->fullJID)))
debugLog(_T("Result Bind: %s confirmed "), m_ThreadInfo->fullJID);
else {
debugLog(_T("Result Bind: %s changed to %s"), m_ThreadInfo->fullJID, szJid);
@@ -589,7 +589,7 @@ void CJabberProto::OnIqResultGetVcardPhoto(HXML n, MCONTACT hContact, bool &hasP return;
TCHAR szAvatarFileName[MAX_PATH];
- GetAvatarFileName(hContact, szAvatarFileName, SIZEOF(szAvatarFileName));
+ GetAvatarFileName(hContact, szAvatarFileName, _countof(szAvatarFileName));
debugLog(_T("Picture file name set to %s"), szAvatarFileName);
HANDLE hFile = CreateFile(szAvatarFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -752,13 +752,13 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) if (nEmail == 0)
mir_strcpy(text, "e-mail");
else
- mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail - 1);
+ mir_snprintf(text, _countof(text), "e-mail%d", nEmail - 1);
}
- else mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail);
+ else mir_snprintf(text, _countof(text), "e-mail%d", nEmail);
setTString(hContact, text, xmlGetText(m));
if (hContact == NULL) {
- mir_snprintf(text, SIZEOF(text), "e-mailFlag%d", nEmail);
+ mir_snprintf(text, _countof(text), "e-mailFlag%d", nEmail);
int nFlag = 0;
if (xmlGetChild(n, "HOME") != NULL) nFlag |= JABBER_VCEMAIL_HOME;
if (xmlGetChild(n, "WORK") != NULL) nFlag |= JABBER_VCEMAIL_WORK;
@@ -820,7 +820,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) mir_sntprintf(text, _T("%s\r\n%s"), xmlGetText(m), xmlGetText(o));
else
_tcsncpy_s(text, xmlGetText(m), _TRUNCATE);
- text[SIZEOF(text)-1] = '\0';
+ text[_countof(text)-1] = '\0';
setTString(hContact, "Street", text);
}
else {
@@ -863,7 +863,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) mir_sntprintf(text, _T("%s\r\n%s"), xmlGetText(m), xmlGetText(o));
else
_tcsncpy_s(text, xmlGetText(m), _TRUNCATE);
- text[SIZEOF(text)-1] = '\0';
+ text[_countof(text)-1] = '\0';
setTString(hContact, "CompanyStreet", text);
}
else {
@@ -924,10 +924,10 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) }
else {
char text[100];
- mir_snprintf(text, SIZEOF(text), "Phone%d", nPhone);
+ mir_snprintf(text, _countof(text), "Phone%d", nPhone);
setTString(text, xmlGetText(m));
- mir_snprintf(text, SIZEOF(text), "PhoneFlag%d", nPhone);
+ mir_snprintf(text, _countof(text), "PhoneFlag%d", nPhone);
int nFlag = 0;
if (xmlGetChild(n, "HOME") != NULL) nFlag |= JABBER_VCTEL_HOME;
if (xmlGetChild(n, "WORK") != NULL) nFlag |= JABBER_VCTEL_WORK;
@@ -1012,7 +1012,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) delSetting(hContact, "e-mail");
else {
char text[100];
- mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail - 1);
+ mir_snprintf(text, _countof(text), "e-mail%d", nEmail - 1);
if (db_get_s(hContact, m_szModuleName, text, &dbv)) break;
db_free(&dbv);
delSetting(hContact, text);
@@ -1023,11 +1023,11 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) else {
while (true) {
char text[100];
- mir_snprintf(text, SIZEOF(text), "e-mail%d", nEmail);
+ mir_snprintf(text, _countof(text), "e-mail%d", nEmail);
if (getString(text, &dbv)) break;
db_free(&dbv);
delSetting(text);
- mir_snprintf(text, SIZEOF(text), "e-mailFlag%d", nEmail);
+ mir_snprintf(text, _countof(text), "e-mailFlag%d", nEmail);
delSetting(text);
nEmail++;
}
@@ -1057,11 +1057,11 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo*) else {
while (true) {
char text[100];
- mir_snprintf(text, SIZEOF(text), "Phone%d", nPhone);
+ mir_snprintf(text, _countof(text), "Phone%d", nPhone);
if (getString(text, &dbv)) break;
db_free(&dbv);
delSetting(text);
- mir_snprintf(text, SIZEOF(text), "PhoneFlag%d", nPhone);
+ mir_snprintf(text, _countof(text), "PhoneFlag%d", nPhone);
delSetting(text);
nPhone++;
}
@@ -1327,7 +1327,7 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo*) }
TCHAR szJid[JABBER_MAX_JID_LEN];
- mir_tstrncpy(szJid, from, SIZEOF(szJid));
+ mir_tstrncpy(szJid, from, _countof(szJid));
TCHAR *res = _tcschr(szJid, _T('/'));
if (res != NULL)
*res = 0;
@@ -1367,7 +1367,7 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo*) }
TCHAR szJid[JABBER_MAX_JID_LEN];
- mir_tstrncpy(szJid, from, SIZEOF(szJid));
+ mir_tstrncpy(szJid, from, _countof(szJid));
TCHAR *res = _tcschr(szJid, _T('/'));
if (res != NULL)
*res = 0;
@@ -1407,7 +1407,7 @@ LBL_ErrFormat: TCHAR tszFileName[MAX_PATH];
if (getByte(hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) {
- GetAvatarFileName(hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(hContact, tszFileName, _countof(tszFileName));
DeleteFile(tszFileName);
}
@@ -1419,7 +1419,7 @@ LBL_ErrFormat: mir_sha1_append(&sha, (BYTE*)(char*)body, resultLen);
mir_sha1_finish(&sha, digest);
- GetAvatarFileName(hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(hContact, tszFileName, _countof(tszFileName));
_tcsncpy_s(ai.filename, tszFileName, _TRUNCATE);
FILE *out = _tfopen(tszFileName, _T("wb"));
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index fde613418b..b66a55cf5b 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -117,14 +117,14 @@ static void sttFillJidList(HWND hwndDlg) if (jidListInfo->type == MUC_BANLIST) {
LPCTSTR reason = xmlGetText(xmlGetChild(itemNode , _T("reason")));
if (reason != NULL) {
- mir_sntprintf(tszItemText, SIZEOF(tszItemText), _T("%s (%s)") , jid, reason);
+ mir_sntprintf(tszItemText, _countof(tszItemText), _T("%s (%s)") , jid, reason);
lvi.pszText = tszItemText;
}
}
else if (jidListInfo->type == MUC_VOICELIST || jidListInfo->type == MUC_MODERATORLIST) {
LPCTSTR nick = xmlGetAttrValue(itemNode, _T("nick"));
if (nick != NULL) {
- mir_sntprintf(tszItemText, SIZEOF(tszItemText), _T("%s (%s)") , nick, jid);
+ mir_sntprintf(tszItemText, _countof(tszItemText), _T("%s (%s)") , nick, jid);
lvi.pszText = tszItemText;
}
}
@@ -200,7 +200,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w {IDC_BTN_FILTERAPPLY, "Apply filter", "sd_filter_apply", false},
{IDC_BTN_FILTERRESET, "Reset filter", "sd_filter_reset", false},
};
- for (int i=0; i < SIZEOF(buttons); i++)
+ for (int i=0; i < _countof(buttons); i++)
{
SendDlgItemMessage(hwndDlg, buttons[i].idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)dat->ppro->LoadIconEx(buttons[i].icon));
SendDlgItemMessage(hwndDlg, buttons[i].idc, BUTTONSETASFLATBTN, TRUE, 0);
@@ -248,7 +248,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) dat);
// Populate displayed list from iqNode
- mir_tstrncpy(title, TranslateT("JID List"), SIZEOF(title));
+ mir_tstrncpy(title, TranslateT("JID List"), _countof(title));
if ((dat=(JABBER_MUC_JIDLIST_INFO *) lParam) != NULL) {
HXML iqNode = dat->iqNode;
if (iqNode != NULL) {
@@ -258,7 +258,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w HXML queryNode = xmlGetChild(iqNode , _T("query"));
if (queryNode != NULL) {
TCHAR *localFrom = mir_tstrdup(from);
- mir_sntprintf(title, SIZEOF(title), TranslateT("%s, %d items (%s)"),
+ mir_sntprintf(title, _countof(title), TranslateT("%s, %d items (%s)"),
(dat->type == MUC_VOICELIST) ? TranslateT("Voice List") :
(dat->type == MUC_MEMBERLIST) ? TranslateT("Member List") :
(dat->type == MUC_MODERATORLIST) ? TranslateT("Moderator List") :
@@ -331,7 +331,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w lvi.iItem = hti.iItem;
lvi.iSubItem = 0;
lvi.pszText = text;
- lvi.cchTextMax = SIZEOF(text);
+ lvi.cchTextMax = _countof(text);
ListView_GetItem(nm->hdr.hwndFrom, &lvi);
if (lvi.lParam == -1) {
CMString szBuffer(dat->type2str());
@@ -357,7 +357,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w //delete
TCHAR msgText[128];
- mir_sntprintf(msgText, SIZEOF(msgText), TranslateT("Removing %s?"), text);
+ mir_sntprintf(msgText, _countof(msgText), TranslateT("Removing %s?"), text);
if (MessageBox(hwndDlg, msgText, dat->type2str(), MB_YESNO|MB_SETFOREGROUND) == IDYES) {
dat->ppro->DeleteMucListItem(dat, (TCHAR*)lvi.lParam);
mir_free((void *)lvi.lParam);
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index f100a5afbf..727f31b3a4 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -64,7 +64,7 @@ static PresenceModeArray[] = { SKINICON_STATUS_DND, ID_STATUS_DND },
{ SKINICON_STATUS_FREE4CHAT, ID_STATUS_FREECHAT },
};
-static HGENMENU g_hMenuDirectPresence[SIZEOF(PresenceModeArray) + 1];
+static HGENMENU g_hMenuDirectPresence[_countof(PresenceModeArray) + 1];
static INT_PTR JabberMenuChooseService(WPARAM wParam, LPARAM lParam)
{
@@ -287,9 +287,9 @@ void g_MenuInit(void) g_hMenuDirectPresence[0] = Menu_AddContactMenuItem(&mi);
mi.flags |= CMIF_ROOTHANDLE | CMIF_TCHAR;
- for (int i=0; i < SIZEOF(PresenceModeArray); i++) {
+ for (int i=0; i < _countof(PresenceModeArray); i++) {
char buf[] = "Jabber/DirectPresenceX";
- buf[SIZEOF(buf)-2] = '0' + i;
+ buf[_countof(buf)-2] = '0' + i;
mi.pszService = buf;
mi.ptszName = pcli->pfnGetStatusModeDescription(PresenceModeArray[i].mode, 0);
mi.position = -1999901000;
@@ -368,7 +368,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) return 0;
Menu_ShowItem(g_hMenuDirectPresence[0], TRUE);
- for (int i=0; i < SIZEOF(PresenceModeArray); i++) {
+ for (int i=0; i < _countof(PresenceModeArray); i++) {
CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_ICON | CMIM_FLAGS;
clmi.hIcon = (HICON)Skin_LoadProtoIcon(m_szModuleName, PresenceModeArray[i].mode);
@@ -445,7 +445,7 @@ int CJabberProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) CMString szTmp;
for (int i=0; i < nMenuResourceItemsNew; i++) {
- mir_snprintf(tDest, SIZEOF(text) - nModuleNameLength, "/UseResource_%d", i);
+ mir_snprintf(tDest, _countof(text) - nModuleNameLength, "/UseResource_%d", i);
if (i >= m_nMenuResourceItems) {
CreateProtoServiceParam(tDest, &CJabberProto::OnMenuHandleResource, MENUITEM_RESOURCES+i);
mi.pszName = "";
@@ -734,19 +734,19 @@ void CJabberProto::MenuInit() mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.hParentMenu = m_hMenuPriorityRoot;
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuSetPriority/0", m_szModuleName);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/menuSetPriority/0", m_szModuleName);
bool needServices = !ServiceExists(srvFce);
if (needServices)
CreateProtoServiceParam(svcName, &CJabberProto::OnMenuSetPriority, 0);
int steps[] = { 10, 5, 1, 0, -1, -5, -10 };
- for (int i = 0; i < SIZEOF(steps); i++) {
+ for (int i = 0; i < _countof(steps); i++) {
if (!steps[i]) {
mi.position += 100000;
continue;
}
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuSetPriority/%d", m_szModuleName, steps[i]);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/menuSetPriority/%d", m_szModuleName, steps[i]);
if (steps[i] > 0) {
mir_sntprintf(szName, TranslateT("Increase priority by %d"), steps[i]);
mi.icolibItem = GetIconHandle(IDI_ARROW_UP);
@@ -1004,7 +1004,7 @@ int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam) return 0;
TCHAR jid[JABBER_MAX_JID_LEN];
- if (GetClientJID(event->hContact, jid, SIZEOF(jid))) {
+ if (GetClientJID(event->hContact, jid, _countof(jid))) {
pResourceStatus r(ResourceInfoFromJID(jid));
if (r && r->m_bMessageSessionActive) {
r->m_bMessageSessionActive = FALSE;
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 6c9372874b..e0961c2a9f 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -61,8 +61,8 @@ int JabberCompareJids(const TCHAR *jid1, const TCHAR *jid2) // match only node@domain part
TCHAR szTempJid1[JABBER_MAX_JID_LEN], szTempJid2[JABBER_MAX_JID_LEN];
return mir_tstrcmpi(
- JabberStripJid(jid1, szTempJid1, SIZEOF(szTempJid1)),
- JabberStripJid(jid2, szTempJid2, SIZEOF(szTempJid2)));
+ JabberStripJid(jid1, szTempJid1, _countof(szTempJid1)),
+ JabberStripJid(jid2, szTempJid2, _countof(szTempJid2)));
}
///////////////////////////////////////////////////////////////////////////////
@@ -361,14 +361,14 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, CMString &res) int i;
// search through known software list
- for (i = 0; i < SIZEOF(sttCapsNodeToName_Map); i++)
+ for (i = 0; i < _countof(sttCapsNodeToName_Map); i++)
if (_tcsstr(resource->m_tszCapsNode, sttCapsNodeToName_Map[i].node)) {
res.Format(_T("%s %s"), sttCapsNodeToName_Map[i].name, resource->m_tszCapsVer);
break;
}
// unknown software
- if (i == SIZEOF(sttCapsNodeToName_Map))
+ if (i == _countof(sttCapsNodeToName_Map))
res.Format(_T("%s %s"), resource->m_tszCapsNode, resource->m_tszCapsVer);
}
@@ -407,9 +407,9 @@ void CJabberProto::UpdateMirVer(MCONTACT hContact, pResourceStatus &resource) TCHAR szFullJid[JABBER_MAX_JID_LEN];
if (resource->m_tszResourceName && !_tcschr(jid, '/'))
- mir_sntprintf(szFullJid, SIZEOF(szFullJid), _T("%s/%s"), jid, resource->m_tszResourceName);
+ mir_sntprintf(szFullJid, _countof(szFullJid), _T("%s/%s"), jid, resource->m_tszResourceName);
else
- mir_tstrncpy(szFullJid, jid, SIZEOF(szFullJid));
+ mir_tstrncpy(szFullJid, jid, _countof(szFullJid));
setTString(hContact, DBSETTING_DISPLAY_UID, szFullJid);
}
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index df53cb80f4..f521cdcbfe 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -437,7 +437,7 @@ protected: // fill predefined resources
TCHAR *szResources[] = { _T("Home"), _T("Work"), _T("Office"), _T("Miranda") };
- for (int i=0; i < SIZEOF(szResources); i++)
+ for (int i=0; i < _countof(szResources); i++)
m_cbResource.AddString(szResources[i]);
// append computer name to the resource list
@@ -546,7 +546,7 @@ private: if (!m_proto->EnterString(buf, TranslateT("Confirm password"), ESF_PASSWORD))
return;
- m_txtPassword.GetText(pass, SIZEOF(pass));
+ m_txtPassword.GetText(pass, _countof(pass));
if (mir_tstrcmp(buf, pass)) {
MessageBox(m_hwnd, TranslateT("Passwords do not match."), _T("Miranda NG"), MB_ICONSTOP|MB_OK);
return;
@@ -558,12 +558,12 @@ private: SendMessage(m_hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
JABBER_CONN_DATA regInfo;
- m_txtUsername.GetText(regInfo.username, SIZEOF(regInfo.username));
- m_txtPassword.GetText(regInfo.password, SIZEOF(regInfo.password));
- m_cbServer.GetTextA(regInfo.server, SIZEOF(regInfo.server));
+ m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
+ m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
+ m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
if (m_chkManualHost.GetState() == BST_CHECKED) {
regInfo.port = (WORD)m_txtManualPort.GetInt();
- m_txtManualHost.GetTextA(regInfo.manualHost, SIZEOF(regInfo.manualHost));
+ m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
}
else {
regInfo.port = (WORD)m_txtPort.GetInt();
@@ -677,12 +677,12 @@ private: void CheckRegistration()
{
JABBER_CONN_DATA regInfo;
- m_txtUsername.GetText(regInfo.username, SIZEOF(regInfo.username));
- m_txtPassword.GetText(regInfo.password, SIZEOF(regInfo.password));
- m_cbServer.GetTextA(regInfo.server, SIZEOF(regInfo.server));
+ m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
+ m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
+ m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
if (m_chkManualHost.GetState() == BST_CHECKED) {
regInfo.port = (WORD)m_txtManualPort.GetInt();
- m_txtManualHost.GetTextA(regInfo.manualHost, SIZEOF(regInfo.manualHost));
+ m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
}
else {
regInfo.port = (WORD)m_txtPort.GetInt();
@@ -1058,10 +1058,10 @@ void CJabberProto::_RosterHandleGetRequest(HXML node, CJabberIqInfo*) TCHAR name[260]=_T("");
TCHAR group[260]=_T("");
TCHAR subscr[260]=_T("");
- ListView_GetItemText(hList, index, 0, jid, SIZEOF(jid));
- ListView_GetItemText(hList, index, 1, name, SIZEOF(name));
- ListView_GetItemText(hList, index, 2, group, SIZEOF(group));
- ListView_GetItemText(hList, index, 3, subscr, SIZEOF(subscr));
+ ListView_GetItemText(hList, index, 0, jid, _countof(jid));
+ ListView_GetItemText(hList, index, 1, name, _countof(name));
+ ListView_GetItemText(hList, index, 2, group, _countof(group));
+ ListView_GetItemText(hList, index, 3, subscr, _countof(subscr));
HXML itemRoster = xmlGetChildByTag(queryRoster, "item", "jid", jid);
BOOL bRemove = !ListView_GetCheckState(hList,index);
if (itemRoster && bRemove) {
@@ -1179,7 +1179,7 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg) TCHAR filename[MAX_PATH] = { 0 };
TCHAR filter[MAX_PATH];
- mir_sntprintf(filter, SIZEOF(filter), _T("%s (*.xml)%c*.xml%c%c"), TranslateT("XML for MS Excel (UTF-8 encoded)"), 0, 0, 0);
+ mir_sntprintf(filter, _countof(filter), _T("%s (*.xml)%c*.xml%c%c"), TranslateT("XML for MS Excel (UTF-8 encoded)"), 0, 0, 0);
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
@@ -1187,7 +1187,7 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg) ofn.lpstrFilter = filter;
ofn.lpstrFile = filename;
ofn.Flags = OFN_HIDEREADONLY;
- ofn.nMaxFile = SIZEOF(filename);
+ ofn.nMaxFile = _countof(filename);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("xml");
if (!GetSaveFileName(&ofn)) return;
@@ -1214,10 +1214,10 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg) TCHAR name[260]=_T("");
TCHAR group[260]=_T("");
TCHAR subscr[260]=_T("");
- ListView_GetItemText(hList, index, 0, jid, SIZEOF(jid));
- ListView_GetItemText(hList, index, 1, name, SIZEOF(name));
- ListView_GetItemText(hList, index, 2, group, SIZEOF(group));
- ListView_GetItemText(hList, index, 3, subscr, SIZEOF(subscr));
+ ListView_GetItemText(hList, index, 0, jid, _countof(jid));
+ ListView_GetItemText(hList, index, 1, name, _countof(name));
+ ListView_GetItemText(hList, index, 2, group, _countof(group));
+ ListView_GetItemText(hList, index, 3, subscr, _countof(subscr));
HXML node = table << XCHILD(_T("Row"));
node << XCHILD(_T("Cell")) << XCHILD(_T("Data"), _T("+")) << XATTR(_T("ss:Type"), _T("String"));
@@ -1248,7 +1248,7 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg) ofn.lpstrFilter = filter;
ofn.lpstrFile = filename;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = SIZEOF(filename);
+ ofn.nMaxFile = _countof(filename);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = "xml";
if (!GetOpenFileNameA(&ofn))
@@ -1351,7 +1351,7 @@ static LRESULT CALLBACK _RosterNewListProc(HWND hList, UINT msg, WPARAM wParam, RECT rc;
TCHAR buff[260];
ListView_GetSubItemRect(hList, lvhti.iItem, lvhti.iSubItem, LVIR_BOUNDS,&rc);
- ListView_GetItemText(hList, lvhti.iItem, lvhti.iSubItem, buff, SIZEOF(buff));
+ ListView_GetItemText(hList, lvhti.iItem, lvhti.iSubItem, buff, _countof(buff));
HWND hEditor=CreateWindow(TEXT("EDIT"),buff,WS_CHILD|ES_AUTOHSCROLL,rc.left+3, rc.top+2, rc.right-rc.left-3, rc.bottom - rc.top-3,hList, NULL, hInst, NULL);
SendMessage(hEditor,WM_SETFONT,(WPARAM)SendMessage(hList,WM_GETFONT,0,0),0);
ShowWindow(hEditor,SW_SHOW);
@@ -1593,7 +1593,7 @@ protected: // fill predefined resources
TCHAR *szResources[] = { _T("Home"), _T("Work"), _T("Office"), _T("Miranda") };
- for (int i=0; i < SIZEOF(szResources); i++)
+ for (int i=0; i < _countof(szResources); i++)
m_cbResource.AddString(szResources[i]);
// append computer name to the resource list
@@ -1619,10 +1619,10 @@ protected: m_cbType.AddString(TranslateT("S.ms"), ACC_SMS);
char server[256], manualServer[256]={0};
- m_cbServer.GetTextA(server, SIZEOF(server));
+ m_cbServer.GetTextA(server, _countof(server));
ptrA dbManualServer( db_get_sa(NULL, m_proto->m_szModuleName, "ManualHost"));
if (dbManualServer != NULL)
- mir_strncpy(manualServer, dbManualServer, SIZEOF(manualServer));
+ mir_strncpy(manualServer, dbManualServer, _countof(manualServer));
m_canregister = true;
if (!mir_strcmp(manualServer, "talk.google.com")) {
@@ -1696,7 +1696,7 @@ protected: TCHAR szCompName[MAX_COMPUTERNAME_LENGTH + 1], szResource[MAX_COMPUTERNAME_LENGTH + 1];
DWORD dwCompNameLength = MAX_COMPUTERNAME_LENGTH;
if (GetComputerName(szCompName, &dwCompNameLength)) {
- m_cbResource.GetText(szResource, SIZEOF(szResource));
+ m_cbResource.GetText(szResource, _countof(szResource));
if (!mir_tstrcmp(szCompName, szResource))
bUseHostnameAsResource = TRUE;
}
@@ -1750,8 +1750,8 @@ protected: char server[256];
char manualServer[256];
- m_cbServer.GetTextA(server, SIZEOF(server));
- m_txtManualHost.GetTextA(manualServer, SIZEOF(manualServer));
+ m_cbServer.GetTextA(server, _countof(server));
+ m_txtManualHost.GetTextA(manualServer, _countof(manualServer));
if ((m_chkManualHost.GetState() == BST_CHECKED) && mir_strcmp(server, manualServer)) {
m_proto->m_options.ManualConnect = TRUE;
@@ -1808,7 +1808,7 @@ private: return;
TCHAR pass[512];
- m_txtPassword.GetText(pass, SIZEOF(pass));
+ m_txtPassword.GetText(pass, _countof(pass));
if (mir_tstrcmp(buf, pass)) {
MessageBox(m_hwnd, TranslateT("Passwords do not match."), _T("Miranda NG"), MB_ICONSTOP|MB_OK);
return;
@@ -1820,12 +1820,12 @@ private: SendMessage(m_hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
JABBER_CONN_DATA regInfo;
- m_txtUsername.GetText(regInfo.username, SIZEOF(regInfo.username));
- m_txtPassword.GetText(regInfo.password, SIZEOF(regInfo.password));
- m_cbServer.GetTextA(regInfo.server, SIZEOF(regInfo.server));
+ m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
+ m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
+ m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
regInfo.port = (WORD)m_txtPort.GetInt();
if (m_chkManualHost.GetState() == BST_CHECKED)
- m_txtManualHost.GetTextA(regInfo.manualHost, SIZEOF(regInfo.manualHost));
+ m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
else
regInfo.manualHost[0] = '\0';
@@ -1867,7 +1867,7 @@ private: if (chk->GetState() == BST_CHECKED) {
char buf[256];
- m_cbServer.GetTextA(buf, SIZEOF(buf));
+ m_cbServer.GetTextA(buf, _countof(buf));
m_txtManualHost.SetTextA(buf);
m_txtPort.SetInt(5222);
@@ -1902,12 +1902,12 @@ void CJabberDlgAccMgrUI::CheckRegistration() }
JABBER_CONN_DATA regInfo;
- m_txtUsername.GetText(regInfo.username, SIZEOF(regInfo.username));
- m_txtPassword.GetText(regInfo.password, SIZEOF(regInfo.password));
- m_cbServer.GetTextA(regInfo.server, SIZEOF(regInfo.server));
+ m_txtUsername.GetText(regInfo.username, _countof(regInfo.username));
+ m_txtPassword.GetText(regInfo.password, _countof(regInfo.password));
+ m_cbServer.GetTextA(regInfo.server, _countof(regInfo.server));
regInfo.port = m_txtPort.GetInt();
if (m_chkManualHost.GetState() == BST_CHECKED)
- m_txtManualHost.GetTextA(regInfo.manualHost, SIZEOF(regInfo.manualHost));
+ m_txtManualHost.GetTextA(regInfo.manualHost, _countof(regInfo.manualHost));
else
regInfo.manualHost[0] = '\0';
diff --git a/protocols/JabberG/src/jabber_password.cpp b/protocols/JabberG/src/jabber_password.cpp index e36ed79c55..8b047cc134 100644 --- a/protocols/JabberG/src/jabber_password.cpp +++ b/protocols/JabberG/src/jabber_password.cpp @@ -59,13 +59,13 @@ static INT_PTR CALLBACK JabberChangePasswordDlgProc(HWND hwndDlg, UINT msg, WPAR case IDOK:
if (ppro->m_bJabberOnline && ppro->m_ThreadInfo != NULL) {
TCHAR newPasswd[512], text[512];
- GetDlgItemText(hwndDlg, IDC_NEWPASSWD, newPasswd, SIZEOF(newPasswd));
- GetDlgItemText(hwndDlg, IDC_NEWPASSWD2, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_NEWPASSWD, newPasswd, _countof(newPasswd));
+ GetDlgItemText(hwndDlg, IDC_NEWPASSWD2, text, _countof(text));
if (mir_tstrcmp(newPasswd, text)) {
MessageBox(hwndDlg, TranslateT("New password does not match."), TranslateT("Change Password"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
break;
}
- GetDlgItemText(hwndDlg, IDC_OLDPASSWD, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_OLDPASSWD, text, _countof(text));
if (mir_tstrcmp(text, ppro->m_ThreadInfo->conn.password)) {
MessageBox(hwndDlg, TranslateT("Current password is incorrect."), TranslateT("Change Password"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
break;
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index 558d70b028..2a8a556305 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -314,7 +314,7 @@ public: void btnOk_OnClick(CCtrlButton*)
{
- GetDlgItemText(m_hwnd, IDC_EDIT_NAME, szLine, SIZEOF(szLine));
+ GetDlgItemText(m_hwnd, IDC_EDIT_NAME, szLine, _countof(szLine));
EndDialog(m_hwnd, 1);
}
void btnCancel_OnClick(CCtrlButton*)
@@ -369,7 +369,7 @@ public: TCHAR *szTypes[] = { _T("JID"), _T("Group"), _T("Subscription"), _T("Any") };
int i, nTypes[] = { Jid, Group, Subscription, Else };
- for (i=0; i < SIZEOF(szTypes); i++) {
+ for (i=0; i < _countof(szTypes); i++) {
LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szTypes[i]));
SendDlgItemMessage(m_hwnd, IDC_COMBO_TYPE, CB_SETITEMDATA, nItem, nTypes[i]);
if (m_pRule->GetType() == nTypes[i])
@@ -378,7 +378,7 @@ public: SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_RESETCONTENT, 0, 0);
TCHAR *szSubscriptions[] = { _T("none"), _T("from"), _T("to"), _T("both") };
- for (i=0; i < SIZEOF(szSubscriptions); i++) {
+ for (i=0; i < _countof(szSubscriptions); i++) {
LRESULT nItem = SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(szSubscriptions[i]));
SendDlgItemMessage(m_hwnd, IDC_COMBO_VALUE, CB_SETITEMDATA, nItem, (LPARAM)szSubscriptions[i]);
}
@@ -497,7 +497,7 @@ public: case Group:
{
TCHAR szText[ 512 ];
- GetDlgItemText(m_hwnd, IDC_COMBO_VALUES, szText, SIZEOF(szText));
+ GetDlgItemText(m_hwnd, IDC_COMBO_VALUES, szText, _countof(szText));
m_pRule->SetValue(szText);
}
break;
@@ -946,7 +946,7 @@ BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) DrawLists(lpdis);
else if (lpdis->CtlID == IDC_CANVAS) {
int i, totalWidth = -5; // spacing for last item
- for (i=0; i < SIZEOF(drawItems); i++) {
+ for (i=0; i < _countof(drawItems); i++) {
SIZE sz = {0};
drawItems[i].text = TranslateTS(drawItems[i].textEng);
GetTextExtentPoint32(lpdis->hDC, drawItems[i].text, (int)mir_tstrlen(drawItems[i].text), &sz);
@@ -957,7 +957,7 @@ BOOL CJabberDlgPrivacyLists::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) RECT rc = lpdis->rcItem;
rc.left = (rc.left + rc.right - totalWidth)/2;
- for (i=0; i < SIZEOF(drawItems); i++) {
+ for (i=0; i < _countof(drawItems); i++) {
DrawIconEx(lpdis->hDC, rc.left, (rc.top+rc.bottom-16)/2, m_proto->LoadIconEx(drawItems[i].icon),
16, 16, 0, NULL, DI_NORMAL);
rc.left += 18;
@@ -991,16 +991,16 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) TCHAR szTypeValue[ 512 ];
switch (pRule->GetType()) {
case Jid:
- mir_sntprintf(szTypeValue, SIZEOF(szTypeValue), _T("If Jabber ID is '%s' then"), pRule->GetValue());
+ mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("If Jabber ID is '%s' then"), pRule->GetValue());
break;
case Group:
- mir_sntprintf(szTypeValue, SIZEOF(szTypeValue), _T("If group is '%s' then"), pRule->GetValue());
+ mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("If group is '%s' then"), pRule->GetValue());
break;
case Subscription:
- mir_sntprintf(szTypeValue, SIZEOF(szTypeValue), _T("If subscription is '%s' then"), pRule->GetValue());
+ mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("If subscription is '%s' then"), pRule->GetValue());
break;
case Else:
- mir_sntprintf(szTypeValue, SIZEOF(szTypeValue), _T("Else"));
+ mir_sntprintf(szTypeValue, _countof(szTypeValue), _T("Else"));
break;
}
@@ -1033,7 +1033,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) }
TCHAR szListItem[ 512 ];
- mir_sntprintf(szListItem, SIZEOF(szListItem), _T("%s %s %s"), szTypeValue, pRule->GetAction() ? _T("allow") : _T("deny"), szPackets);
+ mir_sntprintf(szListItem, _countof(szListItem), _T("%s %s %s"), szTypeValue, pRule->GetAction() ? _T("allow") : _T("deny"), szPackets);
LRESULT nItemId = SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_ADDSTRING, 0, (LPARAM)szListItem);
SendDlgItemMessage(m_hwnd, IDC_PL_RULES_LIST, LB_SETITEMDATA, nItemId, (LPARAM)pRule);
@@ -2101,7 +2101,7 @@ void CJabberProto::BuildPrivacyMenu() CreateProtoService("/PrivacyLists", &CJabberProto::OnMenuHandlePrivacyLists);
char srvFce[MAX_PATH + 64];
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/PrivacyLists", m_szModuleName);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/PrivacyLists", m_szModuleName);
mi.pszService = srvFce;
mi.position = 3000040000;
mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR;
@@ -2130,7 +2130,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) mi.pszService = srvFce;
int i = 0;
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
if (i > m_privacyMenuServiceAllocated) {
CreateProtoServiceParam(svcName, &CJabberProto::menuSetPrivacyList, i);
m_privacyMenuServiceAllocated = i;
@@ -2142,7 +2142,7 @@ void CJabberProto::BuildPrivacyListsMenu(bool bDeleteOld) for (CPrivacyList *pList = m_privacyListManager.GetFirstList(); pList; pList = pList->GetNext()) {
i++;
- mir_snprintf(srvFce, SIZEOF(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
+ mir_snprintf(srvFce, _countof(srvFce), "%s/menuPrivacy%d", m_szModuleName, i);
if (i > m_privacyMenuServiceAllocated) {
CreateProtoServiceParam(svcName, &CJabberProto::menuSetPrivacyList, i);
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 076e76aeca..3ea5af5ddf 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -46,8 +46,8 @@ static int compareListItems(const JABBER_LIST_ITEM *p1, const JABBER_LIST_ITEM * return mir_tstrcmpi(p1->jid, p2->jid);
TCHAR szp1[JABBER_MAX_JID_LEN], szp2[JABBER_MAX_JID_LEN];
- JabberStripJid(p1->jid, szp1, SIZEOF(szp1));
- JabberStripJid(p2->jid, szp2, SIZEOF(szp2));
+ JabberStripJid(p1->jid, szp1, _countof(szp1));
+ JabberStripJid(p2->jid, szp2, _countof(szp2));
return mir_tstrcmpi(szp1, szp2);
}
@@ -577,7 +577,7 @@ DWORD_PTR __cdecl CJabberProto::GetCaps(int type, MCONTACT hContact) return (DWORD_PTR)"jid";
case PFLAG_MAXCONTACTSPERPACKET:
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if (GetClientJID(hContact, szClientJid, SIZEOF(szClientJid))) {
+ if (GetClientJID(hContact, szClientJid, _countof(szClientJid))) {
JabberCapsBits jcb = GetResourceCapabilites(szClientJid, TRUE);
return ((~jcb & JABBER_CAPS_ROSTER_EXCHANGE) ? 0 : 50);
}
@@ -594,10 +594,10 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) return 1;
TCHAR jid[JABBER_MAX_JID_LEN], szBareJid[JABBER_MAX_JID_LEN];
- if (!GetClientJID(hContact, jid, SIZEOF(jid)))
+ if (!GetClientJID(hContact, jid, _countof(jid)))
return 1;
- JabberStripJid(jid, szBareJid, SIZEOF(szBareJid));
+ JabberStripJid(jid, szBareJid, _countof(szBareJid));
bool bUseResource = ListGetItemPtr(LIST_CHATROOM, szBareJid) != NULL;
if (m_ThreadInfo) {
@@ -633,7 +633,7 @@ int __cdecl CJabberProto::GetInfo(MCONTACT hContact, int /*infoType*/) for (int i=0; i < item->arResources.getCount(); i++) {
pResourceStatus r(item->arResources[i]);
TCHAR tmp[JABBER_MAX_JID_LEN];
- mir_sntprintf(tmp, SIZEOF(tmp), _T("%s/%s"), szBareJid, r->m_tszResourceName);
+ mir_sntprintf(tmp, _countof(tmp), _T("%s/%s"), szBareJid, r->m_tszResourceName);
if (r->m_jcbCachedCaps & JABBER_CAPS_DISCO_INFO) {
XmlNodeIq iq5(AddIQ(&CJabberProto::OnIqResultCapsDiscoInfoSI, JABBER_IQ_TYPE_GET, tmp, JABBER_IQ_PARSE_FROM | JABBER_IQ_PARSE_CHILD_TAG_NODE | JABBER_IQ_PARSE_HCONTACT));
@@ -716,7 +716,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid) mir_free(szServer);
szServer = mir_tstrdup(_T("sms"));
}
- mir_sntprintf(jsb->jid, SIZEOF(jsb->jid), _T("%s@%s"), szJid, szServer);
+ mir_sntprintf(jsb->jid, _countof(jsb->jid), _T("%s@%s"), szJid, szServer);
}
else _tcsncpy_s(jsb->jid, szJid, _TRUNCATE);
mir_free(szServer);
@@ -813,7 +813,7 @@ int __cdecl CJabberProto::SendContacts(MCONTACT hContact, int, int nContacts, MC return 0;
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if (!GetClientJID(hContact, szClientJid, SIZEOF(szClientJid)))
+ if (!GetClientJID(hContact, szClientJid, _countof(szClientJid)))
return 0;
JabberCapsBits jcb = GetResourceCapabilites(szClientJid, TRUE);
@@ -952,7 +952,7 @@ static char PGP_EPILOG[] = "\r\n-----END PGP MESSAGE-----\r\n"; int __cdecl CJabberProto::SendMsg(MCONTACT hContact, int, const char* pszSrc)
{
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if (!m_bJabberOnline || !GetClientJID(hContact, szClientJid, SIZEOF(szClientJid))) {
+ if (!m_bJabberOnline || !GetClientJID(hContact, szClientJid, _countof(szClientJid))) {
TFakeAckParams *param = new TFakeAckParams(hContact, Translate("Protocol is offline or no JID"));
ForkThread(&CJabberProto::SendMessageAckThread, param);
return 1;
@@ -1239,7 +1239,7 @@ int __cdecl CJabberProto::UserIsTyping(MCONTACT hContact, int type) if (!m_bJabberOnline) return 0;
TCHAR szClientJid[JABBER_MAX_JID_LEN];
- if (!GetClientJID(hContact, szClientJid, SIZEOF(szClientJid)))
+ if (!GetClientJID(hContact, szClientJid, _countof(szClientJid)))
return 0;
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, szClientJid);
diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index a2ac93a80d..6e11c3c324 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -310,7 +310,7 @@ int CJabberProto::AdhocSetStatusHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhoc // priority
TCHAR szPriority[ 256 ];
- mir_sntprintf(szPriority, SIZEOF(szPriority), _T("%d"), (short)getWord("Priority", 5));
+ mir_sntprintf(szPriority, _countof(szPriority), _T("%d"), (short)getWord("Priority", 5));
xNode << XCHILD(_T("field")) << XATTR(_T("label"), TranslateT("Priority")) << XATTR(_T("type"), _T("text-single"))
<< XATTR(_T("var"), _T("status-priority")) << XCHILD(_T("value"), szPriority);
@@ -414,12 +414,12 @@ int CJabberProto::AdhocOptionsHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe // Automatically Accept File Transfers
TCHAR szTmpBuff[ 1024 ];
- mir_sntprintf(szTmpBuff, SIZEOF(szTmpBuff), _T("%d"), db_get_b(NULL, "SRFile", "AutoAccept", 0));
+ mir_sntprintf(szTmpBuff, _countof(szTmpBuff), _T("%d"), db_get_b(NULL, "SRFile", "AutoAccept", 0));
xNode << XCHILD(_T("field")) << XATTR(_T("label"), TranslateT("Automatically Accept File Transfers"))
<< XATTR(_T("type"), _T("boolean")) << XATTR(_T("var"), _T("auto-files")) << XCHILD(_T("value"), szTmpBuff);
// Use sounds
- mir_sntprintf(szTmpBuff, SIZEOF(szTmpBuff), _T("%d"), db_get_b(NULL, "Skin", "UseSound", 0));
+ mir_sntprintf(szTmpBuff, _countof(szTmpBuff), _T("%d"), db_get_b(NULL, "Skin", "UseSound", 0));
xNode << XCHILD(_T("field")) << XATTR(_T("label"), TranslateT("Play sounds"))
<< XATTR(_T("type"), _T("boolean")) << XATTR(_T("var"), _T("sounds")) << XCHILD(_T("value"), szTmpBuff);
@@ -495,7 +495,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe if (pSession->GetStage() == 0) {
int nUnreadEvents = RcGetUnreadEventsCount();
if (!nUnreadEvents) {
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("There is no messages to forward"));
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("There is no messages to forward"));
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
@@ -517,7 +517,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe xNode << XCHILD(_T("title"), TranslateT("Forward options"));
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("%d message(s) to be forwarded"), nUnreadEvents);
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("%d message(s) to be forwarded"), nUnreadEvents);
xNode << XCHILD(_T("instructions"), szMsg);
xNode << XCHILD(_T("field")) << XATTR(_T("type"), _T("hidden")) << XATTR(_T("var"), _T("FORM_TYPE"))
@@ -583,7 +583,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe size_t cbBlob = mir_strlen((LPSTR)dbei.pBlob)+1;
if (cbBlob < dbei.cbBlob) { // rest of message contains a sender's resource
ptrT szOResource( mir_utf8decodeT((LPSTR)dbei.pBlob + cbBlob+1));
- mir_sntprintf(szOFrom, SIZEOF(szOFrom), _T("%s/%s"), tszJid, szOResource);
+ mir_sntprintf(szOFrom, _countof(szOFrom), _T("%s/%s"), tszJid, szOResource);
} else
_tcsncpy_s(szOFrom, tszJid, _TRUNCATE);
@@ -593,7 +593,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe time_t ltime = (time_t)dbei.timestamp;
struct tm *gmt = gmtime(<ime);
TCHAR stime[512];
- mir_sntprintf(stime, SIZEOF(stime), _T("%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ"), gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
+ mir_sntprintf(stime, _countof(stime), _T("%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ"), gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday,
gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
msg << XCHILDNS(_T("delay"), _T("urn:xmpp:delay")) << XATTR(_T("stamp"), stime);
@@ -607,7 +607,7 @@ int CJabberProto::AdhocForwardHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSe }
}
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("%d message(s) forwarded"), nEventsSent);
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("%d message(s) forwarded"), nEventsSent);
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
@@ -627,9 +627,9 @@ int CJabberProto::AdhocLockWSHandler(HXML, CJabberIqInfo *pInfo, CJabberAdhocSes TCHAR szMsg[ 1024 ];
if (bOk)
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("Workstation successfully locked"));
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("Workstation successfully locked"));
else
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("Error %d occurred during workstation lock"), GetLastError());
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("Error %d occurred during workstation lock"), GetLastError());
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
@@ -709,7 +709,7 @@ int CJabberProto::AdhocLeaveGroupchatsHandler(HXML, CJabberIqInfo *pInfo, CJabbe if (!nChatsCount) {
TCHAR szMsg[ 1024 ];
- mir_sntprintf(szMsg, SIZEOF(szMsg), TranslateT("There is no group chats to leave"));
+ mir_sntprintf(szMsg, _countof(szMsg), TranslateT("There is no group chats to leave"));
m_ThreadInfo->send(
XmlNodeIq(_T("result"), pInfo)
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index af1ebda659..87fcc15b21 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -461,7 +461,7 @@ int CJabberProto::SearchRenewFields(HWND hwndDlg, JabberSearchData *dat) { TCHAR szServerName[100]; EnableWindow(GetDlgItem(hwndDlg, IDC_GO), FALSE); - GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, SIZEOF(szServerName)); + GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, _countof(szServerName)); dat->CurrentHeight = 0; dat->curPos = 0; SetScrollPos(GetDlgItem(hwndDlg, IDC_VSCROLL), SB_CTL, 0, FALSE); @@ -493,21 +493,21 @@ void CJabberProto::SearchDeleteFromRecent(const TCHAR *szAddr, BOOL deleteLastFr //search in recent for (int i = 0; i < 10; i++) { char key[30]; - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", i); ptrT szValue(getTStringA(key)); if (szValue == NULL || mir_tstrcmpi(szAddr, szValue)) continue; for (int j = i; j < 10; j++) { - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j + 1); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", j + 1); szValue = getTStringA(key); if (szValue != NULL) { - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", j); setTString(NULL, key, szValue); } else { if (deleteLastFromDB) { - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", j); delSetting(NULL, key); } break; @@ -523,15 +523,15 @@ void CJabberProto::SearchAddToRecent(const TCHAR *szAddr, HWND hwndDialog) SearchDeleteFromRecent(szAddr); for (int j = 9; j > 0; j--) { - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j - 1); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", j - 1); ptrT szValue(getTStringA(key)); if (szValue != NULL) { - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", j); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", j); setTString(NULL, key, szValue); } } - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", 0); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", 0); setTString(key, szAddr); if (hwndDialog) JabberSearchAddUrlToRecentCombo(hwndDialog, szAddr); @@ -563,7 +563,7 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR for (i = 0; i < 10; i++) { char key[30]; - mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i); + mir_snprintf(key, _countof(key), "RecentlySearched_%d", i); ptrT szValue(dat->ppro->getTStringA(key)); if (szValue != NULL) JabberSearchAddUrlToRecentCombo(hwndDlg, szValue); @@ -743,7 +743,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg) // get server name TCHAR szServerName[100]; - GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, SIZEOF(szServerName)); + GetDlgItemText(hwndDlg, IDC_SERVER, szServerName, _countof(szServerName)); // formating query CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultAdvancedSearch, JABBER_IQ_TYPE_SET, szServerName); @@ -764,7 +764,7 @@ HWND __cdecl CJabberProto::SearchAdvanced(HWND hwndDlg) else { //and Simple fields: XEP-0055 Example 3 for (int i = 0; i < dat->nJSInfCount; i++) { TCHAR szFieldValue[100]; - GetWindowText(dat->pJSInf[i].hwndValueItem, szFieldValue, SIZEOF(szFieldValue)); + GetWindowText(dat->pJSInf[i].hwndValueItem, szFieldValue, _countof(szFieldValue)); if (szFieldValue[0] != 0) { xmlAddChild(query, dat->pJSInf[i].szFieldName, szFieldValue); fRequestNotEmpty = TRUE; diff --git a/protocols/JabberG/src/jabber_secur.cpp b/protocols/JabberG/src/jabber_secur.cpp index 5bebb8ac3a..24c93439db 100644 --- a/protocols/JabberG/src/jabber_secur.cpp +++ b/protocols/JabberG/src/jabber_secur.cpp @@ -50,7 +50,7 @@ LBL_Invalid: TCHAR szSpn[1024] = _T("");
if (mir_strcmp(mechanism, "NTLM"))
- if (!getSpn(szSpn, SIZEOF(szSpn)) && !mir_strcmp(mechanism, "GSSAPI"))
+ if (!getSpn(szSpn, _countof(szSpn)) && !mir_strcmp(mechanism, "GSSAPI"))
goto LBL_Invalid;
if ((hProvider = Netlib_InitSecurityProvider2(szProvider, szSpn)) == NULL)
@@ -66,10 +66,10 @@ TNtlmAuth::~TNtlmAuth() bool TNtlmAuth::getSpn(TCHAR* szSpn, size_t dwSpnLen)
{
TCHAR szFullUserName[128] = _T("");
- ULONG szFullUserNameLen = SIZEOF(szFullUserName);
+ ULONG szFullUserNameLen = _countof(szFullUserName);
if (!GetUserNameEx(NameDnsDomain, szFullUserName, &szFullUserNameLen)) {
szFullUserName[0] = 0;
- szFullUserNameLen = SIZEOF(szFullUserName);
+ szFullUserNameLen = _countof(szFullUserName);
GetUserNameEx(NameSamCompatible, szFullUserName, &szFullUserNameLen);
}
@@ -155,7 +155,7 @@ char* TMD5Auth::getChallenge(const TCHAR *challenge) mir_md5_state_t ctx;
CallService(MS_UTILS_GETRANDOM, sizeof(digest), (LPARAM)digest);
- mir_snprintf(cnonce, SIZEOF(cnonce), "%08x%08x%08x%08x", htonl(digest[0]), htonl(digest[1]), htonl(digest[2]), htonl(digest[3]));
+ mir_snprintf(cnonce, _countof(cnonce), "%08x%08x%08x%08x", htonl(digest[0]), htonl(digest[1]), htonl(digest[2]), htonl(digest[3]));
T2Utf uname(info->conn.username), passw(info->conn.password);
ptrA serv(mir_utf8encode(info->conn.server));
@@ -182,15 +182,15 @@ char* TMD5Auth::getChallenge(const TCHAR *challenge) mir_md5_finish(&ctx, (BYTE*)hash2);
mir_md5_init(&ctx);
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "%08x%08x%08x%08x", htonl(hash1[0]), htonl(hash1[1]), htonl(hash1[2]), htonl(hash1[3]));
+ mir_snprintf(tmpBuf, _countof(tmpBuf), "%08x%08x%08x%08x", htonl(hash1[0]), htonl(hash1[1]), htonl(hash1[2]), htonl(hash1[3]));
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf));
mir_md5_append(&ctx, (BYTE*)":", 1);
mir_md5_append(&ctx, (BYTE*)nonce, (int)mir_strlen(nonce));
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), ":%08d:", iCallCount);
+ mir_snprintf(tmpBuf, _countof(tmpBuf), ":%08d:", iCallCount);
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf));
mir_md5_append(&ctx, (BYTE*)cnonce, (int)mir_strlen(cnonce));
mir_md5_append(&ctx, (BYTE*)":auth:", 6);
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "%08x%08x%08x%08x", htonl(hash2[0]), htonl(hash2[1]), htonl(hash2[2]), htonl(hash2[3]));
+ mir_snprintf(tmpBuf, _countof(tmpBuf), "%08x%08x%08x%08x", htonl(hash2[0]), htonl(hash2[1]), htonl(hash2[2]), htonl(hash2[3]));
mir_md5_append(&ctx, (BYTE*)tmpBuf, (int)mir_strlen(tmpBuf));
mir_md5_finish(&ctx, (BYTE*)digest);
@@ -278,7 +278,7 @@ char* TScramAuth::getChallenge(const TCHAR *challenge) mir_sha1_finish(&ctx, storedKey);
char authmsg[4096];
- int authmsgLen = mir_snprintf(authmsg, SIZEOF(authmsg), "%s,%s,c=biws,r=%s", msg1, chl, snonce);
+ int authmsgLen = mir_snprintf(authmsg, _countof(authmsg), "%s,%s,c=biws,r=%s", msg1, chl, snonce);
BYTE clientSig[MIR_SHA1_HASH_SIZE];
mir_hmac_sha1(clientSig, storedKey, sizeof(storedKey), (BYTE*)authmsg, authmsgLen);
diff --git a/protocols/JabberG/src/jabber_std.cpp b/protocols/JabberG/src/jabber_std.cpp index 84745e30d5..485d85ff01 100644 --- a/protocols/JabberG/src/jabber_std.cpp +++ b/protocols/JabberG/src/jabber_std.cpp @@ -72,17 +72,17 @@ void CJabberProto::ConvertPasswords() for (int i = 0;; i++) {
char varName[100];
- mir_snprintf(varName, SIZEOF(varName), "rcMuc_%d_server", i);
+ mir_snprintf(varName, _countof(varName), "rcMuc_%d_server", i);
ptrA str(getStringA(NULL, varName));
if (str == NULL)
break;
- mir_snprintf(varName, SIZEOF(varName), "rcMuc_%d", i);
+ mir_snprintf(varName, _countof(varName), "rcMuc_%d", i);
ptrT passw(JSetStringCrypt(m_szModuleName, NULL, varName));
if (passw != NULL) {
delSetting(varName);
- mir_snprintf(varName, SIZEOF(varName), "password_rcMuc_%d", i);
+ mir_snprintf(varName, _countof(varName), "password_rcMuc_%d", i);
setTString(varName, passw);
}
}
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp index 916a3ce87c..ff9279d881 100644 --- a/protocols/JabberG/src/jabber_svc.cpp +++ b/protocols/JabberG/src/jabber_svc.cpp @@ -130,7 +130,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) }
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(pai->hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName));
_tcsncpy_s(pai->filename, tszFileName, _TRUNCATE);
pai->format = (pai->hContact == NULL) ? PA_FORMAT_PNG : getByte(pai->hContact, "AvatarType", 0);
@@ -153,7 +153,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam) TCHAR szJid[JABBER_MAX_JID_LEN]; szJid[0] = 0;
if (item->arResources.getCount() != NULL && !isXVcard)
if (TCHAR *bestResName = ListGetBestClientResourceNamePtr(tszJid))
- mir_sntprintf(szJid, SIZEOF(szJid), _T("%s/%s"), tszJid, bestResName);
+ mir_sntprintf(szJid, _countof(szJid), _T("%s/%s"), tszJid, bestResName);
if (szJid[0] == 0)
_tcsncpy_s(szJid, tszJid, _TRUNCATE);
@@ -533,7 +533,7 @@ INT_PTR __cdecl CJabberProto::JabberSendNudge(WPARAM hContact, LPARAM) TCHAR tszJid[JABBER_MAX_JID_LEN];
TCHAR *szResource = ListGetBestClientResourceNamePtr(jid);
if (szResource)
- mir_sntprintf(tszJid, SIZEOF(tszJid), _T("%s/%s"), jid, szResource);
+ mir_sntprintf(tszJid, _countof(tszJid), _T("%s/%s"), jid, szResource);
else
_tcsncpy_s(tszJid, jid, _TRUNCATE);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index cd3e8d0d18..f22f0299ed 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -94,7 +94,7 @@ static INT_PTR CALLBACK JabberPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa param->saveOnlinePassword = IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD);
param->pro->setByte("SaveSessionPassword", param->saveOnlinePassword);
- GetDlgItemText(hwndDlg, IDC_PASSWORD, param->onlinePassword, SIZEOF(param->onlinePassword));
+ GetDlgItemText(hwndDlg, IDC_PASSWORD, param->onlinePassword, _countof(param->onlinePassword));
{
BOOL savePassword = IsDlgButtonChecked(hwndDlg, IDC_SAVE_PERM);
param->pro->setByte("SavePassword", savePassword);
@@ -148,7 +148,7 @@ void ThreadData::xmpp_client_query(void) return;
char temp[256];
- mir_snprintf(temp, SIZEOF(temp), "_xmpp-client._tcp.%s", conn.server);
+ mir_snprintf(temp, _countof(temp), "_xmpp-client._tcp.%s", conn.server);
DNS_RECORDA *results = NULL;
DNS_STATUS status = DnsQuery_A(temp, DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, (PDNS_RECORD *)&results, NULL);
@@ -250,7 +250,7 @@ void CJabberProto::ServerThread(JABBER_CONN_DATA *param) _tcsncpy_s(info.conn.username, tszValue, _TRUNCATE);
if (*rtrimt(info.conn.username) == '\0') {
- DWORD dwSize = SIZEOF(info.conn.username);
+ DWORD dwSize = _countof(info.conn.username);
if (GetUserName(info.conn.username, &dwSize))
setTString("LoginName", info.conn.username);
else
@@ -278,7 +278,7 @@ LBL_FatalError: }
if (m_options.HostNameAsResource) {
- DWORD dwCompNameLen = SIZEOF(info.resource) - 1;
+ DWORD dwCompNameLen = _countof(info.resource) - 1;
if (!GetComputerName(info.resource, &dwCompNameLen))
mir_tstrcpy(info.resource, _T("Miranda"));
}
@@ -290,7 +290,7 @@ LBL_FatalError: }
TCHAR jidStr[512];
- mir_sntprintf(jidStr, SIZEOF(jidStr), _T("%s@%S/%s"), info.conn.username, info.conn.server, info.resource);
+ mir_sntprintf(jidStr, _countof(jidStr), _T("%s@%S/%s"), info.conn.username, info.conn.server, info.resource);
_tcsncpy_s(info.fullJID, jidStr, _TRUNCATE);
if (m_options.UseDomainLogin) // in the case of NTLM auth we have no need in password
@@ -299,7 +299,7 @@ LBL_FatalError: if (m_savedPassword != NULL)
_tcsncpy_s(info.conn.password, m_savedPassword, _TRUNCATE);
else {
- mir_sntprintf(jidStr, SIZEOF(jidStr), _T("%s@%S"), info.conn.username, info.conn.server);
+ mir_sntprintf(jidStr, _countof(jidStr), _T("%s@%S"), info.conn.username, info.conn.server);
JabberPasswordDlgParam param;
param.pro = this;
@@ -971,7 +971,7 @@ void CJabberProto::OnProcessPubsubEvent(HXML node) szLengthInTime[0] = 0;
if (szLength) {
int nLength = _ttoi(szLength);
- mir_sntprintf(szLengthInTime, SIZEOF(szLengthInTime), _T("%02d:%02d:%02d"),
+ mir_sntprintf(szLengthInTime, _countof(szLengthInTime), _T("%02d:%02d:%02d"),
nLength / 3600, (nLength / 60) % 60, nLength % 60);
}
@@ -1289,7 +1289,7 @@ void CJabberProto::OnProcessMessage(HXML node, ThreadData *info) else if (!mir_tstrcmp(ptszXmlns, JABBER_FEAT_ROSTER_EXCHANGE) &&
item != NULL && (item->subscription == SUB_BOTH || item->subscription == SUB_TO)) {
TCHAR chkJID[JABBER_MAX_JID_LEN] = _T("@");
- JabberStripJid(from, chkJID + 1, SIZEOF(chkJID) - 1);
+ JabberStripJid(from, chkJID + 1, _countof(chkJID) - 1);
for (int i = 1;; i++) {
HXML iNode = xmlGetNthChild(xNode, _T("item"), i);
if (iNode == NULL)
@@ -1496,9 +1496,9 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData *info) MCONTACT hContact;
BOOL bSelfPresence = FALSE;
TCHAR szBareFrom[JABBER_MAX_JID_LEN];
- JabberStripJid(from, szBareFrom, SIZEOF(szBareFrom));
+ JabberStripJid(from, szBareFrom, _countof(szBareFrom));
TCHAR szBareOurJid[JABBER_MAX_JID_LEN];
- JabberStripJid(info->fullJID, szBareOurJid, SIZEOF(szBareOurJid));
+ JabberStripJid(info->fullJID, szBareOurJid, _countof(szBareOurJid));
if (!mir_tstrcmpi(szBareFrom, szBareOurJid))
bSelfPresence = TRUE;
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp index 93ef27846b..cff0711614 100644 --- a/protocols/JabberG/src/jabber_userinfo.cpp +++ b/protocols/JabberG/src/jabber_userinfo.cpp @@ -176,7 +176,7 @@ static HTREEITEM sttFillInfoLine(HWND hwndTree, HTREEITEM htiRoot, HICON hIcon, if (title) mir_sntprintf(buf, _T("%s: %s"), title, value); else - mir_tstrncpy(buf, value, SIZEOF(buf)); + mir_tstrncpy(buf, value, _countof(buf)); TVINSERTSTRUCT tvis = {0}; tvis.hParent = htiRoot; @@ -251,20 +251,20 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti // Resource priority TCHAR szPriority[128]; - mir_sntprintf(szPriority, SIZEOF(szPriority), _T("%d"), (int)r->m_iPriority); + mir_sntprintf(szPriority, _countof(szPriority), _T("%d"), (int)r->m_iPriority); sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("Resource priority"), szPriority, sttInfoLineId(resource, INFOLINE_PRIORITY)); // Idle if (r->m_dwIdleStartTime > 0) { - mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), SIZEOF(buf)); + mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), _countof(buf)); size_t len = mir_tstrlen(buf); if (len > 0) buf[len-1] = 0; } else if (!r->m_dwIdleStartTime) - mir_tstrncpy(buf, TranslateT("unknown"), SIZEOF(buf)); + mir_tstrncpy(buf, TranslateT("unknown"), _countof(buf)); else - mir_tstrncpy(buf, TranslateT("<not specified>"), SIZEOF(buf)); + mir_tstrncpy(buf, TranslateT("<not specified>"), _countof(buf)); sttFillInfoLine(hwndTree, htiResource, NULL, TranslateT("Idle since"), buf, sttInfoLineId(resource, INFOLINE_IDLE)); @@ -279,7 +279,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti if (jcb & g_JabberFeatCapPairs[i].jcbCap) { TCHAR szDescription[ 1024 ]; if (g_JabberFeatCapPairs[i].tszDescription) - mir_sntprintf(szDescription, SIZEOF(szDescription), _T("%s (%s)"), TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature); + mir_sntprintf(szDescription, _countof(szDescription), _T("%s (%s)"), TranslateTS(g_JabberFeatCapPairs[i].tszDescription), g_JabberFeatCapPairs[i].szFeature); else _tcsncpy_s(szDescription, g_JabberFeatCapPairs[i].szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); @@ -289,7 +289,7 @@ static void sttFillResourceInfo(CJabberProto *ppro, HWND hwndTree, HTREEITEM hti if (jcb & ppro->m_lstJabberFeatCapPairsDynamic[j]->jcbCap) { TCHAR szDescription[ 1024 ]; if (ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription) - mir_sntprintf(szDescription, SIZEOF(szDescription), _T("%s (%s)"), TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature); + mir_sntprintf(szDescription, _countof(szDescription), _T("%s (%s)"), TranslateTS(ppro->m_lstJabberFeatCapPairsDynamic[j]->szDescription), ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature); else _tcsncpy_s(szDescription, ppro->m_lstJabberFeatCapPairsDynamic[j]->szFeature, _TRUNCATE); sttFillInfoLine(hwndTree, htiCaps, NULL, NULL, szDescription, sttInfoLineId(resource, INFOLINE_CAPS, i)); @@ -365,15 +365,15 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM // logoff JABBER_RESOURCE_STATUS *r = item->getTemp(); if (r->m_dwIdleStartTime > 0) { - mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), SIZEOF(buf)); + mir_tstrncpy(buf, _tctime(&r->m_dwIdleStartTime), _countof(buf)); size_t len = mir_tstrlen(buf); if (len > 0) buf[len-1] = 0; } else if (!r->m_dwIdleStartTime) - mir_tstrncpy(buf, TranslateT("unknown"), SIZEOF(buf)); + mir_tstrncpy(buf, TranslateT("unknown"), _countof(buf)); else - mir_tstrncpy(buf, TranslateT("<not specified>"), SIZEOF(buf)); + mir_tstrncpy(buf, TranslateT("<not specified>"), _countof(buf)); sttFillInfoLine(hwndTree, htiRoot, NULL, (item->jid && _tcschr(item->jid, _T('@'))) ? TranslateT("Last logoff time") : TranslateT("Uptime"), buf, @@ -384,9 +384,9 @@ static void sttFillUserInfo(CJabberProto *ppro, HWND hwndTree, JABBER_LIST_ITEM // activity if (item->m_pLastSeenResource) - mir_tstrncpy(buf, item->m_pLastSeenResource->m_tszResourceName, SIZEOF(buf)); + mir_tstrncpy(buf, item->m_pLastSeenResource->m_tszResourceName, _countof(buf)); else - mir_tstrncpy(buf, TranslateT("<no information available>"), SIZEOF(buf)); + mir_tstrncpy(buf, TranslateT("<no information available>"), _countof(buf)); sttFillInfoLine(hwndTree, htiRoot, NULL, TranslateT("Last active resource"), buf, sttInfoLineId(0, INFOLINE_LASTACTIVE)); @@ -537,7 +537,7 @@ static INT_PTR CALLBACK JabberUserInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa TVITEMEX tvi = { 0 }; tvi.mask = TVIF_HANDLE | TVIF_TEXT | TVIF_STATE; tvi.hItem = hItem; - tvi.cchTextMax = SIZEOF(szBuffer); + tvi.cchTextMax = _countof(szBuffer); tvi.pszText = szBuffer; if (TreeView_GetItem(hwndTree, &tvi)) { if (TCHAR *str = _tcsstr(szBuffer, _T(": "))) diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 059015f155..a709bc492c 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -542,8 +542,8 @@ int __stdcall JabberGetPacketID(HXML n) {
const TCHAR *str = xmlGetAttrValue(n, _T("id"));
if (str)
- if (!_tcsncmp(str, _T(JABBER_IQID), SIZEOF(JABBER_IQID) - 1))
- return _ttoi(str + SIZEOF(JABBER_IQID) - 1);
+ if (!_tcsncmp(str, _T(JABBER_IQID), _countof(JABBER_IQID) - 1))
+ return _ttoi(str + _countof(JABBER_IQID) - 1);
return -1;
}
@@ -941,7 +941,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) if (getByte(ai.hContact, "AvatarType", PA_FORMAT_UNKNOWN) != (unsigned char)pictureType) {
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(ai.hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(ai.hContact, tszFileName, _countof(tszFileName));
DeleteFile(tszFileName);
}
@@ -958,7 +958,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) ptrA cmpsha(getStringA(ai.hContact, "AvatarSaved"));
if (cmpsha == NULL || strnicmp(cmpsha, buffer, sizeof(buffer))) {
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(ai.hContact, tszFileName, SIZEOF(tszFileName));
+ GetAvatarFileName(ai.hContact, tszFileName, _countof(tszFileName));
_tcsncpy_s(ai.filename, tszFileName, _TRUNCATE);
FILE* out = _tfopen(tszFileName, _T("wb"));
if (out != NULL) {
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp index 510abac8ac..d98e163758 100644 --- a/protocols/JabberG/src/jabber_vcard.cpp +++ b/protocols/JabberG/src/jabber_vcard.cpp @@ -288,9 +288,9 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR dat->ppro->m_szPhotoFileName[0] = '\0';
}
EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE), FALSE);
- dat->ppro->GetAvatarFileName(NULL, szAvatarFileName, SIZEOF(szAvatarFileName));
+ dat->ppro->GetAvatarFileName(NULL, szAvatarFileName, _countof(szAvatarFileName));
if (_taccess(szAvatarFileName, 0) == 0) {
- if (GetTempPath(SIZEOF(szTempPath), szTempPath) <= 0)
+ if (GetTempPath(_countof(szTempPath), szTempPath) <= 0)
mir_tstrcpy(szTempPath, _T(".\\"));
if (GetTempFileName(szTempPath, _T("jab"), 0, szTempFileName) > 0) {
dat->ppro->debugLog(_T("Temp file = %s"), szTempFileName);
@@ -334,7 +334,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDC_LOAD:
TCHAR szFilter[512], szFileName[MAX_PATH];
- Bitmap_GetFilter(szFilter, SIZEOF(szFilter));
+ Bitmap_GetFilter(szFilter, _countof(szFilter));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
@@ -354,7 +354,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR MessageBox(hwndDlg, TranslateT("Only JPG, GIF, and BMP image files smaller than 40 KB are supported."), TranslateT("Jabber vCard"), MB_OK | MB_SETFOREGROUND);
break;
}
- if (GetTempPath(SIZEOF(szTempPath), szTempPath) <= 0)
+ if (GetTempPath(_countof(szTempPath), szTempPath) <= 0)
mir_tstrcpy(szTempPath, _T(".\\"));
if (GetTempFileName(szTempPath, _T("jab"), 0, szTempFileName) > 0) {
@@ -579,7 +579,7 @@ static INT_PTR CALLBACK EditEmailDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, }
TCHAR text[128];
- GetDlgItemText(hwndDlg, IDC_EMAIL, text, SIZEOF(text));
+ GetDlgItemText(hwndDlg, IDC_EMAIL, text, _countof(text));
mir_snprintf(idstr, "e-mail%d", dat->id);
dat->ppro->setTString(idstr, text);
{
@@ -650,7 +650,7 @@ static INT_PTR CALLBACK EditPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, }
char text[128];
- GetDlgItemTextA(hwndDlg, IDC_PHONE, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, IDC_PHONE, text, _countof(text));
mir_snprintf(idstr, "Phone%d", dat->id);
dat->ppro->setString(idstr, text);
@@ -733,7 +733,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP ptrT email( ppro->getTStringA(idstr));
if (email == NULL) break;
- mir_sntprintf(number, SIZEOF(number), _T("%d"), i+1);
+ mir_sntprintf(number, _countof(number), _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_EMAILS), &lvi);
@@ -754,7 +754,7 @@ static INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lP ptrT phone( ppro->getTStringA(idstr));
if (phone == NULL) break;
- mir_sntprintf(number, SIZEOF(number), _T("%d"), i+1);
+ mir_sntprintf(number, _countof(number), _T("%d"), i+1);
lvi.pszText = number;
lvi.lParam = (LPARAM)i;
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
@@ -921,40 +921,40 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) // Page 0: Personal
switch (iPage) {
case 0:
- GetDlgItemText(hwndPage, IDC_FULLNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_FULLNAME, text, _countof(text));
setTString("FullName", text);
- GetDlgItemText(hwndPage, IDC_NICKNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_NICKNAME, text, _countof(text));
setTString("Nick", text);
- GetDlgItemText(hwndPage, IDC_FIRSTNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_FIRSTNAME, text, _countof(text));
setTString("FirstName", text);
- GetDlgItemText(hwndPage, IDC_MIDDLE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_MIDDLE, text, _countof(text));
setTString("MiddleName", text);
- GetDlgItemText(hwndPage, IDC_LASTNAME, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_LASTNAME, text, _countof(text));
setTString("LastName", text);
- GetDlgItemText(hwndPage, IDC_BIRTH, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_BIRTH, text, _countof(text));
setTString("BirthDate", text);
switch (SendDlgItemMessage(hwndPage, IDC_GENDER, CB_GETCURSEL, 0, 0)) {
case 0: setString("GenderString", "Male"); break;
case 1: setString("GenderString", "Female"); break;
default: setString("GenderString", ""); break;
}
- GetDlgItemText(hwndPage, IDC_OCCUPATION, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_OCCUPATION, text, _countof(text));
setTString("Role", text);
- GetDlgItemText(hwndPage, IDC_HOMEPAGE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_HOMEPAGE, text, _countof(text));
setTString("Homepage", text);
break;
// Page 1: Home
case 1:
- GetDlgItemText(hwndPage, IDC_ADDRESS1, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ADDRESS1, text, _countof(text));
setTString("Street", text);
- GetDlgItemText(hwndPage, IDC_ADDRESS2, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ADDRESS2, text, _countof(text));
setTString("Street2", text);
- GetDlgItemText(hwndPage, IDC_CITY, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_CITY, text, _countof(text));
setTString("City", text);
- GetDlgItemText(hwndPage, IDC_STATE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_STATE, text, _countof(text));
setTString("State", text);
- GetDlgItemText(hwndPage, IDC_ZIP, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ZIP, text, _countof(text));
setTString("ZIP", text);
{
int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0);
@@ -966,21 +966,21 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) // Page 2: Work
case 2:
- GetDlgItemText(hwndPage, IDC_COMPANY, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_COMPANY, text, _countof(text));
setTString("Company", text);
- GetDlgItemText(hwndPage, IDC_DEPARTMENT, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_DEPARTMENT, text, _countof(text));
setTString("CompanyDepartment", text);
- GetDlgItemText(hwndPage, IDC_TITLE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_TITLE, text, _countof(text));
setTString("CompanyPosition", text);
- GetDlgItemText(hwndPage, IDC_ADDRESS1, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ADDRESS1, text, _countof(text));
setTString("CompanyStreet", text);
- GetDlgItemText(hwndPage, IDC_ADDRESS2, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ADDRESS2, text, _countof(text));
setTString("CompanyStreet2", text);
- GetDlgItemText(hwndPage, IDC_CITY, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_CITY, text, _countof(text));
setTString("CompanyCity", text);
- GetDlgItemText(hwndPage, IDC_STATE, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_STATE, text, _countof(text));
setTString("CompanyState", text);
- GetDlgItemText(hwndPage, IDC_ZIP, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_ZIP, text, _countof(text));
setTString("CompanyZIP", text);
{
int i = SendDlgItemMessage(hwndPage, IDC_COUNTRY, CB_GETCURSEL, 0, 0);
@@ -995,7 +995,7 @@ void CJabberProto::SaveVcardToDB(HWND hwndPage, int iPage) // Page 4: Note
case 4:
- GetDlgItemText(hwndPage, IDC_DESC, text, SIZEOF(text));
+ GetDlgItemText(hwndPage, IDC_DESC, text, _countof(text));
setTString("About", text);
break;
}
@@ -1105,7 +1105,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) }
TCHAR szAvatarName[MAX_PATH], *szFileName;
- GetAvatarFileName(NULL, szAvatarName, SIZEOF(szAvatarName));
+ GetAvatarFileName(NULL, szAvatarName, _countof(szAvatarName));
if (bPhotoChanged)
szFileName = szPhotoFileName;
else
@@ -1159,7 +1159,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName) if (bPhotoChanged) {
DeleteFile(szAvatarName);
- GetAvatarFileName(NULL, szAvatarName, SIZEOF(szAvatarName));
+ GetAvatarFileName(NULL, szAvatarName, _countof(szAvatarName));
CopyFile(szFileName, szAvatarName, FALSE);
}
diff --git a/protocols/JabberG/src/jabber_ws.cpp b/protocols/JabberG/src/jabber_ws.cpp index 2abed513d4..62e9da7501 100644 --- a/protocols/JabberG/src/jabber_ws.cpp +++ b/protocols/JabberG/src/jabber_ws.cpp @@ -29,7 +29,7 @@ BOOL CJabberProto::WsInit(void) m_lastTicks = ::GetTickCount();
TCHAR name[128];
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY;
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp index 61585a59f2..947d047537 100644 --- a/protocols/JabberG/src/jabber_xstatus.cpp +++ b/protocols/JabberG/src/jabber_xstatus.cpp @@ -345,7 +345,7 @@ BOOL CJabberDlgPepSimple::OnWmDrawItem(UINT, WPARAM, LPARAM lParam) break;
}
}
- else mir_tstrncpy(text, mode->m_title, SIZEOF(text));
+ else mir_tstrncpy(text, mode->m_title, _countof(text));
DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 2, (lpdis->rcItem.top + lpdis->rcItem.bottom - 16) / 2, mode->m_hIcon, 16, 16, 0, NULL, DI_NORMAL);
TextOut(lpdis->hDC, lpdis->rcItem.left + 23, (lpdis->rcItem.top + lpdis->rcItem.bottom - tm.tmHeight) / 2, text, (int)mir_tstrlen(text));
@@ -680,7 +680,7 @@ void CPepMood::SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szTe if (szMood) {
char* p = mir_t2a(szMood);
- for (int i = 1; i < SIZEOF(g_arrMoods); i++)
+ for (int i = 1; i < _countof(g_arrMoods); i++)
if (!mir_strcmp(g_arrMoods[i].szTag, p)) {
mood = i;
break;
@@ -701,7 +701,7 @@ void CPepMood::SetMood(MCONTACT hContact, const TCHAR *szMood, const TCHAR *szTe if (m_proto->m_pInfoFrame) {
if (mood >= 0) {
- mir_sntprintf(title, SIZEOF(title), TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
+ mir_sntprintf(title, _countof(title), TranslateT("Mood: %s"), TranslateTS(g_arrMoods[mood].szName));
m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/mood", g_MoodIcons.GetIcolibHandle(g_arrMoods[mood].szTag), TranslateTS(g_arrMoods[mood].szName));
}
else {
@@ -739,7 +739,7 @@ void CPepMood::ShowSetDialog(BYTE bQuiet) {
if (!bQuiet) {
CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Mood"));
- for (int i = 1; i < SIZEOF(g_arrMoods); i++)
+ for (int i = 1; i < _countof(g_arrMoods); i++)
dlg.AddStatusMode(i, g_arrMoods[i].szTag, g_MoodIcons.GetIcon(g_arrMoods[i].szTag), TranslateTS(g_arrMoods[i].szName));
dlg.SetActiveStatus(m_mode, m_text);
@@ -916,7 +916,7 @@ char* returnActivity(int id) char* ActivityGetFirst(int id)
{
- if (id >= SIZEOF(g_arrActivities) - 1)
+ if (id >= _countof(g_arrActivities) - 1)
return NULL;
while (id >= 0) {
@@ -932,7 +932,7 @@ char *ActivityGetFirst(char *szId) {
if (!szId) return NULL;
- int id = SIZEOF(g_arrActivities) - 1;
+ int id = _countof(g_arrActivities) - 1;
bool found_second = false;
while (id >= 0) {
@@ -953,7 +953,7 @@ char *ActivityGetSecond(int id) TCHAR *ActivityGetFirstTitle(int id)
{
- if (id >= SIZEOF(g_arrActivities) - 1)
+ if (id >= _countof(g_arrActivities) - 1)
return NULL;
while (id >= 0) {
@@ -1078,7 +1078,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec }
TCHAR activityTitle[128];
- ActivityBuildTitle(activity, activityTitle, SIZEOF(activityTitle));
+ ActivityBuildTitle(activity, activityTitle, _countof(activityTitle));
if (!hContact) {
m_mode = activity;
@@ -1089,7 +1089,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec if (m_proto->m_pInfoFrame) {
if (activity >= 0) {
- mir_sntprintf(title, SIZEOF(title), TranslateT("Activity: %s"), activityTitle);
+ mir_sntprintf(title, _countof(title), TranslateT("Activity: %s"), activityTitle);
m_proto->m_pInfoFrame->UpdateInfoItem("$/PEP/activity", g_ActivityIcons.GetIcolibHandle(returnActivity(activity)), activityTitle);
}
else {
@@ -1113,7 +1113,7 @@ void CPepActivity::SetActivity(MCONTACT hContact, LPCTSTR szFirst, LPCTSTR szSec void CPepActivity::ShowSetDialog(BYTE)
{
CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Activity"));
- for (int i=0; i < SIZEOF(g_arrActivities); i++)
+ for (int i=0; i < _countof(g_arrActivities); i++)
if (g_arrActivities[i].szFirst || g_arrActivities[i].szSecond)
dlg.AddStatusMode(i, ActivityGetId(i), g_ActivityIcons.GetIcon(returnActivity(i)), TranslateTS(g_arrActivities[i].szTitle), (g_arrActivities[i].szSecond != NULL));
@@ -1162,7 +1162,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusIcon(WPARAM wParam, LPARAM lParam) if (!wParam)
wParam = ((CPepMood*)m_pepServices.Find(JABBER_FEAT_USER_MOOD))->m_mode;
- if (wParam < 1 || wParam >= SIZEOF(g_arrMoods))
+ if (wParam < 1 || wParam >= _countof(g_arrMoods))
return 0;
int flags = 0;
@@ -1227,7 +1227,7 @@ void CJabberProto::SetContactTune(MCONTACT hContact, LPCTSTR szArtist, LPCTSTR s setTString(hContact, "ListeningTo", szListeningTo);
char tuneIcon[128];
- mir_snprintf(tuneIcon, SIZEOF(tuneIcon), "%s_%s", m_szModuleName, "main");
+ mir_snprintf(tuneIcon, _countof(tuneIcon), "%s_%s", m_szModuleName, "main");
WriteAdvStatus(hContact, ADVSTATUS_TUNE, _T("listening_to"), tuneIcon, TranslateT("Listening To"), szListeningTo);
mir_free(szListeningTo);
@@ -1292,7 +1292,7 @@ INT_PTR __cdecl CJabberProto::OnSetListeningTo(WPARAM, LPARAM lParam) szTmp++;
}
}
- mir_sntprintf(szLengthInSec, SIZEOF(szLengthInSec), _T("%d"), result);
+ mir_sntprintf(szLengthInSec, _countof(szLengthInSec), _T("%d"), result);
}
SendPepTune(szArtist, szLength ? szLengthInSec : NULL, szSource, szTitle, szTrack, NULL);
@@ -1354,7 +1354,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam) if (pData->flags & CSSF_MASK_NAME) {
if (pData->flags & CSSF_DEFAULT_NAME) {
DWORD dwXStatus = (pData->wParam == NULL) ? pepMood->m_mode : *pData->wParam;
- if (dwXStatus >= SIZEOF(g_arrMoods))
+ if (dwXStatus >= _countof(g_arrMoods))
return 1;
if (pData->flags & CSSF_UNICODE)
@@ -1404,7 +1404,7 @@ INT_PTR __cdecl CJabberProto::OnGetXStatusEx(WPARAM hContact, LPARAM lParam) if (pData->flags & CSSF_STATUSES_COUNT)
if (pData->wParam)
- *pData->wParam = SIZEOF(g_arrMoods);
+ *pData->wParam = _countof(g_arrMoods);
if (pData->flags & CSSF_STR_SIZES) {
if (pData->wParam) *pData->wParam = STATUS_TITLE_MAX;
@@ -1425,7 +1425,7 @@ INT_PTR __cdecl CJabberProto::OnSetXStatusEx(WPARAM, LPARAM lParam) CPepMood *pepMood = (CPepMood*)m_pepServices.Find(JABBER_FEAT_USER_MOOD);
int status = (pData->flags & CSSF_MASK_STATUS) ? *pData->status : pepMood->m_mode;
- if (status >= 0 && status < SIZEOF(g_arrMoods)) {
+ if (status >= 0 && status < _countof(g_arrMoods)) {
pepMood->m_mode = status;
pepMood->m_text = (pData->flags & CSSF_MASK_MESSAGE) ? JabberStrFixLines(pData->ptszMessage) : NULL;
pepMood->LaunchSetGui(1);
@@ -1509,18 +1509,18 @@ TCHAR* CJabberProto::ReadAdvStatusT(MCONTACT hContact, const char *pszSlot, cons void g_XstatusIconsInit()
{
TCHAR szFile[MAX_PATH];
- GetModuleFileName(hInst, szFile, SIZEOF(szFile));
+ GetModuleFileName(hInst, szFile, _countof(szFile));
if (TCHAR *p = _tcsrchr(szFile, '\\'))
mir_tstrcpy(p + 1, _T("..\\Icons\\xstatus_jabber.dll"));
TCHAR szSection[100];
mir_tstrcpy(szSection, _T("Protocols/Jabber/")LPGENT("Moods"));
- for (int i = 1; i < SIZEOF(g_arrMoods); i++)
+ for (int i = 1; i < _countof(g_arrMoods); i++)
g_MoodIcons.RegisterIcon(g_arrMoods[i].szTag, szFile, -(200 + i), szSection, TranslateTS(g_arrMoods[i].szName));
mir_tstrcpy(szSection, _T("Protocols/Jabber/")LPGENT("Activities"));
- for (int k = 0; k < SIZEOF(g_arrActivities); k++) {
+ for (int k = 0; k < _countof(g_arrActivities); k++) {
if (g_arrActivities[k].szFirst)
g_ActivityIcons.RegisterIcon(g_arrActivities[k].szFirst, szFile, g_arrActivities[k].iconid, szSection, TranslateTS(g_arrActivities[k].szTitle));
if (g_arrActivities[k].szSecond)
diff --git a/protocols/MRA/src/MraAdvancedSearch.cpp b/protocols/MRA/src/MraAdvancedSearch.cpp index 94d201356e..42cc03beb1 100644 --- a/protocols/MRA/src/MraAdvancedSearch.cpp +++ b/protocols/MRA/src/MraAdvancedSearch.cpp @@ -80,7 +80,7 @@ void InitComboBoxNumders(HWND hWndCombo, DWORD dwStart, DWORD dwEnd) for (DWORD i = dwStart; i <= dwEnd; i++) {
TCHAR szBuff[MAX_PATH];
- mir_sntprintf(szBuff, SIZEOF(szBuff), _T("%lu"), i);
+ mir_sntprintf(szBuff, _countof(szBuff), _T("%lu"), i);
DWORD dwItem = SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)szBuff);
SendMessage(hWndCombo, CB_SETITEMDATA, dwItem, i);
}
@@ -106,7 +106,7 @@ INT_PTR CALLBACK AdvancedSearchDlgProc(HWND hWndDlg, UINT message, WPARAM wParam HWND hWndCombo = GetDlgItem(hWndDlg, IDC_EMAIL_DOMAIN);
ResetComboBox(hWndCombo);
for (size_t i = 0; lpcszMailRuDomains[i]; i++) {
- MultiByteToWideChar(MRA_CODE_PAGE, 0, lpcszMailRuDomains[i], -1, wszBuff, SIZEOF(wszBuff));
+ MultiByteToWideChar(MRA_CODE_PAGE, 0, lpcszMailRuDomains[i], -1, wszBuff, _countof(wszBuff));
SendMessage(hWndCombo, CB_ADDSTRING, 0, (LPARAM)wszBuff);
}
@@ -260,20 +260,20 @@ HWND CMraProto::SearchAdvanced(HWND hWndDlg) char szUser[MAX_PATH], szDomain[MAX_PATH];
TCHAR wszNickName[MAX_PATH], wszFirstName[MAX_PATH], wszLastName[MAX_PATH];
- size_t dwUserSize = GetDlgItemTextA(hWndDlg, IDC_EMAIL_USER, szUser, SIZEOF(szUser));
- size_t dwDomainSize = GetDlgItemTextA(hWndDlg, IDC_EMAIL_DOMAIN, szDomain, SIZEOF(szDomain));
+ size_t dwUserSize = GetDlgItemTextA(hWndDlg, IDC_EMAIL_USER, szUser, _countof(szUser));
+ size_t dwDomainSize = GetDlgItemTextA(hWndDlg, IDC_EMAIL_DOMAIN, szDomain, _countof(szDomain));
if (dwUserSize && dwDomainSize) {
SetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_USER);
SetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_DOMAIN);
}
- size_t dwNickNameSize = GetDlgItemText(hWndDlg, IDC_NICK, wszNickName, SIZEOF(wszNickName));
+ size_t dwNickNameSize = GetDlgItemText(hWndDlg, IDC_NICK, wszNickName, _countof(wszNickName));
if (dwNickNameSize) SetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_NICKNAME);
- size_t dwFirstNameSize = GetDlgItemText(hWndDlg, IDC_FIRSTNAME, wszFirstName, SIZEOF(wszFirstName));
+ size_t dwFirstNameSize = GetDlgItemText(hWndDlg, IDC_FIRSTNAME, wszFirstName, _countof(wszFirstName));
if (dwFirstNameSize) SetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_FIRSTNAME);
- size_t dwLastNameSize = GetDlgItemText(hWndDlg, IDC_LASTNAME, wszLastName, SIZEOF(wszLastName));
+ size_t dwLastNameSize = GetDlgItemText(hWndDlg, IDC_LASTNAME, wszLastName, _countof(wszLastName));
if (dwLastNameSize) SetBit(dwRequestFlags, MRIM_CS_WP_REQUEST_PARAM_LASTNAME);
DWORD dwSex = GET_CURRENT_COMBO_DATA(hWndDlg, IDC_GENDER);
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index fc53c18d8e..41139cbe0f 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -48,7 +48,7 @@ DWORD MraAvatarsHttpTransaction(HANDLE hConnection, DWORD dwRequestType, LPCSTR DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle)
{
- mir_snprintf(szAvtSectName, SIZEOF(szAvtSectName), "%s Avatars", m_szModuleName);
+ mir_snprintf(szAvtSectName, _countof(szAvtSectName), "%s Avatars", m_szModuleName);
if (phAvatarsQueueHandle == NULL)
return ERROR_INVALID_HANDLE;
@@ -230,7 +230,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) break;
default:
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), TranslateT("Avatars: server return HTTP code: %lu"), dwResultCode);
+ mir_sntprintf(szErrorText, _countof(szErrorText), TranslateT("Avatars: server return HTTP code: %lu"), dwResultCode);
ShowFormattedErrorMessage(szErrorText, NO_ERROR);
break;
}
@@ -262,7 +262,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) bContinue = FALSE;
break;
case 1:
- dwReceived = Netlib_Recv(hConnection, (LPSTR)&btBuff, SIZEOF(btBuff), 0);
+ dwReceived = Netlib_Recv(hConnection, (LPSTR)&btBuff, _countof(btBuff), 0);
if (dwReceived == 0 || dwReceived == SOCKET_ERROR) {
dwErrorCode = GetLastError();
ShowFormattedErrorMessage(L"Avatars: error on receive file data", dwErrorCode);
@@ -288,7 +288,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter) }
else {
dwErrorCode = GetLastError();
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), TranslateT("Avatars: can't open file %s, error"), wszFileName);
+ mir_sntprintf(szErrorText, _countof(szErrorText), TranslateT("Avatars: can't open file %s, error"), wszFileName);
ShowFormattedErrorMessage(szErrorText, dwErrorCode);
}
}
@@ -375,7 +375,7 @@ DWORD MraAvatarsHttpTransaction(HANDLE hConnection, DWORD dwRequestType, LPCSTR }
char szBuff[4096];
- mir_snprintf(szBuff, SIZEOF(szBuff), "http://%s/%s/%s/%s", lpszHost, lpszDomain, lpszUser, lpszReqObj);
+ mir_snprintf(szBuff, _countof(szBuff), "http://%s/%s/%s/%s", lpszHost, lpszDomain, lpszUser, lpszReqObj);
CMStringA szSelfVersionString = MraGetSelfVersionString();
NETLIBHTTPHEADER nlbhHeaders[8] = { 0 };
@@ -473,7 +473,7 @@ DWORD CMraProto::MraAvatarsGetFileName(HANDLE hAvatarsQueueHandle, MCONTACT hCon return ERROR_NOT_SUPPORTED;
TCHAR tszBase[MAX_PATH];
- mir_sntprintf(tszBase, SIZEOF(tszBase), _T("%s\\%s\\"), VARST(_T("%miranda_avatarcache%")), m_tszUserName);
+ mir_sntprintf(tszBase, _countof(tszBase), _T("%s\\%s\\"), VARST(_T("%miranda_avatarcache%")), m_tszUserName);
res = tszBase;
// some path in buff and free space for file name is avaible
@@ -601,13 +601,13 @@ INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wPara CheckDlgButton(hWndDlg, IDC_RETURN_ABC_PATH, db_get_b(NULL, MRA_AVT_SECT_NAME, "ReturnAbsolutePath", MRA_AVT_DEFAULT_RET_ABC_PATH) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hWndDlg, IDC_DELETE_AVT_ON_CONTACT_DELETE, db_get_b(NULL, MRA_AVT_SECT_NAME, "DeleteAvtOnContactDelete", MRA_DELETE_AVT_ON_CONTACT_DELETE) ? BST_CHECKED : BST_UNCHECKED);
- EnableControlsArray(hWndDlg, (WORD*)&wMraAvatarsControlsList, SIZEOF(wMraAvatarsControlsList), IsDlgButtonChecked(hWndDlg, IDC_ENABLE));
+ EnableControlsArray(hWndDlg, (WORD*)&wMraAvatarsControlsList, _countof(wMraAvatarsControlsList), IsDlgButtonChecked(hWndDlg, IDC_ENABLE));
}
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDC_ENABLE)
- EnableControlsArray(hWndDlg, (WORD*)&wMraAvatarsControlsList, SIZEOF(wMraAvatarsControlsList), IsDlgButtonChecked(hWndDlg, IDC_ENABLE));
+ EnableControlsArray(hWndDlg, (WORD*)&wMraAvatarsControlsList, _countof(wMraAvatarsControlsList), IsDlgButtonChecked(hWndDlg, IDC_ENABLE));
if (LOWORD(wParam) == IDC_BUTTON_DEFAULT) {
SetDlgItemTextA(hWndDlg, IDC_SERVER, MRA_AVT_DEFAULT_SERVER);
@@ -629,7 +629,7 @@ INT_PTR CALLBACK MraAvatarsQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wPara db_set_dw(NULL, MRA_AVT_SECT_NAME, "ServerPort", GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE));
TCHAR szServer[MAX_PATH];
- GetDlgItemText(hWndDlg, IDC_SERVER, szServer, SIZEOF(szServer));
+ GetDlgItemText(hWndDlg, IDC_SERVER, szServer, _countof(szServer));
db_set_ts(NULL, MRA_AVT_SECT_NAME, "Server", szServer);
return TRUE;
}
diff --git a/protocols/MRA/src/MraChat.cpp b/protocols/MRA/src/MraChat.cpp index bf259339e1..758669b69b 100644 --- a/protocols/MRA/src/MraChat.cpp +++ b/protocols/MRA/src/MraChat.cpp @@ -44,7 +44,7 @@ INT_PTR CMraProto::MraChatSessionNew(MCONTACT hContact) if (!CallServiceSync(MS_GC_NEWSESSION, NULL, (LPARAM)&gcw)) {
GCDEST gcd = { m_szModuleName, wszEMail.c_str(), GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
- for (int i = 0; i < SIZEOF(lpwszStatuses); i++) {
+ for (int i = 0; i < _countof(lpwszStatuses); i++) {
gce.ptszStatus = TranslateTS(lpwszStatuses[i]);
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
}
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index c2270d4d16..448d344c8f 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -67,7 +67,7 @@ static WORD wMraFilesControlsList[] = { void MraFilesQueueDlgEnableDirectConsControls(HWND hWndDlg, BOOL bEnabled)
{
- EnableControlsArray(hWndDlg, (WORD*)&wMraFilesControlsList, SIZEOF(wMraFilesControlsList), bEnabled);
+ EnableControlsArray(hWndDlg, (WORD*)&wMraFilesControlsList, _countof(wMraFilesControlsList), bEnabled);
EnableWindow(GetDlgItem(hWndDlg, IDC_FILE_SEND_EXTRA_ADDRESS), (bEnabled && IsDlgButtonChecked(hWndDlg, IDC_FILE_SEND_ADD_EXTRA_ADDRESS)));
}
@@ -122,7 +122,7 @@ INT_PTR CALLBACK MraFilesQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, ppro->setByte("FileSendAddExtraAddresses", IsDlgButtonChecked(hWndDlg, IDC_FILE_SEND_ADD_EXTRA_ADDRESS));
WCHAR szBuff[MAX_PATH];
- GetDlgItemText(hWndDlg, IDC_FILE_SEND_EXTRA_ADDRESS, szBuff, SIZEOF(szBuff));
+ GetDlgItemText(hWndDlg, IDC_FILE_SEND_EXTRA_ADDRESS, szBuff, _countof(szBuff));
ppro->mraSetStringW(NULL, "FileSendExtraAddresses", szBuff);
ppro->setDword("FileSendBlockSize", (DWORD)GetDlgItemInt(hWndDlg, IDC_FILE_SEND_BLOCK_SIZE, NULL, FALSE));
ppro->setByte("FileSendEnableMRIMProxyCons", IsDlgButtonChecked(hWndDlg, IDC_FILE_SEND_ENABLE_MRIMPROXY_CONS));
@@ -240,7 +240,7 @@ size_t CMraProto::MraFilesQueueGetLocalAddressesList(LPSTR lpszBuff, size_t dwBu }
CHAR szHostName[MAX_PATH] = { 0 };
- if (gethostname(szHostName, SIZEOF(szHostName)) == 0)
+ if (gethostname(szHostName, _countof(szHostName)) == 0)
if ((sh = gethostbyname((LPSTR)&szHostName))) {
while (sh->h_addr_list[dwAdapter]) {
lpszCurPos += mir_snprintf(lpszCurPos, (dwBuffSize - ((size_t)lpszCurPos - (size_t)lpszBuff)), "%s:%lu;", inet_ntoa(*((struct in_addr*)sh->h_addr_list[dwAdapter])), dwPort);
@@ -390,14 +390,14 @@ bool CMraProto::MraFilesQueueHandCheck(HANDLE hConnection, MRA_FILES_QUEUE_ITEM if (dat->bSending == FALSE) {
// receiving
- dwBuffSize = mir_snprintf((LPSTR)btBuff, SIZEOF(btBuff), "%s %s", MRA_FT_HELLO, szEmailMy.c_str()) + 1;
+ dwBuffSize = mir_snprintf((LPSTR)btBuff, _countof(btBuff), "%s %s", MRA_FT_HELLO, szEmailMy.c_str()) + 1;
if (dwBuffSize == (size_t)Netlib_Send(hConnection, (LPSTR)btBuff, (int)dwBuffSize, 0)) {
// my email sended
ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, (HANDLE)dat->dwIDRequest, 0);
dwBuffSize = Netlib_Recv(hConnection, (LPSTR)btBuff, sizeof(btBuff), 0);
if ((szEmail.GetLength() + sizeof(MRA_FT_HELLO)+1) == dwBuffSize) {
// email received
- mir_snprintf(((LPSTR)btBuff + dwBuffSize), (SIZEOF(btBuff) - dwBuffSize), "%s %s", MRA_FT_HELLO, szEmail);
+ mir_snprintf(((LPSTR)btBuff + dwBuffSize), (_countof(btBuff) - dwBuffSize), "%s %s", MRA_FT_HELLO, szEmail);
if (!_memicmp(btBuff, btBuff + dwBuffSize, dwBuffSize))
return true;
}
@@ -408,10 +408,10 @@ bool CMraProto::MraFilesQueueHandCheck(HANDLE hConnection, MRA_FILES_QUEUE_ITEM if ((szEmail.GetLength() + sizeof(MRA_FT_HELLO)+1) == dwBuffSize) {
// email received
ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, (HANDLE)dat->dwIDRequest, 0);
- mir_snprintf(((LPSTR)btBuff + dwBuffSize), (SIZEOF(btBuff) - dwBuffSize), "%s %s", MRA_FT_HELLO, szEmail);
+ mir_snprintf(((LPSTR)btBuff + dwBuffSize), (_countof(btBuff) - dwBuffSize), "%s %s", MRA_FT_HELLO, szEmail);
if (!_memicmp(btBuff, btBuff + dwBuffSize, dwBuffSize)) {
// email verified
- dwBuffSize = (mir_snprintf((LPSTR)btBuff, SIZEOF(btBuff), "%s %s", MRA_FT_HELLO, szEmailMy.c_str()) + 1);
+ dwBuffSize = (mir_snprintf((LPSTR)btBuff, _countof(btBuff), "%s %s", MRA_FT_HELLO, szEmailMy.c_str()) + 1);
if (dwBuffSize == (size_t)Netlib_Send(hConnection, (LPSTR)btBuff, (int)dwBuffSize, 0))
return true;
}
@@ -670,13 +670,13 @@ DWORD CMraProto::MraFilesQueueAddReceive(HANDLE hFilesQueueHandle, DWORD dwFlags LPWSTR lpwszDelimiter = dat->pwszFilesList;
LPWSTR lpwszCurrentItem = dat->pwszDescription;
- StrFormatByteSizeW(dat->dwFilesTotalSize, szBuff, SIZEOF(szBuff));
+ StrFormatByteSizeW(dat->dwFilesTotalSize, szBuff, _countof(szBuff));
lpwszCurrentItem += mir_sntprintf(lpwszCurrentItem, ((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)), L"%I64u Files (%s)\r\n", dat->dwFilesCount, szBuff);
// description + filesnames
for (size_t i = 0; i < dat->dwFilesCount; i++) {
lpwszDelimiter += mir_sntprintf(lpwszDelimiter, ((dwMemSize - ((size_t)lpwszDelimiter - (size_t)dat->pwszFilesList)) / sizeof(WCHAR)), L"%s", dat->pmfqfFiles[i].lpwszName);
- StrFormatByteSizeW(dat->pmfqfFiles[i].dwSize, szBuff, SIZEOF(szBuff));
+ StrFormatByteSizeW(dat->pmfqfFiles[i].dwSize, szBuff, _countof(szBuff));
lpwszCurrentItem += mir_sntprintf(lpwszCurrentItem, ((dwMemSize - ((size_t)lpwszCurrentItem - (size_t)dat->pwszDescription)) / sizeof(WCHAR)), L"%s - %s\r\n", dat->pmfqfFiles[i].lpwszName, szBuff);
}
@@ -769,7 +769,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) pfts.currentFileProgress = 0;
//pfts.currentFileTime; //as seconds since 1970
- if ((dat->dwPathSize + dat->pmfqfFiles[i].dwNameLen) < SIZEOF(wszFileName)) {
+ if ((dat->dwPathSize + dat->pmfqfFiles[i].dwNameLen) < _countof(wszFileName)) {
memcpy(wszFileName, dat->lpwszPath, (dat->dwPathSize*sizeof(WCHAR)));
memcpy((wszFileName + dat->dwPathSize), dat->pmfqfFiles[i].lpwszName, ((dat->pmfqfFiles[i].dwNameLen + 1)*sizeof(WCHAR)));
wszFileName[dat->dwPathSize + dat->pmfqfFiles[i].dwNameLen] = 0;
@@ -786,10 +786,10 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, (HANDLE)dat->dwIDRequest, 0);
- //dwBuffSizeUsed = (mir_snprintf((LPSTR)btBuff, SIZEOF(btBuff), "%s %S", MRA_FT_GET_FILE, dat->pmfqfFiles[i].lpwszName)+1);
+ //dwBuffSizeUsed = (mir_snprintf((LPSTR)btBuff, _countof(btBuff), "%s %S", MRA_FT_GET_FILE, dat->pmfqfFiles[i].lpwszName)+1);
memcpy(btBuff, MRA_FT_GET_FILE, sizeof(MRA_FT_GET_FILE));
btBuff[(sizeof(MRA_FT_GET_FILE)-1)] = ' ';
- dwBuffSizeUsed = sizeof(MRA_FT_GET_FILE) + WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[i].lpwszName, (int)dat->pmfqfFiles[i].dwNameLen, (LPSTR)(btBuff + sizeof(MRA_FT_GET_FILE)), (int)(SIZEOF(btBuff) - sizeof(MRA_FT_GET_FILE)), NULL, NULL);
+ dwBuffSizeUsed = sizeof(MRA_FT_GET_FILE) + WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[i].lpwszName, (int)dat->pmfqfFiles[i].dwNameLen, (LPSTR)(btBuff + sizeof(MRA_FT_GET_FILE)), (int)(_countof(btBuff) - sizeof(MRA_FT_GET_FILE)), NULL, NULL);
btBuff[dwBuffSizeUsed] = 0;
dwBuffSizeUsed++;
@@ -822,7 +822,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) bContinue = FALSE;
break;
case 1:
- dwReceived = Netlib_Recv(dat->hConnection, (LPSTR)&btBuff, SIZEOF(btBuff), 0);
+ dwReceived = Netlib_Recv(dat->hConnection, (LPSTR)&btBuff, _countof(btBuff), 0);
if (dwReceived == 0 || dwReceived == SOCKET_ERROR) {
dwRetErrorCode = GetLastError();
ShowFormattedErrorMessage(L"Receive files: error on receive file data", dwRetErrorCode);
@@ -857,7 +857,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) }
else {// err allocating file disk space
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), TranslateT("Receive files: can't allocate disk space for file, size %lu bytes, error"), dat->pmfqfFiles[i].dwSize);
+ mir_sntprintf(szErrorText, _countof(szErrorText), TranslateT("Receive files: can't allocate disk space for file, size %lu bytes, error"), dat->pmfqfFiles[i].dwSize);
ShowFormattedErrorMessage(szErrorText, dwRetErrorCode);
}
CloseHandle(hFile);
@@ -870,7 +870,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) }
else {// err on open file
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), TranslateT("Receive files: can't open file %s, error"), wszFileName);
+ mir_sntprintf(szErrorText, _countof(szErrorText), TranslateT("Receive files: can't open file %s, error"), wszFileName);
ShowFormattedErrorMessage(szErrorText, dwRetErrorCode);
bFailed = TRUE;
break;
@@ -878,7 +878,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) }
else {// err on send request for file
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), TranslateT("Receive files: request for file %s not sent, error"), dat->pmfqfFiles[i].lpwszName);
+ mir_sntprintf(szErrorText, _countof(szErrorText), TranslateT("Receive files: request for file %s not sent, error"), dat->pmfqfFiles[i].lpwszName);
ShowFormattedErrorMessage(szErrorText, NO_ERROR);
bFailed = TRUE;
break;
@@ -986,7 +986,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) pfts.wszWorkingDir = dat->lpwszPath;
dwSendBlockSize = getDword("FileSendBlockSize", MRA_DEFAULT_FILE_SEND_BLOCK_SIZE);
- if (dwSendBlockSize > SIZEOF(btBuff)) dwSendBlockSize = SIZEOF(btBuff);
+ if (dwSendBlockSize > _countof(btBuff)) dwSendBlockSize = _countof(btBuff);
if (dwSendBlockSize < 512) dwSendBlockSize = MRA_DEFAULT_FILE_SEND_BLOCK_SIZE;
if (MraFilesQueueConnectIn(dat))
@@ -1014,7 +1014,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) dwBuffSizeUsed = 0;
while (TRUE) {
- dwReceived = Netlib_Recv(dat->hConnection, ((LPSTR)btBuff + dwBuffSizeUsed), (int)(SIZEOF(btBuff) - dwBuffSizeUsed), 0);
+ dwReceived = Netlib_Recv(dat->hConnection, ((LPSTR)btBuff + dwBuffSizeUsed), (int)(_countof(btBuff) - dwBuffSizeUsed), 0);
if (dwReceived == 0 || dwReceived == SOCKET_ERROR) { // err on receive file name to send
dwRetErrorCode = GetLastError();
ShowFormattedErrorMessage(L"Send files: file send request not received, error", dwRetErrorCode);
@@ -1038,7 +1038,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) bFailed = TRUE;
for (j = 0; j < dat->dwFilesCount; j++) {
lpwszFileName = GetFileNameFromFullPathW(dat->pmfqfFiles[j].lpwszName, dat->pmfqfFiles[j].dwNameLen);
- szFileName[WideCharToMultiByte(MRA_CODE_PAGE, 0, lpwszFileName, (int)(dat->pmfqfFiles[j].dwNameLen - (lpwszFileName - dat->pmfqfFiles[j].lpwszName)), szFileName, SIZEOF(szFileName), NULL, NULL)] = 0;
+ szFileName[WideCharToMultiByte(MRA_CODE_PAGE, 0, lpwszFileName, (int)(dat->pmfqfFiles[j].dwNameLen - (lpwszFileName - dat->pmfqfFiles[j].lpwszName)), szFileName, _countof(szFileName), NULL, NULL)] = 0;
if (!_memicmp(btBuff + sizeof(MRA_FT_GET_FILE), szFileName, dwBuffSizeUsed - (sizeof(MRA_FT_GET_FILE)+1))) {
bFailed = FALSE;
@@ -1057,7 +1057,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) pfts.currentFileProgress = 0;
//pfts.currentFileTime; //as seconds since 1970
- WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[j].lpwszName, (int)dat->pmfqfFiles[j].dwNameLen, szFileName, SIZEOF(szFileName), NULL, NULL);
+ WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[j].lpwszName, (int)dat->pmfqfFiles[j].dwNameLen, szFileName, _countof(szFileName), NULL, NULL);
ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (HANDLE)dat->dwIDRequest, (LPARAM)&pfts);
while (TRUE) { // read and sending
@@ -1101,14 +1101,14 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) }
else { // err on open file
dwRetErrorCode = GetLastError();
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), TranslateT("Send files: can't open file %s, error"), dat->pmfqfFiles[j].lpwszName);
+ mir_sntprintf(szErrorText, _countof(szErrorText), TranslateT("Send files: can't open file %s, error"), dat->pmfqfFiles[j].lpwszName);
ShowFormattedErrorMessage(szErrorText, dwRetErrorCode);
bFailed = TRUE;
break;
}
}
else {
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), TranslateT("Send files: requested file: %S - not found in send files list."), (((LPSTR)btBuff) + sizeof(MRA_FT_GET_FILE)));
+ mir_sntprintf(szErrorText, _countof(szErrorText), TranslateT("Send files: requested file: %S - not found in send files list."), (((LPSTR)btBuff) + sizeof(MRA_FT_GET_FILE)));
ShowFormattedErrorMessage(szErrorText, NO_ERROR);
bFailed = TRUE;
break;
diff --git a/protocols/MRA/src/MraIcons.cpp b/protocols/MRA/src/MraIcons.cpp index ee4ca32b7c..c50782741e 100644 --- a/protocols/MRA/src/MraIcons.cpp +++ b/protocols/MRA/src/MraIcons.cpp @@ -75,7 +75,7 @@ void InitXStatusIcons() {
// load libs
TCHAR szBuff[MAX_FILEPATH];
- if (GetModuleFileName(NULL, szBuff, SIZEOF(szBuff))) {
+ if (GetModuleFileName(NULL, szBuff, _countof(szBuff))) {
LPWSTR lpwszFileName;
g_dwMirWorkDirPathLen = GetFullPathName(szBuff, MAX_FILEPATH, g_szMirWorkDirPath, &lpwszFileName);
if (g_dwMirWorkDirPathLen) {
@@ -84,7 +84,7 @@ void InitXStatusIcons() // load xstatus icons lib
DWORD dwBuffLen;
- DWORD dwErrorCode = FindFile(g_szMirWorkDirPath, (DWORD)g_dwMirWorkDirPathLen, _T("xstatus_MRA.dll"), -1, szBuff, SIZEOF(szBuff), &dwBuffLen);
+ DWORD dwErrorCode = FindFile(g_szMirWorkDirPath, (DWORD)g_dwMirWorkDirPathLen, _T("xstatus_MRA.dll"), -1, szBuff, _countof(szBuff), &dwBuffLen);
if (dwErrorCode == NO_ERROR) {
g_hDLLXStatusIcons = LoadLibraryEx(szBuff, NULL, 0);
if (g_hDLLXStatusIcons) {
@@ -98,7 +98,7 @@ void InitXStatusIcons() }
}
- GetModuleFileName((g_hDLLXStatusIcons != NULL) ? g_hDLLXStatusIcons : g_hInstance, szBuff, SIZEOF(szBuff));
+ GetModuleFileName((g_hDLLXStatusIcons != NULL) ? g_hDLLXStatusIcons : g_hInstance, szBuff, _countof(szBuff));
SKINICONDESC sid = { 0 };
sid.section.t = LPGENT("Protocols")_T("/")LPGENT("MRA")_T("/")LPGENT("Custom Status");
@@ -109,7 +109,7 @@ void InitXStatusIcons() hXStatusAdvancedStatusIcons[0] = NULL;
for (DWORD i = 1; i < MRA_XSTATUS_COUNT+1; i++) {
char szBuff[MAX_PATH];
- mir_snprintf(szBuff, SIZEOF(szBuff), "mra_xstatus%ld", i);
+ mir_snprintf(szBuff, _countof(szBuff), "mra_xstatus%ld", i);
sid.pszName = szBuff;
int iCurIndex = i+IDI_XSTATUS1-1;
@@ -125,7 +125,7 @@ void DestroyXStatusIcons() char szBuff[MAX_PATH];
for (DWORD i = 1; i < MRA_XSTATUS_COUNT+1; i++) {
- mir_snprintf(szBuff, SIZEOF(szBuff), "mra_xstatus%ld", i);
+ mir_snprintf(szBuff, _countof(szBuff), "mra_xstatus%ld", i);
IcoLib_RemoveIcon(szBuff);
}
diff --git a/protocols/MRA/src/MraPlaces.h b/protocols/MRA/src/MraPlaces.h index ef85c025e7..4adccbb8a9 100644 --- a/protocols/MRA/src/MraPlaces.h +++ b/protocols/MRA/src/MraPlaces.h @@ -41,7 +41,7 @@ typedef struct {
if (mrapPlaces[i].dwCityID == 0 && mrapPlaces[i].dwPlaceID == 0)
{
- mir_sntprintf(szBuff, SIZEOF(szBuff), L" {%ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].lpszData);
+ mir_sntprintf(szBuff, _countof(szBuff), L" {%ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].lpszData);
DebugPrintCRLFW(szBuff);
}
}
@@ -53,7 +53,7 @@ typedef struct {
if (mrapPlaces[i].dwCityID && mrapPlaces[i].dwPlaceID == 0)
{
- mir_sntprintf(szBuff, SIZEOF(szBuff), L" {%ld, %ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].dwCityID, mrapPlaces[i].lpszData);
+ mir_sntprintf(szBuff, _countof(szBuff), L" {%ld, %ld, TEXT(\"%s\")}, ", mrapPlaces[i].dwCountryID, mrapPlaces[i].dwCityID, mrapPlaces[i].lpszData);
DebugPrintCRLFW(szBuff);
}
}
diff --git a/protocols/MRA/src/MraPopUp.cpp b/protocols/MRA/src/MraPopUp.cpp index 0f95e24cd2..3fb69e53aa 100644 --- a/protocols/MRA/src/MraPopUp.cpp +++ b/protocols/MRA/src/MraPopUp.cpp @@ -47,20 +47,20 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR bEnabled = GetBit(ppro->getDword("PopupsEventFilter", MRA_DEFAULT_POPUPS_EVENT_FILTER), dwType);
CheckDlgButton(hWndDlg, IDC_CHK_ENABLE, bEnabled ? BST_CHECKED : BST_UNCHECKED);
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]);
bUseWinColors = ppro->getByte(szBuff, MRA_DEFAULT_POPUP_USE_WIN_COLORS);
CheckDlgButton(hWndDlg, IDC_CHK_USE_WIN_COLORS, bUseWinColors ? BST_CHECKED : BST_UNCHECKED);
EnableWindow(GetDlgItem(hWndDlg, IDC_CHK_USE_WIN_COLORS), bEnabled);
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]);
SendDlgItemMessage(hWndDlg, IDC_POPUP_BACKCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(szBuff, MRA_DEFAULT_POPUP_COLOR_BACK));
EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_BACKCOLOR), (bEnabled && bUseWinColors == FALSE));
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]);
SendDlgItemMessage(hWndDlg, IDC_POPUP_TEXTCOLOR, CPM_SETCOLOUR, 0, ppro->getDword(szBuff, MRA_DEFAULT_POPUP_COLOR_TEXT));
EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_TEXTCOLOR), (bEnabled && bUseWinColors == FALSE));
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]);
SetDlgItemInt(hWndDlg, IDC_POPUP_TIMEOUT, ppro->getDword(szBuff, MRA_DEFAULT_POPUP_TIMEOUT), FALSE);
EnableWindow(GetDlgItem(hWndDlg, IDC_POPUP_TIMEOUT), bEnabled);
}
@@ -105,16 +105,16 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR ppro->setDword("PopupsEventFilter", dwPopupsEventFilter);
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]);
ppro->setByte(szBuff, IsDlgButtonChecked(hWndDlg, IDC_CHK_USE_WIN_COLORS));
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]);
ppro->setDword(szBuff, SendDlgItemMessage(hWndDlg, IDC_POPUP_BACKCOLOR, CPM_GETCOLOUR, 0, 0));
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]);
ppro->setDword(szBuff, SendDlgItemMessage(hWndDlg, IDC_POPUP_TEXTCOLOR, CPM_GETCOLOUR, 0, 0));
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]);
ppro->setDword(szBuff, GetDlgItemInt(hWndDlg, IDC_POPUP_TIMEOUT, NULL, FALSE));
}
return TRUE;
@@ -204,9 +204,9 @@ void CMraProto::MraPopupShowFromContactW(MCONTACT hContact, DWORD dwType, DWORD mraGetStringW(hContact, "Nick", szNick);
mraGetStringW(hContact, "e-mail", szEmail);
if (hContact)
- mir_snwprintf(szTitle, SIZEOF(szTitle), L"%s <%s>", szNick, szEmail);
+ mir_snwprintf(szTitle, _countof(szTitle), L"%s <%s>", szNick, szEmail);
else
- mir_snwprintf(szTitle, SIZEOF(szTitle), L"%s: %s <%s>", m_tszUserName, szNick, szEmail);
+ mir_snwprintf(szTitle, _countof(szTitle), L"%s: %s <%s>", m_tszUserName, szNick, szEmail);
MraPopupShowW(hContact, dwType, dwFlags, szTitle, lpszMessage);
}
@@ -262,21 +262,21 @@ void CMraProto::MraPopupShowW(MCONTACT hContact, DWORD dwType, DWORD dwFlags, LP ppd.PluginData = dat;
char szBuff[MAX_PATH];
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SUseWinColors", lpcwszPopupsTypes[dwType]);
BOOL bUseWinColors = getByte(szBuff, MRA_DEFAULT_POPUP_USE_WIN_COLORS);
if (bUseWinColors) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
}
else {
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SColorBack", lpcwszPopupsTypes[dwType]);
ppd.colorBack = getDword(szBuff, MRA_DEFAULT_POPUP_COLOR_BACK);
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%SColorText", lpcwszPopupsTypes[dwType]);
ppd.colorText = getDword(szBuff, MRA_DEFAULT_POPUP_COLOR_TEXT);
}
- mir_snprintf(szBuff, SIZEOF(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]);
+ mir_snprintf(szBuff, _countof(szBuff), "PopupType%STimeout", lpcwszPopupsTypes[dwType]);
ppd.iSeconds = getDword(szBuff, MRA_DEFAULT_POPUP_TIMEOUT);
if (dat->iPopupType == MRA_POPUP_TYPE_EMAIL_STATUS && dat->ppro->hWndEMailPopupStatus)
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index bddac7dc98..94a41372e4 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -36,7 +36,7 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : m_heNudgeReceived = CreateProtoEvent(PE_NUDGE);
TCHAR name[MAX_PATH];
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
@@ -46,7 +46,7 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : InitMenus();
- mir_snprintf(szNewMailSound, SIZEOF(szNewMailSound), "%s_new_email", m_szModuleName);
+ mir_snprintf(szNewMailSound, _countof(szNewMailSound), "%s_new_email", m_szModuleName);
SkinAddNewSoundEx(szNewMailSound, m_szModuleName, MRA_SOUND_NEW_EMAIL);
HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &CMraProto::MraRebuildStatusMenu);
@@ -525,11 +525,11 @@ HANDLE CMraProto::GetAwayMsg(MCONTACT hContact) SYSTEMTIME tt = { 0 };
dwTime = getDword(hContact, DBSETTING_BLOGSTATUSTIME, 0);
if (dwTime && MakeLocalSystemTimeFromTime32(dwTime, &tt))
- mir_sntprintf(szTime, SIZEOF(szTime), _T("%04ld.%02ld.%02ld %02ld:%02ld: "), tt.wYear, tt.wMonth, tt.wDay, tt.wHour, tt.wMinute);
+ mir_sntprintf(szTime, _countof(szTime), _T("%04ld.%02ld.%02ld %02ld:%02ld: "), tt.wYear, tt.wMonth, tt.wDay, tt.wHour, tt.wMinute);
else
szTime[0] = 0;
- mir_sntprintf(szStatusDesc, SIZEOF(szStatusDesc), _T("%s%s"), szTime, szBlogStatus.c_str());
+ mir_sntprintf(szStatusDesc, _countof(szStatusDesc), _T("%s%s"), szTime, szBlogStatus.c_str());
iRet = GetTickCount();
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)iRet, (LPARAM)szStatusDesc);
}
diff --git a/protocols/MRA/src/MraSelectEMail.cpp b/protocols/MRA/src/MraSelectEMail.cpp index ad8b4f11a8..f956bddbec 100644 --- a/protocols/MRA/src/MraSelectEMail.cpp +++ b/protocols/MRA/src/MraSelectEMail.cpp @@ -14,7 +14,7 @@ void AddContactEMailToListParam(MCONTACT hContact, BOOL bMRAOnly, LPSTR lpszModu if (DB_GetStringA(hContact, lpszModule, lpszValueName, szEmail)) {
if (bMRAOnly == FALSE || IsEMailMR(szEmail)) {
WCHAR wszBuff[MAX_EMAIL_LEN];
- MultiByteToWideChar(MRA_CODE_PAGE, 0, szEmail, -1, wszBuff, SIZEOF(wszBuff));
+ MultiByteToWideChar(MRA_CODE_PAGE, 0, szEmail, -1, wszBuff, _countof(wszBuff));
if (SendMessage(hWndList, LB_FINDSTRING, -1, (LPARAM)wszBuff) == LB_ERR)
SendMessage(hWndList, LB_ADDSTRING, 0, (LPARAM)wszBuff);
}
@@ -22,11 +22,11 @@ void AddContactEMailToListParam(MCONTACT hContact, BOOL bMRAOnly, LPSTR lpszModu for (int i = 0; true; i++) {
char szBuff[MAX_PATH];
- mir_snprintf(szBuff, SIZEOF(szBuff), "%s%lu", lpszValueName, i);
+ mir_snprintf(szBuff, _countof(szBuff), "%s%lu", lpszValueName, i);
if (DB_GetStringA(hContact, lpszModule, szBuff, szEmail)) {
if (bMRAOnly == FALSE || IsEMailMR(szEmail)) {
WCHAR wszBuff[MAX_EMAIL_LEN];
- MultiByteToWideChar(MRA_CODE_PAGE, 0, szEmail, -1, wszBuff, SIZEOF(wszBuff));
+ MultiByteToWideChar(MRA_CODE_PAGE, 0, szEmail, -1, wszBuff, _countof(wszBuff));
if (SendMessage(hWndList, LB_FINDSTRING, -1, (LPARAM)wszBuff) == LB_ERR)
SendMessage(hWndList, LB_ADDSTRING, 0, (LPARAM)wszBuff);
}
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 8197824146..2425c27ccc 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -423,7 +423,7 @@ DWORD CMraProto::GetContactBasicInfoW(MCONTACT hContact, DWORD *pdwID, DWORD *pd for (int i = 0; i < 3; i++) {
char szValue[50];
- mir_snprintf(szValue, SIZEOF(szValue), "MyPhone%d", i);
+ mir_snprintf(szValue, _countof(szValue), "MyPhone%d", i);
if (DB_GetStringA(hContact, "UserInfo", szValue, szPhone)) {
if (szPhones->GetLength())
szPhones->AppendChar(',');
@@ -474,7 +474,7 @@ DWORD CMraProto::SetContactBasicInfoW(MCONTACT hContact, DWORD dwSetInfoFlags, D break;
char szValue[MAX_PATH];
- mir_snprintf(szValue, SIZEOF(szValue), "MyPhone%d", i++);
+ mir_snprintf(szValue, _countof(szValue), "MyPhone%d", i++);
DB_SetStringExA(hContact, "UserInfo", szValue, "+" + szPhone);
}
}
@@ -644,14 +644,14 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & MCONTACT hContact = NULL;
TCHAR szMailBoxStatus[MAX_SECONDLINE];
- mir_sntprintf(szMailBoxStatus, SIZEOF(szMailBoxStatus), TranslateT("Unread mail is available: %lu/%lu messages"), m_dwEmailMessagesUnread, dwEmailMessagesTotal);
+ mir_sntprintf(szMailBoxStatus, _countof(szMailBoxStatus), TranslateT("Unread mail is available: %lu/%lu messages"), m_dwEmailMessagesUnread, dwEmailMessagesTotal);
if (!pszFrom.IsEmpty() || !pszSubject.IsEmpty()) {
CMStringA szFrom, szSubject;
if (GetEMailFromString(szFrom, szEmail))
hContact = MraHContactFromEmail(szEmail, FALSE, TRUE, NULL);
- mir_sntprintf(szStatusText, SIZEOF(szStatusText), TranslateT("From: %S\r\nSubject: %S\r\n%s"), pszFrom.c_str(), szSubject.c_str(), szMailBoxStatus);
+ mir_sntprintf(szStatusText, _countof(szStatusText), TranslateT("From: %S\r\nSubject: %S\r\n%s"), pszFrom.c_str(), szSubject.c_str(), szMailBoxStatus);
}
else _tcsncpy_s(szStatusText, szMailBoxStatus, _TRUNCATE);
@@ -692,7 +692,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & hWndEMailPopupStatus = NULL;
}
else {
- mir_sntprintf(szStatusText, SIZEOF(szStatusText), TranslateT("No unread mail is available\r\nTotal messages: %lu"), dwEmailMessagesTotal);
+ mir_sntprintf(szStatusText, _countof(szStatusText), TranslateT("No unread mail is available\r\nTotal messages: %lu"), dwEmailMessagesTotal);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_EMAIL_STATUS, (MRA_POPUP_ALLOW_ENTER), szStatusText);
}
}
@@ -802,7 +802,7 @@ DWORD GetContactEMailCountParam(MCONTACT hContact, BOOL bMRAOnly, LPSTR lpszModu for (int i = 0; TRUE; i++) {
char szBuff[100];
- mir_snprintf(szBuff, SIZEOF(szBuff), "%s%lu", lpszValueName, i);
+ mir_snprintf(szBuff, _countof(szBuff), "%s%lu", lpszValueName, i);
if (DB_GetStringA(hContact, lpszModule, szBuff, szEmail)) {
if (bMRAOnly == FALSE || IsEMailMR(szEmail))
dwRet++;
@@ -840,7 +840,7 @@ bool GetContactFirstEMailParam(MCONTACT hContact, BOOL bMRAOnly, LPSTR lpszModul for (int i = 0; true; i++) {
char szBuff[100];
- mir_snprintf(szBuff, SIZEOF(szBuff), "%s%lu", lpszValueName, i);
+ mir_snprintf(szBuff, _countof(szBuff), "%s%lu", lpszValueName, i);
if (DB_GetStringA(hContact, lpszModule, szBuff, szEmail)) {
if (bMRAOnly == FALSE || IsEMailMR(szEmail)) {
res = szEmail;
@@ -875,9 +875,9 @@ void CMraProto::ShowFormattedErrorMessage(LPWSTR lpwszErrText, DWORD dwErrorCode if (dwErrorCode == NO_ERROR)
_tcsncpy_s(szErrorText, TranslateTS(lpwszErrText), _TRUNCATE);
else {
- dwErrDescriptionSize = (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode, 0, szErrDescription, (SIZEOF(szErrDescription) - sizeof(WCHAR)), NULL) - 2);
+ dwErrDescriptionSize = (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode, 0, szErrDescription, (_countof(szErrDescription) - sizeof(WCHAR)), NULL) - 2);
szErrDescription[dwErrDescriptionSize] = 0;
- mir_sntprintf(szErrorText, SIZEOF(szErrorText), _T("%s %lu: %s"), TranslateTS(lpwszErrText), dwErrorCode, szErrDescription);
+ mir_sntprintf(szErrorText, _countof(szErrorText), _T("%s %lu: %s"), TranslateTS(lpwszErrText), dwErrorCode, szErrDescription);
}
MraPopupShowFromAgentW(MRA_POPUP_TYPE_ERROR, 0, szErrorText);
}
@@ -996,13 +996,13 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP SendMessage(hWndDlg, WM_SETICON, ICON_BIG, (LPARAM)dat->hDlgIcon);
SetWindowText(hWndDlg, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus]));
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldName", dat->dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldName", dat->dwXStatus);
if (dat->ppro->mraGetStringW(NULL, szValueName, szBuff))
SetDlgItemText(hWndDlg, IDC_XTITLE, szBuff.c_str()); // custom xstatus name
else // default xstatus name
SetDlgItemText(hWndDlg, IDC_XTITLE, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus]));
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dat->dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldMsg", dat->dwXStatus);
if (dat->ppro->mraGetStringW(NULL, szValueName, szBuff))
SetDlgItemText(hWndDlg, IDC_XMSG, szBuff.c_str()); // custom xstatus description
else // default xstatus description
@@ -1017,7 +1017,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP case WM_TIMER:
if (dat->dwCountdown != -1) {
TCHAR szBuff[MAX_PATH];
- mir_sntprintf(szBuff, SIZEOF(szBuff), TranslateT("Closing in %ld"), dat->dwCountdown--);
+ mir_sntprintf(szBuff, _countof(szBuff), TranslateT("Closing in %ld"), dat->dwCountdown--);
SetDlgItemText(hWndDlg, IDOK, szBuff);
break;
}
@@ -1047,7 +1047,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP DWORD dwBuffSize = GetDlgItemText(hWndDlg, IDC_XMSG, szBuff, (STATUS_DESC_MAX + 1));
char szValueName[MAX_PATH];
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dat->dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldMsg", dat->dwXStatus);
dat->ppro->mraSetStringExW(NULL, szValueName, szBuff);
dat->ppro->mraSetStringExW(NULL, DBSETTING_XSTATUSMSG, szBuff);
@@ -1056,7 +1056,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP mir_tstrncpy(szBuff, TranslateTS(lpcszXStatusNameDef[dat->dwXStatus]), STATUS_TITLE_MAX + 1);
dwBuffSize = (DWORD)mir_wstrlen(szBuff);
}
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%dName", dat->dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%dName", dat->dwXStatus);
dat->ppro->mraSetStringExW(NULL, szValueName, szBuff);
dat->ppro->mraSetStringExW(NULL, DBSETTING_XSTATUSNAME, szBuff);
@@ -1147,7 +1147,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w DWORDLONG dwBlogStatusID;
TCHAR szBuff[MICBLOG_STATUS_MAX];
- GetDlgItemText(hWndDlg, IDC_MSG_TO_SEND, szBuff, SIZEOF(szBuff));
+ GetDlgItemText(hWndDlg, IDC_MSG_TO_SEND, szBuff, _countof(szBuff));
if (dat->hContact) {
dwFlags = (MRIM_BLOG_STATUS_REPLY | MRIM_BLOG_STATUS_NOTIFY);
@@ -1176,7 +1176,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w size_t dwMessageSize = GetWindowTextLength(GetDlgItem(hWndDlg, IDC_MSG_TO_SEND));
EnableWindow(GetDlgItem(hWndDlg, IDOK), (int)dwMessageSize);
- mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%d/%d"), dwMessageSize, MICBLOG_STATUS_MAX);
+ mir_sntprintf(tszBuff, _countof(tszBuff), _T("%d/%d"), dwMessageSize, MICBLOG_STATUS_MAX);
SetDlgItemText(hWndDlg, IDC_STATIC_CHARS_COUNTER, tszBuff);
}
break;
@@ -1442,7 +1442,7 @@ static const size_t dwXMLSymbolsCount[] = { sizeof(TCHAR), sizeof(TCHAR), sizeof CMStringW DecodeXML(const CMStringW &lptszMessage)
{
CMStringW ret('\0', (lptszMessage.GetLength() * 4));
- ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(TCHAR), SIZEOF(lpszXMLTags), (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, ret);
+ ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(TCHAR), _countof(lpszXMLTags), (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, ret);
return ret;
}
@@ -1450,6 +1450,6 @@ CMStringW DecodeXML(const CMStringW &lptszMessage) CMStringW EncodeXML(const CMStringW &lptszMessage)
{
CMStringW ret('\0', (lptszMessage.GetLength() * 4));
- ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(TCHAR), SIZEOF(lpszXMLTags), (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, ret);
+ ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(TCHAR), _countof(lpszXMLTags), (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, ret);
return ret;
}
diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index 6f349e9d0d..ec0ee058dd 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -282,7 +282,7 @@ int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM) pszServiceFunctionName = szServiceFunction + mir_strlen(m_szModuleName);
TCHAR szItem[MAX_PATH + 64];
- mir_sntprintf(szItem, SIZEOF(szItem), _T("%s Custom Status"), m_tszUserName);
+ mir_sntprintf(szItem, _countof(szItem), _T("%s Custom Status"), m_tszUserName);
CLISTMENUITEM mi = { sizeof(mi) };
mi.position = 2000060000;
@@ -301,7 +301,7 @@ int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM) mir_snprintf(pszServiceFunctionName, 100, "/menuXStatus%ld", i);
mi.position ++;
if (i) {
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldName", i);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldName", i);
if (mraGetStringW(NULL, szValueName, szStatusTitle))
mi.ptszName = (TCHAR*)szStatusTitle.c_str();
else
@@ -400,7 +400,7 @@ void CMraProto::InitMenus() // xstatus menu
for (DWORD i = 0; i < MRA_XSTATUS_COUNT; i++) {
char szServiceName[100];
- mir_snprintf(szServiceName, SIZEOF(szServiceName), "/menuXStatus%d", i);
+ mir_snprintf(szServiceName, _countof(szServiceName), "/menuXStatus%d", i);
CreateProtoServiceParam(szServiceName, &CMraProto::MraXStatusMenu, i);
}
}
diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp index 4bf263fb2c..b833a7cd22 100644 --- a/protocols/MRA/src/Mra_options.cpp +++ b/protocols/MRA/src/Mra_options.cpp @@ -37,10 +37,10 @@ INT_PTR CALLBACK DlgProcOptsAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
TCHAR szBuff[MAX_EMAIL_LEN];
- GetDlgItemText(hWndDlg, IDC_LOGIN, szBuff, SIZEOF(szBuff));
+ GetDlgItemText(hWndDlg, IDC_LOGIN, szBuff, _countof(szBuff));
ppro->setTString(NULL, "e-mail", szBuff);
- if (GetDlgItemText(hWndDlg, IDC_PASSWORD, szBuff, SIZEOF(szBuff))) {
+ if (GetDlgItemText(hWndDlg, IDC_PASSWORD, szBuff, _countof(szBuff))) {
ppro->setTString("Password", szBuff);
SecureZeroMemory(szBuff, sizeof(szBuff));
}
@@ -87,10 +87,10 @@ INT_PTR CALLBACK DlgProcAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lP switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
TCHAR szBuff[MAX_EMAIL_LEN];
- GetDlgItemText(hWndDlg, IDC_LOGIN, szBuff, SIZEOF(szBuff));
+ GetDlgItemText(hWndDlg, IDC_LOGIN, szBuff, _countof(szBuff));
ppro->mraSetStringW(NULL, "e-mail", szBuff);
- if (GetDlgItemText(hWndDlg, IDC_PASSWORD, szBuff, SIZEOF(szBuff))) {
+ if (GetDlgItemText(hWndDlg, IDC_PASSWORD, szBuff, _countof(szBuff))) {
ppro->setTString("Password", szBuff);
SecureZeroMemory(szBuff, sizeof(szBuff));
}
@@ -186,7 +186,7 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg, UINT msg, WPARAM wParam, L switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
TCHAR szBuff[MAX_PATH];
- GetDlgItemText(hWndDlg, IDC_SERVER, szBuff, SIZEOF(szBuff));
+ GetDlgItemText(hWndDlg, IDC_SERVER, szBuff, _countof(szBuff));
ppro->mraSetStringW(NULL, "Server", szBuff);
ppro->setWord("ServerPort", (WORD)GetDlgItemInt(hWndDlg, IDC_SERVERPORT, NULL, FALSE));
ppro->setByte("AutoAddContactsToServer", IsDlgButtonChecked(hWndDlg, IDC_AUTO_ADD_CONTACTS_TO_SERVER));
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index f1060c459e..3279852f6a 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -156,7 +156,7 @@ DWORD CMraProto::MraGetNLBData(CMStringA &szHost, WORD *pwPort) bContinue = FALSE;
break;
case 1:
- dwBytesReceived = Netlib_Recv(nls.hReadConns[0], (LPSTR)(btBuff + dwRcvBuffSizeUsed), (int)(SIZEOF(btBuff) - dwRcvBuffSizeUsed), 0);
+ dwBytesReceived = Netlib_Recv(nls.hReadConns[0], (LPSTR)(btBuff + dwRcvBuffSizeUsed), (int)(_countof(btBuff) - dwRcvBuffSizeUsed), 0);
if (dwBytesReceived && dwBytesReceived != SOCKET_ERROR)
dwRcvBuffSizeUsed += dwBytesReceived;
else
@@ -349,11 +349,11 @@ bool CMraProto::CmdHelloAck(BinBuffer &buf) DWORD dwXStatusMir = m_iXStatus, dwXStatus;
DWORD dwStatus = GetMraStatusFromMiradaStatus(m_iDesiredStatus, dwXStatusMir, &dwXStatus);
if (IsXStatusValid(dwXStatusMir)) {// xstatuses
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldName", dwXStatusMir);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldName", dwXStatusMir);
if (!mraGetStringW(NULL, szValueName, wszStatusTitle))
wszStatusTitle = TranslateTS(lpcszXStatusNameDef[dwXStatusMir]);
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dwXStatusMir);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldMsg", dwXStatusMir);
mraGetStringW(NULL, szValueName, wszStatusDesc);
}
else wszStatusTitle = pcli->pfnGetStatusModeDescription(m_iDesiredStatus, 0);
@@ -646,7 +646,7 @@ bool CMraProto::CmdFileTransferAck(BinBuffer &buf) break;
default:// ## unknown error
TCHAR szBuff[1024];
- mir_sntprintf(szBuff, SIZEOF(szBuff), TranslateT("MRIM_CS_FILE_TRANSFER_ACK: unknown error, code: %lu"), dwAckType);
+ mir_sntprintf(szBuff, _countof(szBuff), TranslateT("MRIM_CS_FILE_TRANSFER_ACK: unknown error, code: %lu"), dwAckType);
ShowFormattedErrorMessage(szBuff, NO_ERROR);
break;
}
@@ -743,7 +743,7 @@ bool CMraProto::CmdContactAck(int cmd, int seq, BinBuffer &buf) break;
default:// ## unknown error
TCHAR szBuff[1024];
- mir_sntprintf(szBuff, SIZEOF(szBuff), TranslateT("MRIM_CS_*_CONTACT_ACK: unknown server error, code: %lu"), dwTemp);
+ mir_sntprintf(szBuff, _countof(szBuff), TranslateT("MRIM_CS_*_CONTACT_ACK: unknown server error, code: %lu"), dwTemp);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff);
break;
}
@@ -1037,7 +1037,7 @@ bool CMraProto::CmdGame(BinBuffer &buf) break;
default:
TCHAR szBuff[1024];
- mir_sntprintf(szBuff, SIZEOF(szBuff), TranslateT("MRIM_CS_GAME: unknown internal game message code: %lu"), dwGameMsg);
+ mir_sntprintf(szBuff, _countof(szBuff), TranslateT("MRIM_CS_GAME: unknown internal game message code: %lu"), dwGameMsg);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff);
break;
}
@@ -1205,7 +1205,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) }
else if (fieldType == 'u') {
char szBuff[50];
- mir_snprintf(szBuff, SIZEOF(szBuff), "%lu, ", dwTemp);//;
+ mir_snprintf(szBuff, _countof(szBuff), "%lu, ", dwTemp);//;
debugLogA("%s ", szBuff);
}
else _CrtDbgBreak();
@@ -1345,7 +1345,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf) ShowFormattedErrorMessage(L"MRIM_CS_CONTACT_LIST2: internal server error", NO_ERROR);
else {
TCHAR szBuff[1024];
- mir_sntprintf(szBuff, SIZEOF(szBuff), TranslateT("MRIM_CS_CONTACT_LIST2: unknown server error, code: %lu"), dwTemp);
+ mir_sntprintf(szBuff, _countof(szBuff), TranslateT("MRIM_CS_CONTACT_LIST2: unknown server error, code: %lu"), dwTemp);
MraPopupShowFromAgentW(MRA_POPUP_TYPE_DEBUG, 0, szBuff);
}
}
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index 4d27ea4e4e..44b6dde3ac 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -353,13 +353,13 @@ DWORD CMraProto::MraSetXStatusInternal(DWORD dwXStatus) // obsolete (TODO: remove in next version)
char szValueName[MAX_PATH];
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldName", dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldName", dwXStatus);
if (!mraGetStringW(NULL, szValueName, szBuff))
szBuff = lpcszXStatusNameDef[dwXStatus];
mraSetStringExW(NULL, DBSETTING_XSTATUSNAME, szBuff);
// obsolete (TODO: remove in next version)
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldMsg", dwXStatus);
if (mraGetStringW(NULL, szValueName, szBuff))
mraSetStringExW(NULL, DBSETTING_XSTATUSMSG, szBuff);
else
@@ -401,7 +401,7 @@ INT_PTR CMraProto::MraSetXStatusEx(WPARAM, LPARAM lParam) // set custom status name
if (pData->flags & CSSF_MASK_NAME) {
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldName", dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldName", dwXStatus);
if (pData->flags & CSSF_UNICODE) {
mraSetStringExW(NULL, szValueName, pData->pwszName);
mraSetStringExW(NULL, DBSETTING_XSTATUSNAME, pData->pwszName);
@@ -414,7 +414,7 @@ INT_PTR CMraProto::MraSetXStatusEx(WPARAM, LPARAM lParam) // set custom status message
if (pData->flags & CSSF_MASK_MESSAGE) {
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dwXStatus);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldMsg", dwXStatus);
if (pData->flags & CSSF_UNICODE) {
mraSetStringExW(NULL, szValueName, pData->pwszMessage);
mraSetStringExW(NULL, DBSETTING_XSTATUSMSG, pData->pwszMessage);
@@ -528,7 +528,7 @@ DWORD CMraProto::MraSendNewStatus(DWORD dwStatusMir, DWORD dwXStatusMir, const C if (IsXStatusValid(dwXStatusMir)) {
char szValueName[MAX_PATH];
if (pwszStatusTitle.IsEmpty()) {
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldName", dwXStatusMir);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldName", dwXStatusMir);
// custom xstatus name
if (!mraGetStringW(NULL, szValueName, wszStatusTitle))
wszStatusTitle = TranslateTS(lpcszXStatusNameDef[dwXStatusMir]);
@@ -536,7 +536,7 @@ DWORD CMraProto::MraSendNewStatus(DWORD dwStatusMir, DWORD dwXStatusMir, const C else wszStatusTitle = pwszStatusTitle;
if (pwszStatusDesc.IsEmpty()) {
- mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dwXStatusMir);
+ mir_snprintf(szValueName, _countof(szValueName), "XStatus%ldMsg", dwXStatusMir);
// custom xstatus description
mraGetStringW(NULL, szValueName, wszStatusDesc);
}
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index c6c9209b89..c866135156 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -153,8 +153,8 @@ int CMsnProto::MSN_GetPassportAuth(void) time_t ts = time(NULL);
TCHAR szTs1[64], szTs2[64];
- TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts, _T("I"), szTs1, SIZEOF(szTs1), 0);
- TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts + 20 * 60, _T("I"), szTs2, SIZEOF(szTs2), 0);
+ TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts, _T("I"), szTs1, _countof(szTs1), 0);
+ TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, ts + 20 * 60, _T("I"), szTs2, _countof(szTs2), 0);
CMStringA szAuthInfo(FORMAT, authPacket, int(ts), MyOptions.szEmail, ptrA(HtmlEncode(szPassword)), szTs1, szTs2);
@@ -266,7 +266,7 @@ int CMsnProto::MSN_GetPassportAuth(void) }
else if (retVal != 3 && retVal != 7) {
char err[512];
- mir_snprintf(err, SIZEOF(err), "Unknown Authentication error: %s", szFault);
+ mir_snprintf(err, _countof(err), "Unknown Authentication error: %s", szFault);
MSN_ShowError(err);
}
}
@@ -954,7 +954,7 @@ const char *CMsnProto::GetSkypeToken(bool bAsAuthHeader) nlhr.requestType = REQUEST_POST;
nlhr.flags = NLHRF_HTTP11 | NLHRF_DUMPASTEXT | NLHRF_PERSISTENT | NLHRF_REDIRECT;
nlhr.nlc = hHttpsConnection;
- nlhr.headersCount = SIZEOF(headers);
+ nlhr.headersCount = _countof(headers);
nlhr.headers = headers;
nlhr.headers[0].szName = "User-Agent";
nlhr.headers[0].szValue = (char*)MSN_USER_AGENT;
diff --git a/protocols/MSN/src/msn_avatar.cpp b/protocols/MSN/src/msn_avatar.cpp index 3e268e3b5b..5c8d3985d2 100644 --- a/protocols/MSN/src/msn_avatar.cpp +++ b/protocols/MSN/src/msn_avatar.cpp @@ -79,7 +79,7 @@ LBL_Error: PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = fmt;
ai.hContact = p->hContact;
- MSN_GetAvatarFileName(ai.hContact, ai.filename, SIZEOF(ai.filename), szExt);
+ MSN_GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename), szExt);
_tremove(ai.filename);
int fileId = _topen(ai.filename, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 6920312d4f..e1aa017893 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -47,14 +47,14 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p {
char *szNet, *szEmail;
- _tcsncpy(info->mChatID, _A2T(pszID), SIZEOF(info->mChatID));
+ _tcsncpy(info->mChatID, _A2T(pszID), _countof(info->mChatID));
parseWLID(NEWSTR_ALLOCA(pszID), &szNet, &szEmail, NULL);
info->netId = atoi(szNet);
strncpy(info->szEmail, szEmail, sizeof(info->szEmail));
TCHAR szName[512];
InterlockedIncrement(&m_chatID);
- if (*pszTopic) _tcsncpy(szName, _A2T(pszTopic), SIZEOF(szName));
+ if (*pszTopic) _tcsncpy(szName, _A2T(pszTopic), _countof(szName));
else mir_sntprintf(szName, _T("%s %s%d"),
m_tszUserName, TranslateT("Chat #"), m_chatID);
@@ -67,7 +67,7 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p GCDEST gcd = { m_szModuleName, info->mChatID, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
- for (int j = 0; j < SIZEOF(m_ptszRoles); j++) {
+ for (int j = 0; j < _countof(m_ptszRoles); j++) {
gce.ptszStatus = m_ptszRoles[j];
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
}
@@ -431,7 +431,7 @@ INT_PTR CALLBACK DlgInviteToChat(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_ADDSCR:
if (param->ppro->msnLoggedIn) {
TCHAR email[MSN_MAX_EMAIL_LEN];
- GetDlgItemText(hwndDlg, IDC_EDITSCR, email, SIZEOF(email));
+ GetDlgItemText(hwndDlg, IDC_EDITSCR, email, _countof(email));
CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
@@ -620,7 +620,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) { LPGENT("&Invite user..."), 10, MENU_ITEM, FALSE },
{ LPGENT("&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) {
@@ -633,7 +633,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) { _T(""), 100, MENU_SEPARATOR, FALSE },
{ LPGENT("&Leave chat session"), 110, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
else {
@@ -653,7 +653,7 @@ int CMsnProto::MSN_GCMenuHook(WPARAM, LPARAM lParam) if (pszRole && !mir_tstrcmpi(pszRole, _T("admin")))
Items[3].pszDesc = LPGENT("&Deop user");
}
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
mir_free(email);
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index c65359a54a..9502935601 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -60,7 +60,7 @@ void CMsnProto::MSN_SetMirVer(MCONTACT hContact, DWORD dwValue, bool always) else if (dwValue == 0x30000024)
szVersion = "Miranda IM 0.4.x (MSN v.0.4.x)";
else if (always || getByte(hContact, "StdMirVer", 0)) {
- unsigned wlmId = min(dwValue >> 28 & 0xff, SIZEOF(MirVerStr) - 1);
+ unsigned wlmId = min(dwValue >> 28 & 0xff, _countof(MirVerStr) - 1);
szVersion = MirVerStr[wlmId];
}
else
@@ -85,7 +85,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para struct { char *typeId, *strMsgBytes; } datas;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2) {
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2) {
debugLogA("Invalid %.3s command, ignoring", cmdString);
return;
}
@@ -439,7 +439,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) nlhr.flags = NLHRF_GENERATEHOST | NLHRF_PERSISTENT | NLHRF_SMARTAUTHHEADER;
nlhr.szUrl = uri;
nlhr.headers = (NETLIBHTTPHEADER*)&nlbhHeaders;
- nlhr.headersCount = SIZEOF(nlbhHeaders);
+ nlhr.headersCount = _countof(nlbhHeaders);
nlhr.nlc = hHttpsConnection;
mHttpsTS = clock();
@@ -481,7 +481,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) sprintf(ft->szInvcookie, "%s/content/imgpsh", uri);
TCHAR tComment[40];
- mir_sntprintf(tComment, SIZEOF(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_sntprintf(tComment, _countof(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
@@ -522,7 +522,7 @@ void CMsnProto::MSN_ProcessYFind(char* buf, size_t len) const char* szCont = ezxml_attr(cont, "n");
char szEmail[128];
- mir_snprintf(szEmail, SIZEOF(szEmail), "%s@%s", szCont, szDom);
+ mir_snprintf(szEmail, _countof(szEmail), "%s@%s", szCont, szDom);
const char *szNetId = ezxml_attr(cont, "t");
if (msnSearchId != NULL) {
@@ -721,7 +721,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) unsigned pCount;
char* p = (char*)szCrntMda;
- for (pCount = 0; pCount < SIZEOF(parts); ++pCount) {
+ for (pCount = 0; pCount < _countof(parts); ++pCount) {
parts[pCount] = p;
char* p1 = strstr(p, "\\0");
@@ -762,7 +762,7 @@ void CMsnProto::MSN_ProcessStatusMessage(ezxml_t xmli, const char* wlid) for (unsigned i = 4; i < pCount; i++) {
char part[16];
- size_t lenPart = mir_snprintf(part, SIZEOF(part), "{%d}", i - 4);
+ size_t lenPart = mir_snprintf(part, _countof(part), "{%d}", i - 4);
if (parts[i][0] == '\0' && unknown != NULL)
parts[i] = unknown;
size_t lenPartsI = mir_strlen(parts[i]);
@@ -837,13 +837,13 @@ void CMsnProto::MSN_ProcessNotificationMessage(char* buf, size_t len) const char* acturl = ezxml_attr(xmlact, "url");
if (acturl == NULL || strstr(acturl, "://") == NULL)
- sz += mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "%s", ezxml_attr(xmlnot, "siteurl"));
+ sz += mir_snprintf((fullurl + sz), (_countof(fullurl) - sz), "%s", ezxml_attr(xmlnot, "siteurl"));
- sz += mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "%s", acturl);
+ sz += mir_snprintf((fullurl + sz), (_countof(fullurl) - sz), "%s", acturl);
if (sz != 0 && fullurl[sz - 1] != '?')
- sz += mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "?");
+ sz += mir_snprintf((fullurl + sz), (_countof(fullurl) - sz), "?");
- mir_snprintf((fullurl + sz), (SIZEOF(fullurl) - sz), "notification_id=%s&message_id=%s",
+ mir_snprintf((fullurl + sz), (_countof(fullurl) - sz), "notification_id=%s&message_id=%s",
ezxml_attr(xmlnot, "id"), ezxml_attr(xmlmsg, "id"));
SkinPlaySound(alertsoundname);
@@ -896,7 +896,7 @@ int CMsnProto::MSN_HandleCommands(ThreadData* info, char* cmdString) struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2) {
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2) {
LBL_InvalidCommand:
debugLogA("Invalid %.3s command, ignoring", cmdString);
break;
@@ -935,7 +935,7 @@ LBL_InvalidCommand: struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
MimeHeaders tHeader;
@@ -966,7 +966,7 @@ LBL_InvalidCommand: struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
HReadBuffer buf(info, 0);
@@ -1034,7 +1034,7 @@ LBL_InvalidCommand: struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
MimeHeaders tHeader;
@@ -1198,7 +1198,7 @@ LBL_InvalidCommand: struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
HReadBuffer buf(info, 0);
@@ -1271,7 +1271,7 @@ LBL_InvalidCommand: struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
MimeHeaders tHeader;
@@ -1322,7 +1322,7 @@ LBL_InvalidCommand: struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2)
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2)
goto LBL_InvalidCommand;
MimeHeaders tHeader;
@@ -1434,7 +1434,7 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, ft->p2p_dest = mir_strdup(email);
TCHAR tComment[40];
- mir_sntprintf(tComment, SIZEOF(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_sntprintf(tComment, _countof(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
@@ -1452,9 +1452,9 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, ThreadData* newThread = new ThreadData;
if (inet_addr(IPAddress) != MyConnection.extIP || !IPAddressInt)
- mir_snprintf(newThread->mServer, SIZEOF(newThread->mServer), "%s:%s", IPAddress, Port);
+ mir_snprintf(newThread->mServer, _countof(newThread->mServer), "%s:%s", IPAddress, Port);
else
- mir_snprintf(newThread->mServer, SIZEOF(newThread->mServer), "%s:%u", IPAddressInt, atol(PortXInt) ^ 0x3141);
+ mir_snprintf(newThread->mServer, _countof(newThread->mServer), "%s:%u", IPAddressInt, atol(PortXInt) ^ 0x3141);
newThread->mType = SERVER_FILETRANS;
@@ -1531,7 +1531,7 @@ void CMsnProto::MSN_InviteMessage(ThreadData* info, char* msgBody, char* email, if (IPAddress != NULL && Port == NULL && SessionID != NULL && SessionProtocol == NULL) { // netmeeting receive 2
char ipaddr[256];
- mir_snprintf(ipaddr, SIZEOF(ipaddr), "callto://%s", IPAddress);
+ mir_snprintf(ipaddr, _countof(ipaddr), "callto://%s", IPAddress);
ShellExecuteA(NULL, "open", ipaddr, NULL, NULL, SW_SHOW);
}
}
@@ -1548,7 +1548,7 @@ void CMsnProto::MSN_ProcessRemove(char* buf, size_t len) int listId = atol(ezxml_attr(cont, "l"));
char szEmail[128];
- mir_snprintf(szEmail, SIZEOF(szEmail), "%s@%s", szCont, szDom);
+ mir_snprintf(szEmail, _countof(szEmail), "%s@%s", szCont, szDom);
Lists_Remove(listId, szEmail);
MsnContact* msc = Lists_Get(szEmail);
@@ -1609,7 +1609,7 @@ void CMsnProto::MSN_CustomSmiley(const char* msgBody, char* email, char* nick, i ptrA smileyName(mir_urlEncode(buf));
TCHAR path[MAX_PATH];
- MSN_GetCustomSmileyFileName(hContact, path, SIZEOF(path), smileyName, iSmileyType);
+ MSN_GetCustomSmileyFileName(hContact, path, _countof(path), smileyName, iSmileyType);
ft->std.tszCurrentFile = mir_tstrdup(path);
if (p2p_IsDlFileOk(ft))
@@ -1644,7 +1644,7 @@ void CMsnProto::MSN_ProcessAdd(char* buf, size_t len) int netId = atol(ezxml_attr(cont, "t"));
char szEmail[128];
- mir_snprintf(szEmail, SIZEOF(szEmail), "%s@%s", szCont, szDom);
+ mir_snprintf(szEmail, _countof(szEmail), "%s@%s", szCont, szDom);
UrlDecode((char*)szNick);
@@ -2206,7 +2206,7 @@ LBL_InvalidCommand: newThread->mType = SERVER_SWITCHBOARD;
newThread->mInitialContactWLID = mir_strdup(data.callerEmail);
MSN_HContactFromEmail(data.callerEmail, data.callerNick, true, true);
- mir_snprintf(newThread->mCookie, SIZEOF(newThread->mCookie), "%s %d", data.authChallengeInfo, trid);
+ mir_snprintf(newThread->mCookie, _countof(newThread->mCookie), "%s %d", data.authChallengeInfo, trid);
ReleaseSemaphore(newThread->hWaitEvent, MSN_PACKETS_COMBINE, NULL);
@@ -2354,7 +2354,7 @@ LBL_InvalidCommand: case ' XUU': // UUX: MSNP11 addition
{
char* tWords[1];
- if (sttDivideWords(params, SIZEOF(tWords), tWords) != SIZEOF(tWords))
+ if (sttDivideWords(params, _countof(tWords), tWords) != _countof(tWords))
goto LBL_InvalidCommand;
int len = atol(tWords[0]);
diff --git a/protocols/MSN/src/msn_errors.cpp b/protocols/MSN/src/msn_errors.cpp index f67293eb2d..64a79fb45a 100644 --- a/protocols/MSN/src/msn_errors.cpp +++ b/protocols/MSN/src/msn_errors.cpp @@ -52,7 +52,7 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString) struct { char *typeId, *strMsgBytes; } data;
};
- if (sttDivideWords(params, SIZEOF(tWords), tWords) < 2) {
+ if (sttDivideWords(params, _countof(tWords), tWords) < 2) {
debugLogA("Invalid %.3s command, ignoring", cmdString);
return 0;
}
@@ -90,7 +90,7 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString) case ERR_DETAILED_ERR_IN_PAYLOAD:
case ERR_LIST_UNAVAILABLE:
char* tWords[4];
- if (sttDivideWords(cmdString, SIZEOF(tWords), tWords) == SIZEOF(tWords))
+ if (sttDivideWords(cmdString, _countof(tWords), tWords) == _countof(tWords))
HReadBuffer(info, 0).surelyRead(atol(tWords[3]));
return 0;
diff --git a/protocols/MSN/src/msn_ftold.cpp b/protocols/MSN/src/msn_ftold.cpp index c5f6c3025b..94e257fade 100644 --- a/protocols/MSN/src/msn_ftold.cpp +++ b/protocols/MSN/src/msn_ftold.cpp @@ -64,7 +64,7 @@ void CMsnProto::msnftp_invite(filetransfer *ft) pszFiles = *ft->std.ptszFiles;
char msg[1024];
- mir_snprintf(msg, SIZEOF(msg),
+ mir_snprintf(msg, _countof(msg),
"Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n"
"Application-Name: File Transfer\r\n"
"Application-GUID: {5D3E02AB-6190-11d3-BBBB-00C04F795683}\r\n"
@@ -152,7 +152,7 @@ int CMsnProto::MSN_HandleMSNFTP(ThreadData *info, char *cmdString) char tCommand[30];
size_t tCommandLen;
- tCommandLen = mir_snprintf(tCommand, SIZEOF(tCommand), "FIL %i\r\n", info->mMsnFtp->std.totalBytes);
+ tCommandLen = mir_snprintf(tCommand, _countof(tCommand), "FIL %i\r\n", info->mMsnFtp->std.totalBytes);
info->send(tCommand, tCommandLen);
break;
@@ -176,7 +176,7 @@ LBL_InvalidCommand: if (info->mCaller == 0) { //receive
char tCommand[MSN_MAX_EMAIL_LEN + 50];
size_t tCommandLen;
- tCommandLen = mir_snprintf(tCommand, SIZEOF(tCommand), "USR %s %s\r\n", MyOptions.szEmail, info->mCookie);
+ tCommandLen = mir_snprintf(tCommand, _countof(tCommand), "USR %s %s\r\n", MyOptions.szEmail, info->mCookie);
info->send(tCommand, tCommandLen);
}
else if (info->mCaller == 2) { //send
diff --git a/protocols/MSN/src/msn_lists.cpp b/protocols/MSN/src/msn_lists.cpp index 35310c1cfb..227f6ff9db 100644 --- a/protocols/MSN/src/msn_lists.cpp +++ b/protocols/MSN/src/msn_lists.cpp @@ -243,7 +243,7 @@ void CMsnProto::MSN_CleanupLists(void) mir_free(sze);
TCHAR title[128];
- mir_sntprintf(title, SIZEOF(title), TranslateT("%s protocol"), m_tszUserName);
+ mir_sntprintf(title, _countof(title), TranslateT("%s protocol"), m_tszUserName);
if (MessageBox(NULL, text, title, MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND) == IDYES) {
MSN_AddUser(p.hContact, p.email, 0, LIST_LL);
@@ -260,7 +260,7 @@ void CMsnProto::MSN_CleanupLists(void) if (p.list & (LIST_LL | LIST_FL) && p.hContact) {
TCHAR path[MAX_PATH];
- MSN_GetCustomSmileyFileName(p.hContact, path, SIZEOF(path), "", 0);
+ MSN_GetCustomSmileyFileName(p.hContact, path, _countof(path), "", 0);
if (path[0]) {
SMADD_CONT cont;
cont.cbSize = sizeof(SMADD_CONT);
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index 652bb0efcd..312cc2bfd7 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -255,14 +255,14 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) wchar_t* mimeSubjectW = tFileInfo.decode(Subject);
- mir_sntprintf(tBuffer2, SIZEOF(tBuffer2), TranslateT("Subject: %s"), mimeSubjectW);
+ mir_sntprintf(tBuffer2, _countof(tBuffer2), TranslateT("Subject: %s"), mimeSubjectW);
TCHAR* msgtxt = _stricmp(From, Fromaddr) ?
TranslateT("Hotmail from %s (%S)") : TranslateT("Hotmail from %s");
- mir_sntprintf(tBuffer, SIZEOF(tBuffer), msgtxt, mimeFromW, Fromaddr);
+ mir_sntprintf(tBuffer, _countof(tBuffer), msgtxt, mimeFromW, Fromaddr);
mir_free(mimeFromW);
mir_free(mimeSubjectW);
ShowPopup = true;
@@ -271,8 +271,8 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) const char* MailData = tFileInfo["Mail-Data"];
if (MailData != NULL) processMailData((char*)MailData);
- mir_sntprintf(tBuffer, SIZEOF(tBuffer), m_tszUserName);
- mir_sntprintf(tBuffer2, SIZEOF(tBuffer2), TranslateT("Unread mail is available: %d in Inbox and %d in other folders."), mUnreadMessages, mUnreadJunkEmails);
+ mir_sntprintf(tBuffer, _countof(tBuffer), m_tszUserName);
+ mir_sntprintf(tBuffer2, _countof(tBuffer2), TranslateT("Unread mail is available: %d in Inbox and %d in other folders."), mUnreadMessages, mUnreadJunkEmails);
}
if (UnreadMessages == mUnreadMessages && UnreadJunkEmails == mUnreadJunkEmails && !isInitial)
@@ -390,7 +390,7 @@ void CMsnProto::displayEmailCount(MCONTACT hContact) rtrimt(name);
TCHAR szNick[128];
- mir_sntprintf(szNick, SIZEOF(szNick),
+ mir_sntprintf(szNick, _countof(szNick),
getByte("DisableHotmailJunk", 0) ? _T("%s [%d]") : _T("%s [%d][%d]"), name, mUnreadMessages, mUnreadJunkEmails);
nickChg = true;
diff --git a/protocols/MSN/src/msn_menu.cpp b/protocols/MSN/src/msn_menu.cpp index 3899dc8cf8..e257a86e54 100644 --- a/protocols/MSN/src/msn_menu.cpp +++ b/protocols/MSN/src/msn_menu.cpp @@ -93,7 +93,7 @@ INT_PTR CMsnProto::MsnViewProfile(WPARAM hContact, LPARAM) }
char tUrl[256];
- mir_snprintf(tUrl, SIZEOF(tUrl), "http://cid-%I64X.profiles.live.com", _atoi64(cid));
+ mir_snprintf(tUrl, _countof(tUrl), "http://cid-%I64X.profiles.live.com", _atoi64(cid));
MsnInvokeMyURL(false, tUrl);
return 0;
}
@@ -181,7 +181,7 @@ INT_PTR CMsnProto::MsnSendNetMeeting(WPARAM wParam, LPARAM) char msg[1024];
- mir_snprintf(msg, SIZEOF(msg),
+ mir_snprintf(msg, _countof(msg),
"Content-Type: text/x-msmsgsinvite; charset=UTF-8\r\n\r\n"
"Application-Name: NetMeeting\r\n"
"Application-GUID: {44BBA842-CC51-11CF-AAFA-00AA00B6015C}\r\n"
@@ -232,7 +232,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam CMsnProto *proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (proto->msnLoggedIn) {
TCHAR str[130];
- GetDlgItemText(hwndDlg, IDC_NICKNAME, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_NICKNAME, str, _countof(str));
proto->MSN_SendNickname(str);
}
}
@@ -349,7 +349,7 @@ void CMsnProto::MSN_EnableMenuItems(bool bEnable) if (!bEnable)
mi.flags |= CMIF_GRAYED;
- for (int i = 0; i < SIZEOF(menuItemsMain); i++)
+ for (int i = 0; i < _countof(menuItemsMain); i++)
if (menuItemsMain[i] != NULL)
Menu_ModifyItem(menuItemsMain[i], &mi);
diff --git a/protocols/MSN/src/msn_mime.cpp b/protocols/MSN/src/msn_mime.cpp index 1b5651794d..7be06009a9 100644 --- a/protocols/MSN/src/msn_mime.cpp +++ b/protocols/MSN/src/msn_mime.cpp @@ -339,7 +339,7 @@ static const struct _tag_cpltbl static unsigned FindCP(const char* mimecp)
{
unsigned cp = CP_ACP;
- for (unsigned i = 0; i < SIZEOF(cptbl); ++i) {
+ for (unsigned i = 0; i < _countof(cptbl); ++i) {
if (_stricmp(mimecp, cptbl[i].mimecp) == 0) {
cp = cptbl[i].cp;
break;
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 4077447e09..6c5e3a4fcd 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -122,7 +122,7 @@ void CMsnProto::InitCustomFolders(void) if (InitCstFldRan) return;
TCHAR folder[MAX_PATH];
- mir_sntprintf(folder, SIZEOF(folder), _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
+ mir_sntprintf(folder, _countof(folder), _T("%%miranda_avatarcache%%\\%S"), m_szModuleName);
hCustomSmileyFolder = FoldersRegisterCustomPathT(LPGEN("Custom Smileys"), m_szModuleName, folder, m_tszUserName);
InitCstFldRan = true;
@@ -290,10 +290,10 @@ int CMsnProto::MSN_SetMyAvatar(const TCHAR* sztFname, void* pData, size_t cbLen) return fmt;
TCHAR szFileName[MAX_PATH];
- MSN_GetAvatarFileName(NULL, szFileName, SIZEOF(szFileName), NULL);
+ MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), NULL);
_tremove(szFileName);
- MSN_GetAvatarFileName(NULL, szFileName, SIZEOF(szFileName), szExt);
+ MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), szExt);
int fileId = _topen(szFileName, _O_CREAT | _O_TRUNC | _O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE);
if (fileId >= 0) {
@@ -479,7 +479,7 @@ int ThreadData::sendMessage(int, const char *email, int netId, const char *parMs #ifdef OBSOLETE
if (parFlags & MSG_OFFLINE)
- off += mir_snprintf((buf + off), (SIZEOF(buf) - off), "Dest-Agent: client\r\n");
+ off += mir_snprintf((buf + off), (_countof(buf) - off), "Dest-Agent: client\r\n");
#endif
}
@@ -541,7 +541,7 @@ void ThreadData::sendCaps(void) char mversion[100], capMsg[1000];
CallService(MS_SYSTEM_GETVERSIONTEXT, sizeof(mversion), (LPARAM)mversion);
- mir_snprintf(capMsg, SIZEOF(capMsg),
+ mir_snprintf(capMsg, _countof(capMsg),
"Content-Type: text/x-clientcaps\r\n\r\n"
"Client-Name: Miranda NG %s (MSN v.%s)\r\n",
mversion, __VERSION_STRING_DOTS);
@@ -586,7 +586,7 @@ int ThreadData::sendRawMessage(int msgType, const char* data, int datLen) void CMsnProto::MSN_SendTyping(ThreadData* info, const char* email, int netId, bool bTyping)
{
char tCommand[1024];
- mir_snprintf(tCommand, SIZEOF(tCommand),
+ mir_snprintf(tCommand, _countof(tCommand),
"Messaging: 2.0\r\n"
"Message-Type: %s\r\n"
"Content-Type: Application/Message\r\n"
@@ -632,7 +632,7 @@ void CMsnProto::MSN_SendStatusMessage(const char*) size_t sz;
char szMsg[2048];
if (msnCurrentMedia.cbSize == 0) {
- sz = mir_snprintf(szMsg, SIZEOF(szMsg), "<Data><PSM>%s</PSM><CurrentMedia></CurrentMedia><MachineGuid>%s</MachineGuid>"
+ sz = mir_snprintf(szMsg, _countof(szMsg), "<Data><PSM>%s</PSM><CurrentMedia></CurrentMedia><MachineGuid>%s</MachineGuid>"
"<DDP></DDP><SignatureSound></SignatureSound><Scene></Scene><ColorScheme></ColorScheme></Data>",
msgEnc, MyOptions.szMachineGuid);
}
@@ -667,7 +667,7 @@ void CMsnProto::MSN_SendStatusMessage(const char*) *szPlayer = HtmlEncodeUTF8T(msnCurrentMedia.ptszPlayer),
*szType = HtmlEncodeUTF8T(msnCurrentMedia.ptszType);
- sz = mir_snprintf(szMsg, SIZEOF(szMsg),
+ sz = mir_snprintf(szMsg, _countof(szMsg),
"<Data>"
"<PSM>%s</PSM>"
"<CurrentMedia>%s\\0%s\\01\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0%s\\0\\0</CurrentMedia>"
@@ -799,7 +799,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus) char szMsg[2048];
#ifdef OBSOLETE
if (m_iStatus < ID_STATUS_ONLINE) {
- int sz = mir_snprintf(szMsg, SIZEOF(szMsg),
+ int sz = mir_snprintf(szMsg, _countof(szMsg),
"<EndpointData><Capabilities>%u:%u</Capabilities></EndpointData>", myFlags, myFlagsEx);
msnNsThread->sendPacket("UUX", "%d\r\n%s", sz, szMsg);
@@ -820,13 +820,13 @@ void CMsnProto::MSN_SetServerStatus(int newStatus) szPlace = dbv.pszVal;
else {
TCHAR buf[128] = _T("Miranda");
- DWORD buflen = SIZEOF(buf);
+ DWORD buflen = _countof(buf);
GetComputerName(buf, &buflen);
szPlace = mir_utf8encodeT(buf);
}
char** msgptr = GetStatusMsgLoc(newStatus);
- int sz = mir_snprintf(szMsg, SIZEOF(szMsg),
+ int sz = mir_snprintf(szMsg, _countof(szMsg),
"<user>"
"<sep n=\"PE\" epid=\"%s\"><VER>%s</VER><TYP>11</TYP><Capabilities>0:0</Capabilities></sep>"
"<s n=\"IM\"><Status>%s</Status></s>"
@@ -859,7 +859,7 @@ void CMsnProto::MSN_SetServerStatus(int newStatus) // TODO: Send, MSN_SendStatusMessage anpassen.
#ifdef OBSOLETE
- int sz = mir_snprintf(szMsg, SIZEOF(szMsg),
+ int sz = mir_snprintf(szMsg, _countof(szMsg),
"<PrivateEndpointData>"
"<EpName>%s</EpName>"
"<Idle>%s</Idle>"
@@ -959,7 +959,7 @@ void CMsnProto::MSN_ShowError(const char* msgtext, ...) TCHAR *buf = Langpack_PcharToTchar(msgtext);
va_start(tArgs, msgtext);
- mir_vsntprintf(tBuffer, SIZEOF(tBuffer), buf, tArgs);
+ mir_vsntprintf(tBuffer, _countof(tBuffer), buf, tArgs);
va_end(tArgs);
mir_free(buf);
@@ -1061,7 +1061,7 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) if ((iserr && !pud->proto->MyOptions.ShowErrorsAsPopups) || !ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
if (pud->flags & MSN_ALLOW_MSGBOX) {
TCHAR szMsg[MAX_SECONDLINE + MAX_CONTACTNAME];
- mir_sntprintf(szMsg, SIZEOF(szMsg), _T("%s:\n%s"), pud->title, pud->text);
+ mir_sntprintf(szMsg, _countof(szMsg), _T("%s:\n%s"), pud->title, pud->text);
MessageBox(NULL, szMsg, TranslateT("MSN Protocol"),
MB_OK | (iserr ? MB_ICONERROR : MB_ICONINFORMATION));
}
@@ -1393,7 +1393,7 @@ void MSN_MakeDigest(const char* chl, char* dgst) md5hash[i] &= 0x7FFFFFFF;
char chlString[128];
- mir_snprintf(chlString, SIZEOF(chlString), "%s%s00000000", chl, msnProductID);
+ mir_snprintf(chlString, _countof(chlString), "%s%s00000000", chl, msnProductID);
chlString[(mir_strlen(chl) + mir_strlen(msnProductID) + 7) & 0xF8] = 0;
LONGLONG high = 0, low = 0;
diff --git a/protocols/MSN/src/msn_natdetect.cpp b/protocols/MSN/src/msn_natdetect.cpp index 18e3a5746e..6485612496 100644 --- a/protocols/MSN/src/msn_natdetect.cpp +++ b/protocols/MSN/src/msn_natdetect.cpp @@ -312,7 +312,7 @@ static bool IsIcfEnabled(void) if (FAILED(hr)) goto error;
TCHAR szFileName[MAX_PATH];
- GetModuleFileName(NULL, szFileName, SIZEOF(szFileName));
+ GetModuleFileName(NULL, szFileName, _countof(szFileName));
wszFileName = mir_t2u(szFileName);
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index c5206af9ed..183252d3db 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -47,19 +47,19 @@ static IconItem iconList[] = void MsnInitIcons(void)
{
- Icon_Register(hInst, "Protocols/MSN", iconList, SIZEOF(iconList), "MSN");
+ Icon_Register(hInst, "Protocols/MSN", iconList, _countof(iconList), "MSN");
}
HICON LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "MSN_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "MSN_%s", name);
return IcoLib_GetIcon(szSettingName, big);
}
HANDLE GetIconHandle(int iconId)
{
- for (unsigned i = 0; i < SIZEOF(iconList); i++)
+ for (unsigned i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
@@ -69,7 +69,7 @@ HANDLE GetIconHandle(int iconId) void ReleaseIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "MSN_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "MSN_%s", name);
IcoLib_Release(szSettingName, big);
}
@@ -174,7 +174,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
HWND tEditField = GetDlgItem(hwndDlg, IDC_MAILER_APP);
- GetWindowTextA(tEditField, szFile, SIZEOF(szFile));
+ GetWindowTextA(tEditField, szFile, _countof(szFile));
size_t tSelectLen = 0;
@@ -196,7 +196,7 @@ LBL_Continue: OPENFILENAMEA ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwndDlg;
- ofn.nMaxFile = SIZEOF(szFile);
+ ofn.nMaxFile = _countof(szFile);
ofn.lpstrFile = szFile;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;
if (GetOpenFileNameA(&ofn) != TRUE)
@@ -204,7 +204,7 @@ LBL_Continue: if (strchr(szFile, ' ') != NULL) {
char tmpBuf[MAX_PATH + 2];
- mir_snprintf(tmpBuf, SIZEOF(tmpBuf), "\"%s\"", szFile);
+ mir_snprintf(tmpBuf, _countof(tmpBuf), "\"%s\"", szFile);
mir_strcpy(szFile, tmpBuf);
}
@@ -225,7 +225,7 @@ LBL_Continue: CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, SIZEOF(szEmail));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, _countof(szEmail));
if (mir_strcmp(_strlwr(szEmail), proto->MyOptions.szEmail)) {
reconnectRequired = true;
mir_strcpy(proto->MyOptions.szEmail, szEmail);
@@ -234,7 +234,7 @@ LBL_Continue: proto->setDword("netId", (proto->MyOptions.netId = proto->GetMyNetID()));
}
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, SIZEOF(password));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, _countof(password));
if (!proto->getString("Password", &dbv)) {
if (mir_strcmp(password, dbv.pszVal)) {
reconnectRequired = true;
@@ -248,7 +248,7 @@ LBL_Continue: }
#ifdef OBSOLETE
- GetDlgItemText(hwndDlg, IDC_HANDLE2, screenStr, SIZEOF(screenStr));
+ GetDlgItemText(hwndDlg, IDC_HANDLE2, screenStr, _countof(screenStr));
if (!proto->getTString("Nick", &dbv)) {
if (mir_tstrcmp(dbv.ptszVal, screenStr))
proto->MSN_SendNickname(screenStr);
@@ -275,7 +275,7 @@ LBL_Continue: proto->setByte("RunMailerOnHotmail", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_RUN_APP_ON_HOTMAIL));
proto->setByte("ManageServer", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MANAGEGROUPS));
- GetDlgItemText(hwndDlg, IDC_MAILER_APP, screenStr, SIZEOF(screenStr));
+ GetDlgItemText(hwndDlg, IDC_MAILER_APP, screenStr, _countof(screenStr));
proto->setTString("MailerPath", screenStr);
if (reconnectRequired && proto->msnLoggedIn)
@@ -382,13 +382,13 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, str, _countof(str));
if (mir_strcmp(str, MSN_DEFAULT_LOGIN_SERVER))
proto->setString("DirectServer", str);
else
proto->delSetting("DirectServer");
- GetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, str, _countof(str));
if (mir_strcmp(str, MSN_DEFAULT_GATEWAY))
proto->setString("GatewayServer", str);
else
@@ -412,7 +412,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam proto->setByte("AutoGetHost", (BYTE)gethst);
if (gethst == 0) {
- GetDlgItemTextA(hwndDlg, IDC_YOURHOST, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_YOURHOST, str, _countof(str));
proto->setString("YourHost", str);
}
else proto->delSetting("YourHost");
@@ -551,7 +551,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, SIZEOF(szEmail));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, _countof(szEmail));
if (mir_strcmp(szEmail, proto->MyOptions.szEmail)) {
mir_strcpy(proto->MyOptions.szEmail, szEmail);
proto->setString("e-mail", szEmail);
@@ -559,7 +559,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L proto->setDword("netId", (proto->MyOptions.netId = proto->GetMyNetID()));
}
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, SIZEOF(password));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, _countof(password));
if (!proto->getString("Password", &dbv)) {
if (mir_strcmp(password, dbv.pszVal))
proto->setString("Password", password);
@@ -568,7 +568,7 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L else proto->setString("Password", password);
TCHAR szPlace[64];
- GetDlgItemText(hwndDlg, IDC_PLACE, szPlace, SIZEOF(szPlace));
+ GetDlgItemText(hwndDlg, IDC_PLACE, szPlace, _countof(szPlace));
if (szPlace[0])
proto->setTString("Place", szPlace);
else
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index 12568c3e52..dc965db7dd 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -235,7 +235,7 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft) PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = format;
ai.hContact = ft->std.hContact;
- MSN_GetAvatarFileName(ai.hContact, ai.filename, SIZEOF(ai.filename), ext);
+ MSN_GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename), ext);
_trename(ft->std.tszCurrentFile, ai.filename);
@@ -1174,7 +1174,7 @@ void CMsnProto::p2p_InitFileTransfer( }
if (pictmatch) {
TCHAR szFileName[MAX_PATH];
- MSN_GetAvatarFileName(NULL, szFileName, SIZEOF(szFileName), NULL);
+ MSN_GetAvatarFileName(NULL, szFileName, _countof(szFileName), NULL);
ft->fileId = _topen(szFileName, O_RDONLY | _O_BINARY, _S_IREAD);
if (ft->fileId == -1) {
p2p_sendStatus(ft, 603);
@@ -1224,7 +1224,7 @@ void CMsnProto::p2p_InitFileTransfer( ft->std.totalFiles = 1;
TCHAR tComment[40];
- mir_sntprintf(tComment, SIZEOF(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
+ mir_sntprintf(tComment, _countof(tComment), TranslateT("%I64u bytes"), ft->std.currentFileSize);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
@@ -1396,7 +1396,7 @@ void CMsnProto::p2p_startConnect(const char* wlid, const char* szCallID, const c newThread->mType = SERVER_P2P_DIRECT;
newThread->mInitialContactWLID = mir_strdup(wlid);
strncpy_s(newThread->mCookie, szCallID, _TRUNCATE);
- mir_snprintf(newThread->mServer, SIZEOF(newThread->mServer),
+ mir_snprintf(newThread->mServer, _countof(newThread->mServer),
ipv6 ? "[%s]:%s" : "%s:%s", pAddrTokBeg, pPortTokBeg);
newThread->startThread(&CMsnProto::p2p_fileActiveThread, this);
@@ -1739,7 +1739,7 @@ void CMsnProto::p2p_processMsgV2(ThreadData* info, char* msgbody, const char* wl if (hdrdata.mRemSize || hdrdata.mTFCode == 0) {
char msgid[128];
- mir_snprintf(msgid, SIZEOF(msgid), "%s_%08x", wlid, hdrdata.mPacketNum);
+ mir_snprintf(msgid, _countof(msgid), "%s_%08x", wlid, hdrdata.mPacketNum);
int idx;
if (hdrdata.mTFCode == 0x01) {
@@ -1830,7 +1830,7 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wlid if (hdrdata.mPacketLen < hdrdata.mTotalSize) {
char msgid[128];
- mir_snprintf(msgid, SIZEOF(msgid), "%s_%08x", wlid, hdrdata.mID);
+ mir_snprintf(msgid, _countof(msgid), "%s_%08x", wlid, hdrdata.mID);
int idx = addCachedMsg(msgid, msgbody, (size_t)hdrdata.mOffset, hdrdata.mPacketLen,
(size_t)hdrdata.mTotalSize, false);
@@ -2094,7 +2094,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) if (ft->p2p_isV2) {
if (cont->places.getCount() && cont->places[0].cap1 & cap_SupportsP2PBootstrap) {
char wlid[128];
- mir_snprintf(wlid, SIZEOF(wlid),
+ mir_snprintf(wlid, _countof(wlid),
mir_strcmp(cont->places[0].id, sttVoidUid) ? "%s;%s" : "%s",
cont->email, cont->places[0].id);
@@ -2145,7 +2145,7 @@ void CMsnProto::p2p_invite(unsigned iAppID, filetransfer* ft, const char *wlid) if (ft->p2p_isV2 && ft->std.currentFileNumber == 0) {
for (int i = 0; i < cont->places.getCount(); ++i) {
char wlid[128];
- mir_snprintf(wlid, SIZEOF(wlid),
+ mir_snprintf(wlid, _countof(wlid),
mir_strcmp(cont->places[i].id, sttVoidUid) ? "%s;%s" : "%s",
cont->email, cont->places[i].id);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index c5709e7fbd..298f1e2892 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -128,7 +128,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : nlu1.szSettingsModule = szDbsettings;
nlu1.ptszDescriptiveName = szBuffer;
- mir_snprintf(szDbsettings, SIZEOF(szDbsettings), "%s_HTTPS", m_szModuleName);
+ mir_snprintf(szDbsettings, _countof(szDbsettings), "%s_HTTPS", m_szModuleName);
mir_sntprintf(szBuffer, TranslateT("%s plugin HTTPS connections"), m_tszUserName);
hNetlibUserHttps = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu1);
@@ -494,7 +494,7 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg) filetransfer* ft = (filetransfer*)arg;
TCHAR filefull[MAX_PATH];
- mir_sntprintf(filefull, SIZEOF(filefull), _T("%s\\%s"), ft->std.tszWorkingDir, ft->std.tszCurrentFile);
+ mir_sntprintf(filefull, _countof(filefull), _T("%s\\%s"), ft->std.tszWorkingDir, ft->std.tszCurrentFile);
replaceStrT(ft->std.tszCurrentFile, filefull);
ResetEvent(ft->hResumeEvt);
@@ -586,7 +586,7 @@ HANDLE __cdecl CMsnProto::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szP if ((ft->std.tszWorkingDir = mir_tstrdup(szPath)) == NULL) {
TCHAR szCurrDir[MAX_PATH];
- GetCurrentDirectory(SIZEOF(szCurrDir), szCurrDir);
+ GetCurrentDirectory(_countof(szCurrDir), szCurrDir);
ft->std.tszWorkingDir = mir_tstrdup(szCurrDir);
}
else {
@@ -1226,7 +1226,7 @@ int __cdecl CMsnProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM l case EV_PROTO_ONERASE:
char szDbsettings[64];
- mir_snprintf(szDbsettings, SIZEOF(szDbsettings), "%s_HTTPS", m_szModuleName);
+ mir_snprintf(szDbsettings, _countof(szDbsettings), "%s_HTTPS", m_szModuleName);
CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szDbsettings);
break;
diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp index a3785c4adf..85395980f5 100644 --- a/protocols/MSN/src/msn_soapab.cpp +++ b/protocols/MSN/src/msn_soapab.cpp @@ -76,8 +76,8 @@ ezxml_t CMsnProto::abSoapHdr(const char* service, const char* scenario, ezxml_t& ezxml_t CMsnProto::getSoapResponse(ezxml_t bdy, const char* service)
{
char resp1[40], resp2[40];
- mir_snprintf(resp1, SIZEOF(resp1), "%sResponse", service);
- mir_snprintf(resp2, SIZEOF(resp2), "%sResult", service);
+ mir_snprintf(resp1, _countof(resp1), "%sResponse", service);
+ mir_snprintf(resp2, _countof(resp2), "%sResult", service);
ezxml_t res = ezxml_get(bdy, "soap:Body", 0, resp1, 0, resp2, -1);
if (res == NULL)
@@ -95,7 +95,7 @@ ezxml_t CMsnProto::getSoapFault(ezxml_t bdy, bool err) void CMsnProto::UpdateABHost(const char* service, const char* url)
{
char hostname[128];
- mir_snprintf(hostname, SIZEOF(hostname), "ABHost-%s", service);
+ mir_snprintf(hostname, _countof(hostname), "ABHost-%s", service);
if (url)
setString(hostname, url);
@@ -114,7 +114,7 @@ void CMsnProto::UpdateABCacheKey(ezxml_t bdy, bool isSharing) char* CMsnProto::GetABHost(const char* service, bool isSharing)
{
char hostname[128];
- mir_snprintf(hostname, SIZEOF(hostname), "ABHost-%s", service);
+ mir_snprintf(hostname, _countof(hostname), "ABHost-%s", service);
char* host = (char*)mir_alloc(256);
if (db_get_static(NULL, m_szModuleName, hostname, host, 256)) {
@@ -284,7 +284,7 @@ bool CMsnProto::MSN_SharingFindMembership(bool deltas, bool allowRecurse) }
else if (mir_strcmp(szType, "Phone") == 0) {
netId = NETID_MOB;
- mir_snprintf(email, SIZEOF(email), "tel:%s", ezxml_txt(ezxml_child(memb, "PhoneNumber")));
+ mir_snprintf(email, _countof(email), "tel:%s", ezxml_txt(ezxml_child(memb, "PhoneNumber")));
szEmail = email;
}
else if (mir_strcmp(szType, "Email") == 0) {
@@ -686,7 +686,7 @@ bool CMsnProto::MSN_ABFind(const char* szMethod, const char* szGuid, bool deltas szMsgUsr = ezxml_txt(ezxml_child(phn, "isMessengerEnabled"));
if (mir_strcmp(szMsgUsr, "true") == 0) {
szEmail = ezxml_txt(ezxml_child(phn, "number"));
- mir_snprintf(email, SIZEOF(email), "tel:%s", szEmail);
+ mir_snprintf(email, _countof(email), "tel:%s", szEmail);
szEmail = email;
netId = NETID_MOB;
break;
@@ -1584,7 +1584,7 @@ void CMsnProto::MSN_ABUpdateDynamicItem(bool allowRecurse) tm *tmst = gmtime(&timer);
char tmstr[64];
- mir_snprintf(tmstr, SIZEOF(tmstr), "%04u-%02u-%02uT%02u:%02u:%02uZ",
+ mir_snprintf(tmstr, _countof(tmstr), "%04u-%02u-%02uT%02u:%02u:%02uZ",
tmst->tm_year + 1900, tmst->tm_mon + 1, tmst->tm_mday,
tmst->tm_hour, tmst->tm_min, tmst->tm_sec);
diff --git a/protocols/MSN/src/msn_soapstore.cpp b/protocols/MSN/src/msn_soapstore.cpp index 8dce12549e..fc8a5b96f2 100644 --- a/protocols/MSN/src/msn_soapstore.cpp +++ b/protocols/MSN/src/msn_soapstore.cpp @@ -71,7 +71,7 @@ ezxml_t CMsnProto::storeSoapHdr(const char* service, const char* scenario, ezxml char* CMsnProto::GetStoreHost(const char* service)
{
char hostname[128];
- mir_snprintf(hostname, SIZEOF(hostname), "StoreHost-%s", service);
+ mir_snprintf(hostname, _countof(hostname), "StoreHost-%s", service);
char* host = (char*)mir_alloc(256);
if (db_get_static(NULL, m_szModuleName, hostname, host, 256) || !*host)
@@ -83,7 +83,7 @@ char* CMsnProto::GetStoreHost(const char* service) void CMsnProto::UpdateStoreHost(const char* service, const char* url)
{
char hostname[128];
- mir_snprintf(hostname, SIZEOF(hostname), "StoreHost-%s", service);
+ mir_snprintf(hostname, _countof(hostname), "StoreHost-%s", service);
setString(hostname, url);
}
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index b509b243f8..93144442b1 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -78,7 +78,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) }
if (pai->hContact == NULL || _stricmp(cont->email, MyOptions.szEmail) == 0) {
- MSN_GetAvatarFileName(NULL, filename, SIZEOF(filename), NULL);
+ MSN_GetAvatarFileName(NULL, filename, _countof(filename), NULL);
pai->format = ProtoGetAvatarFormat(filename);
if (pai->format != PA_FORMAT_UNKNOWN)
mir_tstrcpy(pai->filename, filename);
@@ -93,7 +93,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) }
else return GAIR_NOAVATAR;
- MSN_GetAvatarFileName(pai->hContact, filename, SIZEOF(filename), NULL);
+ MSN_GetAvatarFileName(pai->hContact, filename, _countof(filename), NULL);
pai->format = ProtoGetAvatarFormat(filename);
if (pai->format != PA_FORMAT_UNKNOWN) {
@@ -139,7 +139,7 @@ INT_PTR CMsnProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) ft->std.hContact = pai->hContact;
ft->p2p_object = mir_strdup(szContext);
- MSN_GetAvatarFileName(pai->hContact, filename, SIZEOF(filename), _T("unk"));
+ MSN_GetAvatarFileName(pai->hContact, filename, _countof(filename), _T("unk"));
ft->std.tszCurrentFile = mir_tstrdup(filename);
p2p_invite(MSN_APPID_AVATAR, ft, NULL);
@@ -188,7 +188,7 @@ INT_PTR CMsnProto::SetAvatar(WPARAM, LPARAM lParam) TCHAR* szFileName = (TCHAR*)lParam;
TCHAR tFileName[MAX_PATH];
- MSN_GetAvatarFileName(NULL, tFileName, SIZEOF(tFileName), NULL);
+ MSN_GetAvatarFileName(NULL, tFileName, _countof(tFileName), NULL);
_tremove(tFileName);
if (szFileName == NULL) {
diff --git a/protocols/MinecraftDynmap/src/dialogs.cpp b/protocols/MinecraftDynmap/src/dialogs.cpp index cc6c8efbf3..ee04d32b47 100644 --- a/protocols/MinecraftDynmap/src/dialogs.cpp +++ b/protocols/MinecraftDynmap/src/dialogs.cpp @@ -30,14 +30,14 @@ static IconItem icons[] = { { "proto", LPGEN("Protocol icon"), IDI_PROTO }, }; -static HANDLE hIconLibItem[SIZEOF(icons)]; +static HANDLE hIconLibItem[_countof(icons)]; void InitIcons(void) { - Icon_Register(g_hInstance, "Protocols/MinecraftDynmap", icons, SIZEOF(icons), "MinecraftDynmap"); + Icon_Register(g_hInstance, "Protocols/MinecraftDynmap", icons, _countof(icons), "MinecraftDynmap"); } HANDLE GetIconHandle(const char* name) { - for (size_t i = 0; i < SIZEOF(icons); i++) { + for (size_t i = 0; i < _countof(icons); i++) { if (strcmp(icons[i].szName, name) == 0) { return hIconLibItem[i]; } @@ -73,7 +73,7 @@ static void StoreDBText(MinecraftDynmapProto* ppro, HWND hwnd, int idCtrl, const { TCHAR tstr[250+1]; - GetDlgItemText(hwnd, idCtrl, tstr, SIZEOF(tstr)); + GetDlgItemText(hwnd, idCtrl, tstr, _countof(tstr)); if (tstr[0] != '\0') { db_set_ts(NULL, ppro->m_szModuleName, szSetting, tstr); } else { diff --git a/protocols/MinecraftDynmap/src/main.cpp b/protocols/MinecraftDynmap/src/main.cpp index 9f60c4d084..28b45731ed 100644 --- a/protocols/MinecraftDynmap/src/main.cpp +++ b/protocols/MinecraftDynmap/src/main.cpp @@ -92,8 +92,8 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfo); mir_getCLI(); - PROTOCOLDESCRIPTOR pd = { 0 };
- pd.cbSize = sizeof(pd);
+ PROTOCOLDESCRIPTOR pd = { 0 }; + pd.cbSize = sizeof(pd); pd.szName = "MinecraftDynmap"; pd.type = PROTOTYPE_PROTOCOL; pd.fnInit = protoInit; @@ -130,7 +130,7 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void) { - for (size_t i=0; i < SIZEOF(g_hEvents); i++) + for (size_t i=0; i < _countof(g_hEvents); i++) UnhookEvent(g_hEvents[i]); return 0; diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index eb7b739c75..ce0afcc440 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -162,12 +162,12 @@ std::string Omegle_client::get_server( bool not_last ) int q = not_last ? 1 : 0;
int server = db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_SERVER, 0);
- if (server < 0 || server >= (int)(SIZEOF(servers)-q))
+ if (server < 0 || server >= (int)(_countof(servers)-q))
server = 0;
if (server == 0) {
srand(::time(NULL));
- server = (rand() % (SIZEOF(servers)-1-q))+1;
+ server = (rand() % (_countof(servers)-1-q))+1;
}
return servers[server];
@@ -176,7 +176,7 @@ std::string Omegle_client::get_server( bool not_last ) std::string Omegle_client::get_language()
{
int language = db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0);
- if (language < 0 || language >= (SIZEOF(languages)))
+ if (language < 0 || language >= (_countof(languages)))
language = 0;
return language > 0 ? languages[language].id : "en";
@@ -300,7 +300,7 @@ bool Omegle_client::start() if (this->spy_mode_) {
//// get last server from list, which is for spy mode
- //this->server_ = servers[SIZEOF(servers)-1];
+ //this->server_ = servers[_countof(servers)-1];
if (this->question_.empty()) {
data = "&wantsspy=1";
@@ -551,7 +551,7 @@ bool Omegle_client::events() st.cbSize = sizeof(st);
// st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_on")); // TODO: typing icon
- mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("%s is typing."), TranslateT("Stranger"));
+ mir_sntprintf(st.tszText, _countof(st.tszText), TranslateT("%s is typing."), TranslateT("Stranger"));
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st);
}
@@ -566,7 +566,7 @@ bool Omegle_client::events() st.cbSize = sizeof(st);
// st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_off")); // TODO: typing icon
- mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("%s stopped typing."), TranslateT("Stranger"));
+ mir_sntprintf(st.tszText, _countof(st.tszText), TranslateT("%s stopped typing."), TranslateT("Stranger"));
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st);
}
diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp index c2f13d2995..7d5754e8a3 100644 --- a/protocols/Omegle/src/dialogs.cpp +++ b/protocols/Omegle/src/dialogs.cpp @@ -47,7 +47,7 @@ static void StoreDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* sz {
TCHAR tstr[250+1];
- GetDlgItemText(hwnd, idCtrl, tstr, SIZEOF(tstr));
+ GetDlgItemText(hwnd, idCtrl, tstr, _countof(tstr));
if (tstr[0] != '\0') {
db_set_ts(NULL, ppro->m_szModuleName, szSetting, tstr);
} else {
@@ -73,12 +73,12 @@ INT_PTR CALLBACK OmegleAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPAR // Server
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, 0, reinterpret_cast<LPARAM>(Translate(servers[0])));
- for(size_t i=1; i<SIZEOF(servers); i++)
+ for(size_t i=1; i<_countof(servers); i++)
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(servers[i]));
SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
// Language
- for(size_t i=0; i<SIZEOF(languages); i++)
+ for(size_t i=0; i<_countof(languages); i++)
SendDlgItemMessageA(hwnd, IDC_LANGUAGE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(languages[i].lang)));
SendDlgItemMessage(hwnd, IDC_LANGUAGE, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0), 0);
@@ -150,12 +150,12 @@ INT_PTR CALLBACK OmegleOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPAR // Server
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, 0, reinterpret_cast<LPARAM>(Translate(servers[0])));
- for(size_t i=1; i<SIZEOF(servers); i++)
+ for(size_t i=1; i<_countof(servers); i++)
SendDlgItemMessageA(hwnd, IDC_SERVER, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(servers[i]));
SendDlgItemMessage(hwnd, IDC_SERVER, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_SERVER, 0), 0);
// Language
- for(size_t i=0; i<SIZEOF(languages); i++)
+ for(size_t i=0; i<_countof(languages); i++)
SendDlgItemMessageA(hwnd, IDC_LANGUAGE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(languages[i].lang)));
SendDlgItemMessage(hwnd, IDC_LANGUAGE, CB_SETCURSEL, db_get_b(NULL, proto->m_szModuleName, OMEGLE_KEY_LANGUAGE, 0), 0);
diff --git a/protocols/Omegle/src/main.cpp b/protocols/Omegle/src/main.cpp index fdc7d17897..be47e64da6 100644 --- a/protocols/Omegle/src/main.cpp +++ b/protocols/Omegle/src/main.cpp @@ -134,7 +134,7 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
//UninitContactMenus();
- for(size_t i=0; i<SIZEOF(g_hEvents); i++)
+ for(size_t i=0; i<_countof(g_hEvents); i++)
UnhookEvent(g_hEvents[i]);
return 0;
diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index 7419a9dcb8..45686560e5 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -47,7 +47,7 @@ OmegleProto::OmegleProto(const char* proto_name, const TCHAR* username) : NETLIBUSER nlu = {sizeof(nlu)};
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR;
nlu.szSettingsModule = m_szModuleName;
- mir_sntprintf(descr,SIZEOF(descr),TranslateT("%s server connection"),m_tszUserName);
+ mir_sntprintf(descr,_countof(descr),TranslateT("%s server connection"),m_tszUserName);
nlu.ptszDescriptiveName = descr;
m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER,0,(LPARAM)&nlu);
if (m_hNetlibUser == NULL) {
diff --git a/protocols/Omegle/src/theme.cpp b/protocols/Omegle/src/theme.cpp index 843eb50ddc..48f61ba93a 100644 --- a/protocols/Omegle/src/theme.cpp +++ b/protocols/Omegle/src/theme.cpp @@ -29,16 +29,16 @@ static IconItem icons[] = { "omegle", LPGEN("Omegle Icon"), IDI_OMEGLE },
};
-static HANDLE hIconLibItem[SIZEOF(icons)];
+static HANDLE hIconLibItem[_countof(icons)];
void InitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/Omegle", icons, SIZEOF(icons), "Omegle");
+ Icon_Register(g_hInstance, "Protocols/Omegle", icons, _countof(icons), "Omegle");
}
HANDLE GetIconHandle(const char* name)
{
- for(size_t i=0; i<SIZEOF(icons); i++)
+ for(size_t i=0; i<_countof(icons); i++)
{
if(mir_strcmp(icons[i].szName, name) == 0)
return hIconLibItem[i];
diff --git a/protocols/Omegle/src/utils.cpp b/protocols/Omegle/src/utils.cpp index 8e804585d5..86db3feec1 100644 --- a/protocols/Omegle/src/utils.cpp +++ b/protocols/Omegle/src/utils.cpp @@ -120,7 +120,7 @@ std::string utils::text::trim(const std::string &data ) int utils::debug::log(const std::string &file_name, const std::string &text)
{
char szFile[MAX_PATH];
- GetModuleFileNameA(g_hInstance, szFile, SIZEOF(szFile));
+ GetModuleFileNameA(g_hInstance, szFile, _countof(szFile));
std::string path = szFile;
path = path.substr( 0, path.rfind( "\\" ));
path = path.substr( 0, path.rfind( "\\" ) + 1 );
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index cadbea21a9..836c94b507 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -410,7 +410,7 @@ INT_PTR CSametimeProto::onMenuCreateChat(WPARAM wParam, LPARAM lParam) if (my_login_info && GetAwareIdFromContact(hContact, &id_block)) {
TCHAR title[512];
TCHAR* ts = mir_utf8decodeT(my_login_info->user_name);
- mir_sntprintf(title, SIZEOF(title), TranslateT("%s's conference"), ts);
+ mir_sntprintf(title, _countof(title), TranslateT("%s's conference"), ts);
mir_free(ts);
idb.user = id_block.user;
@@ -518,13 +518,13 @@ void CSametimeProto::InitConferenceMenu() mi.pszContactOwner = m_szModuleName;
mi.ptszName = LPGENT("Leave conference");
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, MS_SAMETIME_MENULEAVECHAT);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, MS_SAMETIME_MENULEAVECHAT);
mi.pszService = service;
mi.icolibItem = GetIconHandle(IDI_ICON_LEAVE);
hLeaveChatMenuItem = Menu_AddContactMenuItem(&mi);
mi.ptszName = LPGENT("Start conference");
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, MS_SAMETIME_MENUCREATECHAT);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, MS_SAMETIME_MENUCREATECHAT);
mi.pszService = service;
mi.icolibItem = GetIconHandle(IDI_ICON_INVITE);
hCreateChatMenuItem = Menu_AddContactMenuItem(&mi);
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index f3e0a2fa2e..8393eb31a8 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -33,7 +33,7 @@ void mwFileTransfer_offered(mwFileTransfer* ft) TCHAR descriptionT[512];
if (message) {
TCHAR* messageT = mir_utf8decodeT(message);
- mir_sntprintf(descriptionT, SIZEOF(descriptionT), _T("%s - %s"), filenameT, messageT);
+ mir_sntprintf(descriptionT, _countof(descriptionT), _T("%s - %s"), filenameT, messageT);
mir_free(messageT);
} else
_tcsncpy_s(descriptionT, filenameT, _TRUNCATE);
diff --git a/protocols/Sametime/src/messaging.cpp b/protocols/Sametime/src/messaging.cpp index aafffea62e..46540ad090 100644 --- a/protocols/Sametime/src/messaging.cpp +++ b/protocols/Sametime/src/messaging.cpp @@ -98,7 +98,7 @@ void mwIm_place_invite(struct mwConversation* conv, const char* message, const c TCHAR* tszMessage = mir_utf8decodeT(message);
TCHAR msg[512];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("SERVICE NOT IMPLEMENTED. %s"), tszMessage);
+ mir_sntprintf(msg, _countof(msg), TranslateT("SERVICE NOT IMPLEMENTED. %s"), tszMessage);
proto->showPopup(msg, SAMETIME_POPUP_INFO);
mir_free(tszMessage);
diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp index f9a2ee775f..d8c3c33bbc 100644 --- a/protocols/Sametime/src/options.cpp +++ b/protocols/Sametime/src/options.cpp @@ -103,14 +103,14 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA WORD client_ver = proto->GetClientVersion();
if (client_ver) {
TCHAR verbuf[100];
- mir_sntprintf(verbuf, SIZEOF(verbuf), TranslateT("Client protocol version: %03d.%03d"), (client_ver & 0xFF00) >> 8, client_ver & 0xFF);
+ mir_sntprintf(verbuf, _countof(verbuf), TranslateT("Client protocol version: %03d.%03d"), (client_ver & 0xFF00) >> 8, client_ver & 0xFF);
SetDlgItemText(hwndDlg, IDC_ST_CLIENTVER, verbuf);
}
WORD server_ver = proto->GetServerVersion();
if (server_ver) {
TCHAR verbuf[100];
- mir_sntprintf(verbuf, SIZEOF(verbuf), TranslateT("Server protocol version: %03d.%03d"), (server_ver & 0xFF00) >> 8, server_ver & 0xFF);
+ mir_sntprintf(verbuf, _countof(verbuf), TranslateT("Server protocol version: %03d.%03d"), (server_ver & 0xFF00) >> 8, server_ver & 0xFF);
SetDlgItemText(hwndDlg, IDC_ST_SERVERVER, verbuf);
}
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index d29923d882..a800096d0d 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -94,12 +94,12 @@ static IconItem iconList[] = void SametimeInitIcons(void)
{
- Icon_Register(hInst, "Protocols/Sametime", iconList, SIZEOF(iconList), "SAMETIME");
+ Icon_Register(hInst, "Protocols/Sametime", iconList, _countof(iconList), "SAMETIME");
}
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;
return NULL;
@@ -108,14 +108,14 @@ HANDLE GetIconHandle(int iconId) HICON LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", "SAMETIME", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", "SAMETIME", name);
return IcoLib_GetIcon(szSettingName, big);
}
void ReleaseIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "%s_%s", "SAMETIME", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "%s_%s", "SAMETIME", name);
IcoLib_Release(szSettingName, big);
}
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 446f477672..9003bfbe21 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -15,7 +15,7 @@ CSametimeProto::CSametimeProto(const char* pszProtoName, const TCHAR* tszUserNam {
// Register m_hNetlibUser user
TCHAR 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);
nlu.flags = NUF_TCHAR | NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS;
@@ -45,7 +45,7 @@ CSametimeProto::CSametimeProto(const char* pszProtoName, const TCHAR* tszUserNam RegisterPopups();
InitAwayMsg();
- mir_snprintf(szProtoGroups, SIZEOF(szProtoGroups), "%s_GROUPS", m_szModuleName);
+ mir_snprintf(szProtoGroups, _countof(szProtoGroups), "%s_GROUPS", m_szModuleName);
m_iStatus = ID_STATUS_OFFLINE;
previous_status = ID_STATUS_OFFLINE;
@@ -177,7 +177,7 @@ HANDLE CSametimeProto::SearchBasic(const TCHAR* id) HWND CSametimeProto::SearchAdvanced(HWND owner)
{
TCHAR buf[512];
- if (GetDlgItemText(owner, IDC_EDIT1, buf, SIZEOF(buf))) {
+ if (GetDlgItemText(owner, IDC_EDIT1, buf, _countof(buf))) {
debugLog(_T("CSametimeProto::SearchAdvanced() buf:len=[%d]"), buf == NULL ? -1 : mir_tstrlen(buf));
return (HWND)SearchForUser(T2Utf(buf), TRUE);
}
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index d8e146447e..11076a6284 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -155,7 +155,7 @@ void __cdecl SessionAnnounce(struct mwSession* session, struct mwLoginInfo* from TCHAR stzFromBuff[256];
stzFrom = mir_utf8decodeT(from->user_name);
stzText = mir_utf8decodeT(text);
- mir_sntprintf(stzFromBuff, SIZEOF(stzFromBuff), TranslateT("Session announcement - from '%s'"), stzFrom);
+ mir_sntprintf(stzFromBuff, _countof(stzFromBuff), TranslateT("Session announcement - from '%s'"), stzFrom);
MessageBox(0, TranslateTS(stzText), stzFromBuff, MB_OK);
mir_free(stzText);
mir_free(stzFrom);
@@ -567,7 +567,7 @@ void CSametimeProto::InitSessionMenu() mi.popupPosition = 500085001;
mi.position = 2000060000;
mi.ptszName = LPGENT("Send announcement...");
- mir_snprintf(service, SIZEOF(service), "%s%s", m_szModuleName, MS_SAMETIME_MENUANNOUNCESESSION);
+ mir_snprintf(service, _countof(service), "%s%s", m_szModuleName, MS_SAMETIME_MENUANNOUNCESESSION);
mi.pszService = service;
mi.icolibItem = GetIconHandle(IDI_ICON_ANNOUNCE);
mi.pszContactOwner = m_szModuleName;
diff --git a/protocols/Sametime/src/utils.cpp b/protocols/Sametime/src/utils.cpp index 1d464b16a1..8bf46c72d1 100644 --- a/protocols/Sametime/src/utils.cpp +++ b/protocols/Sametime/src/utils.cpp @@ -40,8 +40,8 @@ void CSametimeProto::RegisterPopups() puc.ptszDescription = szDescr;
puc.pszName = szName;
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", m_szModuleName, "Notify");
- mir_sntprintf(szDescr, SIZEOF(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Notification"));
+ mir_snprintf(szName, _countof(szName), "%s_%s", m_szModuleName, "Notify");
+ mir_sntprintf(szDescr, _countof(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Notification"));
puc.hIcon = CopyIcon(LoadIconEx("notify", FALSE));
ReleaseIconEx("notify", FALSE);
puc.iSeconds = 8;
@@ -49,8 +49,8 @@ void CSametimeProto::RegisterPopups() puc.colorText = GetSysColor(COLOR_WINDOWTEXT);
hPopupNotify = Popup_RegisterClass(&puc);
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", m_szModuleName, "Error");
- mir_sntprintf(szDescr, SIZEOF(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Error"));
+ mir_snprintf(szName, _countof(szName), "%s_%s", m_szModuleName, "Error");
+ mir_sntprintf(szDescr, _countof(szDescr), _T("%s/%s"), m_tszUserName, TranslateT("Error"));
puc.hIcon = CopyIcon(LoadIconEx("error", FALSE));
ReleaseIconEx("error", FALSE);
puc.iSeconds = 10;
@@ -89,9 +89,9 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) ppd.ptszTitle = puData->title;
ppd.ptszText = puData->text;
if (puData->flag == SAMETIME_POPUP_ERROR)
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", proto->m_szModuleName, "Error");
+ mir_snprintf(szName, _countof(szName), "%s_%s", proto->m_szModuleName, "Error");
else
- mir_snprintf(szName, SIZEOF(szName), "%s_%s", proto->m_szModuleName, "Notify");
+ mir_snprintf(szName, _countof(szName), "%s_%s", proto->m_szModuleName, "Notify");
ppd.pszClassName = szName;
CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
}
diff --git a/protocols/SkypeWeb/src/http_request.h b/protocols/SkypeWeb/src/http_request.h index f12a5111b1..b939d9508d 100644 --- a/protocols/SkypeWeb/src/http_request.h +++ b/protocols/SkypeWeb/src/http_request.h @@ -257,7 +257,7 @@ public: }
char message[1024];
- mir_snprintf(message, SIZEOF(message), "Send request to %s", szUrl);
+ mir_snprintf(message, _countof(message), "Send request to %s", szUrl);
CallService(MS_NETLIB_LOG, (WPARAM)hConnection, (LPARAM)&message);
return (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hConnection, (LPARAM)this);
diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index 0988f2a6d2..92045e962d 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -63,7 +63,7 @@ void CSkypeProto::OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg) PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = ProtoGetBufferFormat(response->pData);
setByte(hContact, "AvatarType", ai.format);
- GetAvatarFileName(hContact, ai.filename, SIZEOF(ai.filename));
+ GetAvatarFileName(hContact, ai.filename, _countof(ai.filename));
FILE *out = _tfopen(ai.filename, _T("wb"));
if (out == NULL) {
@@ -98,8 +98,8 @@ INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) pai->format = getByte(pai->hContact, "AvatarType", PA_FORMAT_JPEG);
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(pai->hContact, tszFileName, SIZEOF(tszFileName));
- _tcsncpy(pai->filename, tszFileName, SIZEOF(pai->filename));
+ GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName));
+ _tcsncpy(pai->filename, tszFileName, _countof(pai->filename));
if (::_taccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar", 0))
return GAIR_SUCCESS;
@@ -117,7 +117,7 @@ INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) INT_PTR CSkypeProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam)
{
TCHAR path[MAX_PATH];
- GetAvatarFileName(NULL, path, SIZEOF(path));
+ GetAvatarFileName(NULL, path, _countof(path));
_tcsncpy((TCHAR*)wParam, path, (int)lParam);
return 0;
}
@@ -155,7 +155,7 @@ void CSkypeProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl) setByte(hContact, "NeedNewAvatar", 1);
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = hContact;
- GetAvatarFileName(ai.hContact, ai.filename, SIZEOF(ai.filename));
+ GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename));
ai.format = ProtoGetAvatarFormat(ai.filename);
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
}
@@ -165,7 +165,7 @@ INT_PTR CSkypeProto::SvcSetMyAvatar(WPARAM, LPARAM lParam) {
TCHAR *path = (TCHAR*)lParam;
TCHAR avatarPath[MAX_PATH];
- GetAvatarFileName(NULL, avatarPath, SIZEOF(avatarPath));
+ GetAvatarFileName(NULL, avatarPath, _countof(avatarPath));
if (path != NULL)
{
if (!CopyFile(path, avatarPath, FALSE))
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 70b31e4447..51b70c307a 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -575,7 +575,7 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam) { LPGENT("&Leave chat session"), 20, MENU_ITEM, FALSE },
{ LPGENT("&Change topic"), 30, MENU_ITEM, FALSE }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
else if (gcmi->Type == MENU_ON_NICKLIST)
@@ -595,7 +595,7 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam) { LPGENT("&Admin"), 30, MENU_POPUPITEM },
{ LPGENT("&User"), 40, MENU_POPUPITEM }
};
- gcmi->nItems = SIZEOF(Items);
+ gcmi->nItems = _countof(Items);
gcmi->Item = (gc_item*)Items;
}
}
@@ -656,7 +656,7 @@ INT_PTR CSkypeProto::GcCreateDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR uids.insert(ppro->getStringA(SKYPE_SETTINGS_ID));
TCHAR tszTitle[1024];
- GetDlgItemText(hwndDlg, IDC_TITLE, tszTitle, SIZEOF(tszTitle));
+ GetDlgItemText(hwndDlg, IDC_TITLE, tszTitle, _countof(tszTitle));
ppro->SendRequest(new CreateChatroomRequest(ppro->m_szRegToken, uids, ptrA(ppro->getStringA(SKYPE_SETTINGS_ID)), ppro->m_szServer));
for (int i = 0; i < uids.getCount(); i++)
mir_free(uids[i]);
diff --git a/protocols/SkypeWeb/src/skype_icons.cpp b/protocols/SkypeWeb/src/skype_icons.cpp index 2972273e33..0848c87077 100644 --- a/protocols/SkypeWeb/src/skype_icons.cpp +++ b/protocols/SkypeWeb/src/skype_icons.cpp @@ -43,10 +43,10 @@ void CSkypeProto::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;
@@ -57,7 +57,7 @@ void CSkypeProto::InitIcons() HANDLE CSkypeProto::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;
return 0;
@@ -66,7 +66,7 @@ HANDLE CSkypeProto::GetIconHandle(const char *name) HANDLE CSkypeProto::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);
@@ -75,6 +75,6 @@ HANDLE CSkypeProto::Skin_GetIconHandle(const char *name) void CSkypeProto::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/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 97d0eedce3..2e7d99a311 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -219,7 +219,7 @@ void CSkypeProto::SendPresence(bool isLogin) else
{
TCHAR compName[MAX_COMPUTERNAME_LENGTH + 1];
- DWORD size = SIZEOF(compName);
+ DWORD size = _countof(compName);
GetComputerName(compName, &size);
epname = mir_utf8encodeT(compName);
}
diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp index f845444451..d840a8f143 100644 --- a/protocols/SkypeWeb/src/skype_menus.cpp +++ b/protocols/SkypeWeb/src/skype_menus.cpp @@ -48,7 +48,7 @@ int CSkypeProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM) int CSkypeProto::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);
CSkypeProto *proto = CSkypeProto::GetContactAccount(hContact);
return proto ? proto->OnPrebuildContactMenu(hContact, lParam) : 0;
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 90b9715ca3..bf99dbe576 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -23,7 +23,7 @@ PROTO<CSkypeProto>(protoName, userName), password(NULL) m_hProtoIcon = Icons[0].Handle;
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);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE;
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 58702f8aef..62370071af 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -32,13 +32,13 @@ void CSkypeProto::SetSrmmReadStatus(MCONTACT hContact) TCHAR ttime[64];
_locale_t locale = _create_locale(LC_ALL, "");
- _tcsftime_l(ttime, SIZEOF(ttime), _T("%X - %x"), localtime(&time), locale);
+ _tcsftime_l(ttime, _countof(ttime), _T("%X - %x"), localtime(&time), locale);
_free_locale(locale);
StatusTextData st = { 0 };
st.cbSize = sizeof(st);
st.hIcon = Skin_LoadIcon(SKINICON_OTHER_HISTORY);
- mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("Message read: %s"), ttime);
+ mir_sntprintf(st.tszText, _countof(st.tszText), TranslateT("Message read: %s"), ttime);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
}
@@ -394,7 +394,7 @@ char *CSkypeProto::RemoveHtml(const char *text) std::string entity = data.substr(begin + 1, i - begin - 1);
bool found = false;
- for (int j = 0; j < SIZEOF(htmlEntities); j++)
+ for (int j = 0; j < _countof(htmlEntities); j++)
{
if (!mir_strcmpi(entity.c_str(), htmlEntities[j].entity))
{
diff --git a/protocols/Steam/src/api/friend_list.h b/protocols/Steam/src/api/friend_list.h index 4c1d6f8ef2..7721f0c921 100644 --- a/protocols/Steam/src/api/friend_list.h +++ b/protocols/Steam/src/api/friend_list.h @@ -20,13 +20,13 @@ public: HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/AddFriendAjax")
{
char login[MAX_PATH];
- mir_snprintf(login, SIZEOF(login), "%s||oauth:%s", steamId, token);
+ mir_snprintf(login, _countof(login), "%s||oauth:%s", steamId, token);
char cookie[MAX_PATH];
- mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+ mir_snprintf(cookie, _countof(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
char data[128];
- mir_snprintf(data, SIZEOF(data),
+ mir_snprintf(data, _countof(data),
"sessionID=%s&steamid=%s",
sessionId,
who);
@@ -44,13 +44,13 @@ public: HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/BlockUserAjax")
{
char login[MAX_PATH];
- mir_snprintf(login, SIZEOF(login), "%s||oauth:%s", steamId, token);
+ mir_snprintf(login, _countof(login), "%s||oauth:%s", steamId, token);
char cookie[MAX_PATH];
- mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+ mir_snprintf(cookie, _countof(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
char data[128];
- mir_snprintf(data, SIZEOF(data),
+ mir_snprintf(data, _countof(data),
"sessionID=%s&action=ignore&steamid=%s",
sessionId,
who);
@@ -68,13 +68,13 @@ public: HttpRequest(REQUEST_POST, STEAM_WEB_URL "/actions/RemoveFriendAjax")
{
char login[MAX_PATH];
- mir_snprintf(login, SIZEOF(login), "%s||oauth:%s", steamId, token);
+ mir_snprintf(login, _countof(login), "%s||oauth:%s", steamId, token);
char cookie[MAX_PATH];
- mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+ mir_snprintf(cookie, _countof(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
char data[128];
- mir_snprintf(data, SIZEOF(data),
+ mir_snprintf(data, _countof(data),
"sessionID=%s&steamid=%s",
sessionId,
who);
diff --git a/protocols/Steam/src/api/login.h b/protocols/Steam/src/api/login.h index 64b41f07cb..00392dd34d 100644 --- a/protocols/Steam/src/api/login.h +++ b/protocols/Steam/src/api/login.h @@ -8,7 +8,7 @@ public: HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Logon/v0001")
{
char data[256];
- mir_snprintf(data, SIZEOF(data), "access_token=%s&ui_mode=web", token);
+ mir_snprintf(data, _countof(data), "access_token=%s&ui_mode=web", token);
SetData(data, strlen(data));
AddHeader("Content-Type", "application/x-www-form-urlencoded");
@@ -22,7 +22,7 @@ public: HttpRequest(REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Logoff/v0001")
{
char data[256];
- mir_snprintf(data, SIZEOF(data), "access_token=%s&umqid=%s", token, umqId);
+ mir_snprintf(data, _countof(data), "access_token=%s&umqid=%s", token, umqId);
SetData(data, strlen(data));
AddHeader("Content-Type", "application/x-www-form-urlencoded");
diff --git a/protocols/Steam/src/api/pending.h b/protocols/Steam/src/api/pending.h index f9965d341f..4e971275b4 100644 --- a/protocols/Steam/src/api/pending.h +++ b/protocols/Steam/src/api/pending.h @@ -8,13 +8,13 @@ public: HttpRequest(REQUEST_POST, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
{
char login[MAX_PATH];
- mir_snprintf(login, SIZEOF(login), "%s||oauth:%s", steamId, token);
+ mir_snprintf(login, _countof(login), "%s||oauth:%s", steamId, token);
char cookie[MAX_PATH];
- mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+ mir_snprintf(cookie, _countof(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
char data[MAX_PATH];
- mir_snprintf(data, SIZEOF(data), "sessionID=%s&id=%s&perform=accept&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
+ mir_snprintf(data, _countof(data), "sessionID=%s&id=%s&perform=accept&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
SetData(data, strlen(data));
AddHeader("Cookie", cookie);
@@ -29,13 +29,13 @@ public: HttpRequest(REQUEST_POST, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
{
char login[MAX_PATH];
- mir_snprintf(login, SIZEOF(login), "%s||oauth:%s", steamId, token);
+ mir_snprintf(login, _countof(login), "%s||oauth:%s", steamId, token);
char cookie[MAX_PATH];
- mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+ mir_snprintf(cookie, _countof(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
char data[MAX_PATH];
- mir_snprintf(data, SIZEOF(data), "sessionID=%s&id=%s&perform=ignore&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
+ mir_snprintf(data, _countof(data), "sessionID=%s&id=%s&perform=ignore&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
SetData(data, strlen(data));
AddHeader("Cookie", cookie);
@@ -50,13 +50,13 @@ public: HttpRequest(REQUEST_POST, FORMAT, STEAM_WEB_URL "/profiles/%s/home_process", steamId)
{
char login[MAX_PATH];
- mir_snprintf(login, SIZEOF(login), "%s||oauth:%s", steamId, token);
+ mir_snprintf(login, _countof(login), "%s||oauth:%s", steamId, token);
char cookie[MAX_PATH];
- mir_snprintf(cookie, SIZEOF(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
+ mir_snprintf(cookie, _countof(cookie), "steamLogin=%s;sessionid=%s;forceMobile=1", login, sessionId);
char data[MAX_PATH];
- mir_snprintf(data, SIZEOF(data), "sessionID=%s&id=%s&perform=block&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
+ mir_snprintf(data, _countof(data), "sessionID=%s&id=%s&perform=block&action=approvePending&itype=friend&json=1&xml=0", sessionId, who);
SetData(data, strlen(data));
AddHeader("Cookie", cookie);
diff --git a/protocols/Steam/src/api/session.h b/protocols/Steam/src/api/session.h index 3e13a2e418..5499d33c74 100644 --- a/protocols/Steam/src/api/session.h +++ b/protocols/Steam/src/api/session.h @@ -10,7 +10,7 @@ public: flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP;
char data[512];
- mir_snprintf(data, SIZEOF(data),
+ mir_snprintf(data, _countof(data),
"oauth_token=%s&steamid=%s&webcookie=%s",
token,
steamId,
diff --git a/protocols/Steam/src/http_request.h b/protocols/Steam/src/http_request.h index aa14d9037d..73fce0eb1b 100644 --- a/protocols/Steam/src/http_request.h +++ b/protocols/Steam/src/http_request.h @@ -86,7 +86,7 @@ public: szUrl = m_url.GetBuffer();
char message[1024];
- mir_snprintf(message, SIZEOF(message), "Send request to %s", szUrl);
+ mir_snprintf(message, _countof(message), "Send request to %s", szUrl);
CallService(MS_NETLIB_LOG, (WPARAM)hConnection, (LPARAM)&message);
return (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hConnection, (LPARAM)this);
diff --git a/protocols/Steam/src/main.cpp b/protocols/Steam/src/main.cpp index 5f67cea6a6..15436fbe90 100644 --- a/protocols/Steam/src/main.cpp +++ b/protocols/Steam/src/main.cpp @@ -47,7 +47,7 @@ extern "C" int __declspec(dllexport) Load(void) Proto_RegisterModule(&pd);
char iconName[100];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, "gaming");
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, "gaming");
// extra statuses
HookEvent(ME_SKIN2_ICONSCHANGED, OnReloadIcons);
diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp index 63554fd630..bd3b14f60e 100644 --- a/protocols/Steam/src/steam_avatars.cpp +++ b/protocols/Steam/src/steam_avatars.cpp @@ -3,7 +3,7 @@ TCHAR* CSteamProto::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)
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index f9a6b0c0c0..4c87e79575 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -625,7 +625,7 @@ void CSteamProto::OnAuthRequested(const NETLIBHTTPREQUEST *response, void *arg) lastName = mir_strdup(""); char reason[MAX_PATH]; - mir_snprintf(reason, SIZEOF(reason), Translate("%s has added you to his or her Friend List"), nickName); + mir_snprintf(reason, _countof(reason), Translate("%s has added you to his or her Friend List"), nickName); // blob is: 0(DWORD), hContact(DWORD), nick(ASCIIZ), firstName(ASCIIZ), lastName(ASCIIZ), sid(ASCIIZ), reason(ASCIIZ) DWORD cbBlob = (DWORD)(sizeof(DWORD)* 2 + mir_strlen(nickName) + mir_strlen(firstName) + mir_strlen(lastName) + mir_strlen(steamId) + mir_strlen(reason) + 5); diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp index c804369dbb..3e768f982d 100644 --- a/protocols/Steam/src/steam_dialogs.cpp +++ b/protocols/Steam/src/steam_dialogs.cpp @@ -10,7 +10,7 @@ CSteamPasswordEditor::CSteamPasswordEditor(CSteamProto *proto) : void CSteamPasswordEditor::OnInitDialog()
{
char iconName[100];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, "main");
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, "main");
SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(iconName, false));
SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(iconName, true));
@@ -48,7 +48,7 @@ CSteamGuardDialog::CSteamGuardDialog(CSteamProto *proto, const char *domain) : void CSteamGuardDialog::OnInitDialog()
{
char iconName[100];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, "main");
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, "main");
SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(iconName, false));
SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(iconName, true));
@@ -59,7 +59,7 @@ void CSteamGuardDialog::OnInitDialog() void CSteamGuardDialog::OnOk(CCtrlButton*)
{
- mir_strncpy(m_guardCode, ptrA(m_text.GetTextA()), SIZEOF(m_guardCode) + 1);
+ mir_strncpy(m_guardCode, ptrA(m_text.GetTextA()), _countof(m_guardCode) + 1);
EndDialog(m_hwnd, 1);
}
@@ -95,7 +95,7 @@ CSteamCaptchaDialog::~CSteamCaptchaDialog() void CSteamCaptchaDialog::OnInitDialog()
{
char iconName[100];
- mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, "main");
+ mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, "main");
SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM)IcoLib_GetIcon(iconName, false));
SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)IcoLib_GetIcon(iconName, true));
@@ -106,7 +106,7 @@ void CSteamCaptchaDialog::OnInitDialog() void CSteamCaptchaDialog::OnOk(CCtrlButton*)
{
- mir_strncpy(m_captchaText, ptrA(m_text.GetTextA()), SIZEOF(m_captchaText) + 1);
+ mir_strncpy(m_captchaText, ptrA(m_text.GetTextA()), _countof(m_captchaText) + 1);
EndDialog(m_hwnd, 1);
}
diff --git a/protocols/Steam/src/steam_menus.cpp b/protocols/Steam/src/steam_menus.cpp index 75c6db25e4..6e1f1b1658 100644 --- a/protocols/Steam/src/steam_menus.cpp +++ b/protocols/Steam/src/steam_menus.cpp @@ -45,7 +45,7 @@ int CSteamProto::JoinToGameCommand(WPARAM hContact, LPARAM) {
char url[MAX_PATH];
DWORD gameId = getDword(hContact, "GameID", 0);
- mir_snprintf(url, SIZEOF(url), "steam://rungameid/%lu", gameId);
+ mir_snprintf(url, _countof(url), "steam://rungameid/%lu", gameId);
CallService(MS_UTILS_OPENURL, 0, (LPARAM)url);
return 0;
@@ -88,7 +88,7 @@ int CSteamProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) int CSteamProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
- for (int i = 0; i < SIZEOF(CSteamProto::contactMenuItems); i++)
+ for (int i = 0; i < _countof(CSteamProto::contactMenuItems); i++)
Menu_ShowItem(CSteamProto::contactMenuItems[i], false);
CSteamProto* ppro = CSteamProto::GetContactProtoInstance((MCONTACT)wParam);
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index 9a36e5df52..c2e342e53f 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -19,10 +19,10 @@ CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) : GetModuleFileName(g_hInstance, filePath, MAX_PATH); wchar_t sectionName[100]; - mir_sntprintf(sectionName, SIZEOF(sectionName), _T("%s/%s"), LPGENT("Protocols"), LPGENT(MODULE)); + mir_sntprintf(sectionName, _countof(sectionName), _T("%s/%s"), LPGENT("Protocols"), LPGENT(MODULE)); char settingName[100]; - mir_snprintf(settingName, SIZEOF(settingName), "%s_%s", MODULE, "main"); + mir_snprintf(settingName, _countof(settingName), "%s_%s", MODULE, "main"); SKINICONDESC sid = { 0 }; sid.flags = SIDF_ALL_TCHAR; @@ -33,7 +33,7 @@ CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) : sid.iDefaultIndex = -IDI_STEAM; IcoLib_AddIcon(&sid); - mir_snprintf(settingName, SIZEOF(settingName), "%s_%s", MODULE, "gaming"); + mir_snprintf(settingName, _countof(settingName), "%s_%s", MODULE, "gaming"); sid.description.t = LPGENT("Gaming icon"); sid.iDefaultIndex = -IDI_GAMING; IcoLib_AddIcon(&sid); @@ -64,7 +64,7 @@ CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) : // netlib support TCHAR name[128]; - mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName); + mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = { sizeof(nlu) }; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_TCHAR; diff --git a/protocols/Steam/src/steam_xstatus.cpp b/protocols/Steam/src/steam_xstatus.cpp index 74de926836..72a4a0e5b6 100644 --- a/protocols/Steam/src/steam_xstatus.cpp +++ b/protocols/Steam/src/steam_xstatus.cpp @@ -20,7 +20,7 @@ int CSteamProto::GetContactXStatus(MCONTACT hContact) void SetContactExtraIcon(MCONTACT hContact, int status) { char iconName[100]; - mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, "gaming"); + mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, "gaming"); ExtraIcon_SetIcon(hExtraXStatus, hContact, (status > 0) ? IcoLib_GetIconHandle(iconName) : NULL); } @@ -96,7 +96,7 @@ HICON CSteamProto::GetXStatusIcon(int status, UINT flags) return 0; char iconName[100]; - mir_snprintf(iconName, SIZEOF(iconName), "%s_%s", MODULE, "gaming"); + mir_snprintf(iconName, _countof(iconName), "%s_%s", MODULE, "gaming"); HICON icon = IcoLib_GetIcon(iconName, (flags & LR_BIGICON) != 0); return (flags & LR_SHARED) ? icon : CopyIcon(icon); diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index 8ae89022a8..5667c73c3c 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -86,7 +86,7 @@ static IconItem iconList[] = static 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;
@@ -108,7 +108,7 @@ void ReleaseIcolibIcon(HICON hIcon) { static void TlenRegisterIcons()
{
- Icon_Register(hInst, "Protocols/Tlen", iconList, SIZEOF(iconList), "TLEN");
+ Icon_Register(hInst, "Protocols/Tlen", iconList, _countof(iconList), "TLEN");
}
int TlenProtocol::PrebuildContactMenu(WPARAM hContact, LPARAM lParam)
@@ -189,7 +189,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam) memset(&cookie, 0, sizeof(cookie));
if (login != NULL && password != NULL) {
- mir_snprintf( form, SIZEOF(form), "username=%s&password=%s", login, password);
+ mir_snprintf( form, _countof(form), "username=%s&password=%s", login, password);
headers[0].szName = "Content-Type";
headers[0].szValue = "application/x-www-form-urlencoded";
memset(&req, 0, sizeof(req));
@@ -225,7 +225,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam) }
mir_free(login);
mir_free(password);
- mir_snprintf(szFileName, SIZEOF(szFileName), "http://poczta.o2.pl/login.html?sid=%s", cookie);
+ mir_snprintf(szFileName, _countof(szFileName), "http://poczta.o2.pl/login.html?sid=%s", cookie);
CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM)szFileName);
return 0;
}
diff --git a/protocols/Tlen/src/tlen_advsearch.cpp b/protocols/Tlen/src/tlen_advsearch.cpp index 1689a93173..aea0a806d0 100644 --- a/protocols/Tlen/src/tlen_advsearch.cpp +++ b/protocols/Tlen/src/tlen_advsearch.cpp @@ -61,7 +61,7 @@ static void FetchField(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, i if (hwndDlg == NULL || fieldName == NULL || str == NULL || strSize == NULL)
return;
- GetDlgItemTextA(hwndDlg, idCtrl, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, idCtrl, text, _countof(text));
if (text[0]) {
if ((localFieldName=TlenTextEncode(fieldName)) != NULL) {
if ((localText=TlenTextEncode(text)) != NULL) {
diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index e0722447a9..d548dc3c31 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -42,7 +42,7 @@ void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, TCHAR* pts else { proto->debugLog(_T("getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s"), ptszDest, errno, strerror(errno)); TCHAR buffer[512]; - mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), ptszDest); + mir_sntprintf(buffer, _countof(buffer), TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), ptszDest); PUShowMessageT(buffer, SM_WARNING); } } @@ -69,7 +69,7 @@ static void RemoveAvatar(TlenProtocol *proto, MCONTACT hContact) { if (hContact == NULL) { proto->threadData->avatarHash[0] = '\0'; } - TlenGetAvatarFileName( proto, NULL, tFileName, SIZEOF(tFileName)-1); + TlenGetAvatarFileName( proto, NULL, tFileName, _countof(tFileName)-1); DeleteFile(tFileName); db_unset(hContact, "ContactPhoto", "File"); db_unset(hContact, proto->m_szModuleName, "AvatarHash"); @@ -100,7 +100,7 @@ static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *it proto->threadData->avatarFormat = format; mir_strcpy(proto->threadData->avatarHash, md5); } - TlenGetAvatarFileName(proto, item, filename, SIZEOF(filename)-1); + TlenGetAvatarFileName(proto, item, filename, _countof(filename)-1); DeleteFile(filename); FILE *out = _tfopen(filename, TEXT("wb") ); if (out != NULL) { @@ -111,7 +111,7 @@ static void SetAvatar(TlenProtocol *proto, MCONTACT hContact, TLEN_LIST_ITEM *it db_set_dw(hContact, proto->m_szModuleName, "AvatarFormat", format); } else { TCHAR buffer[128]; - mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Cannot save new avatar file \"%s\" Error:\n\t%s (Error: %d)"), filename, _tcserror(errno), errno); + mir_sntprintf(buffer, _countof(buffer), TranslateT("Cannot save new avatar file \"%s\" Error:\n\t%s (Error: %d)"), filename, _tcserror(errno), errno); PUShowMessageT(buffer, SM_WARNING); proto->debugLog(buffer); return; diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp index 4ab81e9819..2ed6d32e7e 100644 --- a/protocols/Tlen/src/tlen_file.cpp +++ b/protocols/Tlen/src/tlen_file.cpp @@ -558,7 +558,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info) char *from=TlenXmlGetAttrValue(node, "f");
if (from != NULL) {
if (strchr(from, '@') == NULL) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", from, info->server);
+ mir_snprintf(jid, _countof(jid), "%s@%s", from, info->server);
} else {
strncpy_s(jid, from, _TRUNCATE);
}
@@ -585,7 +585,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info) }
}
else if (numFiles > 1) {
- mir_snprintf(szFilename, SIZEOF(szFilename), Translate("%d Files"), numFiles);
+ mir_snprintf(szFilename, _countof(szFilename), Translate("%d Files"), numFiles);
}
}
diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp index a6a7f39bd4..96b925d0b2 100644 --- a/protocols/Tlen/src/tlen_iqid.cpp +++ b/protocols/Tlen/src/tlen_iqid.cpp @@ -54,7 +54,7 @@ void TlenIqResultAuth(TlenProtocol *proto, XmlNode *iqNode) char text[128];
TlenSend(proto, "</s>");
- mir_snprintf(text, SIZEOF(text), Translate("Authentication failed for %s@%s."), proto->threadData->username, proto->threadData->server);
+ mir_snprintf(text, _countof(text), Translate("Authentication failed for %s@%s."), proto->threadData->username, proto->threadData->server);
MessageBoxA(NULL, text, Translate("Tlen Authentication"), MB_OK|MB_ICONSTOP|MB_SETFOREGROUND);
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_WRONGPASSWORD);
proto->threadData = NULL; // To disallow auto reconnect
@@ -260,7 +260,7 @@ void TlenIqResultVcard(TlenProtocol *proto, XmlNode *iqNode) if (strchr(jid, '@') != NULL) {
strncpy_s(text, jid, _TRUNCATE);
} else {
- mir_snprintf(text, SIZEOF(text), "%s@%s", jid, dbv.pszVal); // Add @tlen.pl
+ mir_snprintf(text, _countof(text), "%s@%s", jid, dbv.pszVal); // Add @tlen.pl
}
db_free(&dbv);
if ((hContact=TlenHContactFromJID(proto, text)) == NULL) {
@@ -421,7 +421,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) if (strchr(jid, '@') != NULL) {
strncpy_s(jsr.jid, jid, _TRUNCATE);
} else {
- mir_snprintf(jsr.jid, SIZEOF(jsr.jid), "%s@%s", jid, dbv.pszVal);
+ mir_snprintf(jsr.jid, _countof(jsr.jid), "%s@%s", jid, dbv.pszVal);
}
jsr.jid[sizeof(jsr.jid)-1] = '\0';
jsr.hdr.id.t = mir_a2t(jid);
@@ -469,7 +469,7 @@ void TlenIqResultSearch(TlenProtocol *proto, XmlNode *iqNode) if (strchr(proto->searchJID, '@') != NULL)
strncpy_s(jsr.jid, proto->searchJID, _TRUNCATE);
else
- mir_snprintf(jsr.jid, SIZEOF(jsr.jid), "%s@%s", proto->searchJID, dbv.pszVal);
+ mir_snprintf(jsr.jid, _countof(jsr.jid), "%s@%s", proto->searchJID, dbv.pszVal);
jsr.hdr.nick.t = jsr.hdr.firstName.t = jsr.hdr.lastName.t = jsr.hdr.email.t = jsr.hdr.id.t = TEXT("");
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE) id, (LPARAM) &jsr);
diff --git a/protocols/Tlen/src/tlen_muc.cpp b/protocols/Tlen/src/tlen_muc.cpp index 2b733f6285..1571b0d843 100644 --- a/protocols/Tlen/src/tlen_muc.cpp +++ b/protocols/Tlen/src/tlen_muc.cpp @@ -70,7 +70,7 @@ static char *getDisplayName(TlenProtocol *proto, const char *id) MCONTACT hContact;
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", id, dbv.pszVal);
+ mir_snprintf(jid, _countof(jid), "%s@%s", id, dbv.pszVal);
db_free(&dbv);
if (((hContact=TlenHContactFromJID(proto, jid)) != NULL) || !mir_strcmp(id, proto->threadData->username)) {
CONTACTINFO ci = { sizeof(ci) };
@@ -107,7 +107,7 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r char jid[256];
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", from, dbv.pszVal);
+ mir_snprintf(jid, _countof(jid), "%s@%s", from, dbv.pszVal);
db_free(&dbv);
} else {
mir_strcpy(jid, from);
@@ -119,7 +119,7 @@ int TlenMUCRecvInvitation(TlenProtocol *proto, const char *roomId, const char *r TLEN_LIST_ITEM *item;
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", from, dbv.pszVal);
+ mir_snprintf(jid, _countof(jid), "%s@%s", from, dbv.pszVal);
db_free(&dbv);
} else {
mir_strcpy(jid, from);
@@ -190,7 +190,7 @@ static int TlenMUCSendQuery(TlenProtocol *proto, int type, const char *parent, i if (type == 3) { // find chat room by name
char serialId[32];
TLEN_LIST_ITEM *item;
- mir_snprintf(serialId, SIZEOF(serialId), TLEN_IQID"%d", TlenSerialNext(proto));
+ mir_snprintf(serialId, _countof(serialId), TLEN_IQID"%d", TlenSerialNext(proto));
item = TlenListAdd(proto, LIST_SEARCH, serialId);
item->roomName = mir_strdup(parent);
TlenSend(proto, "<iq to='c' type='3' n='%s' id='%s'/>", parent, serialId);
@@ -236,7 +236,7 @@ INT_PTR TlenProtocol::MUCContactMenuHandleMUC(WPARAM wParam, LPARAM lParam) if ((hContact=wParam) != NULL && isOnline) {
if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
char serialId[32];
- mir_snprintf(serialId, SIZEOF(serialId), TLEN_IQID"%d", TlenSerialNext(this));
+ mir_snprintf(serialId, _countof(serialId), TLEN_IQID"%d", TlenSerialNext(this));
item = TlenListAdd(this, LIST_INVITATIONS, serialId);
item->nick = mir_strdup(dbv.pszVal);
TlenSend(this, "<p to='c' tp='c' id='%s'/>", serialId);
diff --git a/protocols/Tlen/src/tlen_opt.cpp b/protocols/Tlen/src/tlen_opt.cpp index 6442ecf019..42a58970fb 100644 --- a/protocols/Tlen/src/tlen_opt.cpp +++ b/protocols/Tlen/src/tlen_opt.cpp @@ -90,7 +90,7 @@ int TlenProtocol::OptionsInit(WPARAM wParam, LPARAM) odp.ptszTitle = m_tszUserName; odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR; odp.dwInitParam = (LPARAM)this; - for (int i = 0; i < SIZEOF(tabPages); i++) { + for (int i = 0; i < _countof(tabPages); i++) { odp.pszTemplate = MAKEINTRESOURCEA(tabPages[i].dlgId); odp.pfnDlgProc = tabPages[i].dlgProc; odp.ptszTab = tabPages[i].tabName; @@ -158,7 +158,7 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR bool reconnectRequired = false; DBVARIANT dbv; - GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, SIZEOF(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, _countof(text)); if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) { reconnectRequired = true; } @@ -170,7 +170,7 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text)); if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) { - GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, SIZEOF(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, _countof(text)); if (db_get(NULL, proto->m_szModuleName, "Password", &dbv)) { reconnectRequired = true; } @@ -302,7 +302,7 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara bool reconnectRequired = false; DBVARIANT dbv; - GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, SIZEOF(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, _countof(text)); if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) { reconnectRequired = true; } @@ -314,7 +314,7 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text)); if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) { - GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, SIZEOF(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, _countof(text)); if (db_get(NULL, proto->m_szModuleName, "Password", &dbv)) { reconnectRequired = true; } @@ -527,7 +527,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, bool reconnectRequired = false; DBVARIANT dbv; - GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, SIZEOF(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, _countof(text)); if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) { reconnectRequired = true; } @@ -538,7 +538,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, } db_set_s(NULL, proto->m_szModuleName, "LoginServer", strlwr(text)); - GetDlgItemTextA(hwndDlg, IDC_HOST, text, SIZEOF(text)); + GetDlgItemTextA(hwndDlg, IDC_HOST, text, _countof(text)); if (db_get(NULL, proto->m_szModuleName, "ManualHost", &dbv)) { reconnectRequired = true; } @@ -568,16 +568,16 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, db_set_b(NULL, proto->m_szModuleName, "UseFileProxy", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY)); db_set_w(NULL, proto->m_szModuleName, "FileProxyType", (WORD) SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_GETCURSEL, 0, 0)); - GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, SIZEOF(text)); + GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, _countof(text)); db_set_s(NULL, proto->m_szModuleName, "FileProxyHost", text); db_set_w(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE)); db_set_b(NULL, proto->m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH)); - GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, SIZEOF(text)); + GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, _countof(text)); db_set_s(NULL, proto->m_szModuleName, "FileProxyUsername", text); - GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, SIZEOF(text)); + GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, _countof(text)); db_set_s(NULL, proto->m_szModuleName, "FileProxyPassword", text); if (reconnectRequired && proto->isConnected) @@ -656,7 +656,7 @@ static INT_PTR CALLBACK TlenPopupsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, } else { delay=GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE); } - mir_sntprintf(title, SIZEOF(title), TranslateT("%S mail"), proto->m_szModuleName); + mir_sntprintf(title, _countof(title), TranslateT("%S mail"), proto->m_szModuleName); MailPopupPreview((DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORBKG,CPM_GETCOLOUR,0,0), (DWORD) SendDlgItemMessage(hwndDlg,IDC_COLORTXT,CPM_GETCOLOUR,0,0), title, diff --git a/protocols/Tlen/src/tlen_p2p_new.cpp b/protocols/Tlen/src/tlen_p2p_new.cpp index 3234fa47f0..1313ee2521 100644 --- a/protocols/Tlen/src/tlen_p2p_new.cpp +++ b/protocols/Tlen/src/tlen_p2p_new.cpp @@ -183,7 +183,7 @@ void TlenBindUDPSocket(TLEN_FILE_TRANSFER *ft) char host_name[256];
gethostname(host_name, sizeof(host_name));
hp = gethostbyname(host_name);
- mir_snprintf(host_name, SIZEOF(host_name), "%u.%u.%u.%u", (unsigned char)hp->h_addr_list[0][0],
+ mir_snprintf(host_name, _countof(host_name), "%u.%u.%u.%u", (unsigned char)hp->h_addr_list[0][0],
(unsigned char)hp->h_addr_list[0][1],
(unsigned char)hp->h_addr_list[0][2],
(unsigned char)hp->h_addr_list[0][3]);
@@ -257,7 +257,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { if ((item=TlenListAdd(ft->proto, LIST_FILE, ft->iqId)) != NULL) {
char fileInfo[128];
item->ft = ft;
- mir_snprintf(fileInfo, SIZEOF(fileInfo), "%s file(s), %s bytes", c, s);
+ mir_snprintf(fileInfo, _countof(fileInfo), "%s file(s), %s bytes", c, s);
TCHAR* filenameT = mir_utf8decodeT((char*)fileInfo);
PROTORECVFILET pre = { 0 };
pre.dwFlags = PRFF_TCHAR;
diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp index ea3fb7e2bb..255c1b8e03 100644 --- a/protocols/Tlen/src/tlen_picture.cpp +++ b/protocols/Tlen/src/tlen_picture.cpp @@ -34,7 +34,7 @@ static void LogPictureMessage(TlenProtocol *proto, const char *jid, const char * {
char message[1024];
const char *msg = isSent ? LPGEN("Image sent file://%s") : LPGEN("Image received file://%s");
- mir_snprintf(message, SIZEOF(message), Translate(msg), filename);
+ mir_snprintf(message, _countof(message), Translate(msg), filename);
TlenLogMessage(proto, TlenHContactFromJID(proto, jid), isSent ? DBEF_SENT : 0, message);
}
@@ -49,7 +49,7 @@ static void TlenPsPostThread(void *ptr) { DWORD ret;
item->ft->s = socket;
item->ft->hFileEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- ret = mir_snprintf(header, SIZEOF(header), "<pic auth='%s' t='p' to='%s' size='%d' idt='%s'/>", proto->threadData->username, item->ft->jid, item->ft->fileTotalSize, item->jid);
+ ret = mir_snprintf(header, _countof(header), "<pic auth='%s' t='p' to='%s' size='%d' idt='%s'/>", proto->threadData->username, item->ft->jid, item->ft->fileTotalSize, item->jid);
TlenWsSend(proto, socket, header, (int)ret);
ret = WaitForSingleObject(item->ft->hFileEvent, 1000 * 60 * 5);
if (ret == WAIT_OBJECT_0) {
@@ -58,7 +58,7 @@ static void TlenPsPostThread(void *ptr) { int i;
char header[512];
char fileBuffer[2048];
- i = mir_snprintf(header, SIZEOF(header), "<pic st='%s' idt='%s'/>", item->ft->iqId, item->jid);
+ i = mir_snprintf(header, _countof(header), "<pic st='%s' idt='%s'/>", item->ft->iqId, item->jid);
TlenWsSend(proto, socket, header, i);
proto->debugLogA("Sending picture data...");
for (i = item->ft->filesSize[0]; i > 0; ) {
@@ -114,7 +114,7 @@ static void TlenPsGetThread(void *ptr) { char header[512];
char fileBuffer[2048];
TlenXmlInitState(&xmlState);
- int header_len = mir_snprintf(header, SIZEOF(header), "<pic auth='%s' t='g' to='%s' pid='1001' idt='%s' rt='%s'/>", proto->threadData->username, item->ft->jid, item->jid, item->ft->id2);
+ int header_len = mir_snprintf(header, _countof(header), "<pic auth='%s' t='g' to='%s' pid='1001' idt='%s' rt='%s'/>", proto->threadData->username, item->ft->jid, item->jid, item->ft->id2);
TlenWsSend(proto, socket, header, header_len);
proto->debugLogA("Reveiving picture data...");
{
@@ -221,7 +221,7 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) { char fileName[MAX_PATH];
char *ext = TlenXmlGetAttrValue(node, "ext");
char *tmpPath = Utils_ReplaceVars( "%miranda_userdata%" );
- int tPathLen = mir_snprintf(fileName, SIZEOF(fileName), "%s\\Images\\Tlen", tmpPath);
+ int tPathLen = mir_snprintf(fileName, _countof(fileName), "%s\\Images\\Tlen", tmpPath);
long oldSize = 0, lSize = atol(size);
DWORD dwAttributes = GetFileAttributesA( fileName );
if ( dwAttributes == 0xffffffff || ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ) == 0 )
@@ -229,7 +229,7 @@ void TlenProcessPic(XmlNode *node, TlenProtocol *proto) { mir_free(tmpPath);
fileName[ tPathLen++ ] = '\\';
- mir_snprintf( fileName + tPathLen, SIZEOF(fileName) - tPathLen, "%s.%s", crc, ext );
+ mir_snprintf( fileName + tPathLen, _countof(fileName) - tPathLen, "%s.%s", crc, ext );
fp = fopen( fileName, "rb" );
if (fp) {
fseek(fp, 0, SEEK_END);
@@ -260,7 +260,7 @@ BOOL SendPicture(TlenProtocol *proto, MCONTACT hContact) { char *jid = dbv.pszVal;
TCHAR tszFilter[512], tszFileName[MAX_PATH];
- Bitmap_GetFilter(tszFilter, SIZEOF(tszFilter));
+ Bitmap_GetFilter(tszFilter, _countof(tszFilter));
tszFileName[0] = '\0';
OPENFILENAME ofn = {0};
@@ -285,7 +285,7 @@ BOOL SendPicture(TlenProtocol *proto, MCONTACT hContact) { char fileBuffer[2048];
int id = TlenSerialNext(proto);
T2Utf szFileName(tszFileName);
- mir_snprintf(idStr, SIZEOF(idStr), "%d", id);
+ mir_snprintf(idStr, _countof(idStr), "%d", id);
item = TlenListAdd(proto, LIST_PICTURE, idStr);
item->ft = TlenFileCreateFT(proto, jid);
item->ft->files = (char **) mir_alloc(sizeof(char *));
diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 75dfe31c80..8fd1cb213d 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -684,7 +684,7 @@ INT_PTR TlenProtocol::GetAvatarInfo(WPARAM wParam, LPARAM lParam) return GAIR_NOAVATAR;
if (avatarHash != NULL && !downloadingAvatar) {
- TlenGetAvatarFileName(this, item, pai->filename, SIZEOF(pai->filename)-1);
+ TlenGetAvatarFileName(this, item, pai->filename, _countof(pai->filename)-1);
pai->format = ( pai->hContact == NULL ) ? threadData->avatarFormat : item->avatarFormat;
return GAIR_SUCCESS;
}
@@ -800,7 +800,7 @@ HANDLE TlenProtocol::SendFile(MCONTACT hContact, const TCHAR* szDescription, TCH db_free(&dbv);
int id = TlenSerialNext(this);
- mir_snprintf(idStr, SIZEOF(idStr), "%d", id);
+ mir_snprintf(idStr, _countof(idStr), "%d", id);
TLEN_LIST_ITEM *item = TlenListAdd(this, LIST_FILE, idStr);
if (item != NULL) {
ft->iqId = mir_strdup(idStr);
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index f6c86885b8..4c3c43769f 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -72,13 +72,13 @@ static INT_PTR CALLBACK TlenPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- mir_snprintf(text, SIZEOF(text), Translate("Enter password for %s"), (char *) lParam);
+ mir_snprintf(text, _countof(text), Translate("Enter password for %s"), (char *) lParam);
SetDlgItemTextA(hwndDlg, IDC_JID, text);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, onlinePassword, SIZEOF(onlinePassword));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, onlinePassword, _countof(onlinePassword));
//EndDialog(hwndDlg, (int) onlinePassword);
//return TRUE;
// Fall through
@@ -207,7 +207,7 @@ void __cdecl TlenServerThread(ThreadData *info) return;
}
- mir_snprintf(jidStr, SIZEOF(jidStr), "%s@%s", info->username, info->server);
+ mir_snprintf(jidStr, _countof(jidStr), "%s@%s", info->username, info->server);
db_set_s(NULL, info->proto->m_szModuleName, "jid", jidStr);
if (!db_get(NULL, info->proto->m_szModuleName, "ManualHost", &dbv)) {
@@ -402,7 +402,7 @@ static void TlenSendAuth(TlenProtocol *proto) { int iqId;
char text[128];
char *str = TlenPasswordHash(proto->threadData->password);
- mir_snprintf(text, SIZEOF(text), "%s%s", proto->threadData->streamId, str);
+ mir_snprintf(text, _countof(text), "%s%s", proto->threadData->streamId, str);
mir_free(str);
str = TlenSha1(text);
char *p=TlenTextEncode(proto->threadData->username);
@@ -912,7 +912,7 @@ static void TlenProcessW(XmlNode *node, ThreadData *info) char *f = TlenXmlGetAttrValue(node, "f");
if (f != NULL) {
char webContactName[128];
- mir_snprintf(webContactName, SIZEOF(webContactName), Translate("%s Web Messages"), info->proto->m_szModuleName);
+ mir_snprintf(webContactName, _countof(webContactName), Translate("%s Web Messages"), info->proto->m_szModuleName);
MCONTACT hContact = TlenHContactFromJID(info->proto, webContactName);
if (hContact == NULL) {
hContact = TlenDBCreateContact(info->proto, webContactName, webContactName, TRUE);
@@ -1198,7 +1198,7 @@ static void TlenProcessV(XmlNode *node, ThreadData *info) char *from=TlenXmlGetAttrValue(node, "f");
if (from != NULL) {
if (strchr(from, '@') == NULL) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", from, info->server);
+ mir_snprintf(jid, _countof(jid), "%s@%s", from, info->server);
} else {
strncpy_s(jid, from, _TRUNCATE);
}
diff --git a/protocols/Tlen/src/tlen_userinfo.cpp b/protocols/Tlen/src/tlen_userinfo.cpp index 161bb926ae..3d1dc7c4e4 100644 --- a/protocols/Tlen/src/tlen_userinfo.cpp +++ b/protocols/Tlen/src/tlen_userinfo.cpp @@ -99,7 +99,7 @@ static void FetchField(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, i if (hwndDlg == NULL || fieldName == NULL || str == NULL || strSize == NULL)
return;
- GetDlgItemTextA(hwndDlg, idCtrl, text, SIZEOF(text));
+ GetDlgItemTextA(hwndDlg, idCtrl, text, _countof(text));
if (text[0]) {
if ((localFieldName=TlenTextEncode(fieldName)) != NULL) {
if ((localText=TlenTextEncode(text)) != NULL) {
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index a08e906761..3842268777 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -493,7 +493,7 @@ static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft) }
{
char ttt[2048];
- mir_snprintf(ttt, SIZEOF(ttt), "%s %d %d ", statusTxt, ft->proto->framesAvailableForPlayback, ft->proto->availOverrunValue);
+ mir_snprintf(ttt, _countof(ttt), "%s %d %d ", statusTxt, ft->proto->framesAvailableForPlayback, ft->proto->availOverrunValue);
SetDlgItemTextA(ft->proto->voiceDlgHWND, IDC_STATUS, ttt);
}
TlenP2PPacketFree(packet);
@@ -683,7 +683,7 @@ INT_PTR TlenProtocol::VoiceContactMenuHandleVoice(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
char serialId[32];
- mir_snprintf(serialId, SIZEOF(serialId), "%d", TlenSerialNext(this));
+ mir_snprintf(serialId, _countof(serialId), "%d", TlenSerialNext(this));
TLEN_LIST_ITEM *item = TlenListAdd(this, LIST_VOICE, serialId);
if (item != NULL) {
TLEN_FILE_TRANSFER *ft = TlenFileCreateFT(this, dbv.pszVal);
@@ -931,7 +931,7 @@ static char *getDisplayName(TlenProtocol *proto, const char *id) MCONTACT hContact;
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", id, dbv.pszVal);
+ mir_snprintf(jid, _countof(jid), "%s@%s", id, dbv.pszVal);
db_free(&dbv);
if ((hContact = TlenHContactFromJID(proto, jid)) != NULL)
return mir_strdup((char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, 0));
@@ -1012,11 +1012,11 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) char jid[256];
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", from, dbv.pszVal);
+ mir_snprintf(jid, _countof(jid), "%s@%s", from, dbv.pszVal);
db_free(&dbv);
}
else {
- strncpy(jid, from, SIZEOF(jid) - 1);
+ strncpy(jid, from, _countof(jid) - 1);
}
ignore = !IsAuthorized(proto, jid);
ask = true;
@@ -1025,11 +1025,11 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) char jid[256];
DBVARIANT dbv;
if (!db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) {
- mir_snprintf(jid, SIZEOF(jid), "%s@%s", from, dbv.pszVal);
+ mir_snprintf(jid, _countof(jid), "%s@%s", from, dbv.pszVal);
db_free(&dbv);
}
else {
- strncpy(jid, from, SIZEOF(jid) - 1);
+ strncpy(jid, from, _countof(jid) - 1);
}
ask = !IsAuthorized(proto, jid);
ignore = false;
diff --git a/protocols/Tlen/src/tlen_ws.cpp b/protocols/Tlen/src/tlen_ws.cpp index 7e31aedd37..7db8152810 100644 --- a/protocols/Tlen/src/tlen_ws.cpp +++ b/protocols/Tlen/src/tlen_ws.cpp @@ -32,13 +32,13 @@ BOOL TlenWsInit(TlenProtocol *proto) nlu.cbSize = sizeof(nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY;
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), proto->m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s connection"), proto->m_tszUserName);
nlu.ptszDescriptiveName = name;
nlu.szSettingsModule = proto->m_szModuleName;
proto->m_hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) &nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_NOOPTIONS | NUF_TCHAR;
- mir_sntprintf(name, SIZEOF(name), TranslateT("%s SOCKS connection"), proto->m_tszUserName);
+ mir_sntprintf(name, _countof(name), TranslateT("%s SOCKS connection"), proto->m_tszUserName);
nlu.ptszDescriptiveName = name;
proto->hFileNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) &nlu);
nlus.cbSize = sizeof(nlus);
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))
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 5bb7e52b51..23d6e15e33 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -167,7 +167,7 @@ bool TwitterProto::NegotiateConnection() // this looks like bad code.. can someone clean this up please? or confirm that it's ok
wchar_t buf[1024] = {};
- mir_snwprintf(buf, SIZEOF(buf), AuthorizeUrl.c_str(), oauthToken.c_str());
+ mir_snwprintf(buf, _countof(buf), AuthorizeUrl.c_str(), oauthToken.c_str());
debugLogW(_T("**NegotiateConnection - Launching %s"), buf);
ShellExecute(NULL, L"open", buf, NULL, NULL, SW_SHOWNORMAL);
diff --git a/protocols/Twitter/src/main.cpp b/protocols/Twitter/src/main.cpp index 58bc371096..4a36d4412b 100644 --- a/protocols/Twitter/src/main.cpp +++ b/protocols/Twitter/src/main.cpp @@ -110,7 +110,7 @@ extern "C" int __declspec(dllexport) Load(void) extern "C" int __declspec(dllexport) Unload(void)
{
UninitContactMenus();
- for (size_t i = 1; i < SIZEOF(g_hEvents); i++)
+ for (size_t i = 1; i < _countof(g_hEvents); i++)
UnhookEvent(g_hEvents[i]);
return 0;
diff --git a/protocols/Twitter/src/oauth.cpp b/protocols/Twitter/src/oauth.cpp index b2d8aa4795..563e5fcbc5 100644 --- a/protocols/Twitter/src/oauth.cpp +++ b/protocols/Twitter/src/oauth.cpp @@ -90,7 +90,7 @@ wstring mir_twitter::UrlGetQuery(const wstring& url) wchar_t buf[1024*4] = {};
components.lpszExtraInfo = buf;
- components.dwExtraInfoLength = SIZEOF(buf);
+ components.dwExtraInfoLength = _countof(buf);
BOOL crackUrlOk = InternetCrackUrl(url.c_str(), url.size(), 0, &components);
_ASSERTE(crackUrlOk);
@@ -308,7 +308,7 @@ wstring mir_twitter::OAuthNormalizeUrl(const wstring& url) if (Compare(brokenURL[L"scheme"], L"http", false) && !(Compare(brokenURL[L"port"], L"80", false)) ||
(Compare(brokenURL[L"scheme"], L"https", false) && !(Compare(brokenURL[L"port"], L"443", false))))
{
- mir_snwprintf(port, SIZEOF(port), L":%s", brokenURL[L"port"]);
+ mir_snwprintf(port, _countof(port), L":%s", brokenURL[L"port"]);
}
// InternetCrackUrl includes ? and # elements in the path,
@@ -366,7 +366,7 @@ wstring mir_twitter::OAuthCreateNonce() wstring nonce;
for (int i = 0; i <= 16; ++i)
- nonce += ALPHANUMERIC[rand() % (SIZEOF(ALPHANUMERIC) - 1)]; // don't count null terminator in array
+ nonce += ALPHANUMERIC[rand() % (_countof(ALPHANUMERIC) - 1)]; // don't count null terminator in array
return nonce;
}
@@ -378,7 +378,7 @@ wstring mir_twitter::OAuthCreateTimestamp() _ASSERTE(utcNow != -1);
wchar_t buf[100] = {};
- mir_snwprintf(buf, SIZEOF(buf), L"%I64u", utcNow);
+ mir_snwprintf(buf, _countof(buf), L"%I64u", utcNow);
return buf;
}
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 752a3f78a2..c9bd871c80 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -45,7 +45,7 @@ TwitterProto::TwitterProto(const char *proto_name, const TCHAR *username) : // Initialize hotkeys
char text[512];
- mir_snprintf(text, SIZEOF(text), "%s/Tweet", m_szModuleName);
+ mir_snprintf(text, _countof(text), "%s/Tweet", m_szModuleName);
HOTKEYDESC hkd = { sizeof(hkd) };
hkd.pszName = text;
@@ -332,7 +332,7 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) // Create avatar network connection (TODO: probably remove this)
char module[512];
- mir_snprintf(module, SIZEOF(module), "%sAv", m_szModuleName);
+ mir_snprintf(module, _countof(module), "%sAv", m_szModuleName);
nlu.szSettingsModule = module;
mir_sntprintf(descr, TranslateT("%s avatar connection"), m_tszUserName);
nlu.ptszDescriptiveName = descr;
@@ -387,7 +387,7 @@ int TwitterProto::ShowPinDialog() void TwitterProto::ShowPopup(const wchar_t *text, int Error)
{
POPUPDATAT popup = {};
- mir_sntprintf(popup.lptzContactName, SIZEOF(popup.lptzContactName), TranslateT("%s Protocol"), m_tszUserName);
+ mir_sntprintf(popup.lptzContactName, _countof(popup.lptzContactName), TranslateT("%s Protocol"), m_tszUserName);
wcsncpy_s(popup.lptzText, text, _TRUNCATE);
if (Error) {
@@ -405,8 +405,8 @@ void TwitterProto::ShowPopup(const wchar_t *text, int Error) void TwitterProto::ShowPopup(const char *text, int Error)
{
POPUPDATAT popup = {};
- mir_sntprintf(popup.lptzContactName, SIZEOF(popup.lptzContactName), TranslateT("%s Protocol"), m_tszUserName);
- mbcs_to_tcs(CP_UTF8, text, popup.lptzText, SIZEOF(popup.lptzText));
+ mir_sntprintf(popup.lptzContactName, _countof(popup.lptzContactName), TranslateT("%s Protocol"), m_tszUserName);
+ mbcs_to_tcs(CP_UTF8, text, popup.lptzText, _countof(popup.lptzText));
if (Error) {
popup.iSeconds = -1;
popup.colorBack = 0x000000FF;
@@ -429,7 +429,7 @@ void TwitterProto::SendTweetWorker(void *p) char *text = static_cast<char*>(p);
if (mir_strlen(text) > 140) { // looks like the chat max outgoing msg thing doesn't work, so i'll do it here.
TCHAR errorPopup[280];
- mir_sntprintf(errorPopup, SIZEOF(errorPopup), _T("Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?"), mir_strlen(text));
+ mir_sntprintf(errorPopup, _countof(errorPopup), _T("Don't be crazy! Everyone knows the max tweet size is 140, and you're trying to fit %d chars in there?"), mir_strlen(text));
ShowPopup(errorPopup, 1);
return;
}
@@ -462,7 +462,7 @@ void TwitterProto::UpdateSettings() std::tstring TwitterProto::GetAvatarFolder()
{
TCHAR path[MAX_PATH];
- mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), VARST(_T("%miranda_avatarcache%")), m_tszUserName);
+ mir_sntprintf(path, _countof(path), _T("%s\\%s"), VARST(_T("%miranda_avatarcache%")), m_tszUserName);
return path;
}
diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp index 8dcf0c2069..71e6d0316b 100644 --- a/protocols/Twitter/src/theme.cpp +++ b/protocols/Twitter/src/theme.cpp @@ -31,18 +31,18 @@ static IconItem icons[] = { LPGEN("Visit Homepage"), "homepage", 0 },
};
-static HANDLE hIconLibItem[SIZEOF(icons)];
+static HANDLE hIconLibItem[_countof(icons)];
// TODO: uninit
void InitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/Twitter", icons, SIZEOF(icons), "Twitter");
- icons[SIZEOF(icons) - 1].hIcolib = Skin_GetIconHandle(SKINICON_EVENT_URL);
+ Icon_Register(g_hInstance, "Protocols/Twitter", icons, _countof(icons), "Twitter");
+ icons[_countof(icons) - 1].hIcolib = Skin_GetIconHandle(SKINICON_EVENT_URL);
}
HANDLE GetIconHandle(const char* name)
{
- for (size_t i = 0; i < SIZEOF(icons); i++)
+ for (size_t i = 0; i < _countof(icons); i++)
if (mir_strcmp(icons[i].szName, name) == 0)
return hIconLibItem[i];
@@ -106,16 +106,16 @@ void InitContactMenus() void UninitContactMenus()
{
- for (size_t i = 0; i < SIZEOF(g_hMenuItems); i++)
+ for (size_t i = 0; i < _countof(g_hMenuItems); i++)
CallService(MO_REMOVEMENUITEM, (WPARAM)g_hMenuItems[i], 0);
UnhookEvent(g_hMenuEvts[0]);
- for (size_t i = 1; i < SIZEOF(g_hMenuEvts); i++)
+ for (size_t i = 1; i < _countof(g_hMenuEvts); i++)
DestroyServiceFunction(g_hMenuEvts[i]);
}
void ShowContactMenus(bool show)
{
- for (size_t i = 0; i < SIZEOF(g_hMenuItems); i++)
+ for (size_t i = 0; i < _countof(g_hMenuItems); i++)
Menu_ShowItem(g_hMenuItems[i], show);
}
diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp index c1575bd090..71dbb239c9 100644 --- a/protocols/Twitter/src/ui.cpp +++ b/protocols/Twitter/src/ui.cpp @@ -50,7 +50,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM db_free(&dbv);
}
- for (size_t i = 0; i < SIZEOF(sites); i++)
+ for (size_t i = 0; i < _countof(sites); i++)
SendDlgItemMessage(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(sites[i]));
if (!db_get_s(0, proto->ModuleName(), TWITTER_KEY_BASEURL, &dbv)) {
@@ -82,12 +82,12 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM char str[128];
TCHAR tstr[128];
- GetDlgItemTextA(hwndDlg, IDC_SERVER, str, SIZEOF(str) - 1);
+ GetDlgItemTextA(hwndDlg, IDC_SERVER, str, _countof(str) - 1);
if (str[mir_strlen(str) - 1] != '/')
- mir_strncat(str, "/", SIZEOF(str) - mir_strlen(str));
+ mir_strncat(str, "/", _countof(str) - mir_strlen(str));
db_set_s(0, proto->ModuleName(), TWITTER_KEY_BASEURL, str);
- GetDlgItemText(hwndDlg, IDC_GROUP, tstr, SIZEOF(tstr));
+ GetDlgItemText(hwndDlg, IDC_GROUP, tstr, _countof(tstr));
db_set_ts(0, proto->ModuleName(), TWITTER_KEY_GROUP, tstr);
return true;
@@ -113,7 +113,7 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam // Set window title
TCHAR title[512];
- mir_sntprintf(title, SIZEOF(title), _T("Send Tweet for %s"), proto->m_tszUserName);
+ mir_sntprintf(title, _countof(title), _T("Send Tweet for %s"), proto->m_tszUserName);
SetWindowText(hwndDlg, title);
return true;
@@ -122,7 +122,7 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam TCHAR msg[141];
proto = reinterpret_cast<TwitterProto*>(GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
- GetDlgItemText(hwndDlg, IDC_TWEETMSG, msg, SIZEOF(msg));
+ GetDlgItemText(hwndDlg, IDC_TWEETMSG, msg, _countof(msg));
ShowWindow(hwndDlg, SW_HIDE);
char *narrow = mir_t2a_cp(msg, CP_UTF8);
@@ -147,7 +147,7 @@ INT_PTR CALLBACK tweet_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam break;
case WM_SETREPLY:
char foo[512];
- mir_snprintf(foo, SIZEOF(foo), "@%s ", (char*)wParam);
+ mir_snprintf(foo, _countof(foo), "@%s ", (char*)wParam);
size_t len = mir_strlen(foo);
SetDlgItemTextA(hwndDlg, IDC_TWEETMSG, foo);
@@ -181,7 +181,7 @@ INT_PTR CALLBACK options_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar CheckDlgButton(hwndDlg, IDC_CHATFEED, db_get_b(0, proto->ModuleName(), TWITTER_KEY_CHATFEED, 0) ? BST_CHECKED : BST_UNCHECKED);
- for (size_t i = 0; i < SIZEOF(sites); i++)
+ for (size_t i = 0; i < _countof(sites); i++)
SendDlgItemMessage(hwndDlg, IDC_BASEURL, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(sites[i]));
if (!db_get_s(0, proto->ModuleName(), TWITTER_KEY_BASEURL, &dbv)) {
@@ -191,7 +191,7 @@ INT_PTR CALLBACK options_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar else SendDlgItemMessage(hwndDlg, IDC_BASEURL, CB_SETCURSEL, 0, 0);
char pollrate_str[32];
- mir_snprintf(pollrate_str, SIZEOF(pollrate_str), "%d", db_get_dw(0, proto->ModuleName(), TWITTER_KEY_POLLRATE, 80));
+ mir_snprintf(pollrate_str, _countof(pollrate_str), "%d", db_get_dw(0, proto->ModuleName(), TWITTER_KEY_POLLRATE, 80));
SetDlgItemTextA(hwndDlg, IDC_POLLRATE, pollrate_str);
CheckDlgButton(hwndDlg, IDC_TWEET_MSG, db_get_b(0, proto->ModuleName(), TWITTER_KEY_TWEET_TO_MSG, 0) ? BST_CHECKED : BST_UNCHECKED);
@@ -226,17 +226,17 @@ INT_PTR CALLBACK options_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar proto = reinterpret_cast<TwitterProto*>(GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_UN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_UN, str, _countof(str));
db_set_s(0, proto->ModuleName(), TWITTER_KEY_UN, str);
- GetDlgItemTextA(hwndDlg, IDC_BASEURL, str, SIZEOF(str) - 1);
+ GetDlgItemTextA(hwndDlg, IDC_BASEURL, str, _countof(str) - 1);
if (str[mir_strlen(str) - 1] != '/')
- mir_strncat(str, "/", SIZEOF(str) - mir_strlen(str));
+ mir_strncat(str, "/", _countof(str) - mir_strlen(str));
db_set_s(0, proto->ModuleName(), TWITTER_KEY_BASEURL, str);
db_set_b(0, proto->ModuleName(), TWITTER_KEY_CHATFEED, IsDlgButtonChecked(hwndDlg, IDC_CHATFEED) != 0);
- GetDlgItemTextA(hwndDlg, IDC_POLLRATE, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_POLLRATE, str, _countof(str));
int rate = atoi(str);
if (rate == 0)
rate = 80;
@@ -260,7 +260,7 @@ namespace popup_options return -1;
else if (IsDlgButtonChecked(hwndDlg, IDC_TIMEOUT_CUSTOM)) {
char str[32];
- GetDlgItemTextA(hwndDlg, IDC_TIMEOUT, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_TIMEOUT, str, _countof(str));
return atoi(str);
}
else // Default checked (probably)
@@ -330,7 +330,7 @@ namespace popup_options }
// Pick a random quote
- int q = rand() % SIZEOF(quotes);
+ int q = rand() % _countof(quotes);
_tcsncpy(popup.lptzContactName, quotes[q].name, MAX_CONTACTNAME);
_tcsncpy(popup.lptzText, quotes[q].text, MAX_SECONDLINE);
@@ -478,7 +478,7 @@ INT_PTR CALLBACK pin_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) proto = reinterpret_cast<TwitterProto*>(GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_PIN, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_PIN, str, _countof(str));
db_set_s(0, proto->ModuleName(), TWITTER_KEY_OAUTH_PIN, str);
EndDialog(hwndDlg, wParam);
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 85c2c6cbb0..39bc02044a 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -55,9 +55,9 @@ bool tlstrstr(TCHAR* _s1, TCHAR* _s2) TCHAR s1[1024], s2[1024];
_tcsncpy_s(s1, _s1, _TRUNCATE);
- CharLowerBuff(s1, SIZEOF(s1));
+ CharLowerBuff(s1, _countof(s1));
_tcsncpy_s(s2, _s2, _TRUNCATE);
- CharLowerBuff(s2, SIZEOF(s2));
+ CharLowerBuff(s2, _countof(s2));
return _tcsstr(s1, s2) != NULL;
}
@@ -82,12 +82,12 @@ static IconItem iconList[] = void InitIcons()
{
- Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("VKontakte"), iconList, SIZEOF(iconList), "VKontakte");
+ Icon_Register(hInst, LPGEN("Protocols")"/"LPGEN("VKontakte"), iconList, _countof(iconList), "VKontakte");
}
HANDLE GetIconHandle(int iCommand)
{
- for (int i = 0; i < SIZEOF(iconList); i++)
+ for (int i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iCommand)
return iconList[i].hIcolib;
@@ -735,13 +735,13 @@ void CVkProto::SetSrmmReadStatus(MCONTACT hContact) TCHAR ttime[64];
_locale_t locale = _create_locale(LC_ALL, "");
- _tcsftime_l(ttime, SIZEOF(ttime), _T("%X - %x"), localtime(&time), locale);
+ _tcsftime_l(ttime, _countof(ttime), _T("%X - %x"), localtime(&time), locale);
_free_locale(locale);
StatusTextData st = { 0 };
st.cbSize = sizeof(st);
st.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_READMSG));
- mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("Message read: %s"), ttime);
+ mir_sntprintf(st.tszText, _countof(st.tszText), TranslateT("Message read: %s"), ttime);
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
}
@@ -756,7 +756,7 @@ char* CVkProto::GetStickerId(const char* Msg, int &stickerid) if (tmpMsg)
iRes = sscanf(tmpMsg, "[sticker:%d]", &stickerid);
if (iRes == 1) {
- mir_snprintf(HeadMsg, SIZEOF(HeadMsg), "[sticker:%d]", stickerid);
+ mir_snprintf(HeadMsg, _countof(HeadMsg), "[sticker:%d]", stickerid);
size_t retLen = mir_strlen(HeadMsg);
if (retLen < mir_strlen(Msg)) {
CMStringA szMsg(Msg, int(mir_strlen(Msg) - mir_strlen(tmpMsg)));
@@ -834,7 +834,7 @@ CMString CVkProto::SpanVKNotificationType(CMString& tszType, VKObjType& vkFeedba CMString tszRes;
vkFeedback = vkParent = vkNull;
- for (int i = 0; i < SIZEOF(vkNotification); i++)
+ for (int i = 0; i < _countof(vkNotification); i++)
if (tszType == vkNotification[i].ptszType) {
vkFeedback = vkNotification[i].vkFeedback;
vkParent = vkNotification[i].vkParent;
@@ -852,7 +852,7 @@ CMString CVkProto::GetVkPhotoItem(const JSONNode &jnPhoto, BBCSupport iBBC) return tszRes;
CMString tszLink, tszPreviewLink;
- for (int i = 0; i < SIZEOF(szImageTypes); i++) {
+ for (int i = 0; i < _countof(szImageTypes); i++) {
const JSONNode &n = jnPhoto[szImageTypes[i]];
if (!n.isnull()) {
tszLink = n.as_mstring();
@@ -922,7 +922,7 @@ CMString CVkProto::SetBBCString(LPCTSTR ptszString, BBCSupport iBBC, VKBBCType b return CMString();
TCHAR *ptszFormat = NULL;
- for (int i = 0; i < SIZEOF(bbcItem); i++)
+ for (int i = 0; i < _countof(bbcItem); i++)
if (bbcItem[i].vkBBCType == bbcType && bbcItem[i].vkBBCSettings == iBBC) {
ptszFormat = bbcItem[i].ptszTempate;
break;
@@ -1059,7 +1059,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport }
else {
CMString tszLink;
- for (int i = 0; i < SIZEOF(szImageTypes); i++) {
+ for (int i = 0; i < _countof(szImageTypes); i++) {
const JSONNode &n = jnSticker[szImageTypes[i]];
if (!n.isnull()) {
tszLink = n.as_mstring();
@@ -1097,7 +1097,7 @@ CMString CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport continue;
CMString tszLink;
- for (int i = 0; i < SIZEOF(szGiftTypes); i++) {
+ for (int i = 0; i < _countof(szGiftTypes); i++) {
const JSONNode &n = jnGift[szGiftTypes[i]];
if (!n.isnull()) {
tszLink = n.as_mstring();
@@ -1146,7 +1146,7 @@ CMString CVkProto::GetFwdMessages(const JSONNode &jnMessages, BBCSupport iBBC) time_t datetime = (time_t)jnMsg["date"].as_int();
TCHAR ttime[64];
_locale_t locale = _create_locale(LC_ALL, "");
- _tcsftime_l(ttime, SIZEOF(ttime), _T("%x %X"), localtime(&datetime), locale);
+ _tcsftime_l(ttime, _countof(ttime), _T("%x %X"), localtime(&datetime), locale);
_free_locale(locale);
CMString tszBody(jnMsg["body"].as_mstring());
diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index ef54de209f..85e97f9906 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -23,7 +23,7 @@ void CVkProto::OnReceiveAvatar(NETLIBHTTPREQUEST *reply, AsyncHttpRequest* pReq) return;
PROTO_AVATAR_INFORMATION ai = { 0 };
- GetAvatarFileName((MCONTACT)pReq->pUserInfo, ai.filename, SIZEOF(ai.filename));
+ GetAvatarFileName((MCONTACT)pReq->pUserInfo, ai.filename, _countof(ai.filename));
ai.format = ProtoGetBufferFormat(reply->pData);
FILE *out = _tfopen(ai.filename, _T("wb"));
@@ -80,8 +80,8 @@ INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) return GAIR_NOAVATAR;
TCHAR tszFileName[MAX_PATH];
- GetAvatarFileName(pai->hContact, tszFileName, SIZEOF(tszFileName));
- _tcsncpy(pai->filename, tszFileName, SIZEOF(pai->filename));
+ GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName));
+ _tcsncpy(pai->filename, tszFileName, _countof(pai->filename));
pai->format = ProtoGetAvatarFormat(pai->filename);
@@ -160,7 +160,7 @@ void CVkProto::SetAvatarUrl(MCONTACT hContact, CMString &tszUrl) setByte(hContact,"NeedNewAvatar", 1);
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = hContact;
- GetAvatarFileName(ai.hContact, ai.filename, SIZEOF(ai.filename));
+ GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename));
ai.format = ProtoGetAvatarFormat(ai.filename);
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&ai, 0);
}
diff --git a/protocols/VKontakte/src/vk_captcha.cpp b/protocols/VKontakte/src/vk_captcha.cpp index 0c0699900a..ede03c51e2 100644 --- a/protocols/VKontakte/src/vk_captcha.cpp +++ b/protocols/VKontakte/src/vk_captcha.cpp @@ -80,7 +80,7 @@ static INT_PTR CALLBACK CaptchaFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam return TRUE;
case IDOK:
- GetDlgItemTextA(hwndDlg, IDC_VALUE, params->Result, SIZEOF(params->Result));
+ GetDlgItemTextA(hwndDlg, IDC_VALUE, params->Result, _countof(params->Result));
EndDialog(hwndDlg, 1);
return TRUE;
}
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 2021f0ee12..5b8b7f7b0f 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -73,7 +73,7 @@ CVkChatInfo* CVkProto::AppendChat(int id, const JSONNode &jnDlg) GCDEST gcd = { m_szModuleName, sid, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
- for (int i = SIZEOF(sttStatuses)-1; i >= 0; i--) {
+ for (int i = _countof(sttStatuses)-1; i >= 0; i--) {
gce.ptszStatus = TranslateTS(sttStatuses[i]);
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
}
@@ -839,11 +839,11 @@ int CVkProto::OnGcMenuHook(WPARAM, LPARAM lParam) return 0;
if (gcmi->Type == MENU_ON_LOG) {
- gcmi->nItems = SIZEOF(sttLogListItems);
+ gcmi->nItems = _countof(sttLogListItems);
gcmi->Item = sttLogListItems;
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
- gcmi->nItems = SIZEOF(sttListItems);
+ gcmi->nItems = _countof(sttListItems);
gcmi->Item = sttListItems;
}
return 0;
@@ -922,7 +922,7 @@ static INT_PTR CALLBACK GcCreateDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L }
TCHAR tszTitle[1024];
- GetDlgItemText(hwndDlg, IDC_TITLE, tszTitle, SIZEOF(tszTitle));
+ GetDlgItemText(hwndDlg, IDC_TITLE, tszTitle, _countof(tszTitle));
ppro->CreateNewChat(uids, tszTitle);
EndDialog(hwndDlg, 0);
return TRUE;
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp index 960dfe70d5..98a7e633aa 100644 --- a/protocols/VKontakte/src/vk_options.cpp +++ b/protocols/VKontakte/src/vk_options.cpp @@ -63,10 +63,10 @@ INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
TCHAR str[1025];
- GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
ppro->setTString("Login", str);
- GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_PASSWORD, str, _countof(str));
T2Utf szRawPasswd(str);
if (szRawPasswd != NULL)
ppro->setString("Password", szRawPasswd);
@@ -170,16 +170,16 @@ INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
TCHAR str[1025];
- GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_LOGIN, str, _countof(str));
ppro->setTString("Login", str);
- GetDlgItemText(hwndDlg, IDC_GROUPNAME, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_GROUPNAME, str, _countof(str));
if (mir_tstrcmp(ppro->getGroup(), str)) {
ppro->setGroup(str);
ppro->setTString("ProtoGroup", str);
}
- GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_PASSWORD, str, _countof(str));
T2Utf szRawPasswd(str);
if (szRawPasswd != NULL)
ppro->setString("Password", szRawPasswd);
@@ -330,7 +330,7 @@ INT_PTR CALLBACK CVkProto::OptionsAdvProc(HWND hwndDlg, UINT uMsg, WPARAM wParam db_set_b(NULL, "ListeningTo", szListeningTo, ppro->m_iMusicSendMetod == 0 ? 0 : 1);
TCHAR buffer[5] = { 0 };
- GetDlgItemText(hwndDlg, IDC_ED_INT_INVIS, buffer, SIZEOF(buffer));
+ GetDlgItemText(hwndDlg, IDC_ED_INT_INVIS, buffer, _countof(buffer));
ppro->setDword("InvisibleInterval", ppro->m_iInvisibleInterval = _ttoi(buffer));
}
break;
@@ -494,10 +494,10 @@ INT_PTR CALLBACK CVkProto::OptionsFeedsProc(HWND hwndDlg, UINT uMsg, WPARAM wPar ppro->setByte("NotificationFilterInvites", ppro->m_bNotificationFilterInvites);
TCHAR buffer[5] = { 0 };
- GetDlgItemText(hwndDlg, IDC_ED_INT_NEWS, buffer, SIZEOF(buffer));
+ GetDlgItemText(hwndDlg, IDC_ED_INT_NEWS, buffer, _countof(buffer));
ppro->setDword("NewsInterval", ppro->m_iNewsInterval = _ttoi(buffer));
- GetDlgItemText(hwndDlg, IDC_ED_INT_NOTIF, buffer, SIZEOF(buffer));
+ GetDlgItemText(hwndDlg, IDC_ED_INT_NOTIF, buffer, _countof(buffer));
ppro->setDword("NotificationsInterval", ppro->m_iNotificationsInterval = _ttoi(buffer));
}
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 45b1bc47cf..b0945d5525 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -148,7 +148,7 @@ int CVkProto::OnModulesLoaded(WPARAM, LPARAM) GCREGISTER gcr = { sizeof(gcr) };
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
- gcr.nColors = SIZEOF(sttColors);
+ gcr.nColors = _countof(sttColors);
gcr.pColors = sttColors;
CallServiceSync(MS_GC_REGISTER, NULL, (LPARAM)&gcr);
CreateProtoService(PS_LEAVECHAT, &CVkProto::OnLeaveChat);
diff --git a/protocols/VKontakte/src/vk_search.cpp b/protocols/VKontakte/src/vk_search.cpp index 82b806c287..957da57c42 100644 --- a/protocols/VKontakte/src/vk_search.cpp +++ b/protocols/VKontakte/src/vk_search.cpp @@ -71,7 +71,7 @@ void __cdecl CVkProto::SearchThread(void* p) PROTOSEARCHBYNAME *pParam = (PROTOSEARCHBYNAME *)p;
TCHAR arg[200];
- mir_sntprintf(arg, SIZEOF(arg), _T("%s %s %s"), pParam->pszFirstName, pParam->pszNick, pParam->pszLastName);
+ mir_sntprintf(arg, _countof(arg), _T("%s %s %s"), pParam->pszFirstName, pParam->pszNick, pParam->pszLastName);
debugLog(_T("CVkProto::SearchThread %s"), arg);
if (!IsOnline())
return;
diff --git a/protocols/VKontakte/src/vk_wallpost.cpp b/protocols/VKontakte/src/vk_wallpost.cpp index 585cf1738d..e46aec3d77 100644 --- a/protocols/VKontakte/src/vk_wallpost.cpp +++ b/protocols/VKontakte/src/vk_wallpost.cpp @@ -63,8 +63,8 @@ static INT_PTR CALLBACK WallPostFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara case IDOK:
TCHAR tszMsg[4096], tszUrl[4096];
- GetDlgItemText(hwndDlg, IDC_ED_MSG, tszMsg, SIZEOF(tszMsg));
- GetDlgItemText(hwndDlg, IDC_ED_URL, tszUrl, SIZEOF(tszUrl));
+ GetDlgItemText(hwndDlg, IDC_ED_MSG, tszMsg, _countof(tszMsg));
+ GetDlgItemText(hwndDlg, IDC_ED_URL, tszUrl, _countof(tszUrl));
if (IsEmpty(tszMsg) && IsEmpty(tszUrl)) {
SetDlgItemText(hwndDlg, IDC_ST_WARNING, TranslateT("Attention! Message body or url should not be empty!"));
diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp index 22266ae931..43016048ee 100644 --- a/protocols/WhatsApp/src/avatars.cpp +++ b/protocols/WhatsApp/src/avatars.cpp @@ -102,8 +102,8 @@ int WhatsAppProto::InternalSetAvatar(MCONTACT hContact, const char *szJid, const TCHAR tszTempFile[MAX_PATH], tszMyFile[MAX_PATH];
if (hContact == NULL) {
- mir_sntprintf(tszMyFile, SIZEOF(tszMyFile), _T("%s\\myavatar.jpg"), m_tszAvatarFolder.c_str());
- mir_sntprintf(tszTempFile, SIZEOF(tszTempFile), _T("%s\\myavatar.preview.jpg"), m_tszAvatarFolder.c_str());
+ mir_sntprintf(tszMyFile, _countof(tszMyFile), _T("%s\\myavatar.jpg"), m_tszAvatarFolder.c_str());
+ mir_sntprintf(tszTempFile, _countof(tszTempFile), _T("%s\\myavatar.preview.jpg"), m_tszAvatarFolder.c_str());
}
else {
std::tstring tszContactAva = GetAvatarFileName(hContact);
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index 9a80485c3f..766bb63425 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -166,14 +166,14 @@ void WhatsAppProto::EditChatSubject(WAChatInfo *pInfo) void WhatsAppProto::SetChatAvatar(WAChatInfo *pInfo)
{
TCHAR tszFileName[MAX_PATH], filter[256];
- Bitmap_GetFilter(filter, SIZEOF(filter));
+ Bitmap_GetFilter(filter, _countof(filter));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.lpstrFilter = filter;
ofn.hwndOwner = 0;
ofn.lpstrFile = tszFileName;
- ofn.nMaxFile = ofn.nMaxFileTitle = SIZEOF(tszFileName);
+ ofn.nMaxFile = ofn.nMaxFileTitle = _countof(tszFileName);
ofn.Flags = OFN_HIDEREADONLY;
ofn.lpstrInitialDir = _T(".");
ofn.lpstrDefExt = _T("");
@@ -274,11 +274,11 @@ int WhatsAppProto::OnChatMenu(WPARAM wParam, LPARAM lParam) return 0;
if (gcmi->Type == MENU_ON_LOG) {
- gcmi->nItems = SIZEOF(sttLogListItems);
+ gcmi->nItems = _countof(sttLogListItems);
gcmi->Item = sttLogListItems;
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
- gcmi->nItems = SIZEOF(sttNickListItems);
+ gcmi->nItems = _countof(sttNickListItems);
gcmi->Item = sttNickListItems;
}
@@ -313,7 +313,7 @@ WAChatInfo* WhatsAppProto::InitChat(const std::string &jid, const std::string &n GCDEST gcd = { m_szModuleName, ptszJid, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
- for (int i = SIZEOF(sttStatuses) - 1; i >= 0; i--) {
+ for (int i = _countof(sttStatuses) - 1; i >= 0; i--) {
gce.ptszStatus = TranslateTS(sttStatuses[i]);
CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
}
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index 20c04040f0..2d94f0228b 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -136,7 +136,7 @@ void WhatsAppProto::UpdateStatusMsg(MCONTACT hContact) if (lastSeen != -1) {
time_t ts = lastSeen;
TCHAR stzLastSeen[MAX_PATH];
- _tcsftime(stzLastSeen, SIZEOF(stzLastSeen), TranslateT("Last seen on %x at %X"), localtime(&ts));
+ _tcsftime(stzLastSeen, _countof(stzLastSeen), TranslateT("Last seen on %x at %X"), localtime(&ts));
ss << stzLastSeen;
}
diff --git a/protocols/WhatsApp/src/messages.cpp b/protocols/WhatsApp/src/messages.cpp index 74bdc36b00..452215b90a 100644 --- a/protocols/WhatsApp/src/messages.cpp +++ b/protocols/WhatsApp/src/messages.cpp @@ -126,6 +126,6 @@ void WhatsAppProto::onMessageStatusUpdate(const FMessage &fmsg) time_t ts = atol(fmsg.key.id.substr(0, delim).c_str());
TCHAR ttime[64];
- _tcsftime(ttime, SIZEOF(ttime), _T("%X"), localtime(&ts));
+ _tcsftime(ttime, _countof(ttime), _T("%X"), localtime(&ts));
utils::setStatusMessage(hContact, CMString(FORMAT, TranslateT("Message received: %s by %s"), ttime, ptszBy));
}
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index 13dc91d1d1..cfdea03d58 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -253,7 +253,7 @@ bool WhatsAppProto::Register(int state, const string &cc, const string &number, nlhr.requestType = REQUEST_POST;
nlhr.szUrl = url.GetBuffer();
nlhr.headers = s_registerHeaders;
- nlhr.headersCount = SIZEOF(s_registerHeaders);
+ nlhr.headersCount = _countof(s_registerHeaders);
nlhr.flags = NLHRF_HTTP11 | NLHRF_GENERATEHOST | NLHRF_REMOVEHOST | NLHRF_SSL;
NETLIBHTTPREQUEST* pnlhr = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,
diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp index 1557f85fb4..6916acabf6 100644 --- a/protocols/WhatsApp/src/theme.cpp +++ b/protocols/WhatsApp/src/theme.cpp @@ -10,12 +10,12 @@ static IconItem icons[] = void InitIcons(void)
{
- Icon_Register(g_hInstance, "Protocols/WhatsApp", icons, SIZEOF(icons), "WhatsApp");
+ Icon_Register(g_hInstance, "Protocols/WhatsApp", icons, _countof(icons), "WhatsApp");
}
HANDLE GetIconHandle(const char* name)
{
- for (size_t i = 0; i < SIZEOF(icons); i++)
+ for (size_t i = 0; i < _countof(icons); i++)
if (mir_strcmp(icons[i].szName, name) == 0)
return icons[i].hIcolib;
@@ -24,7 +24,7 @@ HANDLE GetIconHandle(const char* name) char* GetIconDescription(const char* name)
{
- for (size_t i = 0; i < SIZEOF(icons); i++)
+ for (size_t i = 0; i < _countof(icons); i++)
if (mir_strcmp(icons[i].szName, name) == 0)
return icons[i].szDescr;
diff --git a/protocols/Xfire/src/Xfire_base.cpp b/protocols/Xfire/src/Xfire_base.cpp index 17a24c2e0c..eecc1b6ac7 100644 --- a/protocols/Xfire/src/Xfire_base.cpp +++ b/protocols/Xfire/src/Xfire_base.cpp @@ -113,7 +113,7 @@ void Xfire_base::readStringfromDB(char*name, unsigned int dbid, char**to) return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
if (!db_get_s(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -131,7 +131,7 @@ void Xfire_base::readStringfromDB(char*name, unsigned int dbid, int id, char**to return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, _countof(temp), "%s_%i_%i", name, dbid, id);
if (!db_get_s(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -149,7 +149,7 @@ void Xfire_base::readUtf8StringfromDB(char*name, unsigned int dbid, char**to) return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
if (!db_get_utf(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -167,7 +167,7 @@ void Xfire_base::readUtf8StringfromDB(char*name, unsigned int dbid, int id, char return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, _countof(temp), "%s_%i_%i", name, dbid, id);
if (!db_get_utf(NULL, protocolname, temp, &dbv))
{
//string setzen
@@ -186,7 +186,7 @@ void Xfire_base::writeStringtoDB(char*name, unsigned int dbid, int id, char*val) return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, _countof(temp), "%s_%i_%i", name, dbid, id);
db_set_s(NULL, protocolname, temp, val);
}
@@ -198,7 +198,7 @@ void Xfire_base::writeStringtoDB(char*name, unsigned int dbid, char*val) return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
db_set_s(NULL, protocolname, temp, val);
}
@@ -210,7 +210,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name, unsigned int dbid, int id, char* return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, _countof(temp), "%s_%i_%i", name, dbid, id);
db_set_utf(NULL, protocolname, temp, val);
}
@@ -222,7 +222,7 @@ void Xfire_base::writeUtf8StringtoDB(char*name, unsigned int dbid, char*val) return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
db_set_utf(NULL, protocolname, temp, val);
}
@@ -235,7 +235,7 @@ void Xfire_base::writeBytetoDB(char*name, unsigned int dbid, int val) return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
db_set_b(NULL, protocolname, temp, val);
}
@@ -247,7 +247,7 @@ void Xfire_base::writeWordtoDB(char*name, unsigned int dbid, int val) return;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
db_set_w(NULL, protocolname, temp, val);
}
@@ -260,7 +260,7 @@ unsigned char Xfire_base::readBytefromDB(char*name, unsigned int dbid, int defau return 0;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
return db_get_b(NULL, protocolname, temp, defaultval);
}
@@ -272,7 +272,7 @@ unsigned int Xfire_base::readWordfromDB(char*name, unsigned int dbid, int defaul return 0;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
return db_get_w(NULL, protocolname, temp, defaultval);
}
@@ -284,7 +284,7 @@ BOOL Xfire_base::removeDBEntry(char*name, unsigned int dbid) return 0;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i", name, dbid);
+ mir_snprintf(temp, _countof(temp), "%s_%i", name, dbid);
//eintrag entfernen
if (!db_get(NULL, protocolname, temp, &dbv))
@@ -305,7 +305,7 @@ BOOL Xfire_base::removeDBEntry(char*name, unsigned int dbid, int id) return 0;
//wert aus der dblesen
- mir_snprintf(temp, SIZEOF(temp), "%s_%i_%i", name, dbid, id);
+ mir_snprintf(temp, _countof(temp), "%s_%i_%i", name, dbid, id);
//eintrag entfernen
if (!db_get(NULL, protocolname, temp, &dbv))
@@ -479,7 +479,7 @@ BOOL Xfire_base::getIniValue(unsigned int gameid, unsigned int subid, const char return FALSE; //kein pfad bug?!?!
if (subid == 0) {
- mir_snprintf(idstring, SIZEOF(idstring), "%d", gameid);
+ mir_snprintf(idstring, _countof(idstring), "%d", gameid);
if (xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
return TRUE;
@@ -487,7 +487,7 @@ BOOL Xfire_base::getIniValue(unsigned int gameid, unsigned int subid, const char subid++;
}
- mir_snprintf(idstring, SIZEOF(idstring), "%d_%d", gameid, subid);
+ mir_snprintf(idstring, _countof(idstring), "%d_%d", gameid, subid);
if (xfire_GetPrivateProfileString(idstring, valname, "", out, sizeofout, path))
return TRUE;
@@ -522,7 +522,7 @@ BOOL Xfire_base::getGamename(unsigned int gameid, char* out, int outsize){ //customnamen laden, wenn vorhanden
DBVARIANT dbv;
char dbstr[XFIRE_MAXSIZEOFGAMENAME];
- mir_snprintf(dbstr, SIZEOF(dbstr), "customgamename_%d", gameid);
+ mir_snprintf(dbstr, _countof(dbstr), "customgamename_%d", gameid);
if (!db_get(NULL, protocolname, dbstr, &dbv)) {
strncpy_s(out, outsize, dbv.pszVal, _TRUNCATE);
db_free(&dbv);
diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp index 87c0a4d2b9..02e16a955a 100644 --- a/protocols/Xfire/src/Xfire_game.cpp +++ b/protocols/Xfire/src/Xfire_game.cpp @@ -57,7 +57,7 @@ BOOL Xfire_game::start_game(char*ip, unsigned int port, char*pw) { //port begrenzen
port = port % 65535;
//port in string wandeln
- mir_snprintf(portstr, SIZEOF(portstr), "%d", port);
+ mir_snprintf(portstr, _countof(portstr), "%d", port);
str_replace(mynetworkparams, "%UA_GAME_HOST_NAME%", ip);
str_replace(mynetworkparams, "%UA_GAME_HOST_PORT%", portstr);
@@ -192,11 +192,11 @@ BOOL Xfire_game::checkpath(PROCESSENTRY32* processInfo) TCHAR fpath[MAX_PATH] = _T("");
//lese den pfad des spiels aus
- GetModuleFileNameEx(op, NULL, fpath, SIZEOF(fpath));
+ GetModuleFileNameEx(op, NULL, fpath, _countof(fpath));
//8.3 pfade umwandeln, nur wenn sich eine tilde im string befindet
if (_tcschr(fpath, '~'))
- GetLongPathName(fpath, fpath, SIZEOF(fpath));
+ GetLongPathName(fpath, fpath, _countof(fpath));
//alles in kelinbuchstaben umwandeln
this->strtolowerT(fpath);
@@ -440,7 +440,7 @@ void Xfire_game::createMenuitem(unsigned int pos, int dbid) mi.pszPopupName = Translate("Start game");
mi.pszContactOwner = protocolname;
- mir_snprintf(temp, SIZEOF(temp), servicefunction, this->id);
+ mir_snprintf(temp, _countof(temp), servicefunction, this->id);
//wenn die servicefunktion schon exisitert vernichten, hehe
if (ServiceExists(temp))
DestroyServiceFunction(temp);
diff --git a/protocols/Xfire/src/Xfire_icon_mng.cpp b/protocols/Xfire/src/Xfire_icon_mng.cpp index 90bf845253..d4dab1b547 100644 --- a/protocols/Xfire/src/Xfire_icon_mng.cpp +++ b/protocols/Xfire/src/Xfire_icon_mng.cpp @@ -137,7 +137,7 @@ Xfire_icon_cache Xfire_icon_mng::LoadGameIcon(unsigned int gameid) { if (hIconDll) {
char resourcename[255];
//kurznamen des spiels uppercasen und .ICO anhängen
- mir_snprintf(resourcename, SIZEOF(resourcename), "XF_%s.ICO", shortname);
+ mir_snprintf(resourcename, _countof(resourcename), "XF_%s.ICO", shortname);
Xfire_base::strtoupper(resourcename);
//versuche die resource zufinden
diff --git a/protocols/Xfire/src/Xfire_voicechat.cpp b/protocols/Xfire/src/Xfire_voicechat.cpp index 543d75de6a..3795196aa2 100644 --- a/protocols/Xfire/src/Xfire_voicechat.cpp +++ b/protocols/Xfire/src/Xfire_voicechat.cpp @@ -151,7 +151,7 @@ void Xfire_voicechat::writeToDatabase(SendGameStatus2Packet* packet) { return;
}
//ip speichern
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0], packet->port);
+ mir_snprintf(temp, _countof(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0], packet->port);
db_set_s(NULL, protocolname, "VServerIP", temp);
//namen jeh nach id schreiben
switch (packet->gameid) {
diff --git a/protocols/Xfire/src/addgamedialog.cpp b/protocols/Xfire/src/addgamedialog.cpp index e729a80ab3..2783d38c13 100644 --- a/protocols/Xfire/src/addgamedialog.cpp +++ b/protocols/Xfire/src/addgamedialog.cpp @@ -144,12 +144,12 @@ static void FillGameList(LPVOID hwndDlg) { if (z2 != zahlbuffer2)
{
listentry.gameid = MAKELONG(gameid, atoi(zahlbuffer2));
- mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d_%d", gameid, atoi(zahlbuffer2));
+ mir_snprintf(gameidtemp, _countof(gameidtemp), "%d_%d", gameid, atoi(zahlbuffer2));
}
else
{
listentry.gameid = gameid;
- mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid);
+ mir_snprintf(gameidtemp, _countof(gameidtemp), "%d", gameid);
}
@@ -265,7 +265,7 @@ BOOL OpenFileDialog(HWND hwndDlg, OPENFILENAMEA*ofn, char*exe) { //kein backslash dann normal ret als exenamen verwenden
if ((int)exename == 1) exename = exe;
//filterstring aufbauen
- mir_snprintf(szFilter, SIZEOF(szFilter), "%s|%s|%s|*.*|", exename, exename, Translate("All Files"));
+ mir_snprintf(szFilter, _countof(szFilter), "%s|%s|%s|*.*|", exename, exename, Translate("All Files"));
//umbruch in 0 wandeln
unsigned int sizeFilter = mir_strlen(szFilter);
for (unsigned int i = 0; i < sizeFilter; i++)
@@ -275,7 +275,7 @@ BOOL OpenFileDialog(HWND hwndDlg, OPENFILENAMEA*ofn, char*exe) { ofn->lStructSize = sizeof(OPENFILENAMEA);
ofn->hwndOwner = hwndDlg;
ofn->lpstrFile = szFile;
- ofn->nMaxFile = SIZEOF(szFile);
+ ofn->nMaxFile = _countof(szFile);
ofn->lpstrFilter = szFilter;
ofn->nFilterIndex = 1;
ofn->lpstrFileTitle = exe;
@@ -308,7 +308,7 @@ INT_PTR CALLBACK DlgAddGameProc(HWND hwndDlg, {
char temp[256];
//eingabe bei der suche auslesen
- GetDlgItemTextA(hwndDlg, IDC_SEARCH, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_SEARCH, temp, _countof(temp));
//eingabe in der liste suchen
int idx = SendDlgItemMessageA(hwndDlg, IDC_GAMELIST, LB_FINDSTRING, 0, (LPARAM)temp);
//gefunden?
@@ -345,13 +345,13 @@ INT_PTR CALLBACK DlgAddGameProc(HWND hwndDlg, int gameid2 = HIWORD(gameids);
if (gameid2 != 0)
- mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d_%d", gameid1, gameid2);
+ mir_snprintf(gameidtemp, _countof(gameidtemp), "%d_%d", gameid1, gameid2);
else
- mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid1);
+ mir_snprintf(gameidtemp, _countof(gameidtemp), "%d", gameid1);
//spielnamen holen
if (xfire_GetPrivateProfileString(gameidtemp, "LongName", "", ret, 512, inipath)) {
- mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid1);
+ mir_snprintf(gameidtemp, _countof(gameidtemp), "%d", gameid1);
//einige felder vorbelegen
SetDlgItemTextA(hPage, IDC_ADD_NAME, ret);
@@ -389,9 +389,9 @@ INT_PTR CALLBACK DlgAddGameProc(HWND hwndDlg, char ret[512];
if (gameid2 != 0)
- mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d_%d", gameid1, gameid2);
+ mir_snprintf(gameidtemp, _countof(gameidtemp), "%d_%d", gameid1, gameid2);
else
- mir_snprintf(gameidtemp, SIZEOF(gameidtemp), "%d", gameid1);
+ mir_snprintf(gameidtemp, _countof(gameidtemp), "%d", gameid1);
//neuen gameeintrag anlegen
Xfire_game* newgame = new Xfire_game();
@@ -628,7 +628,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM newgame = new Xfire_game();
//Spielname
- GetDlgItemTextA(hwndDlg, IDC_ADD_NAME, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_ADD_NAME, temp, _countof(temp));
if (!mir_strlen(temp))
{
if (!editgame) delete newgame;
@@ -643,7 +643,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM }
//spielid nur setzen/prüfen, wenn kein editgame
if (!editgame) {
- GetDlgItemTextA(hwndDlg, IDC_ADD_ID, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_ADD_ID, temp, _countof(temp));
if (!mir_strlen(temp))
{
if (!editgame) delete newgame;
@@ -671,7 +671,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM }
}
//zu sendene spielid
- GetDlgItemTextA(hwndDlg, IDC_ADD_SENDID, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_ADD_SENDID, temp, _countof(temp));
if (mir_strlen(temp))
{
//standardmäßig wird bei einem customeintrag keine id versendet
@@ -681,7 +681,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM }
//launcher exe
- GetDlgItemTextA(hwndDlg, IDC_ADD_LAUNCHEREXE, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_ADD_LAUNCHEREXE, temp, _countof(temp));
if (mir_strlen(temp))
{
//lowercase pfad
@@ -690,7 +690,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM newgame->setString(temp, &newgame->launchparams);
}
//detectexe
- GetDlgItemTextA(hwndDlg, IDC_ADD_DETECTEXE, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_ADD_DETECTEXE, temp, _countof(temp));
if (!mir_strlen(temp))
{
if (!editgame) delete newgame;
@@ -708,13 +708,13 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM }
//mustcontain parameter
- GetDlgItemTextA(hwndDlg, IDC_ADD_CUSTOMPARAMS, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_ADD_CUSTOMPARAMS, temp, _countof(temp));
if (mir_strlen(temp))
{
newgame->setString(temp, &newgame->mustcontain);
}
//statusmsg speichern
- GetDlgItemTextA(hwndDlg, IDC_ADD_STATUSMSG, temp, SIZEOF(temp));
+ GetDlgItemTextA(hwndDlg, IDC_ADD_STATUSMSG, temp, _countof(temp));
if (mir_strlen(temp))
{
newgame->setString(temp, &newgame->statusmsg);
diff --git a/protocols/Xfire/src/buddylist.cpp b/protocols/Xfire/src/buddylist.cpp index ac3bfbf608..e3a5dd7dff 100644 --- a/protocols/Xfire/src/buddylist.cpp +++ b/protocols/Xfire/src/buddylist.cpp @@ -146,7 +146,7 @@ namespace xfirelib { /* ## buddies im miranda verarbietn */ char temp[255]; char * dummy; - mir_snprintf(temp,SIZEOF(temp),"Clan_%d",entry->clanid); + mir_snprintf(temp,_countof(temp),"Clan_%d",entry->clanid); DBVARIANT dbv; if (!db_get(NULL,protocolname,temp,&dbv)) diff --git a/protocols/Xfire/src/iniupdater.cpp b/protocols/Xfire/src/iniupdater.cpp index 072e0f692e..6d97588ad4 100644 --- a/protocols/Xfire/src/iniupdater.cpp +++ b/protocols/Xfire/src/iniupdater.cpp @@ -53,11 +53,11 @@ void UpdateMyXFireIni(LPVOID dummy) { //ini pfad rausbekommen
char file[1024], file2[1024], file3[1024];
- mir_snprintf(file,SIZEOF(file), "%sxfire_games.new",inipath);
- mir_snprintf(file2,SIZEOF(file2), "%sxfire_games.ini",inipath);
- mir_snprintf(file3,SIZEOF(file3), "%sxfire_games.old",inipath);
+ mir_snprintf(file,_countof(file), "%sxfire_games.new",inipath);
+ mir_snprintf(file2,_countof(file2), "%sxfire_games.ini",inipath);
+ mir_snprintf(file3,_countof(file3), "%sxfire_games.old",inipath);
- mir_snprintf(request, SIZEOF(request), "%s%d", INI_URLREQUEST, getfilesize(file2));
+ mir_snprintf(request, _countof(request), "%s%d", INI_URLREQUEST, getfilesize(file2));
if (CheckWWWContent(request))
{
@@ -89,11 +89,11 @@ void UpdateMyIcons(LPVOID dummy) { //ini pfad rausbekommen
char file[1024], file2[1024], file3[1024];
- mir_snprintf(file,SIZEOF(file), "%sicons.new",inipath);
- mir_snprintf(file2,SIZEOF(file2), "%sicons.dll",inipath);
- mir_snprintf(file3,SIZEOF(file3), "%sicons.old",inipath);
+ mir_snprintf(file,_countof(file), "%sicons.new",inipath);
+ mir_snprintf(file2,_countof(file2), "%sicons.dll",inipath);
+ mir_snprintf(file3,_countof(file3), "%sicons.old",inipath);
- mir_snprintf(request, SIZEOF(request), "%s%d", ICO_URLREQUEST, getfilesize(file2));
+ mir_snprintf(request, _countof(request), "%s%d", ICO_URLREQUEST, getfilesize(file2));
if (CheckWWWContent(request))
{
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index fd04b1f76e..968e3e6664 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -419,7 +419,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) { for (int i = 0; i < claninv->numberOfInv; i++)
{
char msg[XFIRE_MAX_STATIC_STRING_LEN];
- mir_snprintf(msg, SIZEOF(msg), Translate("%s (Nickname: %s) has invited you to join the %s clan. Message: %s%sPlease go to the XFire clan site to accept the Invitation."), claninv->invitefromusername[i].c_str(),
+ mir_snprintf(msg, _countof(msg), Translate("%s (Nickname: %s) has invited you to join the %s clan. Message: %s%sPlease go to the XFire clan site to accept the Invitation."), claninv->invitefromusername[i].c_str(),
claninv->invitefrom[i].c_str(),
claninv->clanname[i].c_str(),
claninv->invitemsg[i].c_str(), "\n");
@@ -482,7 +482,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) { char temp[255];
char * dummy;
ClanBuddyListNamesPacket *clan = (ClanBuddyListNamesPacket*)content;
- mir_snprintf(temp, SIZEOF(temp), "Clan_%d", clan->clanid);
+ mir_snprintf(temp, _countof(temp), "Clan_%d", clan->clanid);
DBVARIANT dbv;
if (!db_get(NULL,protocolname,temp,&dbv))
@@ -638,10 +638,10 @@ void XFireClient::receivedPacket(XFirePacket *packet) { for (int i = 0; i < clan->count; i++)
{
- mir_snprintf(temp, SIZEOF(temp), "Clan_%d", clan->clanid[i]);
+ mir_snprintf(temp, _countof(temp), "Clan_%d", clan->clanid[i]);
db_set_s(NULL, protocolname, temp, (char*)clan->name[i].c_str());
- mir_snprintf(temp, SIZEOF(temp), "ClanUrl_%d", clan->clanid[i]);
+ mir_snprintf(temp, _countof(temp), "ClanUrl_%d", clan->clanid[i]);
db_set_s(NULL, protocolname, temp, (char*)clan->url[i].c_str());
if (!db_get_b(NULL, protocolname, "noclangroups", 0)) {
@@ -681,7 +681,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) { //recprotoverchg
if (db_get_w(NULL, protocolname, "recprotoverchg", 0) == 0)
{
- mir_snprintf(temp, SIZEOF(temp), Translate("The protocol version is too old. Changed current version from %d to %d. You can reconnect now."), client->protocolVersion, version->newversion);
+ mir_snprintf(temp, _countof(temp), Translate("The protocol version is too old. Changed current version from %d to %d. You can reconnect now."), client->protocolVersion, version->newversion);
MSGBOXE(temp);
}
else
@@ -692,7 +692,7 @@ void XFireClient::receivedPacket(XFirePacket *packet) { }
else
{
- mir_snprintf(temp, SIZEOF(temp), Translate("The protocol version is too old. Cannot detect a new version number."));
+ mir_snprintf(temp, _countof(temp), Translate("The protocol version is too old. Cannot detect a new version number."));
MSGBOXE(temp);
SetStatus(ID_STATUS_OFFLINE, NULL);
}
@@ -847,7 +847,7 @@ INT_PTR UrlCall(WPARAM wparam, LPARAM lparam) { if (mir_strlen(g) > 25) //zugroße abschneiden
*(g + 25) = 0;
- mir_snprintf(temp, SIZEOF(temp), Translate("Do you really want to add %s to your friend list?"), g);
+ mir_snprintf(temp, _countof(temp), Translate("Do you really want to add %s to your friend list?"), g);
//Nutzer vorher fragen, ob er wirklich user xyz adden möchte
if (MessageBoxA(NULL, temp, Translate(PLUGIN_TITLE), MB_YESNO | MB_ICONQUESTION) == IDYES)
{
@@ -1045,7 +1045,7 @@ extern "C" __declspec(dllexport) int Load(void) //statusmessages setzen
mir_strcpy(statusmessage[0], "");
- mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
+ mir_snprintf(statusmessage[1], _countof(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
HookEvent(ME_OPT_INITIALISE, OptInit);
HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded);
@@ -1525,7 +1525,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam) {
//setze bei aktivem nocustomaway die alte awaystatusmsg zurück, bugfix
if (db_get_b(NULL, protocolname, "nocustomaway", 0))
- mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
+ mir_snprintf(statusmessage[1], _countof(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
myClient->Status(statusmessage[1]);
}
@@ -1914,7 +1914,7 @@ static INT_PTR GetIPPort(WPARAM hContact, LPARAM lParam) return 0;
char temp[XFIRE_MAX_STATIC_STRING_LEN];
- mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, "Port", -1));
+ mir_snprintf(temp, _countof(temp), "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, "Port", -1));
db_free(&dbv);
if (OpenClipboard(NULL)) {
@@ -1942,7 +1942,7 @@ static INT_PTR GetVIPPort(WPARAM hContact, LPARAM lParam) return 0;
char temp[XFIRE_MAX_STATIC_STRING_LEN];
- mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, "VPort", -1));
+ mir_snprintf(temp, _countof(temp), "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, "VPort", -1));
db_free(&dbv);
if (OpenClipboard(NULL)) {
@@ -1982,7 +1982,7 @@ static INT_PTR GotoXFireClanSite(WPARAM hContact, LPARAM lParam) char temp[64] = "";
int clanid = db_get_dw(hContact, protocolname, "Clan", -1);
- mir_snprintf(temp, SIZEOF(temp), "ClanUrl_%d", clanid);
+ mir_snprintf(temp, _countof(temp), "ClanUrl_%d", clanid);
if (db_get_s(NULL, protocolname, temp, &dbv))
return 0;
@@ -2210,7 +2210,7 @@ void gamedetectiont(LPVOID lparam) if (packet->ip[3]!=0)
{
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0],packet->port);
+ mir_snprintf(temp, _countof(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0],packet->port);
db_set_s(NULL, protocolname, "VServerIP", temp);
db_set_s(NULL, protocolname, "currentvoicename", "Teamspeak");
}
@@ -2250,7 +2250,7 @@ void gamedetectiont(LPVOID lparam) db_set_w(NULL,protocolname,"currentvoice",vid);
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
+ mir_snprintf(temp, _countof(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
db_set_s(NULL, protocolname, "VServerIP", temp);
if (myClient!=NULL)
@@ -2290,7 +2290,7 @@ void gamedetectiont(LPVOID lparam) packet->gameid=vid;
db_set_w(NULL,protocolname,"currentvoice",vid);
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
+ mir_snprintf(temp, _countof(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1],(unsigned char)packet->ip[0],packet->port);
db_set_s(NULL, protocolname, "VServerIP", temp);
if (myClient!=NULL)
@@ -2345,7 +2345,7 @@ void gamedetectiont(LPVOID lparam) myClient->Status(statusmessage[1]);
}
- mir_snprintf(temp, SIZEOF(temp), Translate("Last game: %s playtime: %.2d:%.2d:%.2d"), currentgame->name, mytm->tm_hour, mytm->tm_min, mytm->tm_sec);
+ mir_snprintf(temp, _countof(temp), Translate("Last game: %s playtime: %.2d:%.2d:%.2d"), currentgame->name, mytm->tm_hour, mytm->tm_min, mytm->tm_sec);
db_set_s(NULL, protocolname, "LastGame", temp);
if (currentgame->noicqstatus != TRUE&&db_get_b(NULL, protocolname, "autosetstatusmsg", 0))
@@ -2399,7 +2399,7 @@ void gamedetectiont(LPVOID lparam) if (packet->ip[3] != 0)
{
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0], packet->port);
+ mir_snprintf(temp, _countof(temp), "%d.%d.%d.%d:%d", (unsigned char)packet->ip[3], (unsigned char)packet->ip[2], (unsigned char)packet->ip[1], (unsigned char)packet->ip[0], packet->port);
db_set_s(NULL, protocolname, "ServerIP", temp);
XFireLog("Got IPPort: %s", temp);
}
@@ -2714,7 +2714,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc {
if ((unsigned char)gameob->ip[3] != 0) // wenn ip, dann speichern
{
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d", (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0]);
+ mir_snprintf(temp, _countof(temp), "%d.%d.%d.%d", (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0]);
db_set_s(hContact, protocolname, "VServerIP", temp);
db_set_w(hContact, protocolname, "VPort", (unsigned long)gameob->port);
}
@@ -2754,7 +2754,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc if (db_get_b(NULL, protocolname, "gamepopup", 0) == 1) {
char temp[256] = "";
- mir_snprintf(temp, SIZEOF(temp), Translate("%s is playing %s."),
+ mir_snprintf(temp, _countof(temp), Translate("%s is playing %s."),
//ist ein nick gesetzt?
(entry->nick.length() == 0 ?
//nein dann username
@@ -2767,7 +2767,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc {
if ((unsigned char)gameob->ip[3] != 0)
{
- mir_snprintf(temp, SIZEOF(temp), Translate("%s is playing %s on server %d.%d.%d.%d:%d."),
+ mir_snprintf(temp, _countof(temp), Translate("%s is playing %s on server %d.%d.%d.%d:%d."),
//ist ein nick gesetzt?
(entry->nick.length() == 0 ?
//nein dann username
@@ -2817,7 +2817,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc if ((unsigned char)gameob->ip[3] != 0)
{
//ip und port in kontakt speichern
- mir_snprintf(temp, SIZEOF(temp), "%d.%d.%d.%d", (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0]);
+ mir_snprintf(temp, _countof(temp), "%d.%d.%d.%d", (unsigned char)gameob->ip[3], (unsigned char)gameob->ip[2], (unsigned char)gameob->ip[1], (unsigned char)gameob->ip[0]);
db_set_s(hContact, protocolname, "ServerIP", temp);
db_set_w(hContact, protocolname, "Port", (unsigned long)gameob->port);
@@ -2828,7 +2828,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc GameServerQuery_query gsqq = { 0 };
gsqq.port = gameob->port;
gsqq.xfiregameid = entry->game;
- strncpy(gsqq.ip, temp, SIZEOF(gsqq.ip)-1);
+ strncpy(gsqq.ip, temp, _countof(gsqq.ip)-1);
CallService("GameServerQuery/Query", (WPARAM)entry, (LPARAM)&gsqq);
}
}
@@ -2941,11 +2941,11 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc {
char temp[256];
DBVARIANT dbv;
- mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
+ mir_snprintf(temp, _countof(temp), "%d", val - 1);
db_get_s(NULL, "CListGroups", temp, &dbv);
if (dbv.pszVal != NULL)
{
- mir_snprintf(temp, SIZEOF(temp), "%s\\%s", &dbv.pszVal[1], group);
+ mir_snprintf(temp, _countof(temp), "%s\\%s", &dbv.pszVal[1], group);
db_set_s(entry->hcontact, "CList", "Group", temp);
db_free(&dbv);
}
@@ -2964,11 +2964,11 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc {
char temp[256];
DBVARIANT dbv;
- mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
+ mir_snprintf(temp, _countof(temp), "%d", val - 1);
db_get_s(NULL, "CListGroups", temp, &dbv);
if (dbv.pszVal != NULL)
{
- mir_snprintf(temp, SIZEOF(temp), "%s\\%s", &dbv.pszVal[1], group);
+ mir_snprintf(temp, _countof(temp), "%s\\%s", &dbv.pszVal[1], group);
db_set_s(entry->hcontact, "CList", "Group", temp);
db_free(&dbv);
}
@@ -3068,21 +3068,21 @@ void CreateGroup(char*grpn, char*field) { if (val == 0)
{
- strcpy_s(grp, SIZEOF(grp), grpn);//((char*)clan->name[i].c_str());
+ strcpy_s(grp, _countof(grp), grpn);//((char*)clan->name[i].c_str());
}
else
{
char temp[255];
DBVARIANT dbv;
- mir_snprintf(temp, SIZEOF(temp), "%d", val - 1);
+ mir_snprintf(temp, _countof(temp), "%d", val - 1);
if (!db_get_s(NULL, "CListGroups", temp, &dbv))
{
- mir_snprintf(grp, SIZEOF(grp), "%s\\%s", &dbv.pszVal[1], grpn);
+ mir_snprintf(grp, _countof(grp), "%s\\%s", &dbv.pszVal[1], grpn);
db_free(&dbv);
}
else //gruppe existiert nciht mehr, auf root alles legen
{
- strcpy_s(grp, SIZEOF(grp), grpn);
+ strcpy_s(grp, _countof(grp), grpn);
db_set_b(NULL, protocolname, field, 0);
}
}
@@ -3093,7 +3093,7 @@ void CreateGroup(char*grpn, char*field) { int i = 0;
for (i = 0;; i++)
{
- mir_snprintf(temp, SIZEOF(temp), "%d", i);
+ mir_snprintf(temp, _countof(temp), "%d", i);
if (db_get_s(NULL, "CListGroups", temp, &dbv))
{
i--;
@@ -3108,7 +3108,7 @@ void CreateGroup(char*grpn, char*field) { strcpy_s(group, 255, "D");
strcat_s(group, 255, grp);
group[0] = 1 | GROUPF_EXPANDED;
- mir_snprintf(temp, SIZEOF(temp), "%d", i + 1);
+ mir_snprintf(temp, _countof(temp), "%d", i + 1);
db_set_s(NULL, "CListGroups", temp, group);
CallServiceSync(MS_CLUI_GROUPADDED, i + 1, 0);
}
@@ -3125,7 +3125,7 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam) }
else if (wParam != ID_STATUS_OFFLINE/*&&db_get_b(NULL,protocolname,"nocustomaway",0)==0*/)
{
- mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
+ mir_snprintf(statusmessage[1], _countof(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
}
}
else
@@ -3136,11 +3136,11 @@ INT_PTR SetAwayMsg(WPARAM wParam, LPARAM lParam) }
else if (wParam != ID_STATUS_OFFLINE) {
if (db_get_b(NULL, protocolname, "nocustomaway", 0) == 0 && mir_strlen((char*)lParam) > 0) {
- mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", (char*)lParam);
+ mir_snprintf(statusmessage[1], _countof(statusmessage[1]), "(AFK) %s", (char*)lParam);
//mir_strcpy(statusmessage[1],( char* )lParam);
}
else
- mir_snprintf(statusmessage[1], SIZEOF(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
+ mir_snprintf(statusmessage[1], _countof(statusmessage[1]), "(AFK) %s", Translate("Away from Keyboard"));
}
}
@@ -3239,7 +3239,7 @@ INT_PTR RemoveFriend(WPARAM hContact, LPARAM lParam) if (!db_get_s(hContact, protocolname, "Username", &dbv))
{
- mir_snprintf(temp, SIZEOF(temp), Translate("Do you really want to delete your friend %s?"), dbv.pszVal);
+ mir_snprintf(temp, _countof(temp), Translate("Do you really want to delete your friend %s?"), dbv.pszVal);
if (MessageBoxA(NULL, temp, Translate("Confirm Delete"), MB_YESNO | MB_ICONQUESTION) == IDYES)
{
if (myClient != NULL)
@@ -3342,7 +3342,7 @@ int doneQuery(WPARAM wParam, LPARAM lParam) { db_set_s(bud->hcontact, protocolname, "ServerName", gameinfo->name);
db_set_s(bud->hcontact, protocolname, "GameType", gameinfo->gametype);
db_set_s(bud->hcontact, protocolname, "Map", gameinfo->map);
- mir_snprintf(temp, SIZEOF(temp), "(%d/%d)", gameinfo->players, gameinfo->maxplayers);
+ mir_snprintf(temp, _countof(temp), "(%d/%d)", gameinfo->players, gameinfo->maxplayers);
db_set_s(bud->hcontact, protocolname, "Players", temp);
db_set_b(bud->hcontact, protocolname, "Passworded", gameinfo->password);
@@ -3367,7 +3367,7 @@ int IconLibChanged(WPARAM wParam, LPARAM lParam) { //ImageList_ReplaceIcon(hAdvancedStatusIcon,(int)icocache[i].handle,icocache[i].hicon);
HANDLE before=icocache[i].handle;
icocache[i].handle=(HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)icocache[i].hicon, 0);
- mir_snprintf(temp, SIZEOF(temp), "before: %d after: %d", before, icocache[i].handle);
+ mir_snprintf(temp, _countof(temp), "before: %d after: %d", before, icocache[i].handle);
MessageBoxA(NULL,temp,temp,0);
DrawIcon(GetDC(NULL),x,0,(HICON)CallService(MS_SKIN2_GETICONBYHANDLE,0,(LPARAM)icocache[i].handle));
x+=32;
diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp index fd13a4688c..670564ea8f 100644 --- a/protocols/Xfire/src/options.cpp +++ b/protocols/Xfire/src/options.cpp @@ -181,7 +181,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } char temp[255] = ""; - mir_snprintf(temp, SIZEOF(temp), "%d", db_get_b(NULL, protocolname, "protover", 0x5b)); + mir_snprintf(temp, _countof(temp), "%d", db_get_b(NULL, protocolname, "protover", 0x5b)); SetDlgItemTextA(hwndDlg, IDC_PVER, temp); EnableWindow(GetDlgItem(hwndDlg, IDC_LASTGAME), FALSE); @@ -253,7 +253,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR char str[128]; DBVARIANT dbv; - GetDlgItemTextA(hwndDlg, IDC_LOGIN, login, SIZEOF(login)); + GetDlgItemTextA(hwndDlg, IDC_LOGIN, login, _countof(login)); dbv.pszVal = NULL; if (db_get(NULL, protocolname, "login", &dbv) || mir_strcmp(login, dbv.pszVal)) reconnectRequired = 1; @@ -278,7 +278,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR db_set_s(NULL, protocolname, "Username", login); //nur wenn der nick erfolgreich übertragen wurde - GetDlgItemTextA(hwndDlg, IDC_NICK, login, SIZEOF(login)); + GetDlgItemTextA(hwndDlg, IDC_NICK, login, _countof(login)); dbv.pszVal = NULL; if (db_get(NULL, protocolname, "Nick", &dbv) || mir_strcmp(login, dbv.pszVal)) { @@ -288,14 +288,14 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (dbv.pszVal != NULL) db_free(&dbv); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, _countof(str)); dbv.pszVal = NULL; if (db_get(NULL, protocolname, "password", &dbv) || mir_strcmp(str, dbv.pszVal)) reconnectRequired = 1; if (dbv.pszVal != NULL) db_free(&dbv); db_set_s(NULL, protocolname, "password", str); - GetDlgItemTextA(hwndDlg, IDC_SERVER, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_SERVER, str, _countof(str)); //neue preferencen sichern if (bpStatus != ID_STATUS_OFFLINE&&bpStatus != ID_STATUS_CONNECTING) @@ -322,7 +322,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } //protocolversion wird autoamtisch vergeben - //GetDlgItemTextA(hwndDlg,IDC_PVER,str,SIZEOF(str)); + //GetDlgItemTextA(hwndDlg,IDC_PVER,str,_countof(str)); //db_set_b(NULL,protocolname,"protover",(char)atoi(str)); if (reconnectRequired) @@ -379,11 +379,11 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR SendDlgItemMessage(hwndDlg, IDC_CLANGROUP, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Root Group>")); SendDlgItemMessage(hwndDlg, IDC_FOFGROUP, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Root Group>")); - mir_snprintf(temp, SIZEOF(temp), "%d", gruppen_id); + mir_snprintf(temp, _countof(temp), "%d", gruppen_id); while (!db_get_s(NULL, "CListGroups", temp, &dbv)) { gruppen_id++; - mir_snprintf(temp, SIZEOF(temp), "%d", gruppen_id); + mir_snprintf(temp, _countof(temp), "%d", gruppen_id); if (dbv.pszVal != NULL) { SendDlgItemMessageA(hwndDlg, IDC_CLANGROUP, CB_ADDSTRING, 0, (LPARAM)&dbv.pszVal[1]); @@ -724,7 +724,7 @@ static INT_PTR CALLBACK DlgProcOpts5(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int reconnectRequired = 0; char str[512]; - GetDlgItemTextA(hwndDlg, IDC_STATUSMSG, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_STATUSMSG, str, _countof(str)); db_set_s(NULL, protocolname, "setstatusmsg", str); db_set_b(NULL, protocolname, "autosetstatusmsg", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG)); @@ -776,7 +776,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR for (int i = 0; i < found; i++) { //id auslesen - mir_snprintf(temp, SIZEOF(temp), "gameid_%d", i); + mir_snprintf(temp, _countof(temp), "gameid_%d", i); int gameid = db_get_w(NULL, protocolname, temp, 0); //spielnamen auslesen xgamelist.getGamename(gameid, temp, XFIRE_MAXSIZEOFGAMENAME); @@ -983,18 +983,18 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //gameskip wert setzen char temp[64] = ""; - mir_snprintf(temp, SIZEOF(temp), "gameskip_%d", gameid); + mir_snprintf(temp, _countof(temp), "gameskip_%d", gameid); CheckDlgButton(hwndDlg, IDC_DONTDETECT, db_get_b(NULL, protocolname, temp, 0) ? BST_CHECKED : BST_UNCHECKED); - mir_snprintf(temp, SIZEOF(temp), "gamenostatus_%d", gameid); + mir_snprintf(temp, _countof(temp), "gamenostatus_%d", gameid); CheckDlgButton(hwndDlg, IDC_NOSTATUSMSG, db_get_b(NULL, protocolname, temp, 0) ? BST_CHECKED : BST_UNCHECKED); - mir_snprintf(temp, SIZEOF(temp), "notinstartmenu_%d", gameid); + mir_snprintf(temp, _countof(temp), "notinstartmenu_%d", gameid); CheckDlgButton(hwndDlg, IDC_NOTINSTARTMENU, db_get_b(NULL, protocolname, temp, 0) ? BST_CHECKED : BST_UNCHECKED); //extra parameter auslesen, aber nur, wenn das spiel auch sowas unterstützt if (xgtemp && xgtemp->haveExtraGameArgs()) { EnableDlgItem(hwndDlg, IDC_EXTRAPARAMS, TRUE); - mir_snprintf(temp, SIZEOF(temp), "gameextraparams_%d", gameid); + mir_snprintf(temp, _countof(temp), "gameextraparams_%d", gameid); DBVARIANT dbv; if (!db_get(NULL, protocolname, temp, &dbv)) { @@ -1035,7 +1035,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //extra parameter auslesen und das gameobj schreiben char str[128] = ""; - GetDlgItemTextA(hwndDlg, IDC_EXTRAPARAMS, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_EXTRAPARAMS, str, _countof(str)); if (str[0] != 0) { //extra parameter sind gesetzt, zuweisen diff --git a/protocols/Xfire/src/passworddialog.cpp b/protocols/Xfire/src/passworddialog.cpp index 4be5760eef..fac061f214 100644 --- a/protocols/Xfire/src/passworddialog.cpp +++ b/protocols/Xfire/src/passworddialog.cpp @@ -15,7 +15,7 @@ INT_PTR CALLBACK DlgPWProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
GetDlgItemTextA(hwndDlg, IDC_PWSTRING, (LPSTR)pw, 254);
if (usenick)
- GetDlgItemTextA(hwndDlg, IDC_PWNICK, (LPSTR)nick, SIZEOF(nick));
+ GetDlgItemTextA(hwndDlg, IDC_PWNICK, (LPSTR)nick, _countof(nick));
EndDialog(hwndDlg, (INT_PTR)pw);
break;
}
diff --git a/protocols/Xfire/src/processbuddyinfo.cpp b/protocols/Xfire/src/processbuddyinfo.cpp index 26b9697d71..788991c7db 100644 --- a/protocols/Xfire/src/processbuddyinfo.cpp +++ b/protocols/Xfire/src/processbuddyinfo.cpp @@ -58,7 +58,7 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo, MCONTACT hcontact, c mir_strcat(filename, ".gif");
type = PA_FORMAT_GIF;
- mir_snprintf(temp, SIZEOF(temp), "/xfire/xf/images/avatars/gallery/default/%03d.gif", buddyinfo->avatarid);
+ mir_snprintf(temp, _countof(temp), "/xfire/xf/images/avatars/gallery/default/%03d.gif", buddyinfo->avatarid);
dl = GetWWWContent("media.xfire.com", temp, filename, FALSE);
break;
@@ -67,7 +67,7 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo, MCONTACT hcontact, c mir_strcat(filename, ".jpg");
type = PA_FORMAT_JPEG;
- mir_snprintf(temp, SIZEOF(temp), "/avatar/100/%s.jpg?%d", username, buddyinfo->avatarid);
+ mir_snprintf(temp, _countof(temp), "/avatar/100/%s.jpg?%d", username, buddyinfo->avatarid);
dl = GetWWWContent("screenshot.xfire.com", temp, filename, FALSE);
break;
@@ -75,7 +75,7 @@ void ProcessBuddyInfo(xfirelib::BuddyInfoPacket *buddyinfo, MCONTACT hcontact, c type = PA_FORMAT_GIF;
mir_strcat(filename, "xfire.gif");
- mir_snprintf(temp, SIZEOF(temp), "/xfire/xf/images/avatars/gallery/default/xfire.gif", buddyinfo->avatarid);
+ mir_snprintf(temp, _countof(temp), "/xfire/xf/images/avatars/gallery/default/xfire.gif", buddyinfo->avatarid);
dl = GetWWWContent("media.xfire.com", temp, filename, TRUE);
break;
diff --git a/protocols/Xfire/src/pwd_dlg.cpp b/protocols/Xfire/src/pwd_dlg.cpp index 31108404a8..3703e6caa1 100644 --- a/protocols/Xfire/src/pwd_dlg.cpp +++ b/protocols/Xfire/src/pwd_dlg.cpp @@ -20,7 +20,7 @@ INT_PTR CALLBACK DlgPwProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
if (LOWORD(wParam) == IDOK)
{
- GetDlgItemTextA(hwndDlg, IDC_NICKNAME, password, SIZEOF(password));
+ GetDlgItemTextA(hwndDlg, IDC_NICKNAME, password, _countof(password));
EndDialog(hwndDlg, TRUE);
return TRUE;
}
diff --git a/protocols/Xfire/src/searching4games.cpp b/protocols/Xfire/src/searching4games.cpp index 01fb52f082..0be853b828 100644 --- a/protocols/Xfire/src/searching4games.cpp +++ b/protocols/Xfire/src/searching4games.cpp @@ -69,9 +69,9 @@ BOOL CheckPath(char*ppath, char*pathwildcard = NULL) strncpy(temp, ppath,XFIRE_MAX_STATIC_STRING_LEN-1);
*(temp + mir_strlen(temp) - 1) = 0;
- mir_strncat(temp, wfd.cFileName, SIZEOF(temp) - mir_strlen(temp));
- mir_strncat(temp, "\\", SIZEOF(temp) - mir_strlen(temp));
- mir_strncat(temp, pos, SIZEOF(temp) - mir_strlen(temp));
+ mir_strncat(temp, wfd.cFileName, _countof(temp) - mir_strlen(temp));
+ mir_strncat(temp, "\\", _countof(temp) - mir_strlen(temp));
+ mir_strncat(temp, pos, _countof(temp) - mir_strlen(temp));
if (GetFileAttributesA(temp) != 0xFFFFFFFF) { //exe vorhanden???? unt hint?
//gefundenes in path kopieren
@@ -253,9 +253,9 @@ void Scan4Games(LPVOID lparam) {
//2 gameids?
if (split)
- mir_snprintf(temp, SIZEOF(temp), "%i_%i", i, i2);
+ mir_snprintf(temp, _countof(temp), "%i_%i", i, i2);
else
- mir_snprintf(temp, SIZEOF(temp), "%i", i);
+ mir_snprintf(temp, _countof(temp), "%i", i);
//MessageBox(0,temp,temp,0);
@@ -467,7 +467,7 @@ void Scan4Games(LPVOID lparam) multiexe = FALSE;
for (int i = 1; i < 9; i++)
{
- mir_snprintf(ret, SIZEOF(ret), "DetectExe[%d]", i);
+ mir_snprintf(ret, _countof(ret), "DetectExe[%d]", i);
if (xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath))
{
char* pos = strrchr(path, '\\');
@@ -550,7 +550,7 @@ void Scan4Games(LPVOID lparam) newgame->setString(ret2, &newgame->launchparams);
//soll alle string, welche nicht in der commandline eines spiels sein soll in einen string pakcen semikolon getrennt
- mir_snprintf(ret, SIZEOF(ret), "CommandLineMustNotContain[0]");
+ mir_snprintf(ret, _countof(ret), "CommandLineMustNotContain[0]");
int i = 0;
while (xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath))
@@ -561,7 +561,7 @@ void Scan4Games(LPVOID lparam) newgame->appendString(ret2, &newgame->notcontain);
i++;
- mir_snprintf(ret, SIZEOF(ret), "CommandLineMustNotContain[%d]", i);
+ mir_snprintf(ret, _countof(ret), "CommandLineMustNotContain[%d]", i);
}
newgame->setNameandIcon();
@@ -652,7 +652,7 @@ void Scan4Games(LPVOID lparam) newgame->setstatusmsg = atoi(ret2);
//soll alle string, welche nicht in der commandline eines spiels sein soll in einen string pakcen semikolon getrennt
- mir_snprintf(ret, SIZEOF(ret), "CommandLineMustNotContain[0]");
+ mir_snprintf(ret, _countof(ret), "CommandLineMustNotContain[0]");
int i = 0;
while (xfire_GetPrivateProfileString(temp, ret, "", ret2, 512, inipath))
@@ -663,7 +663,7 @@ void Scan4Games(LPVOID lparam) newgame->appendString(ret2, &newgame->notcontain);
i++;
- mir_snprintf(ret, SIZEOF(ret), "CommandLineMustNotContain[%d]", i);
+ mir_snprintf(ret, _countof(ret), "CommandLineMustNotContain[%d]", i);
}
newgame->setNameandIcon();
@@ -725,7 +725,7 @@ void Scan4Games(LPVOID lparam) int p = mir_strlen(gamelist) - 2;
if (p > -1)
gamelist[p] = 0; //letztes koma killen
- mir_snprintf(ret, SIZEOF(ret), Translate("Games found:%s%s"), "\r\n\r\n", gamelist);
+ mir_snprintf(ret, _countof(ret), Translate("Games found:%s%s"), "\r\n\r\n", gamelist);
MSGBOX(ret);
}
diff --git a/protocols/Xfire/src/setnickname.cpp b/protocols/Xfire/src/setnickname.cpp index bfd5d3465a..d4eecf58c3 100644 --- a/protocols/Xfire/src/setnickname.cpp +++ b/protocols/Xfire/src/setnickname.cpp @@ -24,7 +24,7 @@ INT_PTR CALLBACK DlgNickProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara if (LOWORD(wParam) == IDOK)
{
char nick[255];
- GetDlgItemTextA(hwndDlg, IDC_NICKNAME, nick, SIZEOF(nick));
+ GetDlgItemTextA(hwndDlg, IDC_NICKNAME, nick, _countof(nick));
CallService(XFIRE_SET_NICK, 0, (LPARAM)nick);
diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp index ebd202f4d7..a38a70fe82 100644 --- a/protocols/Xfire/src/tools.cpp +++ b/protocols/Xfire/src/tools.cpp @@ -100,8 +100,8 @@ int displayPopup(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType, HICON h bIconsNotLoaded = FALSE; } - mir_tstrncpy(ppd.lptzContactName, _A2T(lpCaption), SIZEOF(ppd.lptzContactName)); - mir_tstrncpy(ppd.lptzText, _A2T(lpText), SIZEOF(ppd.lptzText)); + mir_tstrncpy(ppd.lptzContactName, _A2T(lpCaption), _countof(ppd.lptzContactName)); + mir_tstrncpy(ppd.lptzText, _A2T(lpText), _countof(ppd.lptzText)); if ((uType & MB_ICONMASK) == MB_ICONSTOP) { ppd.lchIcon = hicError; diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp index 37840a72c1..49e2cd2875 100644 --- a/protocols/Xfire/src/userdetails.cpp +++ b/protocols/Xfire/src/userdetails.cpp @@ -45,7 +45,7 @@ void LoadProfilStatus(void *arg) { //dl
char url[255];
- mir_snprintf(url, SIZEOF(url),"http://miniprofile.xfire.com/bg/sh/type/1/%s.png",fname);
+ mir_snprintf(url, _countof(url),"http://miniprofile.xfire.com/bg/sh/type/1/%s.png",fname);
char* buf = NULL;
unsigned int size = 0;
@@ -68,7 +68,7 @@ void SetItemTxt(HWND hwndDlg, int feldid, char*feld, MCONTACT hcontact, int type if (type == 1)
{
char temp[255];
- mir_snprintf(temp, SIZEOF(temp), "%i", dbv.wVal);
+ mir_snprintf(temp, _countof(temp), "%i", dbv.wVal);
SetDlgItemTextA(hwndDlg, feldid, temp);
}
else
@@ -95,7 +95,7 @@ static int GetIPPortUDetails(MCONTACT hContact, char* feld1, char* feld2) return 0;
char temp[255];
- mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, feld2, -1));
+ mir_snprintf(temp, _countof(temp), "%s:%d", dbv.pszVal, db_get_w(hContact, protocolname, feld2, -1));
db_free(&dbv);
if (OpenClipboard(NULL)) {
@@ -380,30 +380,30 @@ char status[256]=""; char game[512]="";
if (!db_get(hContact,"ContactPhoto","File",&dbv))
{
-mir_snprintf(img,SIZEOF(img),"<img src=\"%s\">",dbv.pszVal);
+mir_snprintf(img,_countof(img),"<img src=\"%s\">",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"Username",&dbv))
{
-mir_snprintf(username,SIZEOF(username),"<b>Username:</b> %s<br>",dbv.pszVal);
+mir_snprintf(username,_countof(username),"<b>Username:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"Nick",&dbv))
{
-mir_snprintf(nick,SIZEOF(nick),"<b>Nick:</b> %s<br>",dbv.pszVal);
+mir_snprintf(nick,_countof(nick),"<b>Nick:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"XStatusMsg",&dbv))
{
-mir_snprintf(status,SIZEOF(status),"<b>Status:</b> %s<br>",dbv.pszVal);
+mir_snprintf(status,_countof(status),"<b>Status:</b> %s<br>",dbv.pszVal);
db_free(&dbv);
}
if (!db_get(hContact,protocolname,"RGame",&dbv))
{
-mir_snprintf(game,SIZEOF(game),"<fieldset style='border:1px solid #0091d5;background-color:#0d2c3e;margin-bottom:8px;'><legend>Spiel</legend><table><tr><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'><b><u>%s</u></b></td></tr></table></fieldset>",dbv.pszVal);
+mir_snprintf(game,_countof(game),"<fieldset style='border:1px solid #0091d5;background-color:#0d2c3e;margin-bottom:8px;'><legend>Spiel</legend><table><tr><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'><b><u>%s</u></b></td></tr></table></fieldset>",dbv.pszVal);
db_free(&dbv);
}
-mir_snprintf(profil,SIZEOF(profil),"mshtml:<div style='position:absolute;top:0;left:0;border:1px solid #0091d5;background-color:#000;padding:6px;width:334px;height:249px'><table><tr><td valign=top>%s</td><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'>%s%s%s</td></tr><tr><td valign=top colspan=\"2\" style='font-family:Arial;font-size:11px;color:#fff;'>%s%s</td></tr></table></div>",img,username,nick,status,game);
+mir_snprintf(profil,_countof(profil),"mshtml:<div style='position:absolute;top:0;left:0;border:1px solid #0091d5;background-color:#000;padding:6px;width:334px;height:249px'><table><tr><td valign=top>%s</td><td valign=top style='font-family:Arial;font-size:11px;color:#fff;'>%s%s%s</td></tr><tr><td valign=top colspan=\"2\" style='font-family:Arial;font-size:11px;color:#fff;'>%s%s</td></tr></table></div>",img,username,nick,status,game);
HWND hWnd = ::CreateWindow("AtlAxWin", profil,
WS_CHILD|WS_VISIBLE, 0, 0, 334, 249, hwndDlg, NULL,
::GetModuleHandle(NULL), NULL);
diff --git a/protocols/Xfire/src/variables.cpp b/protocols/Xfire/src/variables.cpp index 86b5138bc9..e77c4e22b2 100644 --- a/protocols/Xfire/src/variables.cpp +++ b/protocols/Xfire/src/variables.cpp @@ -108,7 +108,7 @@ char* Varxfireserverip(ARGUMENTSINFO *ai) { DBVARIANT dbv3;
if (!db_get(ai->fi->hContact, protocolname, "ServerIP", &dbv3))
{
- mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv3.pszVal, db_get_w(ai->fi->hContact, protocolname, "Port", 0));
+ mir_snprintf(temp, _countof(temp), "%s:%d", dbv3.pszVal, db_get_w(ai->fi->hContact, protocolname, "Port", 0));
db_free(&dbv3);
return mir_strdup(temp);
}
@@ -133,7 +133,7 @@ char* Varxfirevoiceip(ARGUMENTSINFO *ai) { DBVARIANT dbv3;
if (!db_get(ai->fi->hContact, protocolname, "VServerIP", &dbv3))
{
- mir_snprintf(temp, SIZEOF(temp), "%s:%d", dbv3.pszVal, db_get_w(ai->fi->hContact, protocolname, "VPort", 0));
+ mir_snprintf(temp, _countof(temp), "%s:%d", dbv3.pszVal, db_get_w(ai->fi->hContact, protocolname, "VPort", 0));
db_free(&dbv3);
return mir_strdup(temp);
}
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index 35af086732..002764f165 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -126,8 +126,8 @@ void CYahooProto::SendAvatar(const TCHAR *szFile) sf->filesize = statbuf.st_size;
wchar_t tszFilename[MAX_PATH];
- wcsncpy(tszFilename, szFile, SIZEOF(tszFilename) - 1);
- GetShortPathNameW(szFile, tszFilename, SIZEOF(tszFilename));
+ wcsncpy(tszFilename, szFile, _countof(tszFilename) - 1);
+ GetShortPathNameW(szFile, tszFilename, _countof(tszFilename));
char szFilename[MAX_PATH];
WideCharToMultiByte(CP_ACP, 0, tszFilename, -1, szFilename, MAX_PATH, 0, 0);
sf->filename = strdup(szFilename);
@@ -468,7 +468,7 @@ void CYahooProto::ext_got_picture_checksum(const char *me, const char *who, int // Need to delete the Avatar File!!
TCHAR szFile[MAX_PATH];
- GetAvatarFileName(hContact, szFile, SIZEOF(szFile) - 1, 0);
+ GetAvatarFileName(hContact, szFile, _countof(szFile) - 1, 0);
DeleteFile(szFile);
// Reset the avatar and cleanup.
@@ -651,7 +651,7 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam) if (getDword(pai->hContact, "PictCK", 0) == 0)
return GAIR_NOAVATAR;
- GetAvatarFileName(pai->hContact, pai->filename, SIZEOF(pai->filename), getByte(pai->hContact, "AvatarType", 0));
+ GetAvatarFileName(pai->hContact, pai->filename, _countof(pai->filename), getByte(pai->hContact, "AvatarType", 0));
pai->format = PA_FORMAT_PNG;
debugLogA("[YAHOO_GETAVATARINFO] filename: %s", pai->filename);
diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index f29c2b99cb..f1a576055f 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -54,7 +54,7 @@ void CALLBACK ConferenceRequestCB(PVOID dwParam); void ext_yahoo_got_conf_invite(int id, const char *me, const char *who, const char *room, const char *msg, YList *members)
{
char z[1024];
- mir_snprintf(z, SIZEOF(z), Translate("[miranda] Got conference invite to room: %s with msg: %s"), room ? room : "", msg ? msg : "");
+ mir_snprintf(z, _countof(z), Translate("[miranda] Got conference invite to room: %s with msg: %s"), room ? room : "", msg ? msg : "");
LOG(("[ext_yahoo_got_conf_invite] %s", z));
CYahooProto* ppro = getProtoById(id);
@@ -91,7 +91,7 @@ void ext_yahoo_conf_userdecline(int id, const char *me, const char *who, const c TCHAR info[1024];
TCHAR *whot = mir_utf8decodeT(who);
TCHAR *msgt = mir_utf8decodeT(msg);
- mir_sntprintf(info, SIZEOF(info), TranslateT("%s denied invitation with message: %s"), whot, msgt ? msgt : _T(""));
+ mir_sntprintf(info, _countof(info), TranslateT("%s denied invitation with message: %s"), whot, msgt ? msgt : _T(""));
GETPROTOBYID(id)->ChatEvent(room, who, GC_EVENT_INFORMATION, info);
mir_free(msgt);
mir_free(whot);
@@ -342,7 +342,7 @@ int __cdecl CYahooProto::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) {
@@ -355,7 +355,7 @@ int __cdecl CYahooProto::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 {
@@ -364,7 +364,7 @@ int __cdecl CYahooProto::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(id);
@@ -501,7 +501,7 @@ INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_ADDSCR:
if (param->ppro->m_bLoggedIn) {
TCHAR sn[64];
- GetDlgItemText(hwndDlg, IDC_EDITSCR, sn, SIZEOF(sn));
+ GetDlgItemText(hwndDlg, IDC_EDITSCR, sn, _countof(sn));
CLCINFOITEM cii = { 0 };
cii.cbSize = sizeof(cii);
@@ -516,7 +516,7 @@ INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDOK:
{
TCHAR msg[1024];
- GetDlgItemText(hwndDlg, IDC_MSG, msg, SIZEOF(msg));
+ GetDlgItemText(hwndDlg, IDC_MSG, msg, _countof(msg));
HWND hwndList = GetDlgItem(hwndDlg, IDC_CCLIST);
YList *who = NULL;
@@ -589,7 +589,7 @@ INT_PTR CALLBACK ChatRequestDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDCANCEL:
if (cm) {
TCHAR msg[1024];
- GetDlgItemText(hwndDlg, IDC_MSG2, msg, SIZEOF(msg));
+ GetDlgItemText(hwndDlg, IDC_MSG2, msg, _countof(msg));
yahoo_conference_decline(param->ppro->m_id, NULL, cm->members, param->room, T2Utf(msg));
param->ppro->m_chatrooms.remove((CYahooProto::ChatRoom*)¶m->room);
@@ -612,7 +612,7 @@ static void CALLBACK ConferenceRequestCB(PVOID pParam) INT_PTR __cdecl CYahooProto::CreateConference(WPARAM /*wParam*/, LPARAM /*lParam*/)
{
char room[128];
- mir_snprintf(room, SIZEOF(room), "%s-%u", m_yahoo_id, time(NULL));
+ mir_snprintf(room, _countof(room), "%s-%u", m_yahoo_id, time(NULL));
InviteChatParam* param = new InviteChatParam(room, this);
DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_CHATROOM_INVITE), NULL,
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index fc6a6ae290..91083d9568 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -299,7 +299,7 @@ static void dl_file(int id, INT_PTR fd, int error, const char *filename, unsigne *
* Don't rely on workingDir to be right, since it's not used to check if file exists.
*/
- mir_sntprintf(filefull, SIZEOF(filefull), _T("%s\\%s"), sf->pfts.tszWorkingDir, sf->pfts.tszCurrentFile);
+ mir_sntprintf(filefull, _countof(filefull), _T("%s\\%s"), sf->pfts.tszWorkingDir, sf->pfts.tszCurrentFile);
FREE(sf->pfts.tszCurrentFile);
sf->pfts.tszCurrentFile = _tcsdup(filefull);
@@ -545,7 +545,7 @@ void CYahooProto::ext_got_files(const char *me, const char *who, const char *ft_ char z[1024];
struct yahoo_file_info *fi = (struct yahoo_file_info *) f->data;
- mir_snprintf(z, SIZEOF(z), "%s (%lu)\r\n", fi->filename, fi->filesize);
+ mir_snprintf(z, _countof(z), "%s (%lu)\r\n", fi->filename, fi->filesize);
mir_strcat(fn, z);
fc++;
}
diff --git a/protocols/Yahoo/src/icolib.cpp b/protocols/Yahoo/src/icolib.cpp index 85ec6ec28e..74aca39d1a 100644 --- a/protocols/Yahoo/src/icolib.cpp +++ b/protocols/Yahoo/src/icolib.cpp @@ -30,19 +30,19 @@ static IconItem iconList[] = void CYahooProto::IconsInit(void)
{
- Icon_Register(hInstance, "Protocols/YAHOO", iconList, SIZEOF(iconList), "YAHOO");
+ Icon_Register(hInstance, "Protocols/YAHOO", iconList, _countof(iconList), "YAHOO");
}
HICON CYahooProto::LoadIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "YAHOO_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "YAHOO_%s", name);
return IcoLib_GetIcon(szSettingName, big);
}
HANDLE CYahooProto::GetIconHandle(int iconId)
{
- for (unsigned i = 0; i < SIZEOF(iconList); i++)
+ for (unsigned i = 0; i < _countof(iconList); i++)
if (iconList[i].defIconID == iconId)
return iconList[i].hIcolib;
@@ -52,6 +52,6 @@ HANDLE CYahooProto::GetIconHandle(int iconId) void CYahooProto::ReleaseIconEx(const char* name, bool big)
{
char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "YAHOO_%s", name);
+ mir_snprintf(szSettingName, _countof(szSettingName), "YAHOO_%s", name);
IcoLib_Release(szSettingName, big);
}
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index 5192666321..db6ead3956 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -40,7 +40,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons if (stat == 2) {
char z[1024];
- mir_snprintf(z, SIZEOF(z), "Error sending message to %s", who);
+ mir_snprintf(z, _countof(z), "Error sending message to %s", who);
LOG((z));
ShowError(TranslateT("Yahoo Error"), _A2T(z));
return;
diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index f8eeab9976..085c488add 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -97,7 +97,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, bool reconnectRequired = false; char str[128]; - GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, _countof(str)); if (ppro->getString(YAHOO_LOGINID, &dbv)) { reconnectRequired = true; } @@ -108,7 +108,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } ppro->setString(YAHOO_LOGINID, str); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, _countof(str)); if (ppro->getString(YAHOO_PASSWORD, &dbv)) { reconnectRequired = true; } @@ -119,7 +119,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } ppro->setString(YAHOO_PASSWORD, str); - GetDlgItemTextA(hwndDlg, IDC_NICK, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_NICK, str, _countof(str)); if (str[0] == '\0') { @@ -213,7 +213,7 @@ YAHOO_DEFAULT_JAPAN_LOGIN_SERVER : if (((LPNMHDR)lParam)->code == PSN_APPLY) { bool reconnectRequired = false; char str[128]; - GetDlgItemTextA(hwndDlg, IDC_LOGINSERVER, str, SIZEOF(str)); + GetDlgItemTextA(hwndDlg, IDC_LOGINSERVER, str, _countof(str)); DBVARIANT dbv; if (ppro->getString(YAHOO_LOGINSERVER, &dbv)) { @@ -303,7 +303,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsIgnore(HWND hwndDlg, UINT msg, WPARAM wP MessageBox(hwndDlg, TranslateT("You need to be connected to Yahoo to add to Ignore List."), TranslateT("Yahoo Ignore"), MB_OK | MB_ICONINFORMATION); else { char id[128]; - int i = GetDlgItemTextA(hwndDlg, IDC_YIGN_EDIT, id, SIZEOF(id)); + int i = GetDlgItemTextA(hwndDlg, IDC_YIGN_EDIT, id, _countof(id)); if (i < 3) { MessageBox(hwndDlg, TranslateT("Please enter a valid buddy name to ignore."), TranslateT("Yahoo Ignore"), MB_OK | MB_ICONINFORMATION); diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 0ebea61427..0689e010b3 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -68,7 +68,7 @@ int CYahooProto::OnModulesLoadedEx(WPARAM, LPARAM) HookProtoEvent(ME_CLIST_PREBUILDCONTACTMENU, &CYahooProto::OnPrebuildContactMenu);
TCHAR tModuleDescr[100];
- mir_sntprintf(tModuleDescr, SIZEOF(tModuleDescr), TranslateT("%s plugin connections"), m_tszUserName);
+ mir_sntprintf(tModuleDescr, _countof(tModuleDescr), TranslateT("%s plugin connections"), m_tszUserName);
NETLIBUSER nlu = { 0 };
nlu.cbSize = sizeof(nlu);
@@ -707,7 +707,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM char str[128];
bool reconnectRequired = false;
- GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, _countof(str));
if (ppro->getString(YAHOO_LOGINID, &dbv)) {
reconnectRequired = true;
@@ -719,7 +719,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM }
ppro->setString(YAHOO_LOGINID, str);
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, _countof(str));
if (ppro->getString(YAHOO_PASSWORD, &dbv)) {
reconnectRequired = true;
diff --git a/protocols/Yahoo/src/search.cpp b/protocols/Yahoo/src/search.cpp index b0ab4bae82..0e05230c5c 100644 --- a/protocols/Yahoo/src/search.cpp +++ b/protocols/Yahoo/src/search.cpp @@ -159,7 +159,7 @@ void __cdecl CYahooProto::searchadv_thread(void *pHWND) HWND hwndDlg = (HWND)pHWND;
TCHAR searchid[128];
- GetDlgItemText(hwndDlg, IDC_SEARCH_ID, searchid, SIZEOF(searchid));
+ GetDlgItemText(hwndDlg, IDC_SEARCH_ID, searchid, _countof(searchid));
if (mir_tstrlen(searchid) == 0) {
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 5900aea998..0155d8a3c6 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -146,7 +146,7 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam CYahooProto* ppro = (CYahooProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
/* Get String from dialog */
- GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, SIZEOF(str));
+ GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, _countof(str));
/* Save it for later use */
ppro->setString(YAHOO_CUSTSTATDB, str);
@@ -173,7 +173,7 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam BOOL toSet;
- toSet = GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, SIZEOF(str)) != 0;
+ toSet = GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, _countof(str)) != 0;
EnableWindow(GetDlgItem(hwndDlg, IDOK), toSet);
}
@@ -224,7 +224,7 @@ void CYahooProto::OpenURL(const char *url, int autoLogin) y = yahoo_urlencode(yahoo_get_cookie(m_id, "y"));
t = yahoo_urlencode(yahoo_get_cookie(m_id, "t"));
u = yahoo_urlencode(url);
- mir_snprintf(tUrl, SIZEOF(tUrl),
+ mir_snprintf(tUrl, _countof(tUrl),
"http://msg.edit.yahoo.com/config/reset_cookies?&.y=Y=%s&.t=T=%s&.ver=2&.done=http%%3a//us.rd.yahoo.com/messenger/client/%%3f%s",
y, t, u);
@@ -233,7 +233,7 @@ void CYahooProto::OpenURL(const char *url, int autoLogin) FREE(u);
}
else {
- mir_snprintf(tUrl, SIZEOF(tUrl), url);
+ mir_snprintf(tUrl, _countof(tUrl), url);
}
debugLogA("[YahooOpenURL] url: %s Final URL: %s", url, tUrl);
@@ -259,7 +259,7 @@ INT_PTR __cdecl CYahooProto::OnShowProfileCommand(WPARAM wParam, LPARAM lParam) if (getString(wParam, YAHOO_LOGINID, &dbv))
return 0;
- mir_snprintf(tUrl, SIZEOF(tUrl), "http://profiles.yahoo.com/%s", dbv.pszVal);
+ mir_snprintf(tUrl, _countof(tUrl), "http://profiles.yahoo.com/%s", dbv.pszVal);
db_free(&dbv);
OpenURL(tUrl, 0);
@@ -285,7 +285,7 @@ INT_PTR __cdecl CYahooProto::OnShowMyProfileCommand(WPARAM wParam, LPARAM lParam }
char tUrl[4096];
- mir_snprintf(tUrl, SIZEOF(tUrl), "http://profiles.yahoo.com/%s", dbv.pszVal);
+ mir_snprintf(tUrl, _countof(tUrl), "http://profiles.yahoo.com/%s", dbv.pszVal);
db_free(&dbv);
OpenURL(tUrl, 0);
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index 098eae59e7..7a04f48e61 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -112,8 +112,8 @@ int CYahooProto::ShowPopup(const TCHAR* nickname, const TCHAR* msg, const char * POPUPDATAT ppd = { 0 };
ppd.PluginWindowProc = PopupWindowProc;
- mir_tstrncpy(ppd.lptzContactName, nickname, SIZEOF(ppd.lptzContactName));
- mir_tstrncpy(ppd.lptzText, msg, SIZEOF(ppd.lptzText));
+ mir_tstrncpy(ppd.lptzContactName, nickname, _countof(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzText, msg, _countof(ppd.lptzText));
if (szURL != NULL) {
ppd.lchIcon = LoadIconEx(!mir_strcmpi(szURL, "http://mail.yahoo.com") ? "mail" : "calendar");
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 7e98c01909..1975b778be 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -519,7 +519,7 @@ void CYahooProto::ext_got_audible(const char *me, const char *who, const char *a }
char z[1028];
- mir_snprintf(z, SIZEOF(z), "[miranda-audible] %s", msg ? msg : "");
+ mir_snprintf(z, _countof(z), "[miranda-audible] %s", msg ? msg : "");
ext_got_im((char*)me, (char*)who, 0, z, 0, 0, 1, -1, NULL, 0);
}
@@ -733,7 +733,7 @@ void CYahooProto::ext_contact_added(const char *myid, const char *who, const cha nick[0] = '\0';
if (lname && fname)
- mir_snprintf(nick, SIZEOF(nick), "%s %s", fname, lname);
+ mir_snprintf(nick, _countof(nick), "%s %s", fname, lname);
else if (lname)
strncpy_s(nick, lname, _TRUNCATE);
else if (fname)
@@ -924,15 +924,15 @@ void CYahooProto::ext_mail_notify(const char *from, const char *subj, int cnt) TCHAR z[MAX_SECONDLINE], title[MAX_CONTACTNAME];
if (from == NULL) {
- mir_sntprintf(title, SIZEOF(title), _T("%s: %s"), m_tszUserName, TranslateT("New Mail"));
- mir_sntprintf(z, SIZEOF(z), TranslateT("You have %i unread messages"), cnt);
+ mir_sntprintf(title, _countof(title), _T("%s: %s"), m_tszUserName, TranslateT("New Mail"));
+ mir_sntprintf(z, _countof(z), TranslateT("You have %i unread messages"), cnt);
}
else {
- mir_sntprintf(title, SIZEOF(title), TranslateT("New Mail (%i messages)"), cnt);
+ mir_sntprintf(title, _countof(title), TranslateT("New Mail (%i messages)"), cnt);
ptrT tszFrom(mir_utf8decodeT(from));
ptrT tszSubj(mir_utf8decodeT(subj));
- mir_sntprintf(z, SIZEOF(z), TranslateT("From: %s\nSubject: %s"), (TCHAR*)tszFrom, (TCHAR*)tszSubj);
+ mir_sntprintf(z, _countof(z), TranslateT("From: %s\nSubject: %s"), (TCHAR*)tszFrom, (TCHAR*)tszSubj);
}
if (!ShowPopup(title, z, "http://mail.yahoo.com"))
@@ -984,7 +984,7 @@ void ext_yahoo_got_cookies(int id) //wsprintfA(z, "Cookie: %s; C=%s; Y=%s; T=%s", Bcookie, yahoo_get_cookie(id, "c"), yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
//wsprintfA(z, "Cookie: %s; Y=%s", Bcookie, yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
- mir_snprintf(z, SIZEOF(z), "Cookie: Y=%s; T=%s", yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
+ mir_snprintf(z, _countof(z), "Cookie: Y=%s; T=%s", yahoo_get_cookie(id, "y"), yahoo_get_cookie(id, "t"));
LOG(("Our Cookie: '%s'", z));
CallService(MS_NETLIB_SETSTICKYHEADERS, (WPARAM)hnuMain, (LPARAM)z);*/
@@ -993,7 +993,7 @@ void ext_yahoo_got_cookies(int id) char z[1024];
// need to add Cookie header to our requests or we get booted w/ "Bad Cookie" message.
- mir_snprintf(z, SIZEOF(z), "Cookie: Y=%s; T=%s; C=%s", yahoo_get_cookie(id, "y"),
+ mir_snprintf(z, _countof(z), "Cookie: Y=%s; T=%s; C=%s", yahoo_get_cookie(id, "y"),
yahoo_get_cookie(id, "t"), yahoo_get_cookie(id, "c"));
LOG(("Our Cookie: '%s'", z));
CallService(MS_NETLIB_SETSTICKYHEADERS, (WPARAM)hNetlibUser, (LPARAM)z);
@@ -1235,7 +1235,7 @@ void CYahooProto::ext_send_http_request(enum yahoo_connection_type type, const c if (nlhr.requestType == REQUEST_POST) {
httpHeaders[nlhr.headersCount].szName = "Content-Length";
- mir_snprintf(z, SIZEOF(z), "%d", content_length);
+ mir_snprintf(z, _countof(z), "%d", content_length);
httpHeaders[nlhr.headersCount].szValue = z;
nlhr.headersCount++;
@@ -1378,7 +1378,7 @@ char * CYahooProto::ext_send_https_request(struct yahoo_data *yd, const char *ho char z[4096], *result = NULL;
int i;
- mir_snprintf(z, SIZEOF(z), "https://%s%s", host, path);
+ mir_snprintf(z, _countof(z), "https://%s%s", host, path);
nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
nlhr.flags = NLHRF_HTTP11 | NLHRF_NODUMPSEND | NLHRF_DUMPASTEXT; /* Use HTTP/1.1 and don't dump the requests to the log */
@@ -1451,7 +1451,7 @@ void CYahooProto::ext_login(enum yahoo_status login_mode) NETLIBHTTPREQUEST nlhr = { 0 }, *nlhrReply;
char z[4096];
- mir_snprintf(z, SIZEOF(z), "http://%s%s", getByte("YahooJapan", 0) != 0 ? "cs1.msg.vip.ogk.yahoo.co.jp" : "vcs.msg.yahoo.com", "/capacity");
+ mir_snprintf(z, _countof(z), "http://%s%s", getByte("YahooJapan", 0) != 0 ? "cs1.msg.vip.ogk.yahoo.co.jp" : "vcs.msg.yahoo.com", "/capacity");
nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
nlhr.flags = NLHRF_HTTP11;
|