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 /plugins/New_GPG | |
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 'plugins/New_GPG')
-rwxr-xr-x | plugins/New_GPG/src/main.cpp | 18 | ||||
-rwxr-xr-x | plugins/New_GPG/src/messages.cpp | 2 | ||||
-rwxr-xr-x | plugins/New_GPG/src/options.cpp | 14 | ||||
-rwxr-xr-x | plugins/New_GPG/src/utilities.cpp | 6 |
4 files changed, 20 insertions, 20 deletions
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 97ba1eabe9..de39d4a36e 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -322,7 +322,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR boost::algorithm::erase_all(out, "\r"); { char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf)); if(!strcmp(buf, Translate("Default"))) { db_set_s(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); @@ -351,7 +351,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR } } TCHAR passwd[64]; - GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, passwd, 64); + GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, passwd, SIZEOF(passwd)); if(passwd[0]) { string dbsetting = "szKey_"; @@ -497,7 +497,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR } { char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf)); if(!strcmp(buf, Translate("Default"))) { db_unset(NULL, szGPGModuleName, "GPGPubKey"); @@ -625,7 +625,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR } { char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf)); if(!strcmp(buf, Translate("Default"))) { db_set_s(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); @@ -650,7 +650,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR case IDC_ACCOUNT: { char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf)); if(!strcmp(buf, Translate("Default"))) { string keyinfo = Translate("key ID"); @@ -1002,7 +1002,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case ID_OK: { TCHAR tmp[512]; - GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, 512); + GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, SIZEOF(tmp)); if(tmp[0]) { char *mir_path = new char [MAX_PATH]; @@ -1052,7 +1052,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, MessageBox(0, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended to use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK); } db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); - GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512); + GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, SIZEOF(tmp)); while(tmp[_tcslen(tmp)-1] == '\\') tmp[_tcslen(tmp)-1] = '\0'; if(!tmp[0]) @@ -1080,7 +1080,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_GENERATE_RANDOM: { TCHAR tmp[512]; - GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, 512); + GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, SIZEOF(tmp)); if(tmp[0]) { char *mir_path = new char [MAX_PATH]; @@ -1130,7 +1130,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, MessageBox(0, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended to use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK); } db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); - GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512); + GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, SIZEOF(tmp)); while(tmp[_tcslen(tmp)-1] == '\\') tmp[_tcslen(tmp)-1] = '\0'; if(!tmp[0]) diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index fbc4f428ed..d1cae49e04 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -998,7 +998,7 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam case IDOK: { TCHAR tmp[64]; - GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, tmp, 64); + GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, tmp, SIZEOF(tmp)); if(tmp[0]) { extern TCHAR *password; diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index 8490ca1fd1..039d91cc35 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -437,7 +437,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange") != 0;
{
TCHAR tmp[512];
- GetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp, 512);
+ GetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp, SIZEOF(tmp));
db_set_ts(NULL, szGPGModuleName, "szLogFilePath", tmp);
}
return TRUE;
@@ -566,9 +566,9 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case PSN_APPLY:
{
TCHAR tmp[512];
- GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, 512);
+ GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, SIZEOF(tmp));
db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
- GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512);
+ GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, SIZEOF(tmp));
while(tmp[_tcslen(tmp)-1] == '\\')
tmp[_tcslen(tmp)-1] = '\0';
db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp);
@@ -633,22 +633,22 @@ static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, bStripTags = CheckStateStoreDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags") != 0;
{
TCHAR tmp[128];
- GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, 128);
+ GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, SIZEOF(tmp));
db_set_ts(NULL, szGPGModuleName, "szInOpenTag", tmp);
mir_free(inopentag);
inopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1));
_tcscpy(inopentag, tmp);
- GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, 128);
+ GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, SIZEOF(tmp));
db_set_ts(NULL, szGPGModuleName, "szInCloseTag", tmp);
mir_free(inclosetag);
inclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1));
_tcscpy(inclosetag, tmp);
- GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, 128);
+ GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, SIZEOF(tmp));
db_set_ts(NULL, szGPGModuleName, "szOutOpenTag", tmp);
mir_free(outopentag);
outopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1));
_tcscpy(outopentag, tmp);
- GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, 128);
+ GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, SIZEOF(tmp));
db_set_ts(NULL, szGPGModuleName, "szOutCloseTag", tmp);
mir_free(outclosetag);
outclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(tmp)+1));
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index ece1904580..1474502e35 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -2084,16 +2084,16 @@ static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wPara std::string old_pass, new_pass; extern TCHAR key_id_global[17]; TCHAR buf[256] = {0}; - GetDlgItemText(hwndDlg, IDC_NEW_PASSWD1, buf, 255); + GetDlgItemText(hwndDlg, IDC_NEW_PASSWD1, buf, SIZEOF(buf)); new_pass = toUTF8(buf); - GetDlgItemText(hwndDlg, IDC_NEW_PASSWD2, buf, 255); + GetDlgItemText(hwndDlg, IDC_NEW_PASSWD2, buf, SIZEOF(buf)); if(new_pass != toUTF8(buf)) { MessageBox(hwndDlg, TranslateT("New passwords do not match"), TranslateT("Error"), MB_OK); //key_id_global[0] = 0; break; } - GetDlgItemText(hwndDlg, IDC_OLD_PASSWD, buf, 255); + GetDlgItemText(hwndDlg, IDC_OLD_PASSWD, buf, SIZEOF(buf)); old_pass = toUTF8(buf); bool old_pass_match = false; TCHAR *pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); |