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/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 +- 5 files changed, 20 insertions(+), 20 deletions(-) (limited to 'protocols/Xfire') 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); -- cgit v1.2.3