kopia lustrzana https://gitlab.com/sane-project/backends
saned/epsonds: Fixes for ring buffer issues and improper early termination.
rodzic
7b847a10db
commit
88ca2d07a1
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Ładowanie…
Reference in New Issue