mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Fix issue 447: Apparently some drivers only emit SANE_STATUS_EOF once, and SANE_STATUS_IO_ERROR after that. The code however assumed that the driver keeps emitting SANE_STATUS_EOF. This commit fixes this.
This commit is contained in:
parent
bed2e429dc
commit
8324a9a3e0
22
Sane/_sane.c
22
Sane/_sane.c
|
@ -916,10 +916,13 @@ SaneDev_snap(SaneDevObject *self, PyObject *args)
|
||||||
call which returns SANE_STATUS_EOF in order to start
|
call which returns SANE_STATUS_EOF in order to start
|
||||||
a new frame.
|
a new frame.
|
||||||
*/
|
*/
|
||||||
do {
|
if (st != SANE_STATUS_EOF)
|
||||||
st = sane_read(self->h, buffer, READSIZE, &len);
|
{
|
||||||
}
|
do {
|
||||||
while (st == SANE_STATUS_GOOD);
|
st = sane_read(self->h, buffer, READSIZE, &len);
|
||||||
|
}
|
||||||
|
while (st == SANE_STATUS_GOOD);
|
||||||
|
}
|
||||||
if (st != SANE_STATUS_EOF)
|
if (st != SANE_STATUS_EOF)
|
||||||
{
|
{
|
||||||
Py_BLOCK_THREADS
|
Py_BLOCK_THREADS
|
||||||
|
@ -937,10 +940,13 @@ SaneDev_snap(SaneDevObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* enforce SANE_STATUS_EOF. Can be necessary for ADF scans for some backends */
|
/* enforce SANE_STATUS_EOF. Can be necessary for ADF scans for some backends */
|
||||||
do {
|
if (st != SANE_STATUS_EOF)
|
||||||
st = sane_read(self->h, buffer, READSIZE, &len);
|
{
|
||||||
}
|
do {
|
||||||
while (st == SANE_STATUS_GOOD);
|
st = sane_read(self->h, buffer, READSIZE, &len);
|
||||||
|
}
|
||||||
|
while (st == SANE_STATUS_GOOD);
|
||||||
|
}
|
||||||
if (st != SANE_STATUS_EOF)
|
if (st != SANE_STATUS_EOF)
|
||||||
{
|
{
|
||||||
sane_cancel(self->h);
|
sane_cancel(self->h);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user