diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-19 19:35:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-19 19:35:42 +0000 |
commit | 4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch) | |
tree | 9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /plugins/New_GPG/src | |
parent | f0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (diff) |
SIZEOF replaced with more secure analog - _countof
git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/New_GPG/src')
-rw-r--r-- | plugins/New_GPG/src/icons.cpp | 2 | ||||
-rwxr-xr-x | plugins/New_GPG/src/main.cpp | 46 | ||||
-rwxr-xr-x | plugins/New_GPG/src/messages.cpp | 2 | ||||
-rwxr-xr-x | plugins/New_GPG/src/options.cpp | 24 | ||||
-rwxr-xr-x | plugins/New_GPG/src/utilities.cpp | 24 |
5 files changed, 49 insertions, 49 deletions
diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp index c474f0df33..d5206f3858 100644 --- a/plugins/New_GPG/src/icons.cpp +++ b/plugins/New_GPG/src/icons.cpp @@ -26,7 +26,7 @@ static IconItem iconList[] = void InitIconLib()
{
- Icon_Register(hInst, szGPGModuleName, iconList, SIZEOF(iconList));
+ Icon_Register(hInst, szGPGModuleName, iconList, _countof(iconList));
}
HANDLE IconLibHookIconsChanged(MIRANDAHOOK hook)
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 9275f0d0e2..6f64c97c5e 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -288,7 +288,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR break; case ID_OK: { - ListView_GetItemText(hwndList, itemnum, 0, fp, SIZEOF(fp)); + ListView_GetItemText(hwndList, itemnum, 0, fp, _countof(fp)); TCHAR *name = new TCHAR [64]; ListView_GetItemText(hwndList, itemnum, 2, name, 64); { @@ -321,7 +321,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, SIZEOF(buf)); + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, _countof(buf)); if(!mir_strcmp(buf, Translate("Default"))) { db_set_s(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); @@ -350,7 +350,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR } } TCHAR passwd[64]; - GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, passwd, SIZEOF(passwd)); + GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, passwd, _countof(passwd)); if(passwd[0]) { string dbsetting = "szKey_"; @@ -448,7 +448,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR } break; case IDC_DELETE_KEY: - ListView_GetItemText(hwndList, itemnum, 0, fp, SIZEOF(fp)); + ListView_GetItemText(hwndList, itemnum, 0, fp, _countof(fp)); { string out; DWORD code; @@ -496,7 +496,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR } { char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf)); + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, _countof(buf)); if(!mir_strcmp(buf, Translate("Default"))) { db_unset(NULL, szGPGModuleName, "GPGPubKey"); @@ -624,7 +624,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR } { char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf)); + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, _countof(buf)); if(!mir_strcmp(buf, Translate("Default"))) { db_set_s(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); @@ -649,7 +649,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR case IDC_ACCOUNT: { char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf)); + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, _countof(buf)); if(!mir_strcmp(buf, Translate("Default"))) { string keyinfo = Translate("key ID"); @@ -676,7 +676,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR { if(OpenClipboard(hwndDlg)) { - ListView_GetItemText(hwndList, itemnum, 0, fp, SIZEOF(fp)); + ListView_GetItemText(hwndList, itemnum, 0, fp, _countof(fp)); string out; DWORD code; std::vector<wstring> cmd; @@ -706,7 +706,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR if(!szKey) { TCHAR msg[64]; - mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to lock memory with error %d"), GetLastError()); + mir_sntprintf(msg, _countof(msg), TranslateT("Failed to lock memory with error %d"), GetLastError()); MessageBox(0, msg, TranslateT("Error"), MB_OK); GlobalFree(hMem); } @@ -718,7 +718,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR { GlobalFree(hMem); TCHAR msg[64]; - mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed write to clipboard with error %d"), GetLastError()); + mir_sntprintf(msg, _countof(msg), TranslateT("Failed write to clipboard with error %d"), GetLastError()); MessageBox(0, msg, TranslateT("Error"), MB_OK); } CloseClipboard(); @@ -741,7 +741,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR mir_free(path); if(!file.is_open()) break; //TODO: handle error - ListView_GetItemText(hwndList, itemnum, 0, fp, SIZEOF(fp)); + ListView_GetItemText(hwndList, itemnum, 0, fp, _countof(fp)); string out; DWORD code; std::vector<wstring> cmd; @@ -767,7 +767,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR } break; case IDC_CHANGE_PASSWD: - ListView_GetItemText(hwndList, itemnum, 0, key_id_global, SIZEOF(key_id_global)); + ListView_GetItemText(hwndList, itemnum, 0, key_id_global, _countof(key_id_global)); // extern void ShowChangePasswdDlg(); // ShowChangePasswdDlg(); //temporary code follows @@ -1001,7 +1001,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case ID_OK: { TCHAR tmp[512]; - GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, SIZEOF(tmp)); + GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, _countof(tmp)); if(tmp[0]) { char *mir_path = new char [MAX_PATH]; @@ -1051,7 +1051,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 that you 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, SIZEOF(tmp)); + GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, _countof(tmp)); while(tmp[mir_tstrlen(tmp)-1] == '\\') tmp[mir_tstrlen(tmp)-1] = '\0'; if(!tmp[0]) @@ -1079,7 +1079,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, SIZEOF(tmp)); + GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, _countof(tmp)); if(tmp[0]) { char *mir_path = new char [MAX_PATH]; @@ -1129,7 +1129,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 that you 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, SIZEOF(tmp)); + GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, _countof(tmp)); while(tmp[mir_tstrlen(tmp)-1] == '\\') tmp[mir_tstrlen(tmp)-1] = '\0'; if(!tmp[0]) @@ -1803,7 +1803,7 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wPar { case IDOK: { - ListView_GetItemText(hwndList, itemnum2, 0, id, SIZEOF(id)); + ListView_GetItemText(hwndList, itemnum2, 0, id, _countof(id)); extern HWND hPubKeyEdit; string out; DWORD code; @@ -2050,11 +2050,11 @@ void InitCheck() if(!home_dir_access || !temp_access || !gpg_valid) { TCHAR buf[4096]; - _tcsncpy(buf, gpg_valid?TranslateT("GPG binary is set and valid (this is good).\n"):TranslateT("GPG binary unset or invalid (plugin will not work).\n"), SIZEOF(buf)); - mir_tstrncat(buf, home_dir_access?TranslateT("Home dir write access granted (this is good).\n"):TranslateT("Home dir has no write access (plugin most probably will not work).\n"), SIZEOF(buf) - mir_tstrlen(buf)); - mir_tstrncat(buf, temp_access?TranslateT("Temp dir write access granted (this is good).\n"):TranslateT("Temp dir has no write access (plugin should work, but may have some problems, file transfers will not work)."), SIZEOF(buf) - mir_tstrlen(buf)); + _tcsncpy(buf, gpg_valid?TranslateT("GPG binary is set and valid (this is good).\n"):TranslateT("GPG binary unset or invalid (plugin will not work).\n"), _countof(buf)); + mir_tstrncat(buf, home_dir_access?TranslateT("Home dir write access granted (this is good).\n"):TranslateT("Home dir has no write access (plugin most probably will not work).\n"), _countof(buf) - mir_tstrlen(buf)); + mir_tstrncat(buf, temp_access?TranslateT("Temp dir write access granted (this is good).\n"):TranslateT("Temp dir has no write access (plugin should work, but may have some problems, file transfers will not work)."), _countof(buf) - mir_tstrlen(buf)); if(!gpg_valid) - mir_tstrncat(buf, TranslateT("\nGPG will be disabled until you solve these problems"), SIZEOF(buf) - mir_tstrlen(buf)); + mir_tstrncat(buf, TranslateT("\nGPG will be disabled until you solve these problems"), _countof(buf) - mir_tstrlen(buf)); MessageBox(0, buf, TranslateT("GPG plugin problems"), MB_OK); } if(!gpg_valid) @@ -2304,8 +2304,8 @@ void ImportKey() ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); _tcsncpy(tmp2, ptmp, MAX_PATH-1); mir_free(ptmp); - mir_tstrncat(tmp2, _T("\\"), SIZEOF(tmp2) - mir_tstrlen(tmp2)); - mir_tstrncat(tmp2, _T("temporary_exported.asc"), SIZEOF(tmp2) - mir_tstrlen(tmp2)); + mir_tstrncat(tmp2, _T("\\"), _countof(tmp2) - mir_tstrlen(tmp2)); + mir_tstrncat(tmp2, _T("temporary_exported.asc"), _countof(tmp2) - mir_tstrlen(tmp2)); boost::filesystem::remove(tmp2); wfstream f(tmp2, std::ios::out); if(db_mc_isMeta(hContact)) diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index 2fe285c330..384f1d7fb1 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -957,7 +957,7 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam case IDOK: { TCHAR tmp[64]; - GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, tmp, SIZEOF(tmp)); + GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, tmp, _countof(tmp)); if(tmp[0]) { extern TCHAR *password; diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index 3973d1cd39..68d705f19c 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -356,7 +356,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if(!szKey)
{
TCHAR msg[64];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to lock memory with error %d"), GetLastError());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Failed to lock memory with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
GlobalFree(hMem);
}
@@ -370,7 +370,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
GlobalFree(hMem);
TCHAR msg[64];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed write to clipboard with error %d"), GetLastError());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Failed write to clipboard with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
}
CloseClipboard();
@@ -379,7 +379,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else
{
TCHAR msg[64];
- mir_sntprintf(msg, SIZEOF(msg), TranslateT("Failed to open clipboard with error %d"), GetLastError());
+ mir_sntprintf(msg, _countof(msg), TranslateT("Failed to open clipboard with error %d"), GetLastError());
MessageBox(0, msg, TranslateT("Error"), MB_OK);
}
}
@@ -439,7 +439,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, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szLogFilePath", tmp);
}
return TRUE;
@@ -568,9 +568,9 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case PSN_APPLY:
{
TCHAR tmp[512];
- GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
- GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, _countof(tmp));
while(tmp[mir_tstrlen(tmp)-1] == '\\')
tmp[mir_tstrlen(tmp)-1] = '\0';
db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp);
@@ -635,22 +635,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, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szInOpenTag", tmp);
mir_free(inopentag);
inopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (mir_tstrlen(tmp)+1));
mir_tstrcpy(inopentag, tmp);
- GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szInCloseTag", tmp);
mir_free(inclosetag);
inclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (mir_tstrlen(tmp)+1));
mir_tstrcpy(inclosetag, tmp);
- GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szOutOpenTag", tmp);
mir_free(outopentag);
outopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (mir_tstrlen(tmp)+1));
mir_tstrcpy(outopentag, tmp);
- GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, SIZEOF(tmp));
+ GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, _countof(tmp));
db_set_ts(NULL, szGPGModuleName, "szOutCloseTag", tmp);
mir_free(outclosetag);
outclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)*(mir_tstrlen(tmp)+1));
@@ -905,8 +905,8 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
_tcsncpy(tmp2, ptmp, MAX_PATH-1);
mir_free(ptmp);
- mir_tstrncat(tmp2, _T("\\"), SIZEOF(tmp2) - mir_tstrlen(tmp2));
- mir_tstrncat(tmp2, _T("temporary_exported.asc"), SIZEOF(tmp2) - mir_tstrlen(tmp2));
+ mir_tstrncat(tmp2, _T("\\"), _countof(tmp2) - mir_tstrlen(tmp2));
+ mir_tstrncat(tmp2, _T("temporary_exported.asc"), _countof(tmp2) - mir_tstrlen(tmp2));
boost::filesystem::remove(tmp2);
wfstream f(tmp2, std::ios::out);
ptmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T(""));
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 34728486b2..711fbadf95 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -61,14 +61,14 @@ void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szEx ofn.lStructSize=CDSIZEOF_STRUCT(OPENFILENAME,lpTemplateName); ofn.Flags=OFN_EXPLORER; ofn.lpstrTitle=TranslateW(WindowTittle); - _tcsncpy(filter,TranslateW(szExtDesc), SIZEOF(filter)-1); + _tcsncpy(filter,TranslateW(szExtDesc), _countof(filter)-1); pfilter=filter+mir_tstrlen(filter)+1; mir_tstrcpy(pfilter, szExt); pfilter[mir_tstrlen(pfilter)+1] = '\0'; pfilter[mir_tstrlen(pfilter)+2] = '\0'; ofn.lpstrFilter=filter; tmp = UniGetContactSettingUtf(0, szGPGModuleName, szSetting, _T("")); - _tcsncpy(str, tmp, SIZEOF(str)-1); + _tcsncpy(str, tmp, _countof(str)-1); mir_free(tmp); if(mir_tstrlen(str)< 2) str[0] = '\0'; @@ -1541,11 +1541,11 @@ void ExportGpGKeysFunc(int type) file.close(); TCHAR msg[512]; if(type == 2) - mir_sntprintf(msg, SIZEOF(msg), TranslateT("We have successfully exported %d public keys and all private keys."), exported_keys); + mir_sntprintf(msg, _countof(msg), TranslateT("We have successfully exported %d public keys and all private keys."), exported_keys); else if(type == 1) - mir_sntprintf(msg, SIZEOF(msg), TranslateT("We have successfully exported all private keys.")); + mir_sntprintf(msg, _countof(msg), TranslateT("We have successfully exported all private keys.")); else if(!type) - mir_sntprintf(msg, SIZEOF(msg), TranslateT("We have successfully exported %d public keys."), exported_keys); + mir_sntprintf(msg, _countof(msg), TranslateT("We have successfully exported %d public keys."), exported_keys); MessageBox(NULL, msg, TranslateT("Keys export result"), MB_OK); } @@ -1862,8 +1862,8 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); _tcsncpy(tmp2, ptmp, MAX_PATH-1); mir_free(ptmp); - mir_tstrncat(tmp2, _T("\\"), SIZEOF(tmp2) - mir_tstrlen(tmp2)); - mir_tstrncat(tmp2, _T("temporary_exported.asc"), SIZEOF(tmp2) - mir_tstrlen(tmp2)); + mir_tstrncat(tmp2, _T("\\"), _countof(tmp2) - mir_tstrlen(tmp2)); + mir_tstrncat(tmp2, _T("temporary_exported.asc"), _countof(tmp2) - mir_tstrlen(tmp2)); boost::filesystem::remove(tmp2); wfstream f(tmp2, std::ios::out); f<<toUTF16(key).c_str(); @@ -1890,9 +1890,9 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) file.close(); TCHAR msg[512]; if(processed_private_keys) - mir_sntprintf(msg, SIZEOF(msg), TranslateT("We have successfully processed %d public keys and some private keys."), processed_keys); + mir_sntprintf(msg, _countof(msg), TranslateT("We have successfully processed %d public keys and some private keys."), processed_keys); else - mir_sntprintf(msg, SIZEOF(msg), TranslateT("We have successfully processed %d public keys."), processed_keys); + mir_sntprintf(msg, _countof(msg), TranslateT("We have successfully processed %d public keys."), processed_keys); MessageBox(NULL, msg, TranslateT("Keys import result"), MB_OK); return 0; } @@ -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, SIZEOF(buf)); + GetDlgItemText(hwndDlg, IDC_NEW_PASSWD1, buf, _countof(buf)); new_pass = toUTF8(buf); - GetDlgItemText(hwndDlg, IDC_NEW_PASSWD2, buf, SIZEOF(buf)); + GetDlgItemText(hwndDlg, IDC_NEW_PASSWD2, buf, _countof(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, SIZEOF(buf)); + GetDlgItemText(hwndDlg, IDC_OLD_PASSWD, buf, _countof(buf)); old_pass = toUTF8(buf); bool old_pass_match = false; TCHAR *pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); |