saned/epsonds: Fixes for ring buffer issues and improper early termination.

666-epsonds-has-issues-with-saned
Ralph Little 2023-03-16 22:24:13 -07:00
rodzic 7b847a10db
commit 88ca2d07a1
2 zmienionych plików z 10 dodań i 4 usunięć

Wyświetl plik

@ -3613,10 +3613,12 @@ sane_read(SANE_Handle handle, SANE_Byte *data, SANE_Int max_length, SANE_Int *le
// data is empty fin
if (read == 0) {
*length = 0;
eds_ring_flush(s->current);
eds_ring_destory(s->current);
DBG(18, "returns EOF 2\n");
return SANE_STATUS_EOF;
// This is silly: we already established above that there is data available.
// eds_ring_flush(s->current);
// eds_ring_destory(s->current);
DBG(18, "Couldn't read anything from ring buffer: probably not enough capacity to receive.\n");
return SANE_STATUS_GOOD;
}
*length = read;

Wyświetl plik

@ -1771,6 +1771,10 @@ do_scan (Wire * w, int h, int data_fd)
/* get more input data */
/* reserve 4 bytes to store the length of the data record: */
/* NOTE: it seems to me that we could dispense with the record if we read nothing from sane_read() */
/* Consider an optimization whereby we add nothing to the ring buffer in this case. */
/* I do need to check the semantics of this though. [RL] */
i = reader;
reader += 4;
if (reader >= (int) buffer_size)