AmendHub

Download:

jcs

/

subtext

/

amendments

/

270

zmodem: Fix compilation with ZMODEM_DEBUG enabled


jcs made amendment 270 over 2 years ago
--- zmodem.c Sun Nov 6 20:56:14 2022 +++ zmodem.c Mon Nov 7 11:50:14 2022 @@ -279,7 +279,7 @@ ZRead1Byte(struct zmodem_session *zs, unsigned char *b zs->LastIAC = 0; return 1; } - + if (session_get_char(zs->session, b) == 0) return 0; @@ -375,7 +375,7 @@ ZShHdr(struct zmodem_session *zs, unsigned char HdrTyp zs->Sending = true; #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZShHdr: %s", state_name(zs), + logger_printf("[%s] ZShHdr: %s", state_name(zs), hdrtype_name(HdrType)); #endif } @@ -458,7 +458,7 @@ ZSbHdr(struct zmodem_session *zs, unsigned char HdrTyp zs->Sending = true; #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZSbHdr: %s", state_name(zs), + logger_printf("[%s] ZSbHdr: %s", state_name(zs), hdrtype_name(HdrType)); #endif } @@ -561,7 +561,7 @@ ZSendCancel(struct zmodem_session *zs) zs->ZState = Z_Cancel; #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZSendCancel", state_name(zs)); + logger_printf("[%s] ZSendCancel", state_name(zs)); #endif } @@ -597,7 +597,7 @@ ZSendInitDat(struct zmodem_session *zs) zs->ZState = Z_SendInitDat; #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZSendInitDat", state_name(zs)); + logger_printf("[%s] ZSendInitDat", state_name(zs)); #endif } @@ -613,7 +613,7 @@ ZSendFileHdr(struct zmodem_session *zs) ZSbHdr(zs, ZFILE); #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZSendFileHdr: %s", state_name(zs), + logger_printf("[%s] ZSendFileHdr: %s", state_name(zs), zs->BinFlag ? "binary" : "text"); #endif } @@ -625,7 +625,7 @@ ZSendFileDat(struct zmodem_session *zs) if (!zs->file) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZSendFileDat: no file, canceling", + logger_printf("[%s] ZSendFileDat: no file, canceling", state_name(zs)); #endif ZSendCancel(zs); @@ -677,7 +677,7 @@ ZSendFileDat(struct zmodem_session *zs) fseek(zs->file, 0, SEEK_SET); #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZSendFileDat: ZFILE: ZF0=%x ZF1=%x " + logger_printf("[%s] ZSendFileDat: ZFILE: ZF0=%x ZF1=%x " "ZF2=%x file=%s size=%lu", state_name(zs), zs->TxHdr[ZF0], zs->TxHdr[ZF1],zs->TxHdr[ZF2], zs->file_name, zs->file_size); #endif @@ -699,8 +699,8 @@ ZSendDataDat(struct zmodem_session *zs) if (zs->Pos >= zs->file_size) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZSendDataDat: pos %lu >= file size " - "%lu, EOFing", state_name(zs), zs->Pos, zs->file_size); + logger_printf("[%s] ZSendDataDat: pos %lu >= file size %lu, EOFing", + state_name(zs), zs->Pos, zs->file_size); #endif zs->Pos = zs->file_size; ZSendEOF(zs); @@ -749,8 +749,7 @@ ZSendDataDat(struct zmodem_session *zs) ZResetTimeout(zs, zs->TimeOut); #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZSendDataDat: pos=%ld", state_name(zs), - zs->Pos); + logger_printf("[%s] ZSendDataDat: pos=%ld", state_name(zs), zs->Pos); #endif } @@ -794,7 +793,7 @@ ZInit(struct zmodem_session *zs) ZResetTimeout(zs, zs->TimeOut); #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZInit: %s", state_name(zs), + logger_printf("[%s] ZInit: %s", state_name(zs), zs->ZMode == IdZReceive ? "receive" : "send"); #endif @@ -818,7 +817,7 @@ void ZTimeOutProc(struct zmodem_session *zs) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZTimeOutProc", state_name(zs)); + logger_printf("[%s] ZTimeOutProc", state_name(zs)); #endif switch (zs->ZState) { @@ -857,16 +856,16 @@ ZCheckHdr(struct zmodem_session *zs) if (ok) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZCheckHdr: CRC%s ok", state_name(zs), + logger_printf("[%s] ZCheckHdr: CRC%s ok", state_name(zs), zs->CRC32 ? "32" : "16"); #endif } else { #ifdef ZMODEM_DEBUG if (zs->CRC32) - logger_printf(logger, "[%s] ZCheckHdr: CRC32 check failed " + logger_printf("[%s] ZCheckHdr: CRC32 check failed " "(0x%lx != 0xDEBB20E3)", state_name(zs), zs->CRC3); else - logger_printf(logger, "[%s] ZCheckHdr: CRC16 check failed " + logger_printf("[%s] ZCheckHdr: CRC16 check failed " "(0x%x != 0x0)", state_name(zs), zs->CRC); #endif switch (zs->ZState) { @@ -892,7 +891,7 @@ ZParseRInit(struct zmodem_session *zs) if ((zs->ZState != Z_SendInit) && (zs->ZState != Z_SendEOF)) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZParseRInit: not in Init or EOF", + logger_printf("[%s] ZParseRInit: not in Init or EOF", state_name(zs)); #endif return; @@ -900,7 +899,7 @@ ZParseRInit(struct zmodem_session *zs) if (!zs->file) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZParseRInit: no file, FINing", + logger_printf("[%s] ZParseRInit: no file, FINing", state_name(zs)); #endif zs->ZState = Z_SendFIN; @@ -924,8 +923,8 @@ ZParseRInit(struct zmodem_session *zs) zs->MaxDataLen = max; #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZParseRInit: max data len %d", - state_name(zs), zs->MaxDataLen); + logger_printf("[%s] ZParseRInit: max data len %d", state_name(zs), + zs->MaxDataLen); #endif zs->ZState = Z_SendFileHdr; @@ -937,7 +936,7 @@ ZParseSInit(struct zmodem_session *zs) { if (zs->ZState != Z_RecvInit) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZParseSInit: state not RecvInit", + logger_printf("[%s] ZParseSInit: state not RecvInit", state_name(zs)); #endif return false; @@ -953,7 +952,7 @@ void ZParseHdr(struct zmodem_session *zs) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZParseHdr: RxType %s", state_name(zs), + logger_printf("[%s] ZParseHdr: RxType %s", state_name(zs), hdrtype_name(zs->RxType)); #endif @@ -1055,7 +1054,7 @@ ZParseHdr(struct zmodem_session *zs) zs->Pos = ZRclHdr(zs); zs->LastPos = zs->Pos; #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZParseHdr: pos=%ld", state_name(zs), + logger_printf("[%s] ZParseHdr: pos=%ld", state_name(zs), zs->Pos); #endif ZSendDataHdr(zs); @@ -1100,7 +1099,7 @@ ZCreateTemporaryFile(struct zmodem_session *zs) { if (zs->upload_file_path[0] == '\0') { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZCreateTemporaryFile: no file path", + logger_printf("[%s] ZCreateTemporaryFile: no file path", state_name(zs)); #endif return false; @@ -1109,15 +1108,15 @@ ZCreateTemporaryFile(struct zmodem_session *zs) zs->file = fopen(zs->upload_file_path, "wb+"); if (zs->file == NULL) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZCreateTemporaryFile: opening %s failed", + logger_printf("[%s] ZCreateTemporaryFile: opening %s failed", state_name(zs), zs->upload_file_path); #endif return false; } #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZCreateTemporaryFile: %s", - state_name(zs), zs->upload_file_path); + logger_printf("[%s] ZCreateTemporaryFile: %s", state_name(zs), + zs->upload_file_path); #endif return true; @@ -1135,7 +1134,7 @@ ZParseFile(struct zmodem_session *zs) if ((zs->ZState != Z_RecvInit) && (zs->ZState != Z_RecvInit2)) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZParseFile: state not RecvInit/2", + logger_printf("[%s] ZParseFile: state not RecvInit/2", state_name(zs)); #endif return false; @@ -1158,7 +1157,7 @@ ZParseFile(struct zmodem_session *zs) } #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZParseFile: path \"%s\" -> \"%s\"", + logger_printf("[%s] ZParseFile: path \"%s\" -> \"%s\"", state_name(zs), (char *)&zs->PktIn, tfile_name); #endif @@ -1212,8 +1211,7 @@ ZWriteData(struct zmodem_session *zs) if (zs->ZState != Z_RecvData) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZWriteData: state != RecvData", - state_name(zs)); + logger_printf("[%s] ZWriteData: state != RecvData", state_name(zs)); #endif return false; } @@ -1234,7 +1232,7 @@ ZWriteData(struct zmodem_session *zs) } #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZWriteData: wrote %d byte(s) at %ld", + logger_printf("[%s] ZWriteData: wrote %d byte(s) at %ld", state_name(zs), zs->PktInPtr, zs->Pos); #endif @@ -1257,8 +1255,8 @@ ZCheckData(struct zmodem_session *zs) if ((zs->CRC32 && zs->CRC3 != 0xDEBB20E3) || (!zs->CRC32 && zs->CRC != 0)) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZCheckData: CRC%s failed", - state_name(zs), zs->CRC32 ? "32" : "16"); + logger_printf("[%s] ZCheckData: CRC%s failed", state_name(zs), + zs->CRC32 ? "32" : "16"); #endif switch (zs->ZState) { case Z_RecvInit: @@ -1290,7 +1288,7 @@ ZCheckData(struct zmodem_session *zs) if (!ok) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZCheckData: bad RxType %s, skipping", + logger_printf("[%s] ZCheckData: bad RxType %s, skipping", state_name(zs), hdrtype_name(zs->RxType)); #endif zs->ZPktState = Z_PktGetPAD; @@ -1325,7 +1323,7 @@ ZCheckData(struct zmodem_session *zs) } #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZCheckData: TERM %s", state_name(zs), + logger_printf("[%s] ZCheckData: TERM %s", state_name(zs), hdrtype_name(zs->TERM)); #endif @@ -1598,7 +1596,7 @@ void ZCancel(struct zmodem_session *zs) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZCancel", state_name(zs)); + logger_printf("[%s] ZCancel", state_name(zs)); #endif ZSendCancel(zs); @@ -1608,7 +1606,7 @@ void ZDestroy(struct zmodem_session *zs) { #ifdef ZMODEM_DEBUG - logger_printf(logger, "[%s] ZDestroy", state_name(zs)); + logger_printf("[%s] ZDestroy", state_name(zs)); #endif if (zs->file)