Skip to content

Commit

Permalink
RLogin-2.29.6
Browse files Browse the repository at this point in the history
  • Loading branch information
kmiya-culti committed Jul 21, 2024
1 parent 7ba5488 commit e746527
Show file tree
Hide file tree
Showing 78 changed files with 2,264 additions and 594 deletions.
39 changes: 37 additions & 2 deletions RLogin/BPlus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,50 @@ const unsigned short crc16tab[] = {
CBPlus::CBPlus(class CRLoginDoc *pDoc, CWnd *pWnd) : CSyncSock(pDoc, pWnd)
{
m_ProtoName = _T("BPlus");

BP_Special_Quoting = 1;
F_FileType = FALSE;
SA_Buf = new buf_type[Max_SA+1];

Seq_Num = 0;
CheckSum = crc_16 = 0;

His_WS = His_WR = His_BS = His_CM = 0;
ZeroMemory(His_QS, sizeof(His_QS));
His_DR = His_UR = His_FI = 0;
Our_WS = Our_WR = Our_BS = Our_CM = 0;
ZeroMemory(Our_QS, sizeof(Our_QS));
Our_DR = Our_UR = Our_FI = 0;

B_Plus = 0;
Use_CRC = 0;
Buffer_Size = 0;
Mx_Bf_Sz = 0;
SA_Max = 0;
SA_Error_Count = 0;
ZeroMemory(Quote_Table, sizeof(Quote_Table));

R_Size = 0;
Timed_Out = Packet_Received = masked = 0;
SA_Next_to_ACK = 0;
SA_Next_to_Fill = 0;
SA_Waiting = 0;
Aborting = 0;

SA_Buf = new buf_type[Max_SA + 1];
R_buffer = new char[Max_Buf_Size];

e_ch = 0;

S_File_Size = R_File_Size = S_Remaining = R_Remaining = 0;
Resume_Flag = 0;

F_Ctime = F_Mtime = 0;
F_FileType = FALSE;
}

CBPlus::~CBPlus()
{
delete [] SA_Buf;
delete [] R_buffer;
}

void CBPlus::OnProc(int cmd)
Expand Down
2 changes: 1 addition & 1 deletion RLogin/BPlus.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CBPlus : public CSyncSock
int Aborting;

buf_type *SA_Buf;
char R_buffer[Max_Buf_Size];
char *R_buffer;

int e_ch;

Expand Down
3 changes: 3 additions & 0 deletions RLogin/BackPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ CBackPage::CBackPage() : CTreePage(CBackPage::IDD)
m_TextFormat.Empty();
m_MapStyle = 0;
m_UrlOpt = _T("#BACKSET");
m_TextColor = m_TabTextColor = m_TabBackColor = 0;
m_TabBackGradient = FALSE;
m_bTabColDark = FALSE;
ZeroMemory(&m_LogFont, sizeof(m_LogFont));
}
CBackPage::~CBackPage()
{
Expand Down
1 change: 1 addition & 0 deletions RLogin/BlockDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ CBlockDlg::CBlockDlg(CWnd* pParent /*=NULL*/)
m_SelBlock = (-1);
m_ScrollPos = 0;
m_ScrollPage = 0;
m_ScrollMax = 0;
}
CBlockDlg::~CBlockDlg()
{
Expand Down
3 changes: 2 additions & 1 deletion RLogin/CharSetPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@ void CCharSetPage::OnEditDelall()
{
CInitAllDlg dlg;

dlg.m_Title.LoadString(IDS_INITFONTSETTITLE);
if ( dlg.m_Title.LoadString(IDS_INITFONTSETTITLE) == 0 )
dlg.m_Title.Empty();

if ( dlg.DoModal() != IDOK )
return;
Expand Down
14 changes: 9 additions & 5 deletions RLogin/ColParaDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,25 @@ IMPLEMENT_DYNCREATE(CColParaDlg, CTreePage)

CColParaDlg::CColParaDlg() : CTreePage(CColParaDlg::IDD)
{
m_UrlOpt = _T("#COLOPT");

m_ColSet = -1;
for ( int n = 0 ; n < 24 ; n++ )
m_Attrb[n] = 0;
m_WakeUpSleep = 0;
m_FontCol[0] = 0;
m_FontCol[1] = 0;
m_FontColName[0] = _T("0");
m_FontColName[1] = _T("0");
ZeroMemory(m_ColTab, sizeof(m_ColTab));
ZeroMemory(m_Attrb, sizeof(m_Attrb));
m_GlassStyle = FALSE;
m_DarkMode = TRUE;

m_EmojiColorMode = EMOJIMODE_MONO;
m_EmojiFontName = _T("");
m_EmojiImageDir = _T("");
m_EmojiColorMode = EMOJIMODE_MONO;
m_UrlOpt = _T("#COLOPT");
m_Constrast = 0.0;

m_Constrast = m_Bright = 0.0;
ZeroMemory(m_Huecol, sizeof(m_Huecol));
}
CColParaDlg::~CColParaDlg()
{
Expand Down
7 changes: 5 additions & 2 deletions RLogin/ComInitDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ CComInitDlg::CComInitDlg(CWnd* pParent /*=NULL*/)
{
m_pSock = NULL;
m_ComIndex = 0;
m_BaudRate = _T("9600");
m_DataBits = _T("8");
m_ParityBit = ParityBitsName[0];
m_StopBits = StopBitsName[0];
m_FlowCtrl = 1;
m_BaudRate = _T("9600");

m_XoffLim = m_XonLim = 0;
m_XonChar = m_XoffChar = 0;

m_SendWait[0] = 0;
m_SendWait[1] = 0;
m_XonLim = 0;
}
CComInitDlg::~CComInitDlg()
{
Expand Down
5 changes: 3 additions & 2 deletions RLogin/ComSock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ CComSock::CComSock(class CRLoginDoc *pDoc):CExtSocket(pDoc)

m_SendWait[0] = 0;
m_SendWait[1] = 0;
m_SendCrLf = 0;

m_ComEvent = 0;
m_CommError = 0;
Expand Down Expand Up @@ -877,7 +878,7 @@ BOOL CComSock::LoadComConf(LPCTSTR ComSetStr, int ComPort, BOOL bOpen)
return FALSE;
} else
m_hCom = hCom;
} else if ( hCom != INVALID_HANDLE_VALUE )
} else if ( hCom != INVALID_HANDLE_VALUE && hCom != NULL )
::CloseHandle(hCom);

if ( m_pComConf != NULL )
Expand Down Expand Up @@ -1113,7 +1114,7 @@ void CComSock::AliveComPort(BYTE pComAliveBits[COMALIVEBYTE])

} else if ( --ReTry > 0 && ::GetLastError() == ERROR_INSUFFICIENT_BUFFER ) {
nBufLen *= 2;
delete pDevBuf;
delete [] pDevBuf;
pDevBuf = new TCHAR[nBufLen];
goto RETRY;

Expand Down
19 changes: 10 additions & 9 deletions RLogin/ControlBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,18 +358,19 @@ void CMiniDockFrameWndEx::OnNcLButtonDown(UINT nHitTest, CPoint point)
if ( (m_wndDockBar.m_dwStyle & CBRS_FLOAT_MULTI) == 0 ) {
int nPos = 1;
CControlBar* pBar = NULL;
while(pBar == NULL && nPos < m_wndDockBar.m_arrBars.GetSize())
pBar = (CControlBar *)m_wndDockBar.m_arrBars[nPos];
CDockContextEx *pCtx = (CDockContextEx *)pBar->m_pDockContext;
CDockContextEx* pCtx = NULL;

ASSERT(pBar != NULL && pCtx != NULL && pCtx->m_pDestroyWnd == NULL);
while( pBar == NULL && nPos < m_wndDockBar.m_arrBars.GetSize() )
pBar = (CControlBar *)m_wndDockBar.m_arrBars[nPos];

// CFrameWndの削除でghostwindowのような動作を抑制
pCtx->m_pDestroyWnd = this;
m_DelayedDestroy = DELAYDESTORY_RESERV;
if ( pBar != NULL && (pCtx = (CDockContextEx *)pBar->m_pDockContext) != NULL && pCtx->m_pDestroyWnd == NULL) {
// CFrameWndの削除でghostwindowのような動作を抑制
pCtx->m_pDestroyWnd = this;
m_DelayedDestroy = DELAYDESTORY_RESERV;

pBar->m_pDockContext->StartDrag(point);
return;
pBar->m_pDockContext->StartDrag(point);
return;
}
}
}

Expand Down
113 changes: 91 additions & 22 deletions RLogin/Data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,8 @@ void CBuffer::Base32Encode(LPBYTE buf, int len, BOOL bHex)
}
}

static const char *QuotedEncTab = "0123456789abcdef";
static const char *HexEncTab = "0123456789ABCDEF";
static const char *QuotedEncTab = "0123456789abcdef";
static const char QuotedDecTab[] = {
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
-1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
Expand Down Expand Up @@ -1238,6 +1239,58 @@ void CBuffer::PutHexBuf(LPBYTE buf, int len)
len--;
}
}
void CBuffer::IntelHexEncode(LPBYTE buf, int len)
{
while ( len > 0 ) {
PutByte(HexEncTab[*buf >> 4]);
PutByte(HexEncTab[*buf & 15]);
buf++;
len--;
}
}
LPCSTR CBuffer::IntelHexDecode(LPCSTR str)
{
int c1, c2;

Clear();
while ( *str != '\0' ) {
if ( (c1 = QuotedDecTab[(BYTE)str[0]]) >= 0 && (c2 = QuotedDecTab[(BYTE)str[1]]) >= 0 ) {
Put8Bit((c1 << 4) | c2);
str += 2;
} else
break;
}
return str;
}
void CBuffer::TekHexEncode(int val, int len)
{
int n;
char tmp[8];

for ( n = 0 ; n < len && n < 8 ; n++ ) {
tmp[n] = HexEncTab[val & 15];
val >>= 4;
}
while ( n > 0 )
PutByte(tmp[--n]);
}
int CBuffer::TekHexDecode(int pos, int len)
{
int n, d;
int val = 0;
LPBYTE p = GetPos(pos);

if ( (pos + len) > GetSize() )
return (-1);

for ( n = 0 ; n < len ; n++ ) {
if ( (d = QuotedDecTab[*(p++)]) == (-1) )
return (-1);
val = (val << 4) | d;
}

return val;
}

static const char BubBabVowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' };
static const char BubBabConsonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'z', 'x' };
Expand Down Expand Up @@ -1558,8 +1611,8 @@ void CBuffer::IshEncJis7(LPBYTE buf, int len)
d = data.GetBits(13);
du = d / 91;
dl = d - du * 91;
PutByte(ent_j7[du & 0x7f]);
PutByte(ent_j7[dl & 0x7f]);
PutByte(ent_j7[du % 91]);
PutByte(ent_j7[dl % 91]);
}
}

Expand Down Expand Up @@ -2170,11 +2223,11 @@ BOOL CBuffer::HuffmanDecode(LPBYTE buf, int len)
c = *(buf++);
len--;

t = &qpack_huffman_decode_table[t->fstate & 0x1ff][c >> 4];
t = &qpack_huffman_decode_table[t->fstate % 257][c >> 4];
if (t->fstate & NGHTTP3_QPACK_HUFFMAN_SYM)
PutByte(t->sym);

t = &qpack_huffman_decode_table[t->fstate & 0x1ff][c & 0xf];
t = &qpack_huffman_decode_table[t->fstate % 257][c & 0xf];
if (t->fstate & NGHTTP3_QPACK_HUFFMAN_SYM)
PutByte(t->sym);
}
Expand Down Expand Up @@ -3387,11 +3440,16 @@ CStringLoad::CStringLoad(int nID, BOOL bMenu)
Delete(0, n + 1);
}

BOOL CStringLoad::LoadString(UINT nID)
int CStringLoad::LoadString(UINT nID)
{
return ((CRLoginApp *)AfxGetApp())->LoadResString(MAKEINTRESOURCE(nID), *this);
BOOL rt = ((CRLoginApp *)AfxGetApp())->LoadResString(MAKEINTRESOURCE(nID), *this);

if ( !rt )
Empty();

return (rt ? 1 : 0);
}
BOOL CStringLoad::IsDigit(LPCTSTR str)
int CStringLoad::IsDigit(LPCTSTR str)
{
return (*str >= _T('0') && *str <= _T('9') ? TRUE : FALSE);
}
Expand Down Expand Up @@ -10736,7 +10794,7 @@ void CStringIndex::SubSetXmlElemnt(CBuffer &str, int nest)

for ( n = 0 ; n < GetSize() ; n++ ) {
if ( m_Array[n].GetSize() == 0 && !m_Array[n].m_nIndex.IsEmpty() && !IsDupIndex(m_Array[n].m_nIndex) ) {
tmp.Format(_T(" %s"), m_Array[n].m_nIndex);
tmp.Format(_T(" %s"), (LPCTSTR)m_Array[n].m_nIndex);
str += (LPCTSTR)tmp;
if ( !m_Array[n].IsEmpty() ) {
str += _T("=\"");
Expand Down Expand Up @@ -11656,12 +11714,26 @@ BOOL CHttpSession::GetRequest(LPCTSTR url, CBuffer &buf, LPCTSTR head, LPCSTR bo

return rc;
}

//////////////////////////////////////////////////////////////////////
// CHttpThreadSession

CHttpThreadSession::CHttpThreadSession(LPCTSTR url, LPCTSTR head, LPCSTR body, CWnd *pWnd)
{
m_TheadhWnd = (pWnd == NULL ? NULL : pWnd->GetSafeHwnd());
m_ThreadUrl = (url == NULL ? _T("") : url);
m_ThreadHead = (head == NULL ? _T("") : head);
m_ThreadBody = (body == NULL ? "" : body);
}

static UINT ThreadRequestProc(LPVOID pParam)
{
CHttpThreadSession *pSess = (CHttpThreadSession *)pParam;
CBuffer *pBuf = new CBuffer;
CString *pMsg = new CString;

ASSERT(pSess != NULL && pSess->m_TheadhWnd != NULL && !pSess->m_ThreadUrl.IsEmpty());

if ( pSess->GetRequest(pSess->m_ThreadUrl, *pBuf, pSess->m_ThreadHead, pSess->m_ThreadBody, pMsg) ) {
::PostMessage(pSess->m_TheadhWnd, WM_HTTPREQUEST, (WPARAM)TRUE, (LPARAM)pBuf);
delete pMsg;
Expand All @@ -11676,19 +11748,22 @@ static UINT ThreadRequestProc(LPVOID pParam)
}
void CHttpThreadSession::Request(LPCTSTR url, LPCTSTR head, LPCSTR body, CWnd *pWnd)
{
CHttpThreadSession *pSess = new CHttpThreadSession;

pSess->m_TheadhWnd = pWnd->GetSafeHwnd();
pSess->m_ThreadUrl = url;
pSess->m_ThreadHead = (head == NULL ? _T("") : head);
pSess->m_ThreadBody = (body == NULL ? "" : body);
CHttpThreadSession *pSess = new CHttpThreadSession(url, head, body, pWnd);

AfxBeginThread(ThreadRequestProc, pSess, THREAD_PRIORITY_BELOW_NORMAL);
}

//////////////////////////////////////////////////////////////////////
// CEmojiDocPos

CEmojiDocPos::CEmojiDocPos(CRLoginDoc* pDoc, int Seq, int Abs, RECT Pos)
{
m_pBack = m_pNext = NULL;
m_pDoc = pDoc;
m_Seq = Seq;
m_Abs = Abs;
m_Pos = Pos;
}
CEmojiDocPos *CEmojiDocPos::AddList(CEmojiDocPos *pTop)
{
if ( pTop == NULL )
Expand Down Expand Up @@ -11800,13 +11875,7 @@ CEmojiImage::~CEmojiImage()
}
void CEmojiImage::Add(class CRLoginDoc *pDoc, CRect pos)
{
CEmojiDocPos *pDocPos = new CEmojiDocPos;

pDocPos->m_pDoc = pDoc;
pDocPos->m_Seq = pDoc->m_DocSeqNumber;
pDocPos->m_Pos = pos;
pDocPos->m_Abs = pDoc->m_TextRam.m_HisAbs;

CEmojiDocPos *pDocPos = new CEmojiDocPos(pDoc, pDoc->m_DocSeqNumber, pDoc->m_TextRam.m_HisAbs, pos);
m_pDocPos = pDocPos->AddTail(m_pDocPos);
}

Expand Down
Loading

0 comments on commit e746527

Please sign in to comment.