• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revisão8444 (tree)
Hora2019-12-14 00:13:21
Autorzmatsuo

Mensagem de Log

openDirectoryWithExplorer() の引数を char * から wchar_t * に変更

- プロジェクト内から mbstowcs() がなくなった

Mudança Sumário

Diff

--- branches/unicode_buf/teraterm/teraterm/vtwin.cpp (revision 8443)
+++ branches/unicode_buf/teraterm/teraterm/vtwin.cpp (revision 8444)
@@ -5163,38 +5163,29 @@
51635163 // return TRUE: success
51645164 // FALSE: failure
51655165 //
5166-static BOOL openDirectoryWithExplorer(char *path)
5166+static BOOL openDirectoryWithExplorer(const wchar_t *path)
51675167 {
51685168 LPSHELLFOLDER pDesktopFolder;
51695169 LPMALLOC pMalloc;
51705170 LPITEMIDLIST pIDL;
5171- WCHAR pwszDisplayName[1024];
5172- size_t szRet, DisplayNameMax;
51735171 SHELLEXECUTEINFO si;
51745172 BOOL ret = FALSE;
51755173
5176- DisplayNameMax = sizeof(pwszDisplayName) / sizeof(pwszDisplayName[0]);
5177-
51785174 if (SHGetDesktopFolder(&pDesktopFolder) == S_OK) {
51795175 if (SHGetMalloc(&pMalloc) == S_OK) {
5180- szRet = mbstowcs(pwszDisplayName, path, DisplayNameMax - 1);
5181- if (szRet != -1) {
5182- pwszDisplayName[szRet] = L'\0';
5176+ if (pDesktopFolder->ParseDisplayName(NULL, NULL, (LPWSTR)path, NULL, &pIDL, NULL) == S_OK) {
5177+ ::ZeroMemory(&si, sizeof(si));
5178+ si.cbSize = sizeof(si);
5179+ si.fMask = SEE_MASK_IDLIST;
5180+ si.lpVerb = _T("open");
5181+ si.lpIDList = pIDL;
5182+ si.nShow = SW_SHOWNORMAL;
5183+ ::ShellExecuteEx(&si);
5184+ pMalloc->Free((void *)pIDL);
51835185
5184- if (pDesktopFolder->ParseDisplayName(NULL, NULL, pwszDisplayName, NULL, &pIDL, NULL) == S_OK) {
5185- ::ZeroMemory(&si, sizeof(si));
5186- si.cbSize = sizeof(si);
5187- si.fMask = SEE_MASK_IDLIST;
5188- si.lpVerb = _T("open");
5189- si.lpIDList = pIDL;
5190- si.nShow = SW_SHOWNORMAL;
5191- ::ShellExecuteEx(&si);
5192- pMalloc->Free((void*)pIDL);
5186+ ret = TRUE;
5187+ }
51935188
5194- ret = TRUE;
5195- }
5196-
5197- }
51985189 pMalloc->Release();
51995190 }
52005191 pDesktopFolder->Release();
@@ -5203,7 +5194,6 @@
52035194 return (ret);
52045195 }
52055196
5206-
52075197 //
52085198 // フォルダもしくはファイルを開く。
52095199 //
@@ -5210,7 +5200,9 @@
52105200 static void openFileDirectory(char *path, char *filename, BOOL open_directory_only, char *open_editor)
52115201 {
52125202 if (open_directory_only) {
5213- openDirectoryWithExplorer(path);
5203+ wchar_t *pathW = ToWcharA(path);
5204+ openDirectoryWithExplorer(pathW);
5205+ free(pathW);
52145206 }
52155207 else {
52165208 openFileWithApplication(path, filename, open_editor);
Show on old repository browser