Revision: 10708 https://osdn.net/projects/ttssh2/scm/svn/commits/10708 Author: zmatsuo Date: 2023-05-16 22:16:24 +0900 (Tue, 16 May 2023) Log Message: ----------- 各転送Protocolソース内で直接dialogの変更を行わないようにした - PFileVarProto構造体経由に修正 - r9059近辺の修正の残り - 関数に static を追加、インデントを調整 Modified Paths: -------------- trunk/teraterm/ttpfile/bplus.c trunk/teraterm/ttpfile/kermit.c trunk/teraterm/ttpfile/quickvan.c trunk/teraterm/ttpfile/xmodem.c trunk/teraterm/ttpfile/ymodem.c trunk/teraterm/ttpfile/zmodem.c -------------- next part -------------- Modified: trunk/teraterm/ttpfile/bplus.c =================================================================== --- trunk/teraterm/ttpfile/bplus.c 2023-05-14 15:37:41 UTC (rev 10707) +++ trunk/teraterm/ttpfile/bplus.c 2023-05-16 13:16:24 UTC (rev 10708) @@ -31,7 +31,6 @@ #include "teraterm.h" #include "tttypes.h" #include <string.h> -#include "tt_res.h" #include "dlglib.h" #include "ftlib.h" @@ -45,34 +44,34 @@ /* B Plus */ typedef struct { - BYTE WS; - BYTE WR; - BYTE B_S; - BYTE CM; - BYTE DQ; - BYTE TL; - BYTE Q[8]; - BYTE DR; - BYTE UR; - BYTE FI; + BYTE WS; + BYTE WR; + BYTE B_S; + BYTE CM; + BYTE DQ; + BYTE TL; + BYTE Q[8]; + BYTE DR; + BYTE UR; + BYTE FI; } TBPParam; typedef struct { - BYTE PktIn[2066], PktOut[2066]; - int PktInCount, CheckCount; - int PktOutLen, PktOutCount, PktOutPtr; - LONG Check, CheckCalc; - BYTE PktNum, PktNumSent; - int PktNumOffset; - int PktSize; - WORD BPMode, BPState, BPPktState; - BOOL GetPacket, EnqSent; - BYTE MaxBS, CM; - BOOL Quoted; - int TimeOut; - BOOL CtlEsc; - BYTE Q[8]; + BYTE PktIn[2066], PktOut[2066]; + int PktInCount, CheckCount; + int PktOutLen, PktOutCount, PktOutPtr; + LONG Check, CheckCalc; + BYTE PktNum, PktNumSent; + int PktNumOffset; + int PktSize; + WORD BPMode, BPState, BPPktState; + BOOL GetPacket, EnqSent; + BYTE MaxBS, CM; + BOOL Quoted; + int TimeOut; + BOOL CtlEsc; + BYTE Q[8]; TProtoLog *log; const char *FullName; // Windows\x8F\xE3\x82̃t\x83@\x83C\x83\x8B\x96\xBC UTF-8 WORD LogState; @@ -146,9 +145,9 @@ } BPDispMode(fv,bv); - SetDlgItemText(fv->HWin, IDC_PROTOPROT, "B-Plus"); + fv->SetDlgProtoText(fv, "B-Plus"); - InitDlgProgress(fv->HWin, IDC_PROTOPROGRESS, &fv->ProgStat); + fv->InitDlgProgress(fv, &fv->ProgStat); fv->StartTime = GetTickCount(); /* file name, file size */ @@ -527,11 +526,10 @@ i = i - 4; BPMakePacket(bv,'N',i); - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, fv->ByteCount); + fv->SetDlgByteCount(fv, fv->ByteCount); if (fv->FileSize>0) - SetDlgPercent(fv->HWin, IDC_PROTOPERCENT, IDC_PROTOPROGRESS, - fv->ByteCount, fv->FileSize, &fv->ProgStat); - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, fv->StartTime, fv->ByteCount); + fv->SetDlgPercent(fv, fv->ByteCount, fv->FileSize, &fv->ProgStat); + fv->SetDlgTime(fv, fv->StartTime, fv->ByteCount); } static void BPCheckPacket(PFileVarProto fv, PBPVar bv, PComVar cv) @@ -555,8 +553,7 @@ bv->PktNum = 0; bv->PktNumOffset = bv->PktNumOffset + 10; } - SetDlgNum(fv->HWin, IDC_PROTOPKTNUM, - bv->PktNum + bv->PktNumOffset); + fv->SetDlgPaketNum(fv, bv->PktNum + bv->PktNumOffset); if (bv->PktIn[1] != '+') BPSendACK(fv,bv,cv); /* Send ack */ @@ -735,45 +732,44 @@ static void BPParsePacket(PFileVarProto fv, PBPVar bv) { - TFileIO *fileio = fv->file; - bv->GetPacket = FALSE; - /* Packet type */ + TFileIO *fileio = fv->file; + bv->GetPacket = FALSE; + /* Packet type */ - switch (bv->PktIn[1]) { + switch (bv->PktIn[1]) { case '+': /* Transport parameters */ - if (bv->BPState==BP_Init) - BPSendInit(bv); - else - BPSendFailure(bv,'E'); - return; + if (bv->BPState==BP_Init) + BPSendInit(bv); + else + BPSendFailure(bv,'E'); + return; case 'F': /* Failure */ - if (! fv->NoMsg) - MessageBox(fv->HMainWin,"Transfer failure", - "Tera Term: Error",MB_ICONEXCLAMATION); - bv->BPState = BP_Close; - break; + if (! fv->NoMsg) + MessageBox(fv->HMainWin,"Transfer failure", + "Tera Term: Error",MB_ICONEXCLAMATION); + bv->BPState = BP_Close; + break; case 'N': /* Data */ - if ((bv->BPState==BP_RecvFile) && - fv->FileOpen) - bv->BPState = BP_RecvData; - else if (bv->BPState != BP_RecvData) - { - BPSendFailure(bv,'E'); - return; - } - fileio->WriteFile(fileio, &(bv->PktIn[2]), bv->PktInCount-2); - fv->ByteCount = fv->ByteCount + - bv->PktInCount - 2; - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, fv->ByteCount); - if (fv->FileSize>0) - SetDlgPercent(fv->HWin, IDC_PROTOPERCENT, IDC_PROTOPROGRESS, - fv->ByteCount, fv->FileSize, &fv->ProgStat); - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, fv->StartTime, fv->ByteCount); - break; + if ((bv->BPState==BP_RecvFile) && + fv->FileOpen) + bv->BPState = BP_RecvData; + else if (bv->BPState != BP_RecvData) + { + BPSendFailure(bv,'E'); + return; + } + fileio->WriteFile(fileio, &(bv->PktIn[2]), bv->PktInCount-2); + fv->ByteCount = fv->ByteCount + + bv->PktInCount - 2; + fv->SetDlgByteCount(fv, fv->ByteCount); + if (fv->FileSize>0) + fv->SetDlgPercent(fv, fv->ByteCount, fv->FileSize, &fv->ProgStat); + fv->SetDlgTime(fv, fv->StartTime, fv->ByteCount); + break; case 'T': - BPParseTPacket(fv,bv); /* File transfer */ - break; - } + BPParseTPacket(fv,bv); /* File transfer */ + break; + } } static void BPParseAck(PFileVarProto fv, PBPVar bv, BYTE b) @@ -832,7 +828,7 @@ break; case BP_Failure: bv->BPState = BP_Close; break; } - SetDlgNum(fv->HWin, IDC_PROTOPKTNUM, bv->PktNum + bv->PktNumOffset); + fv->SetDlgPaketNum(fv, bv->PktNum + bv->PktNumOffset); } static void BPDequote(LPBYTE b) Modified: trunk/teraterm/ttpfile/kermit.c =================================================================== --- trunk/teraterm/ttpfile/kermit.c 2023-05-14 15:37:41 UTC (rev 10707) +++ trunk/teraterm/ttpfile/kermit.c 2023-05-16 13:16:24 UTC (rev 10708) @@ -36,7 +36,6 @@ #include <sys/stat.h> #include <sys/utime.h> -#include "tt_res.h" #include "ttcommon.h" #include "ttlib.h" #include "dlglib.h" @@ -709,9 +708,9 @@ } if (Buff==NULL) - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, fv->ByteCount); + fv->SetDlgByteCount(fv, fv->ByteCount); *BuffLen = BuffPtr; - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, fv->StartTime, fv->ByteCount); + fv->SetDlgTime(fv, fv->StartTime, fv->ByteCount); } static void KmtRecvFileAttr(PFileVarProto fv, PKmtVar kv, PCHAR Buff, int *BuffLen) @@ -968,10 +967,9 @@ int DataLen, DataLenNew, maxlen; BOOL NextFlag; - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, fv->ByteCount); - SetDlgPercent(fv->HWin, IDC_PROTOPERCENT, IDC_PROTOPROGRESS, - fv->ByteCount, fv->FileSize, &fv->ProgStat); - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, fv->StartTime, fv->ByteCount); + fv->SetDlgByteCount(fv, fv->ByteCount); + fv->SetDlgPercent(fv, fv->ByteCount, fv->FileSize, &fv->ProgStat); + fv->SetDlgTime(fv, fv->StartTime, fv->ByteCount); DataLen = 0; DataLenNew = 0; @@ -1000,10 +998,9 @@ if (DataLen==0) { - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, fv->ByteCount); - SetDlgPercent(fv->HWin, IDC_PROTOPERCENT, IDC_PROTOPROGRESS, - fv->ByteCount, fv->FileSize, &fv->ProgStat); - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, fv->StartTime, fv->ByteCount); + fv->SetDlgByteCount(fv, fv->ByteCount); + fv->SetDlgPercent(fv, fv->ByteCount, fv->FileSize, &fv->ProgStat); + fv->SetDlgTime(fv, fv->StartTime, fv->ByteCount); KmtSendEOFPacket(fv,kv,cv); } else { @@ -1075,10 +1072,10 @@ fv->StartTime = GetTickCount(); fv->SetDlgProtoFileName(fv, kv->FullName); - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, fv->ByteCount); - SetDlgPercent(fv->HWin, IDC_PROTOPERCENT, IDC_PROTOPROGRESS, + fv->SetDlgByteCount(fv, fv->ByteCount); + fv->SetDlgPercent(fv, fv->ByteCount, fv->FileSize, &fv->ProgStat); - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, fv->StartTime, fv->ByteCount); + fv->SetDlgTime(fv, fv->StartTime, fv->ByteCount); KmtIncPacketNum(kv); filename = file->GetSendFilename(file, kv->FullName, FALSE, TRUE, FALSE); @@ -1174,10 +1171,10 @@ { PKmtVar kv = fv->data; - SetDlgItemText(fv->HWin, IDC_PROTOPROT, "Kermit"); + fv->SetDlgProtoText(fv, "Kermit"); if (kv->KmtMode == IdKmtSend) { - InitDlgProgress(fv->HWin, IDC_PROTOPROGRESS, &fv->ProgStat); + fv->InitDlgProgress(fv, &fv->ProgStat); fv->StartTime = GetTickCount(); } else { @@ -1640,7 +1637,7 @@ kv->PktNumOffset = kv->PktNumOffset + 64; } - SetDlgNum(fv->HWin, IDC_PROTOPKTNUM, kv->PktNum); + fv->SetDlgPaketNum(fv, kv->PktNum); return TRUE; } Modified: trunk/teraterm/ttpfile/quickvan.c =================================================================== --- trunk/teraterm/ttpfile/quickvan.c 2023-05-14 15:37:41 UTC (rev 10707) +++ trunk/teraterm/ttpfile/quickvan.c 2023-05-16 13:16:24 UTC (rev 10708) @@ -36,7 +36,6 @@ #include <sys/utime.h> #include <sys/stat.h> -#include "tt_res.h" #include "dlglib.h" #include "ftlib.h" #include "ttlib.h" @@ -46,20 +45,20 @@ /* Quick-VAN */ typedef struct { - BYTE PktIn[142], PktOut[142]; - int PktInCount, PktInPtr; - int PktOutCount, PktOutPtr, PktOutLen; - WORD Ver, WinSize; - WORD QVMode, QVState, PktState; - WORD AValue; - WORD SeqNum; - WORD FileNum; - int RetryCount; - BOOL CanFlag; - WORD Year,Month,Day,Hour,Min,Sec; - WORD SeqSent, WinEnd, FileEnd; - BOOL EnqFlag; - BYTE CheckSum; + BYTE PktIn[142], PktOut[142]; + int PktInCount, PktInPtr; + int PktOutCount, PktOutPtr, PktOutLen; + WORD Ver, WinSize; + WORD QVMode, QVState, PktState; + WORD AValue; + WORD SeqNum; + WORD FileNum; + int RetryCount; + BOOL CanFlag; + WORD Year,Month,Day,Hour,Min,Sec; + WORD SeqSent, WinEnd, FileEnd; + BOOL EnqFlag; + BYTE CheckSum; TProtoLog *log; const char *FullName; // Windows\x8F\xE3\x82̃t\x83@\x83C\x83\x8B\x96\xBC UTF-8 WORD LogState; @@ -174,9 +173,9 @@ fv->FileOpen = FALSE; fv->ByteCount = 0; - SetDlgItemText(fv->HWin, IDC_PROTOPROT, "Quick-VAN"); + fv->SetDlgProtoText(fv, "Quick-VAN"); - InitDlgProgress(fv->HWin, IDC_PROTOPROGRESS, &fv->ProgStat); + fv->InitDlgProgress(fv, &fv->ProgStat); fv->StartTime = GetTickCount(); qv->SeqNum = 0; @@ -493,11 +492,10 @@ /* sec */ QVGetNum2(qv,&i,&(qv->Sec)); - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, 0); + fv->SetDlgByteCount(fv, 0); if (fv->FileSize>0) - SetDlgPercent(fv->HWin, IDC_PROTOPERCENT, IDC_PROTOPROGRESS, - 0, fv->FileSize, &fv->ProgStat); - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, fv->StartTime, fv->ByteCount); + fv->SetDlgPercent(fv, 0, fv->FileSize, &fv->ProgStat); + fv->SetDlgTime(fv, fv->StartTime, fv->ByteCount); /* Send VRPOS */ QVSetResPacket(qv,'P',0,0); @@ -574,12 +572,11 @@ file->WriteFile(file,&(qv->PktIn[3]),C); fv->ByteCount = fv->ByteCount + C; - SetDlgNum(fv->HWin, IDC_PROTOPKTNUM, qv->SeqNum); - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, fv->ByteCount); + fv->SetDlgPaketNum(fv, qv->SeqNum); + fv->SetDlgByteCount(fv, fv->ByteCount); if (fv->FileSize>0) - SetDlgPercent(fv->HWin, IDC_PROTOPERCENT, IDC_PROTOPROGRESS, - fv->ByteCount, fv->FileSize, &fv->ProgStat); - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, fv->StartTime, fv->ByteCount); + fv->SetDlgPercent(fv, fv->ByteCount, fv->FileSize, &fv->ProgStat); + fv->SetDlgTime(fv, fv->StartTime, fv->ByteCount); } static BOOL QVCheckWindow8(PQVVar qv, WORD w0, WORD w1, BYTE b, LPWORD w) @@ -960,11 +957,10 @@ file->Seek(file, Pos); file->ReadFile(file,&(qv->PktOut[3]),C); fv->ByteCount = Pos + (LONG)C; - SetDlgNum(fv->HWin, IDC_PROTOPKTNUM, qv->SeqSent); - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, fv->ByteCount); - SetDlgPercent(fv->HWin, IDC_PROTOPERCENT, IDC_PROTOPROGRESS, - fv->ByteCount, fv->FileSize, &fv->ProgStat); - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, fv->StartTime, fv->ByteCount); + fv->SetDlgPaketNum(fv, qv->SeqSent); + fv->SetDlgByteCount(fv, fv->ByteCount); + fv->SetDlgPercent(fv, fv->ByteCount, fv->FileSize, &fv->ProgStat); + fv->SetDlgTime(fv, fv->StartTime, fv->ByteCount); for (i = C ; i <= 127 ; i++) qv->PktOut[3+i] = 0; /* send VDAT */ Modified: trunk/teraterm/ttpfile/xmodem.c =================================================================== --- trunk/teraterm/ttpfile/xmodem.c 2023-05-14 15:37:41 UTC (rev 10707) +++ trunk/teraterm/ttpfile/xmodem.c 2023-05-16 13:16:24 UTC (rev 10708) @@ -40,22 +40,22 @@ /* XMODEM */ typedef struct { - BYTE PktIn[1030], PktOut[1030]; - int PktBufCount, PktBufPtr; - BYTE PktNum, PktNumSent; - int PktNumOffset; - int PktReadMode; - WORD XMode, XOpt, TextFlag; - WORD NAKMode; - int NAKCount; - WORD DataLen, CheckLen; - BOOL CRRecv; - int TOutShort; - int TOutLong; - int TOutInit; - int TOutInitCRC; - int TOutVLong; - int CANCount; + BYTE PktIn[1030], PktOut[1030]; + int PktBufCount, PktBufPtr; + BYTE PktNum, PktNumSent; + int PktNumOffset; + int PktReadMode; + WORD XMode, XOpt, TextFlag; + WORD NAKMode; + int NAKCount; + WORD DataLen, CheckLen; + BOOL CRRecv; + int TOutShort; + int TOutLong; + int TOutInit; + int TOutInitCRC; + int TOutVLong; + int CANCount; TProtoLog *log; const char *FullName; // Windows\x8F\xE3\x82̃t\x83@\x83C\x83\x8B\x96\xBC UTF-8 WORD LogState; @@ -73,10 +73,7 @@ #define XnakNAK 1 #define XnakC 2 -BOOL XParse(PFileVarProto fv, PComVar cv); -void XTimeOutProc(PFileVarProto fv, PComVar cv); -void XCancel(PFileVarProto fv, PComVar cv); -static int SetOptV(PFileVarProto fv, int request, va_list ap); +static void XCancel(PFileVarProto fv, PComVar cv); static int XRead1Byte(PFileVarProto fv, PXVar xv, PComVar cv, LPBYTE b) { @@ -217,7 +214,7 @@ (LOBYTE(Check) == xv->PktIn[xv->DataLen + 4])); } -BOOL XInit(PFileVarProto fv, PComVar cv, PTTSet ts) +static BOOL XInit(PFileVarProto fv, PComVar cv, PTTSet ts) { TFileIO *file = fv->file; PXVar xv = fv->data; @@ -305,7 +302,7 @@ return TRUE; } -void XCancel(PFileVarProto fv, PComVar cv) +static void XCancel(PFileVarProto fv, PComVar cv) { PXVar xv = fv->data; // five cancels & five backspaces per spec @@ -315,7 +312,7 @@ xv->XMode = 0; // quit } -void XTimeOutProc(PFileVarProto fv, PComVar cv) +static void XTimeOutProc(PFileVarProto fv, PComVar cv) { PXVar xv = fv->data; switch (xv->XMode) { @@ -636,7 +633,7 @@ return TRUE; } -BOOL XParse(PFileVarProto fv, PComVar cv) +static BOOL XParse(PFileVarProto fv, PComVar cv) { PXVar xv = fv->data; switch (xv->XMode) { Modified: trunk/teraterm/ttpfile/ymodem.c =================================================================== --- trunk/teraterm/ttpfile/ymodem.c 2023-05-14 15:37:41 UTC (rev 10707) +++ trunk/teraterm/ttpfile/ymodem.c 2023-05-16 13:16:24 UTC (rev 10708) @@ -36,7 +36,6 @@ #include "teraterm.h" #include "tttypes.h" -#include "tt_res.h" #include "ttcommon.h" #include "ttlib.h" #include "ftlib.h" @@ -46,27 +45,27 @@ /* YMODEM */ typedef struct { - BYTE PktIn[1030], PktOut[1030]; - int PktBufCount, PktBufPtr; - BYTE PktNum, PktNumSent; - int PktNumOffset; - int PktReadMode; - WORD YMode, YOpt, TextFlag; - WORD NAKMode; - int NAKCount; - WORD __DataLen, CheckLen; - BOOL CRRecv; - int TOutShort; - int TOutLong; - int TOutInit; - int TOutInitCRC; - int TOutVLong; - int SendFileInfo; - int SendEot; - int LastSendEot; - WORD DataLen; - BYTE LastMessage; - BOOL RecvFilesize; + BYTE PktIn[1030], PktOut[1030]; + int PktBufCount, PktBufPtr; + BYTE PktNum, PktNumSent; + int PktNumOffset; + int PktReadMode; + WORD YMode, YOpt, TextFlag; + WORD NAKMode; + int NAKCount; + WORD __DataLen, CheckLen; + BOOL CRRecv; + int TOutShort; + int TOutLong; + int TOutInit; + int TOutInitCRC; + int TOutVLong; + int SendFileInfo; + int SendEot; + int LastSendEot; + WORD DataLen; + BYTE LastMessage; + BOOL RecvFilesize; TProtoLog *log; const char *FullName; // Windows\x8F\xE3\x82̃t\x83@\x83C\x83\x8B\x96\xBC UTF-8 WORD LogState; @@ -169,7 +168,7 @@ yv->CheckLen = 2; break; } - SetDlgItemText(fv->HWin, IDC_PROTOPROT, Tmp); + fv->SetDlgProtoText(fv, Tmp); } static void YSendNAK(PFileVarProto fv, PYVar yv, PComVar cv) @@ -313,7 +312,7 @@ } if (yv->YMode == IdYSend) { - InitDlgProgress(fv->HWin, IDC_PROTOPROGRESS, &fv->ProgStat); + fv->InitDlgProgress(fv, &fv->ProgStat); } else { fv->ProgStat = -1; } @@ -714,9 +713,9 @@ fv->ByteCount = fv->ByteCount + c; - SetDlgNum(fv->HWin, IDC_PROTOPKTNUM, yv->PktNumOffset+yv->PktNum); - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, fv->ByteCount); - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, fv->StartTime, fv->ByteCount); + fv->SetDlgPaketNum(fv, yv->PktNumOffset+yv->PktNum); + fv->SetDlgByteCount(fv, fv->ByteCount); + fv->SetDlgTime(fv, fv->StartTime, fv->ByteCount); fv->FTSetTimeOut(fv,yv->TOutLong); @@ -1109,17 +1108,16 @@ { if (0 == yv->PktNumSent) { - SetDlgNum(fv->HWin, IDC_PROTOPKTNUM, yv->PktNumOffset + 256); + fv->SetDlgPaketNum(fv, yv->PktNumOffset + 256); } else { - SetDlgNum(fv->HWin, IDC_PROTOPKTNUM, yv->PktNumOffset + yv->PktNumSent); + fv->SetDlgPaketNum(fv, yv->PktNumOffset + yv->PktNumSent); } - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, fv->ByteCount); - SetDlgPercent(fv->HWin, IDC_PROTOPERCENT, IDC_PROTOPROGRESS, - fv->ByteCount, fv->FileSize, &fv->ProgStat); - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, fv->StartTime, fv->ByteCount); + fv->SetDlgByteCount(fv, fv->ByteCount); + fv->SetDlgPercent(fv, fv->ByteCount, fv->FileSize, &fv->ProgStat); + fv->SetDlgTime(fv, fv->StartTime, fv->ByteCount); } return TRUE; Modified: trunk/teraterm/ttpfile/zmodem.c =================================================================== --- trunk/teraterm/ttpfile/zmodem.c 2023-05-14 15:37:41 UTC (rev 10707) +++ trunk/teraterm/ttpfile/zmodem.c 2023-05-16 13:16:24 UTC (rev 10708) @@ -51,8 +51,6 @@ #include <sys/types.h> #include <sys/stat.h> -#include "tt_res.h" - #include "dlglib.h" #include "ftlib.h" #include "ttcommon.h" @@ -62,22 +60,22 @@ /* ZMODEM */ typedef struct { - BYTE RxHdr[4], TxHdr[4]; - BYTE RxType, TERM; - BYTE PktIn[1032], PktOut[1032]; - int PktInPtr, PktOutPtr; - int PktInCount, PktOutCount; - int PktInLen; - BOOL BinFlag; - BOOL Sending; - int ZMode, ZState, ZPktState; - int MaxDataLen, TimeOut, CanCount; - BOOL CtlEsc, CRC32, HexLo, Quoted, CRRecv; - WORD CRC; - LONG CRC3, Pos, LastPos, WinSize; - BYTE LastSent; - int TOutInit; - int TOutFin; + BYTE RxHdr[4], TxHdr[4]; + BYTE RxType, TERM; + BYTE PktIn[1032], PktOut[1032]; + int PktInPtr, PktOutPtr; + int PktInCount, PktOutCount; + int PktInLen; + BOOL BinFlag; + BOOL Sending; + int ZMode, ZState, ZPktState; + int MaxDataLen, TimeOut, CanCount; + BOOL CtlEsc, CRC32, HexLo, Quoted, CRRecv; + WORD CRC; + LONG CRC3, Pos, LastPos, WinSize; + BYTE LastSent; + int TOutInit; + int TOutFin; TProtoLog *log; const char *FullName; // Windows\x8F\xE3\x82̃t\x83@\x83C\x83\x8B\x96\xBC UTF-8 WORD LogState; @@ -614,10 +612,9 @@ fv->ByteCount = 0; fv->ProgStat = 0; fv->StartTime = GetTickCount(); - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, fv->ByteCount); - SetDlgPercent(fv->HWin, IDC_PROTOPERCENT, IDC_PROTOPROGRESS, - fv->ByteCount, fv->FileSize, &fv->ProgStat); - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, fv->StartTime, fv->ByteCount); + fv->SetDlgByteCount(fv, fv->ByteCount); + fv->SetDlgPercent(fv, fv->ByteCount, fv->FileSize, &fv->ProgStat); + fv->SetDlgTime(fv, fv->StartTime, fv->ByteCount); add_sendbuf("%s: ZFILE: ZF0=%x ZF1=%x ZF2=%x file=%s size=%lu", __FUNCTION__, @@ -661,10 +658,9 @@ } } while ((c != 0) && (zv->PktOutCount <= zv->MaxDataLen - 2)); - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, fv->ByteCount); - SetDlgPercent(fv->HWin, IDC_PROTOPERCENT, IDC_PROTOPROGRESS, - fv->ByteCount, fv->FileSize, &fv->ProgStat); - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, fv->StartTime, fv->ByteCount); + fv->SetDlgByteCount(fv, fv->ByteCount); + fv->SetDlgPercent(fv, fv->ByteCount, fv->FileSize, &fv->ProgStat); + fv->SetDlgTime(fv, fv->StartTime, fv->ByteCount); zv->Pos = fv->ByteCount; zv->PktOut[zv->PktOutCount] = ZDLE; @@ -716,9 +712,9 @@ CommInsert1Byte(cv, ZPAD); } - SetDlgItemText(fv->HWin, IDC_PROTOPROT, "ZMODEM"); + fv->SetDlgProtoText(fv, "ZMODEM"); - InitDlgProgress(fv->HWin, IDC_PROTOPROGRESS, &fv->ProgStat); + fv->InitDlgProgress(fv, &fv->ProgStat); fv->StartTime = GetTickCount(); fv->FileSize = 0; @@ -1121,11 +1117,11 @@ ZStoHdr(zv, 0); zv->ZState = Z_RecvData; - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, 0); + fv->SetDlgByteCount(fv, 0); if (fv->FileSize > 0) - SetDlgPercent(fv->HWin, IDC_PROTOPERCENT, IDC_PROTOPROGRESS, + fv->SetDlgPercent(fv, 0, fv->FileSize, &fv->ProgStat); - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, GetTickCount(), fv->ByteCount); + fv->SetDlgTime(fv, GetTickCount(), fv->ByteCount); /* set timeout for data */ fv->FTSetTimeOut(fv, zv->TimeOut); @@ -1159,11 +1155,11 @@ fv->ByteCount = fv->ByteCount + zv->PktInPtr; zv->Pos = zv->Pos + zv->PktInPtr; ZStoHdr(zv, zv->Pos); - SetDlgNum(fv->HWin, IDC_PROTOBYTECOUNT, fv->ByteCount); + fv->SetDlgByteCount(fv, fv->ByteCount); if (fv->FileSize > 0) - SetDlgPercent(fv->HWin, IDC_PROTOPERCENT, IDC_PROTOPROGRESS, + fv->SetDlgPercent(fv, fv->ByteCount, fv->FileSize, &fv->ProgStat); - SetDlgTime(fv->HWin, IDC_PROTOELAPSEDTIME, fv->StartTime, fv->ByteCount); + fv->SetDlgTime(fv, fv->StartTime, fv->ByteCount); /* set timeout for data */ fv->FTSetTimeOut(fv, zv->TimeOut);