From 4f0e30cdf56fbafdf955bbe8b93930bab9e39bd0 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Sun, 30 Nov 2014 18:33:56 +0000 Subject: 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 --- protocols/AimOscar/src/ui.cpp | 28 ++-- protocols/FacebookRM/src/dialogs.cpp | 10 +- protocols/Gadu-Gadu/src/dialogs.cpp | 54 +++---- protocols/Gadu-Gadu/src/gg_proto.cpp | 12 +- protocols/Gadu-Gadu/src/import.cpp | 4 +- protocols/Gadu-Gadu/src/token.cpp | 2 +- protocols/Gadu-Gadu/src/userutils.cpp | 16 +- protocols/IRCG/src/windows.cpp | 4 +- protocols/IcqOscarJ/src/UI/loginpassword.cpp | 2 +- protocols/IcqOscarJ/src/changeinfo/db.cpp | 4 +- protocols/IcqOscarJ/src/icq_advsearch.cpp | 4 +- protocols/IcqOscarJ/src/icq_firstrun.cpp | 4 +- protocols/IcqOscarJ/src/icq_opts.cpp | 4 +- protocols/JabberG/src/jabber_opt.cpp | 2 +- protocols/MRA/src/Mra_functions.cpp | 4 +- protocols/MRA/src/Mra_options.cpp | 2 +- protocols/MSN/src/msn_opts.cpp | 18 +-- protocols/Omegle/src/dialogs.cpp | 2 +- protocols/Sametime/src/sametime_proto.cpp | 2 +- protocols/SkypeClassic/src/skypeapi.cpp | 8 +- protocols/SkypeClassic/src/skypeopt.cpp | 30 ++-- protocols/Tlen/src/tlen_advsearch.cpp | 2 +- protocols/Tlen/src/tlen_opt.cpp | 18 +-- protocols/Tlen/src/tlen_thread.cpp | 2 +- protocols/Tlen/src/tlen_userinfo.cpp | 2 +- protocols/Tox/src/tox_options.cpp | 212 +++++++++++++-------------- protocols/Twitter/src/ui.cpp | 14 +- protocols/WhatsApp/src/dialogs.cpp | 10 +- protocols/Xfire/src/addgamedialog.cpp | 18 +-- protocols/Xfire/src/options.cpp | 16 +- protocols/Xfire/src/passworddialog.cpp | 2 +- protocols/Xfire/src/pwd_dlg.cpp | 2 +- protocols/Xfire/src/setnickname.cpp | 2 +- protocols/Yahoo/src/chat.cpp | 2 +- protocols/Yahoo/src/options.cpp | 10 +- protocols/Yahoo/src/proto.cpp | 4 +- protocols/Yahoo/src/search.cpp | 2 +- protocols/Yahoo/src/services.cpp | 4 +- 38 files changed, 269 insertions(+), 269 deletions(-) (limited to 'protocols') diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index 382d51b00c..5521b00598 100644 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -691,7 +691,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar break; char name[64]; - GetDlgItemTextA(hwndDlg, IDC_FNAME, name, sizeof(name)); + GetDlgItemTextA(hwndDlg, IDC_FNAME, name, SIZEOF(name)); if (strlen(trim_str(name)) > 0 && !ppro->getString(AIM_KEY_SN, &dbv)) { if (strcmp(name, dbv.pszVal)) @@ -700,7 +700,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar } char email[254]; - GetDlgItemTextA(hwndDlg, IDC_CEMAIL, email, sizeof(email)); + GetDlgItemTextA(hwndDlg, IDC_CEMAIL, email, SIZEOF(email)); if (strlen(trim_str(email)) > 1 && !ppro->getString(AIM_KEY_EM, &dbv)) // Must be greater than 1 or a SNAC error is thrown. { if (strcmp(email, dbv.pszVal)) @@ -711,9 +711,9 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ShowWindow(GetDlgItem(hwndDlg, IDC_PINFO), SW_HIDE); char cpw[256], npw1[256], npw2[256]; - GetDlgItemTextA(hwndDlg, IDC_CPW, cpw, sizeof(cpw)); - GetDlgItemTextA(hwndDlg, IDC_NPW1, npw1, sizeof(npw1)); - GetDlgItemTextA(hwndDlg, IDC_NPW2, npw2, sizeof(npw2)); + GetDlgItemTextA(hwndDlg, IDC_CPW, cpw, SIZEOF(cpw)); + GetDlgItemTextA(hwndDlg, IDC_NPW1, npw1, SIZEOF(npw1)); + GetDlgItemTextA(hwndDlg, IDC_NPW2, npw2, SIZEOF(npw2)); if (cpw[0] != 0 && npw1[0] != 0 && npw2[0] != 0) { // AOL only requires that you send the current password and a (single) new password. @@ -864,7 +864,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP { char str[128]; //SN - GetDlgItemTextA(hwndDlg, IDC_SN, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_SN, str, SIZEOF(str)); if (str[0] != 0) ppro->setString(AIM_KEY_SN, str); else @@ -872,17 +872,17 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP //END SN //NK - if (GetDlgItemTextA(hwndDlg, IDC_NK, str, sizeof(str))) + if (GetDlgItemTextA(hwndDlg, IDC_NK, str, SIZEOF(str))) ppro->setString(AIM_KEY_NK, str); else { - GetDlgItemTextA(hwndDlg, IDC_SN, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_SN, str, SIZEOF(str)); ppro->setString(AIM_KEY_NK, str); } //END NK //PW - GetDlgItemTextA(hwndDlg, IDC_PW, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_PW, str, SIZEOF(str)); if (str[0] != 0) ppro->setString(AIM_KEY_PW, str); else @@ -890,7 +890,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP //END PW //HN - GetDlgItemTextA(hwndDlg, IDC_HN, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_HN, str, SIZEOF(str)); if (str[0] != 0 && strcmp(str, AIM_DEFAULT_SERVER)) ppro->setString(AIM_KEY_HN, str); else @@ -1196,10 +1196,10 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_NOTIFY: if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { char str[128]; - GetDlgItemTextA(hwndDlg, IDC_SN, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_SN, str, SIZEOF(str)); ppro->setString(AIM_KEY_SN, str); - GetDlgItemTextA(hwndDlg, IDC_PW, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_PW, str, SIZEOF(str)); ppro->setString(AIM_KEY_PW, str); return TRUE; } @@ -1306,7 +1306,7 @@ INT_PTR CALLBACK join_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM switch (LOWORD(wParam)) { case IDOK: char room[128]; - GetDlgItemTextA(hwndDlg, IDC_ROOM, room, sizeof(room)); + GetDlgItemTextA(hwndDlg, IDC_ROOM, room, SIZEOF(room)); if (ppro->state == 1 && room[0] != 0) { chatnav_param* par = new chatnav_param(room, 4); ppro->ForkThread(&CAimProto::chatnav_request_thread, par); @@ -1461,7 +1461,7 @@ INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (item) { char msg[1024]; - GetDlgItemTextA(hwndDlg, IDC_MSG, msg, sizeof(msg)); + GetDlgItemTextA(hwndDlg, IDC_MSG, msg, SIZEOF(msg)); HWND hwndList = GetDlgItem(hwndDlg, IDC_CCLIST); clist_chat_invite_send(NULL, hwndList, item, param->ppro, msg); diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index 0e13fc8317..024e920626 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -88,10 +88,10 @@ INT_PTR CALLBACK FBAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp { char str[128]; - GetDlgItemTextA(hwnd, IDC_UN, str, sizeof(str)); + GetDlgItemTextA(hwnd, IDC_UN, str, SIZEOF(str)); db_set_s(NULL, proto->ModuleName(), FACEBOOK_KEY_LOGIN, str); - GetDlgItemTextA(hwnd, IDC_PW, str, sizeof(str)); + GetDlgItemTextA(hwnd, IDC_PW, str, SIZEOF(str)); db_set_s(NULL, proto->ModuleName(), FACEBOOK_KEY_PASS, str); return TRUE; } @@ -395,13 +395,13 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp { char str[128]; TCHAR tstr[128]; - GetDlgItemTextA(hwnd,IDC_UN,str,sizeof(str)); + GetDlgItemTextA(hwnd,IDC_UN,str,SIZEOF(str)); db_set_s(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,str); - GetDlgItemTextA(hwnd,IDC_PW,str,sizeof(str)); + GetDlgItemTextA(hwnd,IDC_PW,str,SIZEOF(str)); proto->setString(FACEBOOK_KEY_PASS, str); - GetDlgItemText(hwnd,IDC_GROUP,tstr,sizeof(tstr)); + GetDlgItemText(hwnd,IDC_GROUP,tstr,SIZEOF(tstr)); if (tstr[0] != '\0') { proto->setTString(FACEBOOK_KEY_DEF_GROUP, tstr); 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; diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index bfd6fb58e6..52b9d32726 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -911,7 +911,7 @@ void CManagerDlg::OnClose() } TCHAR window[256]; - GetDlgItemText(m_hwnd, IDC_CAPTION, window, 255); + GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window)); CMString S = _T(""); TCHAR temp[1000]; for (int i = 0; i < 5; i++) { @@ -1246,7 +1246,7 @@ void CManagerDlg::OnRadio(CCtrlData*) void CManagerDlg::ApplyQuestion() { TCHAR window[256]; - GetDlgItemText(m_hwnd, IDC_CAPTION, window, 255); + GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window)); TCHAR mode[3]; lstrcpy(mode, _T("+b")); diff --git a/protocols/IcqOscarJ/src/UI/loginpassword.cpp b/protocols/IcqOscarJ/src/UI/loginpassword.cpp index da8fe181bf..3464db871a 100644 --- a/protocols/IcqOscarJ/src/UI/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/UI/loginpassword.cpp @@ -66,7 +66,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ppro->m_bRememberPwd = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVEPASS); ppro->setByte("RememberPass", ppro->m_bRememberPwd); - GetDlgItemTextA(hwndDlg, IDC_LOGINPW, ppro->m_szPassword, sizeof(ppro->m_szPassword)); + GetDlgItemTextA(hwndDlg, IDC_LOGINPW, ppro->m_szPassword, SIZEOF(ppro->m_szPassword)); ppro->icq_login(ppro->m_szPassword); diff --git a/protocols/IcqOscarJ/src/changeinfo/db.cpp b/protocols/IcqOscarJ/src/changeinfo/db.cpp index d4d8d6881c..963ed4eb4c 100644 --- a/protocols/IcqOscarJ/src/changeinfo/db.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/db.cpp @@ -136,7 +136,7 @@ static INT_PTR CALLBACK PwConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, { char szTest[16]; - GetDlgItemTextA(hwndDlg, IDC_OLDPASS, szTest, sizeof(szTest)); + GetDlgItemTextA(hwndDlg, IDC_OLDPASS, szTest, SIZEOF(szTest)); if (strcmpnull(szTest, dat->ppro->GetUserPassword(TRUE))) { MessageBox(hwndDlg, TranslateT("The password does not match your current password. Check Caps Lock and try again."), TranslateT("Change ICQ Details"), MB_OK); @@ -145,7 +145,7 @@ static INT_PTR CALLBACK PwConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, break; } - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szTest, sizeof(szTest)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szTest, SIZEOF(szTest)); if (strcmpnull(szTest, dat->Pass)) { MessageBox(hwndDlg, TranslateT("The password does not match the password you originally entered. Check Caps Lock and try again."), TranslateT("Change ICQ Details"), MB_OK); SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_SETSEL, 0, (LPARAM)-1); diff --git a/protocols/IcqOscarJ/src/icq_advsearch.cpp b/protocols/IcqOscarJ/src/icq_advsearch.cpp index 510c1bc03b..c50d7dcc8b 100644 --- a/protocols/IcqOscarJ/src/icq_advsearch.cpp +++ b/protocols/IcqOscarJ/src/icq_advsearch.cpp @@ -72,7 +72,7 @@ static void searchPackTLVLNTS(PBYTE *buf, size_t *buflen, HWND hwndDlg, UINT idC { char str[512]; - GetDlgItemTextA(hwndDlg, idControl, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, idControl, str, SIZEOF(str)); ppackLETLVLNTS(buf, buflen, str, wType, 0); } @@ -81,7 +81,7 @@ static void searchPackTLVWordLNTS(PBYTE *buf, size_t *buflen, HWND hwndDlg, UINT { char str[512]; - GetDlgItemTextA(hwndDlg, idControl, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, idControl, str, SIZEOF(str)); ppackLETLVWordLNTS(buf, buflen, w, str, wType, 0); } diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index 5cd1ceece3..1880dd3364 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -86,10 +86,10 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: char str[128]; - GetDlgItemTextA(hwndDlg, IDC_UIN, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_UIN, str, SIZEOF(str)); ppro->setDword(UNIQUEIDSETTING, atoi(str)); - GetDlgItemTextA(hwndDlg, IDC_PW, str, sizeof(ppro->m_szPassword)); + GetDlgItemTextA(hwndDlg, IDC_PW, str, SIZEOF(ppro->m_szPassword)); strcpy(ppro->m_szPassword, str); ppro->setString("Password", str); break; diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index d3466c6770..87c2a451cd 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -146,7 +146,7 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP char str[128]; ppro->setDword(UNIQUEIDSETTING, GetDlgItemInt(hwndDlg, IDC_ICQNUM, NULL, FALSE)); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(ppro->m_szPassword)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(ppro->m_szPassword)); if (mir_strlen(str)) { strcpy(ppro->m_szPassword, str); ppro->m_bRememberPwd = true; @@ -154,7 +154,7 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else ppro->m_bRememberPwd = ppro->getByte("RememberPass", 0); ppro->setString("Password", str); - GetDlgItemTextA(hwndDlg, IDC_ICQSERVER, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_ICQSERVER, str, SIZEOF(str)); ppro->setString("OscarServer", str); ppro->setWord("OscarPort", (WORD)GetDlgItemInt(hwndDlg, IDC_ICQPORT, NULL, FALSE)); diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 9b225a91e5..f4171a6eba 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -1268,7 +1268,7 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg) ofn.lpstrFilter = filter; ofn.lpstrFile = filename; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; - ofn.nMaxFile = sizeof(filename); + ofn.nMaxFile = SIZEOF(filename); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = "xml"; if (!GetOpenFileNameA(&ofn)) diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 3893bab587..a9af00ed8c 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -187,7 +187,7 @@ bool DB_GetStaticStringA(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueN DBVARIANT dbv = { 0 }; if (db_get_ws(hContact, lpszModule, lpszValueName, &dbv) == 0) { - int dwRetBuffSizeLocal, dwReadedStringLen = lstrlenW(dbv.pwszVal); + size_t dwRetBuffSizeLocal, dwReadedStringLen = mir_wstrlen(dbv.pwszVal); if (lpszRetBuff && (dwRetBuffSize > dwReadedStringLen)) { dwRetBuffSizeLocal = WideCharToMultiByte(MRA_CODE_PAGE, 0, dbv.pwszVal, dwReadedStringLen, lpszRetBuff, dwRetBuffSize, NULL, NULL); (*((CHAR*)(lpszRetBuff + dwRetBuffSizeLocal))) = 0; @@ -1041,7 +1041,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP if (dat) { // set our xStatus TCHAR szBuff[STATUS_TITLE_MAX + STATUS_DESC_MAX]; - DWORD dwBuffSize = GetDlgItemText(hWndDlg, IDC_XMSG, szBuff, STATUS_DESC_MAX + 1); + DWORD dwBuffSize = GetDlgItemText(hWndDlg, IDC_XMSG, szBuff, (STATUS_DESC_MAX + 1)); char szValueName[MAX_PATH]; mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dat->dwXStatus); diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp index d30e207549..9498b1ceca 100644 --- a/protocols/MRA/src/Mra_options.cpp +++ b/protocols/MRA/src/Mra_options.cpp @@ -42,7 +42,7 @@ INT_PTR CALLBACK DlgProcOptsAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA if (GetDlgItemText(hWndDlg, IDC_PASSWORD, szBuff, SIZEOF(szBuff))) { ppro->setTString("Password", szBuff); - SecureZeroMemory(szBuff, SIZEOF(szBuff)); + SecureZeroMemory(szBuff, sizeof(szBuff)); } return TRUE; } diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 9f35d48978..6003c2c5e5 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -174,7 +174,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { HWND tEditField = GetDlgItem(hwndDlg, IDC_MAILER_APP); - GetWindowTextA(tEditField, szFile, sizeof(szFile)); + GetWindowTextA(tEditField, szFile, SIZEOF(szFile)); size_t tSelectLen = 0; @@ -196,7 +196,7 @@ LBL_Continue: OPENFILENAMEA ofn = { 0 }; ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwndDlg; - ofn.nMaxFile = sizeof(szFile); + ofn.nMaxFile = SIZEOF(szFile); ofn.lpstrFile = szFile; ofn.Flags = OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR; if (GetOpenFileNameA(&ofn) != TRUE) @@ -225,14 +225,14 @@ LBL_Continue: CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, sizeof(szEmail)); + GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, SIZEOF(szEmail)); if (strcmp(_strlwr(szEmail), proto->MyOptions.szEmail)) { reconnectRequired = true; strcpy(proto->MyOptions.szEmail, szEmail); proto->setString("e-mail", szEmail); } - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, sizeof(password)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, SIZEOF(password)); if (!proto->getString("Password", &dbv)) { if (strcmp(password, dbv.pszVal)) { reconnectRequired = true; @@ -379,13 +379,13 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - GetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, str, SIZEOF(str)); if (strcmp(str, MSN_DEFAULT_LOGIN_SERVER)) proto->setString("DirectServer", str); else proto->delSetting("DirectServer"); - GetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, str, SIZEOF(str)); if (strcmp(str, MSN_DEFAULT_GATEWAY)) proto->setString("GatewayServer", str); else @@ -406,7 +406,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam proto->setByte("AutoGetHost", (BYTE)gethst); if (gethst == 0) { - GetDlgItemTextA(hwndDlg, IDC_YOURHOST, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_YOURHOST, str, SIZEOF(str)); proto->setString("YourHost", str); } else proto->delSetting("YourHost"); @@ -547,13 +547,13 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); - GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, sizeof(szEmail)); + GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, SIZEOF(szEmail)); if (strcmp(szEmail, proto->MyOptions.szEmail)) { strcpy(proto->MyOptions.szEmail, szEmail); proto->setString("e-mail", szEmail); } - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, sizeof(password)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, SIZEOF(password)); if (!proto->getString("Password", &dbv)) { if (strcmp(password, dbv.pszVal)) proto->setString("Password", password); diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp index b531e58b45..2b42a930af 100644 --- a/protocols/Omegle/src/dialogs.cpp +++ b/protocols/Omegle/src/dialogs.cpp @@ -50,7 +50,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, SIZEOF(tstr)); if ( _tcsclen( tstr ) > 0 ) { db_set_ts(NULL, ppro->m_szModuleName, szSetting, tstr); } else { diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 6037abcc7d..d69db969f9 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -224,7 +224,7 @@ HWND CSametimeProto::SearchAdvanced(HWND owner) { TCHAR buf[512]; int ret = 0; - if (GetDlgItemText(owner, IDC_EDIT1, buf, 512)) { + if (GetDlgItemText(owner, IDC_EDIT1, buf, SIZEOF(buf))) { debugLog(_T("CSametimeProto::SearchAdvanced() buf:len=[%d]"), buf == NULL ? -1 : _tcslen(buf)); char* buf_utf8 = mir_utf8encodeT(buf); ret = SearchForUser(buf_utf8, TRUE); diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp index afbde43ec8..8ed5900f57 100644 --- a/protocols/SkypeClassic/src/skypeapi.cpp +++ b/protocols/SkypeClassic/src/skypeapi.cpp @@ -738,7 +738,7 @@ static INT_PTR CALLBACK DialDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR switch (LOWORD(wParam)) { case IDDIAL: EnableWindow(GetDlgItem(hwndDlg, IDDIAL), FALSE); - GetDlgItemTextA(hwndDlg, IDC_NUMBER, number, sizeof(number)); + GetDlgItemTextA(hwndDlg, IDC_NUMBER, number, SIZEOF(number)); if (!strncmp(number, "00", 2)) { memmove(number, number+1, sizeof(number)-1); number[0]='+'; @@ -834,15 +834,15 @@ static INT_PTR CALLBACK CallstatDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, TranslateDialogDefault(hwndDlg); SendMessage(hwndDlg, WM_COMMAND, IDC_JOIN, 0); - GetWindowTextA(hwndDlg, buf, sizeof(buf)); + GetWindowTextA(hwndDlg, buf, SIZEOF(buf)); _snprintf(buf2, sizeof(buf), buf, CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)lParam,0)); SetWindowTextA(hwndDlg, buf2); - GetDlgItemTextA(hwndDlg, IDC_JOIN, buf, sizeof(buf)); + GetDlgItemTextA(hwndDlg, IDC_JOIN, buf, SIZEOF(buf)); _snprintf(buf2, sizeof(buf), buf, szOtherCaller); SetDlgItemTextA(hwndDlg, IDC_JOIN, buf2); - GetDlgItemTextA(hwndDlg, IDC_HOLD, buf, sizeof(buf)); + GetDlgItemTextA(hwndDlg, IDC_HOLD, buf, SIZEOF(buf)); _snprintf(buf2, sizeof(buf), buf, szOtherCaller); SetDlgItemTextA(hwndDlg, IDC_HOLD, buf2); diff --git a/protocols/SkypeClassic/src/skypeopt.cpp b/protocols/SkypeClassic/src/skypeopt.cpp index 0f2f89a298..f260107b2c 100644 --- a/protocols/SkypeClassic/src/skypeopt.cpp +++ b/protocols/SkypeClassic/src/skypeopt.cpp @@ -396,13 +396,13 @@ INT_PTR CALLBACK OptionsProxyDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA case PSN_KILLACTIVE: { char buf[1024]; - GetDlgItemTextA(hwndDlg, IDC_HOST, buf, sizeof(buf)); + GetDlgItemTextA(hwndDlg, IDC_HOST, buf, SIZEOF(buf)); db_set_s(NULL, SKYPE_PROTONAME, "Host", buf); db_set_w(NULL, SKYPE_PROTONAME, "Port", (unsigned short)GetDlgItemInt(hwndDlg, IDC_PORT, NULL, FALSE)); db_set_b(NULL, SKYPE_PROTONAME, "RequiresPassword", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_REQPASS), BM_GETCHECK,0,0))); db_set_b (NULL, SKYPE_PROTONAME, "UseSkype2Socket", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_USES2S), BM_GETCHECK,0,0))); ZeroMemory(buf, sizeof(buf)); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, buf, sizeof(buf)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, buf, SIZEOF(buf)); db_set_s(NULL, SKYPE_PROTONAME, "Password", buf); return TRUE; } @@ -622,22 +622,22 @@ INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L db_set_b (NULL, SKYPE_PROTONAME, "removable", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_REMOVEABLE), BM_GETCHECK,0,0))); db_set_b (NULL, SKYPE_PROTONAME, "secondary", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_SECONDARY), BM_GETCHECK,0,0))); - GetDlgItemTextA(hwndDlg,IDC_COMMANDLINE,text,sizeof(text)); + GetDlgItemTextA(hwndDlg,IDC_COMMANDLINE,text,SIZEOF(text)); strncpy(szRelativePath, text, sizeof(szRelativePath)-1); CallService (MS_UTILS_PATHTORELATIVE, (WPARAM)text, (LPARAM)szRelativePath); db_set_s(NULL, SKYPE_PROTONAME, "CommandLine", szRelativePath); - GetDlgItemTextA(hwndDlg,IDC_DATAPATH,text,sizeof(text)); + GetDlgItemTextA(hwndDlg,IDC_DATAPATH,text,SIZEOF(text)); strncpy(szRelativePath, text, sizeof(szRelativePath)-1); CallService (MS_UTILS_PATHTORELATIVE, (WPARAM)text, (LPARAM)szRelativePath); db_set_s(NULL, SKYPE_PROTONAME, "datapath", szRelativePath); // LoginUserName - GetDlgItemText(hwndDlg,IDC_USERNAME,wtext,sizeof(wtext)/sizeof(TCHAR)); + GetDlgItemText(hwndDlg,IDC_USERNAME,wtext,SIZEOF(wtext)); db_set_ts(NULL, SKYPE_PROTONAME, "LoginUserName", wtext); // LoginPassword - GetDlgItemText(hwndDlg,IDC_PASSWORD,wtext,sizeof(wtext)/sizeof(TCHAR)); + GetDlgItemText(hwndDlg,IDC_PASSWORD,wtext,SIZEOF(wtext)); db_set_ts(NULL, SKYPE_PROTONAME, "LoginPassword", wtext); return TRUE; @@ -681,12 +681,12 @@ INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L ofn.lStructSize=sizeof(ofn); ofn.hwndOwner=hwndDlg; ofn.lpstrFilter="Executable files (*.exe)\0*.exe\0All files (*.*)\0*.*\0"; - ofn.nMaxFile=sizeof(szFileName); + ofn.nMaxFile=SIZEOF(szFileName); ofn.lpstrDefExt="exe"; ofn.lpstrFile=szFileName; ofn.Flags=OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLESIZING; - GetDlgItemTextA(hwndDlg,IDC_COMMANDLINE,szFileName,sizeof(szFileName)); + GetDlgItemTextA(hwndDlg,IDC_COMMANDLINE,szFileName,SIZEOF(szFileName)); TranslateMirandaRelativePathToAbsolute(szFileName, szAbsolutePath, FALSE); strcpy (szFileName, szAbsolutePath); @@ -707,7 +707,7 @@ INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L { char szFileName[MAX_PATH], szAbsolutePath[MAX_PATH]; - GetDlgItemTextA (hwndDlg, IDC_DATAPATH, szFileName, MAX_PATH); + GetDlgItemTextA (hwndDlg, IDC_DATAPATH, szFileName, SIZEOF(szFileName)); TranslateMirandaRelativePathToAbsolute(szFileName, szAbsolutePath, FALSE); BROWSEINFOA bi={0}; @@ -880,12 +880,12 @@ INT_PTR CALLBACK DetailsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) if ( HIWORD( wParam ) == BN_CLICKED ) { switch( LOWORD( wParam )) { case IDC_SAVEDETAILS: - GetDlgItemText(hwndDlg,IDC_FULLNAME,myProfile.FullName,sizeof(myProfile.FullName)/sizeof(TCHAR)); - GetDlgItemTextA(hwndDlg,IDC_HOMEPAGE,myProfile.HomePage,sizeof(myProfile.HomePage)/sizeof(TCHAR)); - GetDlgItemTextA(hwndDlg,IDC_HOMEPHONE,myProfile.HomePhone,sizeof(myProfile.HomePhone)/sizeof(TCHAR)); - GetDlgItemTextA(hwndDlg,IDC_OFFICEPHONE,myProfile.OfficePhone,sizeof(myProfile.OfficePhone)/sizeof(TCHAR)); - GetDlgItemText(hwndDlg,IDC_CITY,myProfile.City,sizeof(myProfile.City)/sizeof(TCHAR)); - GetDlgItemText(hwndDlg,IDC_PROVINCE,myProfile.Province,sizeof(myProfile.Province)/sizeof(TCHAR)); + GetDlgItemText(hwndDlg,IDC_FULLNAME,myProfile.FullName,SIZEOF(myProfile.FullName)); + GetDlgItemTextA(hwndDlg,IDC_HOMEPAGE,myProfile.HomePage,SIZEOF(myProfile.HomePage)); + GetDlgItemTextA(hwndDlg,IDC_HOMEPHONE,myProfile.HomePhone,SIZEOF(myProfile.HomePhone)); + GetDlgItemTextA(hwndDlg,IDC_OFFICEPHONE,myProfile.OfficePhone,SIZEOF(myProfile.OfficePhone)); + GetDlgItemText(hwndDlg,IDC_CITY,myProfile.City,SIZEOF(myProfile.City)); + GetDlgItemText(hwndDlg,IDC_PROVINCE,myProfile.Province,SIZEOF(myProfile.Province)); sex = SendMessage(GetDlgItem(hwndDlg,IDC_SEX),CB_GETCURSEL,0,0); myProfile.Sex = 0; diff --git a/protocols/Tlen/src/tlen_advsearch.cpp b/protocols/Tlen/src/tlen_advsearch.cpp index 33d7e907a9..1689a93173 100644 --- a/protocols/Tlen/src/tlen_advsearch.cpp +++ b/protocols/Tlen/src/tlen_advsearch.cpp @@ -61,7 +61,7 @@ static void FetchField(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, i if (hwndDlg == NULL || fieldName == NULL || str == NULL || strSize == NULL) return; - GetDlgItemTextA(hwndDlg, idCtrl, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, idCtrl, text, SIZEOF(text)); if (text[0]) { if ((localFieldName=TlenTextEncode(fieldName)) != NULL) { if ((localText=TlenTextEncode(text)) != NULL) { diff --git a/protocols/Tlen/src/tlen_opt.cpp b/protocols/Tlen/src/tlen_opt.cpp index 580de2c3cb..e7e73be5be 100644 --- a/protocols/Tlen/src/tlen_opt.cpp +++ b/protocols/Tlen/src/tlen_opt.cpp @@ -158,7 +158,7 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR bool reconnectRequired = false; DBVARIANT dbv; - GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, SIZEOF(text)); if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) { reconnectRequired = true; } @@ -170,7 +170,7 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text)); if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) { - GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, SIZEOF(text)); if (db_get(NULL, proto->m_szModuleName, "Password", &dbv)) { reconnectRequired = true; } @@ -302,7 +302,7 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara bool reconnectRequired = false; DBVARIANT dbv; - GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, SIZEOF(text)); if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) { reconnectRequired = true; } @@ -314,7 +314,7 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text)); if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) { - GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, SIZEOF(text)); if (db_get(NULL, proto->m_szModuleName, "Password", &dbv)) { reconnectRequired = true; } @@ -527,7 +527,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, bool reconnectRequired = false; DBVARIANT dbv; - GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, SIZEOF(text)); if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) { reconnectRequired = true; } @@ -538,7 +538,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, } db_set_s(NULL, proto->m_szModuleName, "LoginServer", strlwr(text)); - GetDlgItemTextA(hwndDlg, IDC_HOST, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_HOST, text, SIZEOF(text)); if (db_get(NULL, proto->m_szModuleName, "ManualHost", &dbv)) { reconnectRequired = true; } @@ -568,16 +568,16 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, db_set_b(NULL, proto->m_szModuleName, "UseFileProxy", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY)); db_set_w(NULL, proto->m_szModuleName, "FileProxyType", (WORD) SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_GETCURSEL, 0, 0)); - GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, SIZEOF(text)); db_set_s(NULL, proto->m_szModuleName, "FileProxyHost", text); db_set_w(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE)); db_set_b(NULL, proto->m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH)); - GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, SIZEOF(text)); db_set_s(NULL, proto->m_szModuleName, "FileProxyUsername", text); - GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, SIZEOF(text)); db_set_s(NULL, proto->m_szModuleName, "FileProxyPassword", text); if (reconnectRequired && proto->isConnected) diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index 0f4a9f8143..0f634b6cff 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -78,7 +78,7 @@ static INT_PTR CALLBACK TlenPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, onlinePassword, sizeof(onlinePassword)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, onlinePassword, SIZEOF(onlinePassword)); //EndDialog(hwndDlg, (int) onlinePassword); //return TRUE; // Fall through diff --git a/protocols/Tlen/src/tlen_userinfo.cpp b/protocols/Tlen/src/tlen_userinfo.cpp index 108214ebf2..dd927f4806 100644 --- a/protocols/Tlen/src/tlen_userinfo.cpp +++ b/protocols/Tlen/src/tlen_userinfo.cpp @@ -99,7 +99,7 @@ static void FetchField(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, i if (hwndDlg == NULL || fieldName == NULL || str == NULL || strSize == NULL) return; - GetDlgItemTextA(hwndDlg, idCtrl, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, idCtrl, text, SIZEOF(text)); if (text[0]) { if ((localFieldName=TlenTextEncode(fieldName)) != NULL) { if ((localText=TlenTextEncode(text)) != NULL) { diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 0cc3f16297..8b6331a8a7 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -1,107 +1,107 @@ -#include "common.h" - -INT_PTR CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - CToxProto *proto = (CToxProto*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - - switch (uMsg) - { - case WM_INITDIALOG: - TranslateDialogDefault(hwnd); - { - proto = (CToxProto*)lParam; - SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); - - ptrT nick(proto->getTStringA("Nick")); - SetDlgItemText(hwnd, IDC_NAME, nick); - - ptrT pass(proto->getTStringA("Password")); - SetDlgItemText(hwnd, IDC_PASSWORD, pass); - - ptrA address(proto->getStringA(TOX_SETTINGS_ID)); - if (address != NULL) - { - SetDlgItemTextA(hwnd, IDC_TOXID, address); - } - - ptrT group(proto->getTStringA(TOX_SETTINGS_GROUP)); - SetDlgItemText(hwnd, IDC_GROUP, group); - SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, 64, 0); - - CheckDlgButton(hwnd, IDC_DISABLE_UDP, proto->getBool("DisableUDP", 0)); - CheckDlgButton(hwnd, IDC_DISABLE_IPV6, proto->getBool("DisableIPv6", 0)); - } - return TRUE; - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_NAME: - case IDC_GROUP: - case IDC_PASSWORD: - if ((HWND)lParam == GetFocus()) - { - if (HIWORD(wParam) != EN_CHANGE) return 0; - SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); - } - break; - - case IDC_DISABLE_UDP: - case IDC_DISABLE_IPV6: - SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); - break; - } - - case IDC_CLIPBOARD: - { - char toxId[TOX_FRIEND_ADDRESS_SIZE * 2 + 1]; - GetDlgItemTextA(hwnd, IDC_TOXID, toxId, SIZEOF(toxId)); - if (OpenClipboard(GetDlgItem(hwnd, IDC_TOXID))) - { - EmptyClipboard(); - HGLOBAL hMem = GlobalAlloc(GMEM_FIXED, SIZEOF(toxId)); - memcpy(GlobalLock(hMem), toxId, SIZEOF(toxId)); - GlobalUnlock(hMem); - SetClipboardData(CF_TEXT, hMem); - CloseClipboard(); - } - } - break; - } - break; - - case WM_NOTIFY: - if (reinterpret_cast(lParam)->code == PSN_APPLY) - { - TCHAR nick[TOX_MAX_NAME_LENGTH], pass[MAX_PATH]; - GetDlgItemText(hwnd, IDC_NAME, nick, TOX_MAX_NAME_LENGTH); - proto->setTString("Nick", nick); - - GetDlgItemText(hwnd, IDC_PASSWORD, pass, SIZEOF(pass)); - proto->setTString("Password", pass); - - proto->setByte("DisableUDP", (BYTE)IsDlgButtonChecked(hwnd, IDC_DISABLE_UDP)); - proto->setByte("DisableIPv6", (BYTE)IsDlgButtonChecked(hwnd, IDC_DISABLE_IPV6)); - - TCHAR group[64]; - GetDlgItemText(hwnd, IDC_GROUP, group, SIZEOF(group)); - if (_tcslen(group) > 0) - { - proto->setTString(NULL, TOX_SETTINGS_GROUP, group); - Clist_CreateGroup(0, group); - } - else - { - proto->delSetting(NULL, TOX_SETTINGS_GROUP); - } - - proto->SaveToxProfile(); - - return TRUE; - } - break; - } - - return FALSE; +#include "common.h" + +INT_PTR CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + CToxProto *proto = (CToxProto*)GetWindowLongPtr(hwnd, GWLP_USERDATA); + + switch (uMsg) + { + case WM_INITDIALOG: + TranslateDialogDefault(hwnd); + { + proto = (CToxProto*)lParam; + SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); + + ptrT nick(proto->getTStringA("Nick")); + SetDlgItemText(hwnd, IDC_NAME, nick); + + ptrT pass(proto->getTStringA("Password")); + SetDlgItemText(hwnd, IDC_PASSWORD, pass); + + ptrA address(proto->getStringA(TOX_SETTINGS_ID)); + if (address != NULL) + { + SetDlgItemTextA(hwnd, IDC_TOXID, address); + } + + ptrT group(proto->getTStringA(TOX_SETTINGS_GROUP)); + SetDlgItemText(hwnd, IDC_GROUP, group); + SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, 64, 0); + + CheckDlgButton(hwnd, IDC_DISABLE_UDP, proto->getBool("DisableUDP", 0)); + CheckDlgButton(hwnd, IDC_DISABLE_IPV6, proto->getBool("DisableIPv6", 0)); + } + return TRUE; + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDC_NAME: + case IDC_GROUP: + case IDC_PASSWORD: + if ((HWND)lParam == GetFocus()) + { + if (HIWORD(wParam) != EN_CHANGE) return 0; + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); + } + break; + + case IDC_DISABLE_UDP: + case IDC_DISABLE_IPV6: + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); + break; + } + + case IDC_CLIPBOARD: + { + char toxId[TOX_FRIEND_ADDRESS_SIZE * 2 + 1]; + GetDlgItemTextA(hwnd, IDC_TOXID, toxId, SIZEOF(toxId)); + if (OpenClipboard(GetDlgItem(hwnd, IDC_TOXID))) + { + EmptyClipboard(); + HGLOBAL hMem = GlobalAlloc(GMEM_FIXED, sizeof(toxId)); + memcpy(GlobalLock(hMem), toxId, sizeof(toxId)); + GlobalUnlock(hMem); + SetClipboardData(CF_TEXT, hMem); + CloseClipboard(); + } + } + break; + } + break; + + case WM_NOTIFY: + if (reinterpret_cast(lParam)->code == PSN_APPLY) + { + TCHAR nick[TOX_MAX_NAME_LENGTH], pass[MAX_PATH]; + GetDlgItemText(hwnd, IDC_NAME, nick, TOX_MAX_NAME_LENGTH); + proto->setTString("Nick", nick); + + GetDlgItemText(hwnd, IDC_PASSWORD, pass, SIZEOF(pass)); + proto->setTString("Password", pass); + + proto->setByte("DisableUDP", (BYTE)IsDlgButtonChecked(hwnd, IDC_DISABLE_UDP)); + proto->setByte("DisableIPv6", (BYTE)IsDlgButtonChecked(hwnd, IDC_DISABLE_IPV6)); + + TCHAR group[64]; + GetDlgItemText(hwnd, IDC_GROUP, group, SIZEOF(group)); + if (_tcslen(group) > 0) + { + proto->setTString(NULL, TOX_SETTINGS_GROUP, group); + Clist_CreateGroup(0, group); + } + else + { + proto->delSetting(NULL, TOX_SETTINGS_GROUP); + } + + proto->SaveToxProfile(); + + return TRUE; + } + break; + } + + return FALSE; } \ No newline at end of file diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp index 7f9a582836..27ee2f4553 100644 --- a/protocols/Twitter/src/ui.cpp +++ b/protocols/Twitter/src/ui.cpp @@ -81,7 +81,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM char str[128]; TCHAR tstr[128]; - GetDlgItemTextA(hwndDlg, IDC_SERVER, str, sizeof(str) - 1); + GetDlgItemTextA(hwndDlg, IDC_SERVER, str, SIZEOF(str) - 1); if (str[strlen(str) - 1] != '/') strncat(str, "/", sizeof(str)); db_set_s(0, proto->ModuleName(), TWITTER_KEY_BASEURL, str); @@ -225,21 +225,21 @@ INT_PTR CALLBACK options_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar proto = reinterpret_cast(GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); char str[128]; - GetDlgItemTextA(hwndDlg, IDC_UN, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_UN, str, SIZEOF(str)); db_set_s(0, proto->ModuleName(), TWITTER_KEY_UN, str); - /*GetDlgItemTextA(hwndDlg,IDC_PW,str,sizeof(str)); + /*GetDlgItemTextA(hwndDlg,IDC_PW,str,SIZEOF(str)); CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),reinterpret_cast(str)); db_set_s(0,proto->ModuleName(),TWITTER_KEY_PASS,str);*/ - GetDlgItemTextA(hwndDlg, IDC_BASEURL, str, sizeof(str) - 1); + GetDlgItemTextA(hwndDlg, IDC_BASEURL, str, SIZEOF(str) - 1); if (str[strlen(str) - 1] != '/') strncat(str, "/", sizeof(str)); db_set_s(0, proto->ModuleName(), TWITTER_KEY_BASEURL, str); db_set_b(0, proto->ModuleName(), TWITTER_KEY_CHATFEED, IsDlgButtonChecked(hwndDlg, IDC_CHATFEED)); - GetDlgItemTextA(hwndDlg, IDC_POLLRATE, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_POLLRATE, str, SIZEOF(str)); int rate = atoi(str); if (rate == 0) rate = 80; @@ -263,7 +263,7 @@ namespace popup_options return -1; else if (IsDlgButtonChecked(hwndDlg, IDC_TIMEOUT_CUSTOM)) { char str[32]; - GetDlgItemTextA(hwndDlg, IDC_TIMEOUT, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_TIMEOUT, str, SIZEOF(str)); return atoi(str); } else // Default checked (probably) @@ -481,7 +481,7 @@ INT_PTR CALLBACK pin_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) proto = reinterpret_cast(GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); char str[128]; - GetDlgItemTextA(hwndDlg, IDC_PIN, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_PIN, str, SIZEOF(str)); db_set_s(0, proto->ModuleName(), TWITTER_KEY_OAUTH_PIN, str); EndDialog(hwndDlg, wParam); diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index 9392737ecf..06bb5c1371 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -53,9 +53,9 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT message, WPARAM wparam, string password; char cc[5]; - GetDlgItemTextA(hwndDlg, IDC_CC, cc, sizeof(cc)); char number[128]; - GetDlgItemTextA(hwndDlg, IDC_LOGIN, number, sizeof(number)); + GetDlgItemTextA(hwndDlg, IDC_CC, cc, SIZEOF(cc)); + GetDlgItemTextA(hwndDlg, IDC_LOGIN, number, SIZEOF(number)); if (LOWORD(wparam) == IDC_BUTTON_REQUEST_CODE) { if (IDYES == MessageBox(NULL, TranslateT(szAskSendSms), PRODUCT_NAME, MB_YESNO)) { @@ -107,13 +107,13 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT message, WPARAM wparam, proto = reinterpret_cast(GetWindowLongPtr(hwndDlg, GWLP_USERDATA)); char str[128]; - GetDlgItemTextA(hwndDlg, IDC_CC, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_CC, str, SIZEOF(str)); db_set_s(0, proto->ModuleName(), WHATSAPP_KEY_CC, str); - GetDlgItemTextA(hwndDlg, IDC_LOGIN, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_LOGIN, str, SIZEOF(str)); db_set_s(0, proto->ModuleName(), WHATSAPP_KEY_LOGIN, str); - GetDlgItemTextA(hwndDlg, IDC_NICK, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_NICK, str, SIZEOF(str)); db_set_s(0, proto->ModuleName(), WHATSAPP_KEY_NICK, str); db_set_b(0, proto->ModuleName(), WHATSAPP_KEY_SSL, IsDlgButtonChecked(hwndDlg, IDC_SSL)); diff --git a/protocols/Xfire/src/addgamedialog.cpp b/protocols/Xfire/src/addgamedialog.cpp index 26297e3bd6..8791aa76e3 100644 --- a/protocols/Xfire/src/addgamedialog.cpp +++ b/protocols/Xfire/src/addgamedialog.cpp @@ -275,7 +275,7 @@ BOOL OpenFileDialog(HWND hwndDlg, OPENFILENAMEA*ofn, char*exe) { ofn->lStructSize = sizeof(OPENFILENAMEA); ofn->hwndOwner = hwndDlg; ofn->lpstrFile = szFile; - ofn->nMaxFile = sizeof(szFile); + ofn->nMaxFile = SIZEOF(szFile); ofn->lpstrFilter = szFilter; ofn->nFilterIndex = 1; ofn->lpstrFileTitle = exe; @@ -308,7 +308,7 @@ INT_PTR CALLBACK DlgAddGameProc(HWND hwndDlg, { char temp[256]; //eingabe bei der suche auslesen - GetDlgItemTextA(hwndDlg, IDC_SEARCH, temp, 256); + GetDlgItemTextA(hwndDlg, IDC_SEARCH, temp, SIZEOF(temp)); //eingabe in der liste suchen int idx = SendDlgItemMessageA(hwndDlg, IDC_GAMELIST, LB_FINDSTRING, 0, (LPARAM)temp); //gefunden? @@ -628,7 +628,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM newgame = new Xfire_game(); //Spielname - GetDlgItemTextA(hwndDlg, IDC_ADD_NAME, temp, 256); + GetDlgItemTextA(hwndDlg, IDC_ADD_NAME, temp, SIZEOF(temp)); if (!strlen(temp)) { if (!editgame) delete newgame; @@ -643,7 +643,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM } //spielid nur setzen/prüfen, wenn kein editgame if (!editgame) { - GetDlgItemTextA(hwndDlg, IDC_ADD_ID, temp, 256); + GetDlgItemTextA(hwndDlg, IDC_ADD_ID, temp, SIZEOF(temp)); if (!strlen(temp)) { if (!editgame) delete newgame; @@ -671,7 +671,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM } } //zu sendene spielid - GetDlgItemTextA(hwndDlg, IDC_ADD_SENDID, temp, 256); + GetDlgItemTextA(hwndDlg, IDC_ADD_SENDID, temp, SIZEOF(temp)); if (strlen(temp)) { //standardmäßig wird bei einem customeintrag keine id versendet @@ -681,7 +681,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM } //launcher exe - GetDlgItemTextA(hwndDlg, IDC_ADD_LAUNCHEREXE, temp, 256); + GetDlgItemTextA(hwndDlg, IDC_ADD_LAUNCHEREXE, temp, SIZEOF(temp)); if (strlen(temp)) { //lowercase pfad @@ -690,7 +690,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM newgame->setString(temp, &newgame->launchparams); } //detectexe - GetDlgItemTextA(hwndDlg, IDC_ADD_DETECTEXE, temp, 256); + GetDlgItemTextA(hwndDlg, IDC_ADD_DETECTEXE, temp, SIZEOF(temp)); if (!strlen(temp)) { if (!editgame) delete newgame; @@ -708,13 +708,13 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM } //mustcontain parameter - GetDlgItemTextA(hwndDlg, IDC_ADD_CUSTOMPARAMS, temp, 256); + GetDlgItemTextA(hwndDlg, IDC_ADD_CUSTOMPARAMS, temp, SIZEOF(temp)); if (strlen(temp)) { newgame->setString(temp, &newgame->mustcontain); } //statusmsg speichern - GetDlgItemTextA(hwndDlg, IDC_ADD_STATUSMSG, temp, 256); + GetDlgItemTextA(hwndDlg, IDC_ADD_STATUSMSG, temp, SIZEOF(temp)); if (strlen(temp)) { newgame->setString(temp, &newgame->statusmsg); diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp index 056bb7b2cd..e3daffe50d 100644 --- a/protocols/Xfire/src/options.cpp +++ b/protocols/Xfire/src/options.cpp @@ -262,7 +262,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR char str[128]; DBVARIANT dbv; - GetDlgItemTextA(hwndDlg, IDC_LOGIN, login, sizeof(login)); + GetDlgItemTextA(hwndDlg, IDC_LOGIN, login, SIZEOF(login)); dbv.pszVal = NULL; if (db_get(NULL, protocolname, "login", &dbv) || lstrcmpA(login, dbv.pszVal)) reconnectRequired = 1; @@ -287,7 +287,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR db_set_s(NULL, protocolname, "Username", login); //nur wenn der nick erfolgreich übertragen wurde - GetDlgItemTextA(hwndDlg, IDC_NICK, login, sizeof(login)); + GetDlgItemTextA(hwndDlg, IDC_NICK, login, SIZEOF(login)); dbv.pszVal = NULL; if (db_get(NULL, protocolname, "Nick", &dbv) || lstrcmpA(login, dbv.pszVal)) { @@ -297,14 +297,14 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (dbv.pszVal != NULL) db_free(&dbv); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str)); dbv.pszVal = NULL; if (db_get(NULL, protocolname, "password", &dbv) || lstrcmpA(str, dbv.pszVal)) reconnectRequired = 1; if (dbv.pszVal != NULL) db_free(&dbv); db_set_s(NULL, protocolname, "password", str); - GetDlgItemTextA(hwndDlg, IDC_SERVER, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_SERVER, str, SIZEOF(str)); //neue preferencen sichern if (bpStatus != ID_STATUS_OFFLINE&&bpStatus != ID_STATUS_CONNECTING) @@ -331,7 +331,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } //protocolversion wird autoamtisch vergeben - //GetDlgItemTextA(hwndDlg,IDC_PVER,str,sizeof(str)); + //GetDlgItemTextA(hwndDlg,IDC_PVER,str,SIZEOF(str)); //db_set_b(NULL,protocolname,"protover",(char)atoi(str)); if (reconnectRequired) @@ -558,7 +558,7 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR db_set_b(NULL, protocolname, "scanalways", (BYTE)ccc); //protocolversion wird autoamtisch vergeben - //GetDlgItemTextA(hwndDlg,IDC_PVER,str,sizeof(str)); + //GetDlgItemTextA(hwndDlg,IDC_PVER,str,SIZEOF(str)); //db_set_b(NULL,protocolname,"protover",(char)atoi(str)); if (reconnectRequired) MessageBox(hwndDlg, TranslateT("The changes you have made require you to reconnect to the XFire network before they take effect"), TranslateT("XFire Options"), MB_OK | MB_ICONINFORMATION); @@ -739,7 +739,7 @@ static INT_PTR CALLBACK DlgProcOpts5(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int reconnectRequired = 0; char str[512]; - GetDlgItemTextA(hwndDlg, IDC_STATUSMSG, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_STATUSMSG, str, SIZEOF(str)); db_set_s(NULL, protocolname, "setstatusmsg", str); db_set_b(NULL, protocolname, "autosetstatusmsg", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG)); @@ -1053,7 +1053,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //extra parameter auslesen und das gameobj schreiben char str[128] = ""; - GetDlgItemTextA(hwndDlg, IDC_EXTRAPARAMS, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_EXTRAPARAMS, str, SIZEOF(str)); if (str[0] != 0) { //extra parameter sind gesetzt, zuweisen diff --git a/protocols/Xfire/src/passworddialog.cpp b/protocols/Xfire/src/passworddialog.cpp index c395f3f630..f6cdb167c8 100644 --- a/protocols/Xfire/src/passworddialog.cpp +++ b/protocols/Xfire/src/passworddialog.cpp @@ -15,7 +15,7 @@ INT_PTR CALLBACK DlgPWProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { GetDlgItemTextA(hwndDlg, IDC_PWSTRING, (LPSTR)pw, 254); if (usenick) - GetDlgItemTextA(hwndDlg, IDC_PWNICK, (LPSTR)nick, 254); + GetDlgItemTextA(hwndDlg, IDC_PWNICK, (LPSTR)nick, SIZEOF(nick)); EndDialog(hwndDlg, (INT_PTR)pw); break; } diff --git a/protocols/Xfire/src/pwd_dlg.cpp b/protocols/Xfire/src/pwd_dlg.cpp index c9e0316627..dbb8415e80 100644 --- a/protocols/Xfire/src/pwd_dlg.cpp +++ b/protocols/Xfire/src/pwd_dlg.cpp @@ -20,7 +20,7 @@ INT_PTR CALLBACK DlgPwProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { if (LOWORD(wParam) == IDOK) { - GetDlgItemTextA(hwndDlg, IDC_NICKNAME, password, sizeof(password)); + GetDlgItemTextA(hwndDlg, IDC_NICKNAME, password, SIZEOF(password)); EndDialog(hwndDlg, TRUE); return TRUE; } diff --git a/protocols/Xfire/src/setnickname.cpp b/protocols/Xfire/src/setnickname.cpp index 96e69c6276..bfd5d3465a 100644 --- a/protocols/Xfire/src/setnickname.cpp +++ b/protocols/Xfire/src/setnickname.cpp @@ -24,7 +24,7 @@ INT_PTR CALLBACK DlgNickProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara if (LOWORD(wParam) == IDOK) { char nick[255]; - GetDlgItemTextA(hwndDlg, IDC_NICKNAME, nick, sizeof(nick)); + GetDlgItemTextA(hwndDlg, IDC_NICKNAME, nick, SIZEOF(nick)); CallService(XFIRE_SET_NICK, 0, (LPARAM)nick); diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index 7b25099304..9fcd34270a 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -551,7 +551,7 @@ INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDOK: { TCHAR msg[1024]; - GetDlgItemText(hwndDlg, IDC_MSG, msg, sizeof(msg)); + GetDlgItemText(hwndDlg, IDC_MSG, msg, SIZEOF(msg)); HWND hwndList = GetDlgItem(hwndDlg, IDC_CCLIST); YList *who = NULL; diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index 237f5e49ce..36459e2a96 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -97,7 +97,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, bool reconnectRequired = false; char str[128]; - GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, sizeof( str )); + GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, SIZEOF(str)); if (ppro->getString(YAHOO_LOGINID, &dbv)) { reconnectRequired = true; } @@ -108,7 +108,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } ppro->setString( YAHOO_LOGINID, str ); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof( str )); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str)); if (ppro->getString(YAHOO_PASSWORD, &dbv)) { reconnectRequired = true; } @@ -119,7 +119,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } ppro->setString( YAHOO_PASSWORD, str ); - GetDlgItemTextA(hwndDlg, IDC_NICK, str, sizeof( str )); + GetDlgItemTextA(hwndDlg, IDC_NICK, str, SIZEOF(str)); if (str[0] == '\0') { @@ -213,7 +213,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar { bool reconnectRequired = false; char str[128]; - GetDlgItemTextA(hwndDlg, IDC_LOGINSERVER, str, sizeof( str )); + GetDlgItemTextA(hwndDlg, IDC_LOGINSERVER, str, SIZEOF(str)); DBVARIANT dbv; if (ppro->getString(YAHOO_LOGINSERVER, &dbv)) { @@ -303,7 +303,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsIgnore(HWND hwndDlg, UINT msg, WPARAM wP MessageBox(hwndDlg, TranslateT("You need to be connected to Yahoo to add to Ignore List."), TranslateT("Yahoo Ignore"), MB_OK| MB_ICONINFORMATION); else { char id[128]; - int i = GetDlgItemTextA(hwndDlg, IDC_YIGN_EDIT, id, sizeof( id )); + int i = GetDlgItemTextA(hwndDlg, IDC_YIGN_EDIT, id, SIZEOF(id)); if (i < 3) { MessageBox(hwndDlg, TranslateT("Please enter a valid buddy name to ignore."), TranslateT("Yahoo Ignore"), MB_OK| MB_ICONINFORMATION); diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 2d635246bf..d192490718 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -769,7 +769,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM char str[128]; bool reconnectRequired = false; - GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, SIZEOF(str)); if (ppro->getString(YAHOO_LOGINID, &dbv)) { reconnectRequired = true; @@ -781,7 +781,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } ppro->setString(YAHOO_LOGINID, str); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str)); if (ppro->getString(YAHOO_PASSWORD, &dbv)) { reconnectRequired = true; diff --git a/protocols/Yahoo/src/search.cpp b/protocols/Yahoo/src/search.cpp index 2b714bd3dd..065539b674 100644 --- a/protocols/Yahoo/src/search.cpp +++ b/protocols/Yahoo/src/search.cpp @@ -165,7 +165,7 @@ void __cdecl CYahooProto::searchadv_thread(void *pHWND) HWND hwndDlg = (HWND) pHWND; TCHAR searchid[128]; - GetDlgItemText(hwndDlg, IDC_SEARCH_ID, searchid, 128); + GetDlgItemText(hwndDlg, IDC_SEARCH_ID, searchid, SIZEOF(searchid)); if (lstrlen(searchid) == 0) { ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE) 1, 0); diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 5fd99f9c6e..f2b179c870 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -147,7 +147,7 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam CYahooProto* ppro = ( CYahooProto* )GetWindowLongPtr(hwndDlg, GWLP_USERDATA ); /* Get String from dialog */ - GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, sizeof( str )); + GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, SIZEOF(str)); /* Save it for later use */ ppro->setString( YAHOO_CUSTSTATDB, str ); @@ -174,7 +174,7 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam BOOL toSet; - toSet = GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, sizeof( str )) != 0; + toSet = GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, SIZEOF(str)) != 0; EnableWindow( GetDlgItem(hwndDlg, IDOK ), toSet ); } -- cgit v1.2.3