summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp
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/WhatsApp
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/WhatsApp')
-rw-r--r--protocols/WhatsApp/src/avatars.cpp4
-rw-r--r--protocols/WhatsApp/src/chat.cpp10
-rw-r--r--protocols/WhatsApp/src/contacts.cpp2
-rw-r--r--protocols/WhatsApp/src/messages.cpp2
-rw-r--r--protocols/WhatsApp/src/proto.cpp2
-rw-r--r--protocols/WhatsApp/src/theme.cpp6
6 files changed, 13 insertions, 13 deletions
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;