summaryrefslogtreecommitdiff
path: root/protocols/Steam/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
commit4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch)
tree9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /protocols/Steam/src
parentf0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (diff)
SIZEOF replaced with more secure analog - _countof
git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src')
-rw-r--r--protocols/Steam/src/api/friend_list.h18
-rw-r--r--protocols/Steam/src/api/login.h4
-rw-r--r--protocols/Steam/src/api/pending.h18
-rw-r--r--protocols/Steam/src/api/session.h2
-rw-r--r--protocols/Steam/src/http_request.h2
-rw-r--r--protocols/Steam/src/main.cpp2
-rw-r--r--protocols/Steam/src/steam_avatars.cpp2
-rw-r--r--protocols/Steam/src/steam_contacts.cpp2
-rw-r--r--protocols/Steam/src/steam_dialogs.cpp10
-rw-r--r--protocols/Steam/src/steam_menus.cpp4
-rw-r--r--protocols/Steam/src/steam_proto.cpp8
-rw-r--r--protocols/Steam/src/steam_xstatus.cpp4
12 files changed, 38 insertions, 38 deletions
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);