diff --git a/backend/epsonds.c b/backend/epsonds.c index 4d2c79977..6901a8dbe 100644 --- a/backend/epsonds.c +++ b/backend/epsonds.c @@ -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; diff --git a/frontend/saned.c b/frontend/saned.c index 575499861..a133b1385 100644 --- a/frontend/saned.c +++ b/frontend/saned.c @@ -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)