• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision9292 (tree)
Time2021-05-28 00:42:20
Authorzmatsuo

Log Message

TCHAR を wchar_t(Unicode)へ変更

- 特に設定していないので、TCHAR = char

- ANSI(非Unicode)としてコンパイルされていた

Change Summary

Incremental Difference

--- trunk/TTXSamples/TTXCheckUpdate/parse.cpp (revision 9291)
+++ trunk/TTXSamples/TTXCheckUpdate/parse.cpp (revision 9292)
@@ -2,6 +2,7 @@
22 #define _CRTDBG_MAP_ALLOC
33 #include <stdlib.h>
44 #include <crtdbg.h>
5+#include <string.h>
56
67 #include "cJSON.h"
78
--- trunk/teraterm/common/dlglib.c (revision 9291)
+++ trunk/teraterm/common/dlglib.c (revision 9292)
@@ -110,11 +110,11 @@
110110
111111 void SetDlgNum(HWND HDlg, int id_Item, LONG Num)
112112 {
113- TCHAR Temp[16];
113+ wchar_t Temp[16];
114114
115115 /* In Win16, SetDlgItemInt can not be used to display long integer. */
116- _sntprintf_s(Temp, _countof(Temp), _TRUNCATE, _T("%d"), Num);
117- SetDlgItemText(HDlg,id_Item,Temp);
116+ _snwprintf_s(Temp, _countof(Temp), _TRUNCATE, L"%d", Num);
117+ SetDlgItemTextW(HDlg,id_Item,Temp);
118118 }
119119
120120 void InitDlgProgress(HWND HDlg, int id_Progress, int *CurProgStat) {
@@ -137,7 +137,7 @@
137137 // 落ちる問題への対処。(2005.3.18 yutaka)
138138 // cf. http://sourceforge.jp/tracker/index.php?func=detail&aid=5713&group_id=1412&atid=5333
139139 double Num;
140- TCHAR NumStr[10];
140+ wchar_t NumStr[10];
141141
142142 if (b==0) {
143143 Num = 100.0;
@@ -145,8 +145,8 @@
145145 else {
146146 Num = 100.0 * (double)a / (double)b;
147147 }
148- _sntprintf_s(NumStr, _countof(NumStr),_TRUNCATE,_T("%3.1f%%"),Num);
149- SetDlgItemText(HDlg, id_Item, NumStr);
148+ _snwprintf_s(NumStr, _countof(NumStr),_TRUNCATE,L"%3.1f%%",Num);
149+ SetDlgItemTextW(HDlg, id_Item, NumStr);
150150
151151 if (id_Progress != 0 && p != NULL && *p >= 0 && (double)*p < Num) {
152152 *p = (int)Num;
@@ -158,13 +158,13 @@
158158 {
159159 static int prev_elapsed;
160160 int elapsed, rate;
161- TCHAR buff[64];
161+ wchar_t buff[64];
162162
163163 elapsed = (GetTickCount() - stime) / 1000;
164164
165165 if (elapsed == 0) {
166166 prev_elapsed = 0;
167- SetDlgItemText(HDlg, id_Item, _T("0:00"));
167+ SetDlgItemTextW(HDlg, id_Item, L"0:00");
168168 return;
169169 }
170170
@@ -175,16 +175,16 @@
175175
176176 rate = bytes / elapsed;
177177 if (rate < 1200) {
178- _sntprintf_s(buff, _countof(buff), _TRUNCATE, _T("%d:%02d (%dBytes/s)"), elapsed / 60, elapsed % 60, rate);
178+ _snwprintf_s(buff, _countof(buff), _TRUNCATE, L"%d:%02d (%dBytes/s)", elapsed / 60, elapsed % 60, rate);
179179 }
180180 else if (rate < 1200000) {
181- _sntprintf_s(buff, _countof(buff), _TRUNCATE, _T("%d:%02d (%d.%02dKB/s)"), elapsed / 60, elapsed % 60, rate / 1000, rate / 10 % 100);
181+ _snwprintf_s(buff, _countof(buff), _TRUNCATE, L"%d:%02d (%d.%02dKB/s)", elapsed / 60, elapsed % 60, rate / 1000, rate / 10 % 100);
182182 }
183183 else {
184- _sntprintf_s(buff, _countof(buff), _TRUNCATE, _T("%d:%02d (%d.%02dMB/s)"), elapsed / 60, elapsed % 60, rate / (1000 * 1000), rate / 10000 % 100);
184+ _snwprintf_s(buff, _countof(buff), _TRUNCATE, L"%d:%02d (%d.%02dMB/s)", elapsed / 60, elapsed % 60, rate / (1000 * 1000), rate / 10000 % 100);
185185 }
186186
187- SetDlgItemText(HDlg, id_Item, buff);
187+ SetDlgItemTextW(HDlg, id_Item, buff);
188188 }
189189
190190 void SetDropDownList(HWND HDlg, int Id_Item, const char *List[], int nsel)
--- trunk/teraterm/teraterm/tekwin.cpp (revision 9291)
+++ trunk/teraterm/teraterm/tekwin.cpp (revision 9292)
@@ -192,11 +192,11 @@
192192 SetDlgMenuTexts(HelpMenu, HelpMenuTextInfo, _countof(HelpMenuTextInfo), ts.UILanguageFile);
193193
194194 if ((ts.MenuFlag & MF_SHOWWINMENU) !=0) {
195- TCHAR uimsg[MAX_UIMSG];
195+ wchar_t uimsg[MAX_UIMSG];
196196 WinMenu = CreatePopupMenu();
197- get_lang_msgT("TEKMENU_WINDOW", uimsg, _countof(uimsg), _T("&Window"), ts.UILanguageFile);
198- ::InsertMenu(*Menu,4,MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
199- (UINT_PTR)WinMenu, uimsg);
197+ get_lang_msgW("TEKMENU_WINDOW", uimsg, _countof(uimsg), L"&Window", ts.UILanguageFile);
198+ ::InsertMenuW(*Menu,4,MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
199+ (UINT_PTR)WinMenu, uimsg);
200200 }
201201 }
202202
@@ -592,12 +592,12 @@
592592 if ((MainMenu!=NULL) &&
593593 (B1 != B2)) {
594594 if (WinMenu==NULL) {
595- TCHAR uimsg[MAX_UIMSG];
595+ wchar_t uimsg[MAX_UIMSG];
596596 WinMenu = CreatePopupMenu();
597- get_lang_msgT("TEKMENU_WINDOW", uimsg, _countof(uimsg), _T("&Window"), ts.UILanguageFile);
598- ::InsertMenu(MainMenu,4,
599- MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
600- (UINT_PTR)WinMenu, uimsg);
597+ get_lang_msgW("TEKMENU_WINDOW", uimsg, _countof(uimsg), L"&Window", ts.UILanguageFile);
598+ ::InsertMenuW(MainMenu,4,
599+ MF_STRING | MF_ENABLED | MF_POPUP | MF_BYPOSITION,
600+ (UINT_PTR)WinMenu, uimsg);
601601 }
602602 else {
603603 RemoveMenu(MainMenu,4,MF_BYPOSITION);
@@ -609,11 +609,11 @@
609609
610610 ::GetSystemMenu(tk.HWin,TRUE);
611611 if ((! Show) && ((ts.MenuFlag & MF_NOSHOWMENU)==0)) {
612- TCHAR uimsg[MAX_UIMSG];
612+ wchar_t uimsg[MAX_UIMSG];
613613 SysMenu = ::GetSystemMenu(tk.HWin,FALSE);
614- AppendMenu(SysMenu, MF_SEPARATOR, 0, NULL);
615- get_lang_msgT("TEKMENU_SHOW_MENUBAR", uimsg, _countof(uimsg), _T("Show menu &bar"), ts.UILanguageFile);
616- AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, uimsg);
614+ AppendMenuW(SysMenu, MF_SEPARATOR, 0, NULL);
615+ get_lang_msgW("TEKMENU_SHOW_MENUBAR", uimsg, _countof(uimsg), L"Show menu &bar", ts.UILanguageFile);
616+ AppendMenuW(SysMenu, MF_STRING, ID_SHOWMENUBAR, uimsg);
617617 }
618618 return 0;
619619 }
@@ -644,11 +644,11 @@
644644
645645 if ((ts.HideTitle==0) && (MainMenu==NULL) &&
646646 ((ts.MenuFlag & MF_NOSHOWMENU) == 0)) {
647- TCHAR uimsg[MAX_UIMSG];
647+ wchar_t uimsg[MAX_UIMSG];
648648 SysMenu = ::GetSystemMenu(HTEKWin,FALSE);
649- AppendMenu(SysMenu, MF_SEPARATOR, 0, NULL);
650- get_lang_msgT("TEKMENU_SHOW_MENUBAR", uimsg, _countof(uimsg), _T("Show menu &bar"), ts.UILanguageFile);
651- AppendMenu(SysMenu, MF_STRING, ID_SHOWMENUBAR, uimsg);
649+ AppendMenuW(SysMenu, MF_SEPARATOR, 0, NULL);
650+ get_lang_msgW("TEKMENU_SHOW_MENUBAR", uimsg, _countof(uimsg), L"Show menu &bar", ts.UILanguageFile);
651+ AppendMenuW(SysMenu, MF_STRING, ID_SHOWMENUBAR, uimsg);
652652 }
653653 return 0;
654654 }
--- trunk/teraterm/teraterm/vtwin.cpp (revision 9291)
+++ trunk/teraterm/teraterm/vtwin.cpp (revision 9292)
@@ -4895,7 +4895,7 @@
48954895 ::ZeroMemory(&si, sizeof(si));
48964896 si.cbSize = sizeof(si);
48974897 si.fMask = SEE_MASK_IDLIST;
4898- si.lpVerb = _T("open");
4898+ si.lpVerb = "open";
48994899 si.lpIDList = pIDL;
49004900 si.nShow = SW_SHOWNORMAL;
49014901 ::ShellExecuteEx(&si);
--- trunk/teraterm/ttpcmn/ttcmn.c (revision 9291)
+++ trunk/teraterm/ttpcmn/ttcmn.c (revision 9292)
@@ -88,8 +88,8 @@
8888 static PMap pm;
8989
9090 static HANDLE HMap = NULL;
91-#define VTCLASSNAME _T("VTWin32")
92-#define TEKCLASSNAME _T("TEKWin32")
91+#define VTCLASSNAME "VTWin32"
92+#define TEKCLASSNAME "TEKWin32"
9393
9494 enum window_style {
9595 WIN_CASCADE,
--- trunk/teraterm/ttpdlg/ttdlg.c (revision 9291)
+++ trunk/teraterm/ttpdlg/ttdlg.c (revision 9292)
@@ -1211,25 +1211,25 @@
12111211 { IDOK, "DLG_SERIAL_OK_RESET" },
12121212 };
12131213 int ret = 0;
1214- TCHAR uimsg[MAX_UIMSG];
1214+ const char *ok_text;
12151215
12161216 if ( cv.Ready && (cv.PortType != IdSerial) ) {
12171217 ret = SetDlgTexts(dlg, TextInfoNewConnection, _countof(TextInfoNewConnection), UILanguageFile);
1218- strncpy_s(uimsg, sizeof(uimsg), "Connect with &New window", _TRUNCATE);
1218+ ok_text = "Connect with &New window";
12191219
12201220 } else {
12211221 if (cv.Open) {
12221222 if (portno != cv.ComPort) {
12231223 ret = SetDlgTexts(dlg, TextInfoCloseNewOpen, _countof(TextInfoCloseNewOpen), UILanguageFile);
1224- strncpy_s(uimsg, sizeof(uimsg), "Close and &New open", _TRUNCATE);
1224+ ok_text = "Close and &New open";
12251225 } else {
12261226 ret = SetDlgTexts(dlg, TextInfoResetSetting, _countof(TextInfoResetSetting), UILanguageFile);
1227- strncpy_s(uimsg, sizeof(uimsg), "&New setting", _TRUNCATE);
1227+ ok_text = "&New setting";
12281228 }
12291229
12301230 } else {
12311231 ret = SetDlgTexts(dlg, TextInfoNewOpen, _countof(TextInfoNewOpen), UILanguageFile);
1232- strncpy_s(uimsg, sizeof(uimsg), "&New open", _TRUNCATE);
1232+ ok_text = "&New open";
12331233 }
12341234 }
12351235
@@ -1237,7 +1237,7 @@
12371237 * デフォルトテキストをセットする。
12381238 */
12391239 if (ret <= 0) {
1240- SetDlgItemText(dlg, IDOK, uimsg);
1240+ SetDlgItemTextA(dlg, IDOK, ok_text);
12411241 }
12421242 }
12431243
@@ -1248,8 +1248,7 @@
12481248 static void serial_dlg_set_comport_info(HWND dlg, int portno, char *desc)
12491249 {
12501250 int i;
1251- ComPortInfo_t *p;
1252- char *strA;
1251+ const ComPortInfo_t *p;
12531252
12541253 for (i = 0 ; i < ComPortInfoCount ; i++) {
12551254 p = &ComPortInfoPtr[i];
@@ -1259,9 +1258,7 @@
12591258 if (i >= ComPortInfoCount) // 該当するCOMポートが見つからなかった
12601259 return;
12611260
1262- strA = ToCharW(p->property);
1263- SetDlgItemTextA(dlg, IDC_SERIALTEXT, strA);
1264- free(strA);
1261+ SetDlgItemTextW(dlg, IDC_SERIALTEXT, p->property);
12651262 }
12661263
12671264 /*
@@ -1316,14 +1313,13 @@
13161313 int w, h;
13171314 int cx, cy;
13181315 RECT wr;
1319- TCHAR str[128], uimsg[MAX_UIMSG];
1316+ wchar_t uimsg[MAX_UIMSG];
13201317 PTTSet ts;
13211318
13221319 switch (msg) {
13231320 case WM_MOUSEMOVE:
13241321 ts = (PTTSet)GetWindowLongPtr(GetParent(hWnd) ,DWLP_USER);
1325- get_lang_msg("DLG_SERIAL_SPEED_TOOLTIP", uimsg, sizeof(uimsg), "You can directly specify a number", ts->UILanguageFile);
1326- _stprintf_s(str, _countof(str), _T(uimsg));
1322+ get_lang_msgW("DLG_SERIAL_SPEED_TOOLTIP", uimsg, _countof(uimsg), L"You can directly specify a number", ts->UILanguageFile);
13271323
13281324 // Combo-boxの左上座標を求める
13291325 GetWindowRect(hWnd, &wr);
@@ -1331,7 +1327,7 @@
13311327 pt.y = wr.top;
13321328
13331329 // 文字列の縦横サイズを取得する
1334- TipWinGetTextWidthHeight(hWnd, str, &w, &h);
1330+ TipWinGetTextWidthHeightW(hWnd, uimsg, &w, &h);
13351331
13361332 cx = pt.x;
13371333 cy = pt.y - (h + TIP_WIN_FRAME_WIDTH * 6);
@@ -1344,7 +1340,7 @@
13441340 if (!TipWinIsVisible(g_SerialDlgSpeedTip))
13451341 TipWinSetVisible(g_SerialDlgSpeedTip, TRUE);
13461342
1347- TipWinSetTextA(g_SerialDlgSpeedTip, str);
1343+ TipWinSetTextW(g_SerialDlgSpeedTip, uimsg);
13481344 TipWinSetPos(g_SerialDlgSpeedTip, cx, cy);
13491345 TipWinSetHideTimer(g_SerialDlgSpeedTip, tooltip_timeout);
13501346
--- trunk/teraterm/ttpmacro/errdlg.cpp (revision 9291)
+++ trunk/teraterm/ttpmacro/errdlg.cpp (revision 9292)
@@ -51,14 +51,14 @@
5151
5252 CErrDlg::CErrDlg(const char *Msg, const char *Line, int x, int y, int lineno, int start, int end, const char *FileName)
5353 {
54- MsgStr = _tcsdup((tc)Msg);
55- LineStr = _tcsdup((tc)Line);
54+ MsgStr = _wcsdup((wc)Msg);
55+ LineStr = _wcsdup((wc)Line);
5656 PosX = x;
5757 PosY = y;
5858 LineNo = lineno;
5959 StartPos = start;
6060 EndPos = end;
61- MacroFileName = _tcsdup((tc)FileName);
61+ MacroFileName = _wcsdup((wc)FileName);
6262 }
6363
6464 INT_PTR CErrDlg::DoModal(HINSTANCE hInst, HWND hWndParent)
@@ -73,32 +73,33 @@
7373 { IDCANCEL, "BTN_CONTINUE" },
7474 { IDC_MACROERRHELP, "BTN_HELP" },
7575 };
76- char buf[MaxLineLen*2], buf2[10];
76+ wchar_t buf[MaxLineLen*2];
7777
7878 SetDlgTexts(m_hWnd, TextInfos, _countof(TextInfos), UILanguageFile);
7979
80- SetDlgItemText(IDC_ERRMSG,MsgStr);
80+ SetDlgItemTextW(IDC_ERRMSG,MsgStr);
8181
8282 // 行番号を先頭につける。
8383 // ファイル名もつける。
8484 // エラー箇所に印をつける。
85- _snprintf_s(buf, sizeof(buf), _TRUNCATE, "%s:%d:", MacroFileName, LineNo);
86- SetDlgItemText(IDC_ERRLINE, buf);
85+ _snwprintf_s(buf, _countof(buf), _TRUNCATE, L"%ls:%d:", MacroFileName, LineNo);
86+ SetDlgItemTextW(IDC_ERRLINE, buf);
8787
88- size_t len = strlen(LineStr);
88+ size_t len = wcslen(LineStr);
8989 buf[0] = 0;
9090 for (size_t i = 0 ; i < len ; i++) {
9191 if (i == StartPos)
92- strncat_s(buf, sizeof(buf), "<<<", _TRUNCATE);
92+ wcsncat_s(buf, _countof(buf), L"<<<", _TRUNCATE);
9393 if (i == EndPos)
94- strncat_s(buf, sizeof(buf), ">>>", _TRUNCATE);
94+ wcsncat_s(buf, _countof(buf), L">>>", _TRUNCATE);
95+ wchar_t buf2[10];
9596 buf2[0] = LineStr[i];
9697 buf2[1] = 0;
97- strncat_s(buf, sizeof(buf), buf2, _TRUNCATE);
98+ wcsncat_s(buf, _countof(buf), buf2, _TRUNCATE);
9899 }
99100 if (EndPos == len)
100- strncat_s(buf, sizeof(buf), ">>>", _TRUNCATE);
101- SetDlgItemText(IDC_EDIT_ERRLINE, buf);
101+ wcsncat_s(buf, _countof(buf), L">>>", _TRUNCATE);
102+ SetDlgItemTextW(IDC_EDIT_ERRLINE, buf);
102103
103104 SetDlgPos();
104105
--- trunk/teraterm/ttpmacro/errdlg.h (revision 9291)
+++ trunk/teraterm/ttpmacro/errdlg.h (revision 9292)
@@ -42,11 +42,11 @@
4242 private:
4343 enum { IDD = IDD_ERRDLG };
4444
45- const TCHAR *MsgStr;
46- const TCHAR *LineStr;
45+ const wchar_t *MsgStr;
46+ const wchar_t *LineStr;
4747 int LineNo;
4848 int StartPos, EndPos;
49- const TCHAR *MacroFileName;
49+ const wchar_t *MacroFileName;
5050
5151 virtual BOOL OnInitDialog();
5252 BOOL OnCommand(WPARAM wp, LPARAM lp);
Show on old repository browser