diff options
author | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-11-30 18:33:56 +0000 |
---|---|---|
committer | Rozhuk Ivan <rozhuk.im@gmail.com> | 2014-11-30 18:33:56 +0000 |
commit | 4f0e30cdf56fbafdf955bbe8b93930bab9e39bd0 (patch) | |
tree | ded36ec10c55fb5d33c8d2e471ec808eeb058a04 /protocols/Gadu-Gadu | |
parent | 237d02ebbabbedfb8b33160ebfb5250bbd491eca (diff) |
Fix buf size for Get/Set text, open/save file name
SMS: SIZE_T -> size_t
MRA: small code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@11175 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu')
-rw-r--r-- | protocols/Gadu-Gadu/src/dialogs.cpp | 54 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.cpp | 12 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/import.cpp | 4 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/token.cpp | 2 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/userutils.cpp | 16 |
5 files changed, 44 insertions, 44 deletions
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index e828504623..b0226022a6 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -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, SIZEOF(email)); uin = atoi(email); - GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, sizeof(email)); + GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email)); if (!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, SIZEOF(pass)); dat.uin = atoi(pass); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, sizeof(pass)); - GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, sizeof(email)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass)); + GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(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, SIZEOF(str)); uin = atoi(str); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(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, SIZEOF(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, SIZEOF(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, SIZEOF(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, SIZEOF(str)); gg->setString(GG_KEY_SERVERHOSTS, str); // Write direct port - GetDlgItemTextA(hwndDlg, IDC_DIRECTPORT, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_DIRECTPORT, str, SIZEOF(str)); gg->setWord(GG_KEY_DIRECTPORT, (WORD)atoi(str)); // Write forwarding host - GetDlgItemTextA(hwndDlg, IDC_FORWARDHOST, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_FORWARDHOST, str, SIZEOF(str)); gg->setString(GG_KEY_FORWARDHOST, str); - GetDlgItemTextA(hwndDlg, IDC_FORWARDPORT, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_FORWARDPORT, str, SIZEOF(str)); gg->setWord(GG_KEY_FORWARDPORT, (WORD)atoi(str)); break; } @@ -831,28 +831,28 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, req = gg_pubdir50_new(GG_PUBDIR50_WRITE); - GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, sizeof(text)); + GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, SIZEOF(text)); if (_tcslen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, text_utf8); mir_free(text_utf8); } - GetDlgItemText(hwndDlg, IDC_LASTNAME, text, sizeof(text)); + GetDlgItemText(hwndDlg, IDC_LASTNAME, text, SIZEOF(text)); if (_tcslen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, text_utf8); mir_free(text_utf8); } - GetDlgItemText(hwndDlg, IDC_NICKNAME, text, sizeof(text)); + GetDlgItemText(hwndDlg, IDC_NICKNAME, text, SIZEOF(text)); if (_tcslen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, text_utf8); mir_free(text_utf8); } - GetDlgItemText(hwndDlg, IDC_CITY, text, sizeof(text)); + GetDlgItemText(hwndDlg, IDC_CITY, text, SIZEOF(text)); if (_tcslen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_CITY, text_utf8); @@ -871,21 +871,21 @@ 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, SIZEOF(text)); if (_tcslen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, text_utf8); mir_free(text_utf8); } - GetDlgItemText(hwndDlg, IDC_FAMILYNAME, text, sizeof(text)); + GetDlgItemText(hwndDlg, IDC_FAMILYNAME, text, SIZEOF(text)); if (_tcslen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_FAMILYNAME, text_utf8); mir_free(text_utf8); } - GetDlgItemText(hwndDlg, IDC_CITYORIGIN, text, sizeof(text)); + GetDlgItemText(hwndDlg, IDC_CITYORIGIN, text, SIZEOF(text)); if (_tcslen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_FAMILYCITY, text_utf8); @@ -986,10 +986,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, SIZEOF(pass)); dat.uin = atoi(pass); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, sizeof(pass)); - GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, sizeof(email)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass)); + GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email)); dat.pass = pass; dat.email = email; dat.gg = gg; @@ -1037,15 +1037,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, SIZEOF(str)); uin = atoi(str); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(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, SIZEOF(str)); gg->setString(GG_KEY_EMAIL, str); } } diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 4b06361a18..248f33e393 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -420,7 +420,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) }
// Fetch search data
- GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, sizeof(text));
+ GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, SIZEOF(text));
if (_tcslen(text))
{
char *firstName_utf8 = mir_utf8encodeT(text);
@@ -430,7 +430,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) }
/* 1 */ strncat(data, ".", sizeof(data) - strlen(data));
- GetDlgItemText(hwndDlg, IDC_LASTNAME, text, sizeof(text));
+ GetDlgItemText(hwndDlg, IDC_LASTNAME, text, SIZEOF(text));
if (_tcslen(text))
{
char *lastName_utf8 = mir_utf8encodeT(text);
@@ -440,7 +440,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) }
/* 2 */ strncat(data, ".", sizeof(data) - strlen(data));
- GetDlgItemText(hwndDlg, IDC_NICKNAME, text, sizeof(text));
+ GetDlgItemText(hwndDlg, IDC_NICKNAME, text, SIZEOF(text));
if (_tcslen(text))
{
char *nickName_utf8 = mir_utf8encodeT(text);
@@ -450,7 +450,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) }
/* 3 */ strncat(data, ".", sizeof(data) - strlen(data));
- GetDlgItemText(hwndDlg, IDC_CITY, text, sizeof(text));
+ GetDlgItemText(hwndDlg, IDC_CITY, text, SIZEOF(text));
if (_tcslen(text))
{
char *city_utf8 = mir_utf8encodeT(text);
@@ -460,7 +460,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) }
/* 4 */ strncat(data, ".", sizeof(data) - strlen(data));
- GetDlgItemText(hwndDlg, IDC_AGEFROM, text, sizeof(text));
+ GetDlgItemText(hwndDlg, IDC_AGEFROM, text, SIZEOF(text));
if (_tcslen(text))
{
int yearTo = _tstoi(text);
@@ -470,7 +470,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, SIZEOF(age));
yearFrom = atoi(age);
// Count & fix ranges
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index a8c58c3190..27c7830354 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -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 = SIZEOF(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("txt");
@@ -429,7 +429,7 @@ INT_PTR GGPROTO::export_text(WPARAM wParam, LPARAM lParam) ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
- ofn.nMaxFile = sizeof(str);
+ ofn.nMaxFile = SIZEOF(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("txt");
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index d6ff406fd5..e208becaf5 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, SIZEOF(dat->val));
EndDialog(hwndDlg, IDOK);
break;
}
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index d7b4643de8..bbd3e6b01f 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, SIZEOF(pass));
+ GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, SIZEOF(cpass));
enable = strlen(pass) && strlen(cpass) && !strcmp(cpass, pass);
if (dat && dat->mode == GG_USERUTIL_REMOVE)
EnableWindow(GetDlgItem(hwndDlg, IDOK), IsDlgButtonChecked(hwndDlg, IDC_CONFIRM) ? enable : FALSE);
@@ -237,18 +237,18 @@ 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, SIZEOF(pass));
+ GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, SIZEOF(cpass));
+ GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email));
EndDialog(hwndDlg, IDOK);
// Check dialog box mode
if (!dat) break;
switch (dat->mode)
{
- case GG_USERUTIL_CREATE: gg_doregister(dat->gg, pass, email); break;
- case GG_USERUTIL_REMOVE: gg_dounregister(dat->gg, dat->uin, pass); break;
- case GG_USERUTIL_PASS: gg_dochpass(dat->gg, dat->uin, dat->pass, pass); break;
+ case GG_USERUTIL_CREATE: gg_doregister(dat->gg, pass, email); break;
+ case GG_USERUTIL_REMOVE: gg_dounregister(dat->gg, dat->uin, pass); break;
+ case GG_USERUTIL_PASS: gg_dochpass(dat->gg, dat->uin, dat->pass, pass); break;
case GG_USERUTIL_EMAIL: gg_dochemail(dat->gg, dat->uin, dat->pass, dat->email, email); break;
}
break;
|