Revision: 10493 https://osdn.net/projects/ttssh2/scm/svn/commits/10493 Author: zmatsuo Date: 2023-01-15 15:31:15 +0900 (Sun, 15 Jan 2023) Log Message: ----------- teraterm/scp.c の引数を wchar_t に変更 - teraterm/ 内は wchar_t で処理 Modified Paths: -------------- trunk/teraterm/teraterm/scp.cpp trunk/teraterm/teraterm/scp.h trunk/teraterm/teraterm/ttdde.c trunk/teraterm/teraterm/vtwin.cpp -------------- next part -------------- Modified: trunk/teraterm/teraterm/scp.cpp =================================================================== --- trunk/teraterm/teraterm/scp.cpp 2023-01-15 06:31:06 UTC (rev 10492) +++ trunk/teraterm/teraterm/scp.cpp 2023-01-15 06:31:15 UTC (rev 10493) @@ -40,6 +40,8 @@ #include <crtdbg.h> #include <windows.h> +#include "codeconv.h" + #include "scp.h" typedef int (CALLBACK *PSSH_start_scp)(char *, char *); @@ -97,8 +99,14 @@ /** * \x83t\x83@\x83C\x83\x8B\x82𑗐M\x82\xB7\x82\xE9 + * @param local \x83\x8D\x81[\x83J\x83\x8B(PC,Windows)\x8F\xE3\x82̃t\x83@\x83C\x83\x8B + * \x83t\x83H\x83\x8B\x83_\x82͎w\x92\xE8\x82ł\xAB\x82Ȃ\xA2 + * @param remote \x83\x8A\x83\x82\x81[\x83g(ssh\x83T\x81[\x83o\x81[)\x8F\xE3\x82̃t\x83H\x83\x8B\x83_ (or \x83t\x83@\x83C\x83\x8B\x96\xBC?) + * L""\x82Ńz\x81[\x83\x80\x83f\x83B\x83\x8C\x83N\x83g\x83\x8A + * @return TRUE ok(\x83\x8A\x83N\x83G\x83X\x83g\x82ł\xAB\x82\xBD) + * @return FALSE ng */ -BOOL ScpSend(const char *local, const char *remote) +BOOL ScpSend(const wchar_t *local, const wchar_t *remote) { if (start_scp == NULL) { ScpInit(); @@ -106,7 +114,11 @@ if (start_scp == NULL) { return FALSE; } - BOOL r = (BOOL)start_scp((char*)local, (char*)remote); + char *localU8 = ToU8W(local); + char *remoteU8 = ToU8W(remote); + BOOL r = (BOOL)start_scp(localU8, remoteU8); + free(localU8); + free(remoteU8); return r; } @@ -130,7 +142,7 @@ /** * \x83t\x83@\x83C\x83\x8B\x82\xF0\x8E\xF3\x90M\x82\xB7\x82\xE9 */ -BOOL ScpReceive(const char *remotefile, const char *localfile) +BOOL ScpReceive(const wchar_t *remotefile, const wchar_t *localfile) { if (receive_file == NULL) { ScpInit(); @@ -138,7 +150,11 @@ if (receive_file == NULL) { return FALSE; } - BOOL r = (BOOL)receive_file((char*)remotefile, (char*)localfile); + char *localU8 = ToU8W(localfile); + char *remoteU8 = ToU8W(remotefile); + BOOL r = (BOOL)receive_file(remoteU8, localU8); + free(localU8); + free(remoteU8); return r; } Modified: trunk/teraterm/teraterm/scp.h =================================================================== --- trunk/teraterm/teraterm/scp.h 2023-01-15 06:31:06 UTC (rev 10492) +++ trunk/teraterm/teraterm/scp.h 2023-01-15 06:31:15 UTC (rev 10493) @@ -32,9 +32,9 @@ extern "C" { #endif -BOOL ScpSend(const char *local, const char *remote); +BOOL ScpSend(const wchar_t *local, const wchar_t *remote); BOOL ScpGetStatus(void); -BOOL ScpReceive(const char *remotefile, const char *localfile); +BOOL ScpReceive(const wchar_t *remotefile, const wchar_t *localfile); BOOL TTXSSHGetKnownHostsFileName(wchar_t **filename); #ifdef __cplusplus Modified: trunk/teraterm/teraterm/ttdde.c =================================================================== --- trunk/teraterm/teraterm/ttdde.c 2023-01-15 06:31:06 UTC (rev 10492) +++ trunk/teraterm/teraterm/ttdde.c 2023-01-15 06:31:15 UTC (rev 10493) @@ -772,7 +772,12 @@ case CmdScpSend: // add 'scpsend' (2008.1.1 yutaka) { - if (ScpSend(ParamFileName, ParamSecondFileName) == FALSE) { + wchar_t *ParamFileNameW = ToWcharU8(ParamFileName); + wchar_t *ParamSecondFileNameW = ToWcharU8(ParamSecondFileName); + BOOL r = ScpSend(ParamFileNameW, ParamSecondFileNameW); + free(ParamFileNameW); + free(ParamSecondFileNameW); + if (r == FALSE) { const char *msg = "ttxssh.dll not support scp"; MessageBox(NULL, msg, "Tera Term: scprecv command error", MB_OK | MB_ICONERROR); return DDE_FNOTPROCESSED; @@ -782,7 +787,12 @@ case CmdScpRcv: { - if (ScpReceive(ParamFileName, ParamSecondFileName) == FALSE) { + wchar_t *ParamFileNameW = ToWcharU8(ParamFileName); + wchar_t *ParamSecondFileNameW = ToWcharU8(ParamSecondFileName); + BOOL r = ScpReceive(ParamFileNameW, ParamSecondFileNameW); + free(ParamFileNameW); + free(ParamSecondFileNameW); + if (r == FALSE) { const char *msg = "ttxssh.dll not support scp"; MessageBox(NULL, msg, "Tera Term: scpsend command error", MB_OK | MB_ICONERROR); return DDE_FNOTPROCESSED; Modified: trunk/teraterm/teraterm/vtwin.cpp =================================================================== --- trunk/teraterm/teraterm/vtwin.cpp 2023-01-15 06:31:06 UTC (rev 10492) +++ trunk/teraterm/teraterm/vtwin.cpp 2023-01-15 06:31:15 UTC (rev 10493) @@ -1528,29 +1528,6 @@ return tmpbuf; } -/* \x93\xFC\x97͂̓t\x83@\x83C\x83\x8B\x82̂\xDD(\x83t\x83H\x83\x8B\x83_\x82͊܂܂\xEA\x82Ȃ\xA2) */ -/** - * SCP\x82Ńt\x83@\x83C\x83\x8B\x82𑗂\xE9 - * @param Filenames \x83t\x83@\x83C\x83\x8B\x96\xBC(\x95\xA1\x90\x94) - * \x83t\x83H\x83\x8B\x83_\x82͑\x97\x82\xEA\x82Ȃ\xA2,\x83t\x83@\x83C\x83\x8B\x82̂\xDD - * @param FileCount \x83t\x83@\x83C\x83\x8B\x90\x94(\x8C\xBB\x8D݂\xCD1\x88ȊO\x82͎g\x82\xA6\x82Ȃ\xA2) - * @param SendDir \x91\x97\x90M\x83t\x83H\x83\x8B\x83_ - * - */ -static bool SendScp(wchar_t *Filenames[], int FileCount, const char *SendDir) -{ - for (int i = 0; i < FileCount; i++) { - char *FileName = ToU8W(Filenames[i]); - BOOL r = ScpSend(FileName, ts.ScpSendDir); - free(FileName); - if (r == FALSE) { - ::MessageBoxA(HVTWin, "scp send error", "Tera Term: error", MB_OK | MB_ICONERROR); - return false; - } - } - return true; -} - void CVTWindow::DropListFree() { if (DropListCount > 0) { @@ -1813,10 +1790,13 @@ case DROP_TYPE_SCP: { // send by scp - wchar_t **FileNames = &DropLists[i]; - int FileCount = 1; - if (!SendScp(FileNames, FileCount, ts.ScpSendDir)) { + const wchar_t *FileName = DropLists[i]; + wchar_t *SendDirW = ToWcharA(ts.ScpSendDir); + BOOL r = ScpSend(FileName, SendDirW); + free(SendDirW); + if (!r) { // \x91\x97\x90M\x83G\x83\x89\x81[ + ::MessageBoxA(HVTWin, "scp send error", "Tera Term: error", MB_OK | MB_ICONERROR); goto finish; }