Some minor changes to serial.c as we progress to a faster method

https://github.com/Hamlib/Hamlib/issues/850
pull/875/head
Mike Black W9MDB 2021-11-02 11:17:19 -05:00
rodzic de1b0f5126
commit 9842cdb1f3
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -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))
{