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/SkypeWeb/src | |
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/SkypeWeb/src')
-rw-r--r-- | protocols/SkypeWeb/src/http_request.h | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_avatars.cpp | 12 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_icons.cpp | 12 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_login.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_menus.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_utils.cpp | 6 |
8 files changed, 22 insertions, 22 deletions
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))
{
|