From 9842cdb1f398e45294b82b00356152f4b1228d2a Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Tue, 2 Nov 2021 11:17:19 -0500 Subject: [PATCH] Some minor changes to serial.c as we progress to a faster method https://github.com/Hamlib/Hamlib/issues/850 --- src/iofunc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/iofunc.c b/src/iofunc.c index 2c75bcd33..232bc3fb0 100644 --- a/src/iofunc.c +++ b/src/iofunc.c @@ -703,9 +703,9 @@ int HAMLIB_API read_string(hamlib_port_t *p, /* Store the time of the read loop start */ gettimeofday(&start_time, NULL); - rxbuffer[0] = 0; /* ensure string is terminated */ + memset(rxbuffer, 0, rxmax); - while (total_count < rxmax - 1) + while (total_count < rxmax - 1) // allow 1 byte for end-of-string { int rd_count; int retval; @@ -793,7 +793,7 @@ int HAMLIB_API read_string(hamlib_port_t *p, // check to see if our string startis with \...if so we need more chars if (total_count == 0 && rxbuffer[total_count] == '\\') { rxmax = (rxmax - 1) * 5; } - ++total_count; + total_count += rd_count; if (stopset && memchr(stopset, rxbuffer[total_count - 1], stopset_len)) {