summaryrefslogtreecommitdiff
path: root/protocols/Omegle
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/Omegle
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/Omegle')
-rw-r--r--protocols/Omegle/src/communication.cpp12
-rw-r--r--protocols/Omegle/src/dialogs.cpp10
-rw-r--r--protocols/Omegle/src/main.cpp2
-rw-r--r--protocols/Omegle/src/proto.cpp2
-rw-r--r--protocols/Omegle/src/theme.cpp6
-rw-r--r--protocols/Omegle/src/utils.cpp2
6 files changed, 17 insertions, 17 deletions
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 );