Skip to content

Commit

Permalink
unicode2
Browse files Browse the repository at this point in the history
  • Loading branch information
craftwar committed Jul 10, 2018
1 parent 1ce59ef commit db4de19
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 44 deletions.
4 changes: 2 additions & 2 deletions Lite/AES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ CAES::~CAES()

}


void CAES::EnterPassword(CString passwd)
// ANSI hack, CStringA
void CAES::EnterPassword(CStringA passwd)
{
int len = (passwd.GetLength() / 16 + (passwd.GetLength() % 16 ? 1 : 0)) * 16;
char pad[32];
Expand Down
3 changes: 2 additions & 1 deletion Lite/AES.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
class CAES : public CRijndael
{
public:
void EnterPassword(CString passwd);
// ANSI hack, CStringA
void EnterPassword(CStringA passwd);
inline BOOL IsInitialized(){ return m_bInit; }
CAES();
virtual ~CAES();
Expand Down
26 changes: 13 additions & 13 deletions Lite/AnsiBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void CAnsiBar::OnBk()
mnu.CreatePopupMenu();
for (int i = 10;i < 18;i++)
{
mnu.AppendMenu(MF_OWNERDRAW, i, "");
mnu.AppendMenu(MF_OWNERDRAW, i, TEXT(""));
}
CRect rc;
::GetWindowRect(::GetDlgItem(m_hWnd, IDC_ANSIBAR_BK), rc);
Expand All @@ -67,7 +67,7 @@ void CAnsiBar::OnFg()
mnu.CreatePopupMenu();
for (int i = 10;i < 26;i++)
{
mnu.AppendMenu(MF_OWNERDRAW, i, "");
mnu.AppendMenu(MF_OWNERDRAW, i, TEXT(""));
}
CRect rc;
::GetWindowRect(::GetDlgItem(m_hWnd, IDC_ANSIBAR_FG), rc);
Expand Down Expand Up @@ -102,13 +102,13 @@ void CAnsiBar::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
case IDC_ANSIBAR_SENDDROP:
dc.DrawFrameControl(&lpDrawItemStruct->rcItem, DFC_SCROLL, DFCS_SCROLLDOWN | (lpDrawItemStruct->itemState&ODS_SELECTED ? DFCS_PUSHED : 0));
break;
default: //前景背景按鈕
default: //前景背景按鈕
clr = AppConfig.colormap[(nIDCtl==IDC_ANSIBAR_FG?fg:bk)];
dc.FillSolidRect(&lpDrawItemStruct->rcItem, clr);
if (GetRValue(clr) <= 128 && GetGValue(clr) <= 128 && GetBValue(clr) <= 128)
txtclr = 0xffffff;
dc.SetTextColor(txtclr);
char txt[5];
TCHAR txt[5];
dc.DrawEdge(&lpDrawItemStruct->rcItem, lpDrawItemStruct->itemState&ODS_SELECTED ? EDGE_SUNKEN : EDGE_RAISED, BF_RECT);
::GetWindowText(lpDrawItemStruct->hwndItem, txt, 5);
dc.DrawText(txt, 4, &lpDrawItemStruct->rcItem, DT_VCENTER | DT_CENTER | DT_SINGLELINE);
Expand Down Expand Up @@ -171,13 +171,13 @@ void CAnsiBar::UpdateColor(UINT type)
telnet->sel_start.y = tmp;
}

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

void CAnsiBar::OnSend()
{
Send(0); //全部格式
Send(0); //全部格式
}

void CAnsiBar::AddAttr(BYTE &attr, UINT type)
Expand Down Expand Up @@ -247,13 +247,13 @@ void CAnsiBar::OnSendDropDown()
UINT id = pop->TrackPopupMenu(TPM_LEFTALIGN | TPM_RETURNCMD, rc.left, rc.bottom, this);
switch (id)
{
case ID_SEND_RESETCLR: //送出色彩還原碼
case ID_SEND_RESETCLR: //送出色彩還原碼
Send(4);
break;
case ID_SEND_FG: //送出前景
case ID_SEND_FG: //送出前景
Send(1);
break;
case ID_SEND_BK: //送出背景
case ID_SEND_BK: //送出背景
Send(2);
break;
}
Expand All @@ -269,7 +269,7 @@ void CAnsiBar::Send(DWORD type)
char tmp[4];
switch (type)
{
case 1: //送出前景
case 1: //送出前景
if (is_blink)
escstr += "5;";
attr = fg;
Expand All @@ -282,12 +282,12 @@ void CAnsiBar::Send(DWORD type)
strcat(tmp, "m");
escstr += tmp;
break;
case 2: //送出背景
case 2: //送出背景
itoa(bk + 40, tmp, 10);
strcat(tmp, "m");
escstr += tmp;
break;
case 4: //送出還原碼
case 4: //送出還原碼
escstr += "m";
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion Lite/AppConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ CString GetIEPath()
HKEY hk = NULL;
// RegOpenKey( HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE", &hk );
// RegQueryValue( hk, NULL, fpath.GetBuffer(_MAX_PATH), &len);
RegQueryValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE", fpath.GetBuffer(_MAX_PATH), &len);
RegQueryValue(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\IEXPLORE.EXE"), fpath.GetBuffer(_MAX_PATH), &len);
// RegCloseKey( hk );
fpath.ReleaseBuffer();
return fpath;
Expand Down
2 changes: 1 addition & 1 deletion Lite/AutoComplete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ int CAutoComplete::CompareItem(const void *p1, const void *p2)
int r = item1->strstrpos - item2->strstrpos;
if (0 != r)
return r;
return strcmp(m_pOpenedList->m_pSrc->GetAt(item1->strpos),
return _tcscmp(m_pOpenedList->m_pSrc->GetAt(item1->strpos),
m_pOpenedList->m_pSrc->GetAt(item2->strpos));
}

Expand Down
42 changes: 21 additions & 21 deletions Lite/AutoReplyPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ void CAutoReplyPage::OnAdd()
msg.SetWindowText(NULL);
respond.SetWindowText(NULL);
protect.SetCheck(FALSE);
first.SetWindowText("1");
count.SetWindowText("1");
first.SetWindowText(TEXT("1"));
count.SetWindowText(TEXT("1"));
list.EnableWindow(FALSE);
}

Expand Down Expand Up @@ -170,7 +170,7 @@ BOOL CAutoReplyPage::OnInitDialog()

void CAutoReplyPage::OnCancel()
{
if (respond.IsWindowEnabled()) //還在編輯狀態
if (respond.IsWindowEnabled()) //還在編輯狀態
return;

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

char sfirst[8];
itoa(item->first, sfirst, 10);
TCHAR sfirst[8];
_itot(item->first, sfirst, 10);
first.SetWindowText(sfirst);
char scount[8];
TCHAR scount[8];
if (item->count == 0)
count.SetWindowText(NULL);
else
{
itoa(item->count, scount, 10);
_itot(item->count, scount, 10);
count.SetWindowText(scount);
}
}
Expand All @@ -221,7 +221,7 @@ void CAutoReplyPage::OnSave()
msg.GetWindowText(tmp);
if (tmp.IsEmpty())
{
// 設定不完整,必須輸入要自動回應的訊息!
// 設定不完整,必須輸入要自動回應的訊息!
MessageBox(LoadString(IDS_INCOMPLETE_AUTO_SETTINGS) , NULL, MB_OK | MB_ICONSTOP);
msg.SetFocus();
return;
Expand All @@ -231,14 +231,14 @@ void CAutoReplyPage::OnSave()
CTriggerItem* item;
BOOL badd = (add.GetDlgCtrlID() == IDC_SAVE);
int i;
if (badd) //新增
if (badd) //新增
{
if (list.FindString(0, tmp) != LB_ERR)
return;
item = new CTriggerItem;
item->pnext = NULL;
}
else //修改
else //修改
{
i = list.GetCurSel();
item = (CTriggerItem*)list.GetItemDataPtr(i);
Expand All @@ -247,25 +247,25 @@ void CAutoReplyPage::OnSave()
item->msg = tmp;

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

char sfirst[8];
TCHAR sfirst[8];
first.GetWindowText(sfirst, 8);
item->first = atoi(sfirst);
item->first = _tstoi(sfirst);
if (item->first < 1)
item->first = 1;
char scount[8];
TCHAR scount[8];
count.GetWindowText(scount, 8);
if (!*scount)
item->count = 0;
else
item->count = atoi(scount);
item->count = _tstoi(scount);

if (badd) //如果新增
if (badd) //如果新增
i = list.AddString(item->msg);
else //如果修改
else //如果修改
{
list.DeleteString(i);
list.InsertString(i, item->msg);
Expand Down Expand Up @@ -318,14 +318,14 @@ void CAutoReplyPage::EnableEdits(BOOL enable)

void CAutoReplyPage::OnProtect()
{
if (protect.GetCheck()) //如果是勾選密碼保護
if (protect.GetCheck()) //如果是勾選密碼保護
{
if (!AppConfig.QueryPassword(TRUE))
protect.SetCheck(0);
else
respond.SetPasswordChar('*');
}
else //如果是取消密碼保護
else //如果是取消密碼保護
{
CPasswdDlg dlg;
if (dlg.DoModal() == IDCANCEL)
Expand Down
8 changes: 4 additions & 4 deletions Lite/AutoUpdate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static char THIS_FILE[]=__FILE__;
CAutoUpdater::CAutoUpdater()
{
// Initialize WinInet
hInternet = InternetOpen("AutoUpdateAgent", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
hInternet = InternetOpen(TEXT("AutoUpdateAgent"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
}

CAutoUpdater::~CAutoUpdater()
Expand Down Expand Up @@ -144,7 +144,7 @@ CAutoUpdater::ErrorType CAutoUpdater::CheckForUpdate()
// }

MessageBox(AfxGetMainWnd()->m_hWnd, LoadString(IDS_INSTALL_UPDATE), LoadString(IDS_PCMAN_CLOSE), MB_ICONINFORMATION|MB_OK);
if (!::ShellExecute(AfxGetMainWnd()->m_hWnd, "open", updateFileLocation, NULL, NULL,
if (!::ShellExecute(AfxGetMainWnd()->m_hWnd, TEXT("open"), updateFileLocation, NULL, NULL,
SW_SHOWNORMAL))
{
return UpdateNotComplete;
Expand Down Expand Up @@ -338,7 +338,7 @@ int CAutoUpdater::CompareVersions(CString ver1, CString ver2)
{
return -21; // Error in structure, too many parameters
}
wVer1[i] = atoi(pToken);
wVer1[i] = _tstoi(pToken);
pToken = strtok(NULL, _T("."));
i--;
}
Expand All @@ -358,7 +358,7 @@ int CAutoUpdater::CompareVersions(CString ver1, CString ver2)
{
return -22; // Error in structure, too many parameters
}
wVer2[i] = atoi(pToken);
wVer2[i] = _tstoi(pToken);
pToken = strtok(NULL, _T("."));
i--;
}
Expand Down
2 changes: 1 addition & 1 deletion Lite/StrUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ char* strnstri(const char* str, const char* sub, int len)
int sl = strlen(sub);
for (pstr = str; pstr <= pend - sl; pstr++)
{
if (!strnicmp(pstr, sub, sl))
if (!_tcsncicmp(pstr, sub, sl))
return (char*)pstr;
}
return NULL;
Expand Down

0 comments on commit db4de19

Please sign in to comment.