Fixed tmxr Buffering functionality broken in the Serial merge from Dave

This commit is contained in:
Mark Pizzolato 2012-04-20 17:58:21 -07:00
parent 1fb1756b65
commit 6912ad167e

View file

@ -387,7 +387,6 @@ return;
static void tmxr_report_connection (TMXR *mp, TMLN *lp, int32 i) static void tmxr_report_connection (TMXR *mp, TMLN *lp, int32 i)
{ {
int32 written, psave; int32 written, psave;
char line [20];
char cmsg[80]; char cmsg[80];
char dmsg[80] = ""; char dmsg[80] = "";
char lmsg[80] = ""; char lmsg[80] = "";
@ -977,7 +976,6 @@ return (lp->rxbpi - lp->rxbpr + ((lp->rxbpi < lp->rxbpr)? TMXR_MAXBUF: 0));
t_stat tmxr_putc_ln (TMLN *lp, int32 chr) t_stat tmxr_putc_ln (TMLN *lp, int32 chr)
{ {
// [JDB] isn't this wrong? it's logging the char before it determines if it can output it!
if (lp->txlog) /* log if available */ if (lp->txlog) /* log if available */
fputc (chr, lp->txlog); fputc (chr, lp->txlog);
if ((lp->conn == 0) && (!lp->txbfd)) /* no conn & not buffered? */ if ((lp->conn == 0) && (!lp->txbfd)) /* no conn & not buffered? */
@ -1049,7 +1047,7 @@ if (nbytes) { /* >0? write */
if (lp->txbpr < lp->txbpi) /* no wrap? */ if (lp->txbpr < lp->txbpi) /* no wrap? */
sbytes = tmxr_write (lp, nbytes); /* write all data */ sbytes = tmxr_write (lp, nbytes); /* write all data */
else else
sbytes = tmxr_write (lp, TMXR_MAXBUF - lp->txbpr); /* write to end buf */ sbytes = tmxr_write (lp, lp->txbsz - lp->txbpr);/* write to end buf */
if (sbytes > 0) { /* ok? */ if (sbytes > 0) { /* ok? */
tmxr_debug (TMXR_DBG_XMT, lp, "Sent", &(lp->txb[lp->txbpr]), sbytes); tmxr_debug (TMXR_DBG_XMT, lp, "Sent", &(lp->txb[lp->txbpr]), sbytes);