• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Tera Termの個人的な作業用リポジトリ


コミットメタ情報

リビジョンad1e59f95aa3605efecdb7039417534608b4ff6c (tree)
日時2019-12-14 00:13:21
作者zmatsuo <zmatsuo@user...>
コミッターzmatsuo

ログメッセージ

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

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

git-svn-id: svn+ssh://svn.osdn.net/svnroot/ttssh2/branches/unicode_buf@8444 f5f01b69-1e22-0410-acbf-894ab4bd6246

変更サマリ

差分

--- a/teraterm/teraterm/vtwin.cpp
+++ b/teraterm/teraterm/vtwin.cpp
@@ -5163,38 +5163,29 @@ error:;
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';
5183-
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);
5193-
5194- ret = TRUE;
5195- }
5196-
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);
5185+
5186+ ret = TRUE;
51975187 }
5188+
51985189 pMalloc->Release();
51995190 }
52005191 pDesktopFolder->Release();
@@ -5203,14 +5194,15 @@ static BOOL openDirectoryWithExplorer(char *path)
52035194 return (ret);
52045195 }
52055196
5206-
52075197 //
52085198 // フォルダもしくはファイルを開く。
52095199 //
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);