Revision: 8542 https://osdn.net/projects/ttssh2/scm/svn/commits/8542 Author: zmatsuo Date: 2020-02-16 23:55:30 +0900 (Sun, 16 Feb 2020) Log Message: ----------- ttxsshの鍵確認ダイアログの文字化けしないようにした - ttxsshのNew connectionダイアログのデザインを修正 - ホスト名のドロップダウンを大きくした - sshバージョンのドロップダウンを大きくした - tcharを使用しない (ttxssh/auth.c) - const static を static const に置き換え - warning: 'static' is not at beginning of declaration [-Wold-style-declaration] Modified Paths: -------------- trunk/ttssh2/ttxssh/auth.c trunk/ttssh2/ttxssh/hosts.c trunk/ttssh2/ttxssh/ttxssh.c trunk/ttssh2/ttxssh/ttxssh.rc -------------- next part -------------- Modified: trunk/ttssh2/ttxssh/auth.c =================================================================== --- trunk/ttssh2/ttxssh/auth.c 2020-02-16 14:55:19 UTC (rev 8541) +++ trunk/ttssh2/ttxssh/auth.c 2020-02-16 14:55:30 UTC (rev 8542) @@ -44,7 +44,6 @@ #endif #include <stdlib.h> #include <crtdbg.h> -#include <tchar.h> #include "resource.h" #include "keyfiles.h" @@ -114,12 +113,12 @@ RECT rect; PTInstVar pvar = data->pvar; UTIL_get_lang_msg("DLG_AUTH_TIP_CONTROL_CODE", pvar, "control character is entered"); - _tcscpy_s(uimsg, _countof(uimsg), pvar->ts->UIMsg); + strcpy_s(uimsg, _countof(uimsg), pvar->ts->UIMsg); if (wParam == 'V' - 'A' + 1) { // CTRL + V - _tcscat_s(uimsg, _countof(uimsg), _T("\n")); + strcat_s(uimsg, _countof(uimsg), "\n"); UTIL_get_lang_msg("DLG_AUTH_TIP_PASTE_KEY", pvar, "Use Shift + Insert to paste from clipboard"); - _tcscat_s(uimsg, _countof(uimsg), pvar->ts->UIMsg); + strcat_s(uimsg, _countof(uimsg), pvar->ts->UIMsg); } GetWindowRect(control, &rect); data->tipwin = TipWinCreateA(hInst, control, rect.left, rect.bottom, uimsg); @@ -1553,7 +1552,7 @@ GetUserName(user_name, &len); GetDlgItemText(dlg, IDC_SSH_WINDOWS_USERNAME_TEXT, uimsg, _countof(uimsg)); - _stprintf_s(uimsg2, _countof(uimsg2), uimsg, user_name); + sprintf_s(uimsg2, _countof(uimsg2), uimsg, user_name); SetDlgItemText(dlg, IDC_SSH_WINDOWS_USERNAME_TEXT, uimsg2); } Modified: trunk/ttssh2/ttxssh/hosts.c =================================================================== --- trunk/ttssh2/ttxssh/hosts.c 2020-02-16 14:55:19 UTC (rev 8541) +++ trunk/ttssh2/ttxssh/hosts.c 2020-02-16 14:55:30 UTC (rev 8542) @@ -54,6 +54,8 @@ #include <direct.h> #include <memory.h> +#include "codeconv.h" +#include "layer_for_unicode.h" #undef DialogBoxParam #define DialogBoxParam(p1,p2,p3,p4,p5) \ @@ -986,24 +988,26 @@ static void init_hosts_dlg(PTInstVar pvar, HWND dlg) { - char buf[1024]; - char buf2[2048]; - int i, j; - int ch; + wchar_t buf[MAX_UIMSG]; + wchar_t buf2[2048]; + size_t i, j; + wchar_t ch; + wchar_t *hostW; // static text\x82\xCC # \x95\x94\x95\xAA\x82\xF0\x83z\x83X\x83g\x96\xBC\x82ɒu\x8A\xB7\x82\xB7\x82\xE9 - GetDlgItemText(dlg, IDC_HOSTWARNING, buf, sizeof(buf)); - for (i = 0; (ch = buf[i]) != 0 && ch != '#'; i++) { + _GetDlgItemTextW(dlg, IDC_HOSTWARNING, buf, sizeof(buf)); + for (i = 0; (ch = buf[i]) != 0 && ch != L'#'; i++) { buf2[i] = ch; } - strncpy_s(buf2 + i, sizeof(buf2) - i, - pvar->hosts_state.prefetched_hostname, _TRUNCATE); - j = i + strlen(buf2 + i); - for (; buf[i] == '#'; i++) { + hostW = ToWcharA(pvar->hosts_state.prefetched_hostname); + wcsncpy_s(buf2 + i, _countof(buf2) - i, hostW, _TRUNCATE); + free(hostW); + j = i + wcslen(buf2 + i); + for (; buf[i] == L'#'; i++) { } - strncpy_s(buf2 + j, sizeof(buf2) - j, buf + i, _TRUNCATE); + wcsncpy_s(buf2 + j, _countof(buf2) - j, buf + i, _TRUNCATE); - SetDlgItemText(dlg, IDC_HOSTWARNING, buf2); + _SetDlgItemTextW(dlg, IDC_HOSTWARNING, buf2); pvar->hFontFixed = UTIL_get_lang_fixedfont(dlg, pvar->ts->UILanguageFile); if (pvar->hFontFixed != NULL) { @@ -1737,7 +1741,7 @@ static INT_PTR CALLBACK hosts_add_dlg_proc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam) { - const static DlgTextInfo text_info[] = { + static const DlgTextInfo text_info[] = { { 0, "DLG_UNKNOWNHOST_TITLE" }, { IDC_HOSTWARNING, "DLG_UNKNOWNHOST_WARNING" }, { IDC_HOSTWARNING2, "DLG_UNKNOWNHOST_WARNING2" }, @@ -1894,7 +1898,7 @@ static INT_PTR CALLBACK hosts_replace_dlg_proc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam) { - const static DlgTextInfo text_info[] = { + static const DlgTextInfo text_info[] = { { 0, "DLG_UNKNOWNHOST_TITLE" }, { IDC_HOSTWARNING, "DLG_DIFFERENTKEY_WARNING" }, { IDC_HOSTWARNING2, "DLG_DIFFERENTKEY_WARNING2" }, @@ -2049,7 +2053,7 @@ static INT_PTR CALLBACK hosts_add2_dlg_proc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam) { - const static DlgTextInfo text_info[] = { + static const DlgTextInfo text_info[] = { { 0, "DLG_DIFFERENTTYPEKEY_TITLE" }, { IDC_HOSTWARNING, "DLG_DIFFERENTTYPEKEY_WARNING" }, { IDC_HOSTWARNING2, "DLG_DIFFERENTTYPEKEY_WARNING2" }, Modified: trunk/ttssh2/ttxssh/ttxssh.c =================================================================== --- trunk/ttssh2/ttxssh/ttxssh.c 2020-02-16 14:55:19 UTC (rev 8541) +++ trunk/ttssh2/ttxssh/ttxssh.c 2020-02-16 14:55:30 UTC (rev 8542) @@ -1294,7 +1294,7 @@ static INT_PTR CALLBACK TTXHostDlg(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam) { - const static DlgTextInfo text_info[] = { + static const DlgTextInfo text_info[] = { { 0, "DLG_HOST_TITLE" }, { IDC_HOSTNAMELABEL, "DLG_HOST_TCPIPHOST" }, { IDC_HISTORY, "DLG_HOST_TCPIPHISTORY" }, @@ -1403,7 +1403,8 @@ j = 0; w = 1; - if ((comports=DetectComPorts(ComPortTable, GetHNRec->MaxComPort, ComPortDesc)) >= 0) { + comports = DetectComPorts(ComPortTable, GetHNRec->MaxComPort, ComPortDesc); + if (comports >= 0) { for (i=0; i<comports; i++) { // MaxComPort \x82\xF0\x89z\x82\xA6\x82\xE9\x83|\x81[\x83g\x82͕\\x8E\xA6\x82\xB5\x82Ȃ\xA2 if (ComPortTable[i] > GetHNRec->MaxComPort) { @@ -1658,7 +1659,8 @@ static BOOL PASCAL TTXGetHostName(HWND parent, PGetHNRec rec) { SetDialogFont(pvar->ts->DialogFontName, pvar->ts->DialogFontPoint, pvar->ts->DialogFontCharSet, - pvar->ts->UILanguageFile, "TTSSH", "DLG_SYSTEM_FONT"); + pvar->ts->UILanguageFile, "TTSSH", "DLG_TAHOMA_FONT"); +// pvar->ts->UILanguageFile, "TTSSH", "DLG_SYSTEM_FONT"); return (BOOL) DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_HOSTDLG), parent, TTXHostDlg, (LPARAM)rec); } @@ -2374,7 +2376,7 @@ static void init_about_dlg(PTInstVar pvar, HWND dlg) { char buf[1024]; - const static DlgTextInfo text_info[] = { + static const DlgTextInfo text_info[] = { { 0, "DLG_ABOUT_TITLE" }, { IDC_FP_HASH_ALG, "DLG_ABOUT_FP_HASH_ALGORITHM" }, { IDOK, "BTN_OK" }, @@ -2627,7 +2629,7 @@ }; wchar_t uimsg[MAX_UIMSG]; - const static DlgTextInfo text_info[] = { + static const DlgTextInfo text_info[] = { { 0, "DLG_SSHSETUP_TITLE" }, { IDC_COMPRESSLABEL, "DLG_SSHSETUP_COMPRESS" }, { IDC_COMPRESSNONE, "DLG_SSHSETUP_COMPRESS_NONE" }, @@ -4168,7 +4170,7 @@ switch (msg) { case WM_INITDIALOG: { - const static DlgTextInfo text_info[] = { + static const DlgTextInfo text_info[] = { { 0, "DLG_KEYGEN_TITLE" }, { IDC_KEYTYPE, "DLG_KEYGEN_KEYTYPE" }, { IDC_KEYBITS_LABEL, "DLG_KEYGEN_BITS" }, Modified: trunk/ttssh2/ttxssh/ttxssh.rc =================================================================== --- trunk/ttssh2/ttxssh/ttxssh.rc 2020-02-16 14:55:19 UTC (rev 8541) +++ trunk/ttssh2/ttxssh/ttxssh.rc 2020-02-16 14:55:30 UTC (rev 8542) @@ -94,7 +94,7 @@ FONT 14, "System", 0, 0, 0x0 BEGIN RTEXT "Hos&t:",IDC_HOSTNAMELABEL,57,10,35,8,NOT WS_GROUP - COMBOBOX IDC_HOSTNAME,95,8,133,54,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_GROUP | WS_TABSTOP + COMBOBOX IDC_HOSTNAME,95,8,133,106,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_GROUP | WS_TABSTOP CONTROL "Hist&ory",IDC_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,95,22,54,8 RTEXT "Service:",IDC_SERVICELABEL,55,34,37,8,NOT WS_GROUP CONTROL "Te&lnet",IDC_HOSTTELNET,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,95,34,44,8 @@ -103,7 +103,7 @@ RTEXT "TCP &port#:",IDC_HOSTTCPPORTLABEL,144,30,51,8,NOT WS_GROUP EDITTEXT IDC_HOSTTCPPORT,198,28,30,12,ES_NUMBER | WS_GROUP RTEXT "SSH &version:",IDC_SSH_VERSION_LABEL,129,46,61,8 - COMBOBOX IDC_SSH_VERSION,193,45,35,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_SSH_VERSION,193,45,35,71,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP RTEXT "IP versio&n:",IDC_HOSTTCPPROTOCOLLABEL,134,63,56,8 COMBOBOX IDC_HOSTTCPPROTOCOL,193,62,35,43,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP RTEXT "Po&rt:",IDC_HOSTCOMLABEL,58,89,34,8,NOT WS_GROUP