Revision: 9726 https://osdn.net/projects/ttssh2/scm/svn/commits/9726 Author: nmaya Date: 2022-02-06 13:16:30 +0900 (Sun, 06 Feb 2022) Log Message: ----------- r9715 の修正を、変換が少なくなるように微調整 Revision Links: -------------- https://osdn.net/projects/ttssh2/scm/svn/commits/9715 Modified Paths: -------------- trunk/ttssh2/ttxssh/ssh.c -------------- next part -------------- Modified: trunk/ttssh2/ttxssh/ssh.c =================================================================== --- trunk/ttssh2/ttxssh/ssh.c 2022-02-05 17:46:17 UTC (rev 9725) +++ trunk/ttssh2/ttxssh/ssh.c 2022-02-06 04:16:30 UTC (rev 9726) @@ -449,9 +449,9 @@ // (2005.3.7 yutaka) // #define MEMTAG_MAX 300 -#define LOGDUMP "ssh2connect.log" -#define LOG_PACKET_DUMP "ssh2packet.log" -#define SENDTOME "Please send '"LOGDUMP"' file to Tera Term developer team." +#define LOGDUMP L"ssh2connect.log" +#define LOG_PACKET_DUMP L"ssh2packet.log" +#define SENDTOME L"Please send '" LOGDUMP L"' file to Tera Term developer team." typedef struct memtag { char *name; @@ -562,22 +562,16 @@ memtag_count = 0; } -void save_memdump(char *filename) +void save_memdump(wchar_t *filename) { FILE *fp; int i; time_t t; struct tm *tm; - wchar_t *filenameW = NULL; - wchar_t *dumpfileW = NULL; - char *dumpfile = NULL; + wchar_t *dumpfile = NULL; - filenameW = ToWcharA(filename); - dumpfileW = get_log_dir_relative_nameW(filenameW); - dumpfile = ToCharW(dumpfileW); - fp = fopen(dumpfile, "w"); - free(filenameW); - free(dumpfileW); + dumpfile = get_log_dir_relative_nameW(filename); + _wfopen_s(&fp, dumpfile, L"w"); free(dumpfile); if (fp == NULL) return; @@ -5466,7 +5460,10 @@ } } else { - _snprintf_s(emsg, sizeof(emsg), _TRUNCATE, "%s: key verify error (%d)\r\n%s", __FUNCTION__, ret, SENDTOME); + char *buf = NULL; + buf = ToCharW(SENDTOME); + _snprintf_s(emsg, sizeof(emsg), _TRUNCATE, "%s: key verify error (%d)\r\n%s", __FUNCTION__, ret, buf); + free(buf); } save_memdump(LOGDUMP);