Skip to content

Commit db4de19

Browse files
committed
unicode2
1 parent 1ce59ef commit db4de19

File tree

8 files changed

+45
-44
lines changed

8 files changed

+45
-44
lines changed

Lite/AES.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ CAES::~CAES()
2424

2525
}
2626

27-
28-
void CAES::EnterPassword(CString passwd)
27+
// ANSI hack, CStringA
28+
void CAES::EnterPassword(CStringA passwd)
2929
{
3030
int len = (passwd.GetLength() / 16 + (passwd.GetLength() % 16 ? 1 : 0)) * 16;
3131
char pad[32];

Lite/AES.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
class CAES : public CRijndael
1616
{
1717
public:
18-
void EnterPassword(CString passwd);
18+
// ANSI hack, CStringA
19+
void EnterPassword(CStringA passwd);
1920
inline BOOL IsInitialized(){ return m_bInit; }
2021
CAES();
2122
virtual ~CAES();

Lite/AnsiBar.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void CAnsiBar::OnBk()
4545
mnu.CreatePopupMenu();
4646
for (int i = 10;i < 18;i++)
4747
{
48-
mnu.AppendMenu(MF_OWNERDRAW, i, "");
48+
mnu.AppendMenu(MF_OWNERDRAW, i, TEXT(""));
4949
}
5050
CRect rc;
5151
::GetWindowRect(::GetDlgItem(m_hWnd, IDC_ANSIBAR_BK), rc);
@@ -67,7 +67,7 @@ void CAnsiBar::OnFg()
6767
mnu.CreatePopupMenu();
6868
for (int i = 10;i < 26;i++)
6969
{
70-
mnu.AppendMenu(MF_OWNERDRAW, i, "");
70+
mnu.AppendMenu(MF_OWNERDRAW, i, TEXT(""));
7171
}
7272
CRect rc;
7373
::GetWindowRect(::GetDlgItem(m_hWnd, IDC_ANSIBAR_FG), rc);
@@ -102,13 +102,13 @@ void CAnsiBar::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
102102
case IDC_ANSIBAR_SENDDROP:
103103
dc.DrawFrameControl(&lpDrawItemStruct->rcItem, DFC_SCROLL, DFCS_SCROLLDOWN | (lpDrawItemStruct->itemState&ODS_SELECTED ? DFCS_PUSHED : 0));
104104
break;
105-
default: //前景背景按鈕
105+
default: //前景背景按鈕
106106
clr = AppConfig.colormap[(nIDCtl==IDC_ANSIBAR_FG?fg:bk)];
107107
dc.FillSolidRect(&lpDrawItemStruct->rcItem, clr);
108108
if (GetRValue(clr) <= 128 && GetGValue(clr) <= 128 && GetBValue(clr) <= 128)
109109
txtclr = 0xffffff;
110110
dc.SetTextColor(txtclr);
111-
char txt[5];
111+
TCHAR txt[5];
112112
dc.DrawEdge(&lpDrawItemStruct->rcItem, lpDrawItemStruct->itemState&ODS_SELECTED ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT);
113113
::GetWindowText(lpDrawItemStruct->hwndItem, txt, 5);
114114
dc.DrawText(txt, 4, &lpDrawItemStruct->rcItem, DT_VCENTER | DT_CENTER | DT_SINGLELINE);
@@ -171,13 +171,13 @@ void CAnsiBar::UpdateColor(UINT type)
171171
telnet->sel_start.y = tmp;
172172
}
173173

174-
if (telnet->sel_block || telnet->sel_start.y == telnet->sel_end.y) //如果使用區塊選取或只選取單行
174+
if (telnet->sel_block || telnet->sel_start.y == telnet->sel_end.y) //如果使用區塊選取或只選取單行
175175
{
176176
for (int i = telnet->sel_start.y;i <= telnet->sel_end.y;i++)
177177
for (int p = telnet->sel_start.x;p < telnet->sel_end.x;p++)
178178
AddAttr(telnet->GetLineAttr(i)[p], type);
179179
}
180-
else //不使用區塊並選取多行
180+
else //不使用區塊並選取多行
181181
{
182182
int i, p;
183183
for (p = telnet->sel_start.x;p < telnet->site_settings.cols_per_page;p++)
@@ -203,7 +203,7 @@ void CAnsiBar::UpdateColor(UINT type)
203203

204204
void CAnsiBar::OnSend()
205205
{
206-
Send(0); //全部格式
206+
Send(0); //全部格式
207207
}
208208

209209
void CAnsiBar::AddAttr(BYTE &attr, UINT type)
@@ -247,13 +247,13 @@ void CAnsiBar::OnSendDropDown()
247247
UINT id = pop->TrackPopupMenu(TPM_LEFTALIGN | TPM_RETURNCMD, rc.left, rc.bottom, this);
248248
switch (id)
249249
{
250-
case ID_SEND_RESETCLR: //送出色彩還原碼
250+
case ID_SEND_RESETCLR: //送出色彩還原碼
251251
Send(4);
252252
break;
253-
case ID_SEND_FG: //送出前景
253+
case ID_SEND_FG: //送出前景
254254
Send(1);
255255
break;
256-
case ID_SEND_BK: //送出背景
256+
case ID_SEND_BK: //送出背景
257257
Send(2);
258258
break;
259259
}
@@ -269,7 +269,7 @@ void CAnsiBar::Send(DWORD type)
269269
char tmp[4];
270270
switch (type)
271271
{
272-
case 1: //送出前景
272+
case 1: //送出前景
273273
if (is_blink)
274274
escstr += "5;";
275275
attr = fg;
@@ -282,12 +282,12 @@ void CAnsiBar::Send(DWORD type)
282282
strcat(tmp, "m");
283283
escstr += tmp;
284284
break;
285-
case 2: //送出背景
285+
case 2: //送出背景
286286
itoa(bk + 40, tmp, 10);
287287
strcat(tmp, "m");
288288
escstr += tmp;
289289
break;
290-
case 4: //送出還原碼
290+
case 4: //送出還原碼
291291
escstr += "m";
292292
break;
293293
default:

Lite/AppConfig.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ CString GetIEPath()
116116
HKEY hk = NULL;
117117
// RegOpenKey( HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE", &hk );
118118
// RegQueryValue( hk, NULL, fpath.GetBuffer(_MAX_PATH), &len);
119-
RegQueryValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE", fpath.GetBuffer(_MAX_PATH), &len);
119+
RegQueryValue(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE"), fpath.GetBuffer(_MAX_PATH), &len);
120120
// RegCloseKey( hk );
121121
fpath.ReleaseBuffer();
122122
return fpath;

Lite/AutoComplete.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ int CAutoComplete::CompareItem(const void *p1, const void *p2)
277277
int r = item1->strstrpos - item2->strstrpos;
278278
if (0 != r)
279279
return r;
280-
return strcmp(m_pOpenedList->m_pSrc->GetAt(item1->strpos),
280+
return _tcscmp(m_pOpenedList->m_pSrc->GetAt(item1->strpos),
281281
m_pOpenedList->m_pSrc->GetAt(item2->strpos));
282282
}
283283

Lite/AutoReplyPage.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ void CAutoReplyPage::OnAdd()
7474
msg.SetWindowText(NULL);
7575
respond.SetWindowText(NULL);
7676
protect.SetCheck(FALSE);
77-
first.SetWindowText("1");
78-
count.SetWindowText("1");
77+
first.SetWindowText(TEXT("1"));
78+
count.SetWindowText(TEXT("1"));
7979
list.EnableWindow(FALSE);
8080
}
8181

@@ -170,7 +170,7 @@ BOOL CAutoReplyPage::OnInitDialog()
170170

171171
void CAutoReplyPage::OnCancel()
172172
{
173-
if (respond.IsWindowEnabled()) //還在編輯狀態
173+
if (respond.IsWindowEnabled()) //還在編輯狀態
174174
return;
175175

176176
int c = list.GetCount();
@@ -197,20 +197,20 @@ void CAutoReplyPage::UpdateDisplay()
197197
msg.SetWindowText(item->msg);
198198
respond.SetPasswordChar(*LPCTSTR(item->respond) == '+' ? '*' : 0);
199199
CString tmp = LPCTSTR(item->respond) + 1;
200-
tmp.Replace("^M^J", "\r\n");
201-
tmp.Replace("^M", "\r\n");
200+
tmp.Replace(TEXT("^M^J"), TEXT("\r\n"));
201+
tmp.Replace(TEXT("^M"), TEXT("\r\n"));
202202
respond.SetWindowText(tmp);
203203
protect.SetCheck(*LPCTSTR(item->respond) == '+');
204204

205-
char sfirst[8];
206-
itoa(item->first, sfirst, 10);
205+
TCHAR sfirst[8];
206+
_itot(item->first, sfirst, 10);
207207
first.SetWindowText(sfirst);
208-
char scount[8];
208+
TCHAR scount[8];
209209
if (item->count == 0)
210210
count.SetWindowText(NULL);
211211
else
212212
{
213-
itoa(item->count, scount, 10);
213+
_itot(item->count, scount, 10);
214214
count.SetWindowText(scount);
215215
}
216216
}
@@ -221,7 +221,7 @@ void CAutoReplyPage::OnSave()
221221
msg.GetWindowText(tmp);
222222
if (tmp.IsEmpty())
223223
{
224-
// 設定不完整,必須輸入要自動回應的訊息!
224+
// 設定不完整,必須輸入要自動回應的訊息!
225225
MessageBox(LoadString(IDS_INCOMPLETE_AUTO_SETTINGS) , NULL, MB_OK | MB_ICONSTOP);
226226
msg.SetFocus();
227227
return;
@@ -231,14 +231,14 @@ void CAutoReplyPage::OnSave()
231231
CTriggerItem* item;
232232
BOOL badd = (add.GetDlgCtrlID() == IDC_SAVE);
233233
int i;
234-
if (badd) //新增
234+
if (badd) //新增
235235
{
236236
if (list.FindString(0, tmp) != LB_ERR)
237237
return;
238238
item = new CTriggerItem;
239239
item->pnext = NULL;
240240
}
241-
else //修改
241+
else //修改
242242
{
243243
i = list.GetCurSel();
244244
item = (CTriggerItem*)list.GetItemDataPtr(i);
@@ -247,25 +247,25 @@ void CAutoReplyPage::OnSave()
247247
item->msg = tmp;
248248

249249
respond.GetWindowText(tmp);
250-
tmp.Replace("\r\n", "^M");
250+
tmp.Replace(TEXT("\r\n"), TEXT("^M"));
251251
item->respond = protect.GetCheck() ? "+" : "-";
252252
item->respond += tmp;
253253

254-
char sfirst[8];
254+
TCHAR sfirst[8];
255255
first.GetWindowText(sfirst, 8);
256-
item->first = atoi(sfirst);
256+
item->first = _tstoi(sfirst);
257257
if (item->first < 1)
258258
item->first = 1;
259-
char scount[8];
259+
TCHAR scount[8];
260260
count.GetWindowText(scount, 8);
261261
if (!*scount)
262262
item->count = 0;
263263
else
264-
item->count = atoi(scount);
264+
item->count = _tstoi(scount);
265265

266-
if (badd) //如果新增
266+
if (badd) //如果新增
267267
i = list.AddString(item->msg);
268-
else //如果修改
268+
else //如果修改
269269
{
270270
list.DeleteString(i);
271271
list.InsertString(i, item->msg);
@@ -318,14 +318,14 @@ void CAutoReplyPage::EnableEdits(BOOL enable)
318318

319319
void CAutoReplyPage::OnProtect()
320320
{
321-
if (protect.GetCheck()) //如果是勾選密碼保護
321+
if (protect.GetCheck()) //如果是勾選密碼保護
322322
{
323323
if (!AppConfig.QueryPassword(TRUE))
324324
protect.SetCheck(0);
325325
else
326326
respond.SetPasswordChar('*');
327327
}
328-
else //如果是取消密碼保護
328+
else //如果是取消密碼保護
329329
{
330330
CPasswdDlg dlg;
331331
if (dlg.DoModal() == IDCANCEL)

Lite/AutoUpdate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static char THIS_FILE[]=__FILE__;
2424
CAutoUpdater::CAutoUpdater()
2525
{
2626
// Initialize WinInet
27-
hInternet = InternetOpen("AutoUpdateAgent", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
27+
hInternet = InternetOpen(TEXT("AutoUpdateAgent"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
2828
}
2929

3030
CAutoUpdater::~CAutoUpdater()
@@ -144,7 +144,7 @@ CAutoUpdater::ErrorType CAutoUpdater::CheckForUpdate()
144144
// }
145145

146146
MessageBox(AfxGetMainWnd()->m_hWnd, LoadString(IDS_INSTALL_UPDATE), LoadString(IDS_PCMAN_CLOSE), MB_ICONINFORMATION|MB_OK);
147-
if (!::ShellExecute(AfxGetMainWnd()->m_hWnd, "open", updateFileLocation, NULL, NULL,
147+
if (!::ShellExecute(AfxGetMainWnd()->m_hWnd, TEXT("open"), updateFileLocation, NULL, NULL,
148148
SW_SHOWNORMAL))
149149
{
150150
return UpdateNotComplete;
@@ -338,7 +338,7 @@ int CAutoUpdater::CompareVersions(CString ver1, CString ver2)
338338
{
339339
return -21; // Error in structure, too many parameters
340340
}
341-
wVer1[i] = atoi(pToken);
341+
wVer1[i] = _tstoi(pToken);
342342
pToken = strtok(NULL, _T("."));
343343
i--;
344344
}
@@ -358,7 +358,7 @@ int CAutoUpdater::CompareVersions(CString ver1, CString ver2)
358358
{
359359
return -22; // Error in structure, too many parameters
360360
}
361-
wVer2[i] = atoi(pToken);
361+
wVer2[i] = _tstoi(pToken);
362362
pToken = strtok(NULL, _T("."));
363363
i--;
364364
}

Lite/StrUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ char* strnstri(const char* str, const char* sub, int len)
4545
int sl = strlen(sub);
4646
for (pstr = str; pstr <= pend - sl; pstr++)
4747
{
48-
if (!strnicmp(pstr, sub, sl))
48+
if (!_tcsncicmp(pstr, sub, sl))
4949
return (char*)pstr;
5050
}
5151
return NULL;

0 commit comments

Comments
 (0)