summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/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/Gadu-Gadu/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/Gadu-Gadu/src')
-rw-r--r--protocols/Gadu-Gadu/src/avatar.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp14
-rw-r--r--protocols/Gadu-Gadu/src/dialogs.cpp72
-rw-r--r--protocols/Gadu-Gadu/src/filetransfer.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp16
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp14
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp8
-rw-r--r--protocols/Gadu-Gadu/src/icolib.cpp10
-rw-r--r--protocols/Gadu-Gadu/src/image.cpp10
-rw-r--r--protocols/Gadu-Gadu/src/import.cpp58
-rw-r--r--protocols/Gadu-Gadu/src/oauth.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/popups.cpp12
-rw-r--r--protocols/Gadu-Gadu/src/services.cpp10
-rw-r--r--protocols/Gadu-Gadu/src/sessions.cpp20
-rw-r--r--protocols/Gadu-Gadu/src/token.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/userutils.cpp10
16 files changed, 135 insertions, 135 deletions
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