kopia lustrzana https://gitlab.com/sane-project/backends
Make sure that *length=0 in sane_read(). Added more debug output.
Henning Meier-Geinitz <henning@meier-geinitz.de>DEVEL_2_0_BRANCH-1
rodzic
5307423bfa
commit
5a044acd2d
|
@ -40,7 +40,7 @@
|
||||||
whether to permit this exception to apply to your modifications.
|
whether to permit this exception to apply to your modifications.
|
||||||
If you do not wish that, delete this exception notice. */
|
If you do not wish that, delete this exception notice. */
|
||||||
|
|
||||||
#define BUILD 1
|
#define BUILD 2
|
||||||
|
|
||||||
#include "../include/sane/config.h"
|
#include "../include/sane/config.h"
|
||||||
|
|
||||||
|
@ -1033,8 +1033,37 @@ sane_read (SANE_Handle handle, SANE_Byte * data,
|
||||||
|
|
||||||
DBG(2,"sane_read: max_length = %d, rgbleftover = {%d, %d, %d}\n",
|
DBG(2,"sane_read: max_length = %d, rgbleftover = {%d, %d, %d}\n",
|
||||||
max_length, rgbleftover[0], rgbleftover[1], rgbleftover[2]);
|
max_length, rgbleftover[0], rgbleftover[1], rgbleftover[2]);
|
||||||
if (handle != MAGIC || !is_open || !infile || !data || !length)
|
if (!length)
|
||||||
return SANE_STATUS_INVAL; /* Unknown handle or no file to read... */
|
{
|
||||||
|
DBG(1, "sane_read: length == NULL\n");
|
||||||
|
return SANE_STATUS_INVAL;
|
||||||
|
}
|
||||||
|
*length = 0;
|
||||||
|
if (!data)
|
||||||
|
{
|
||||||
|
DBG(1, "sane_read: data == NULL\n");
|
||||||
|
return SANE_STATUS_INVAL;
|
||||||
|
}
|
||||||
|
if (handle != MAGIC)
|
||||||
|
{
|
||||||
|
DBG(1, "sane_read: unknown handle\n");
|
||||||
|
return SANE_STATUS_INVAL;
|
||||||
|
}
|
||||||
|
if (!is_open)
|
||||||
|
{
|
||||||
|
DBG(1, "sane_read: call sane_open first\n");
|
||||||
|
return SANE_STATUS_INVAL;
|
||||||
|
}
|
||||||
|
if (!infile)
|
||||||
|
{
|
||||||
|
DBG(1, "sane_read: scan was cancelled\n");
|
||||||
|
return SANE_STATUS_CANCELLED;
|
||||||
|
}
|
||||||
|
if (feof (infile))
|
||||||
|
{
|
||||||
|
DBG(2, "sane_read: EOF reached\n");
|
||||||
|
return SANE_STATUS_EOF;
|
||||||
|
}
|
||||||
|
|
||||||
if(status_jammed == SANE_TRUE) return SANE_STATUS_JAMMED;
|
if(status_jammed == SANE_TRUE) return SANE_STATUS_JAMMED;
|
||||||
if(status_eof == SANE_TRUE) return SANE_STATUS_EOF;
|
if(status_eof == SANE_TRUE) return SANE_STATUS_EOF;
|
||||||
|
@ -1044,11 +1073,6 @@ sane_read (SANE_Handle handle, SANE_Byte * data,
|
||||||
if(status_nomem == SANE_TRUE) return SANE_STATUS_NO_MEM;
|
if(status_nomem == SANE_TRUE) return SANE_STATUS_NO_MEM;
|
||||||
if(status_accessdenied == SANE_TRUE) return SANE_STATUS_ACCESS_DENIED;
|
if(status_accessdenied == SANE_TRUE) return SANE_STATUS_ACCESS_DENIED;
|
||||||
|
|
||||||
*length = 0;
|
|
||||||
|
|
||||||
if (feof (infile))
|
|
||||||
return SANE_STATUS_EOF;
|
|
||||||
|
|
||||||
/* Allocate a buffer for the RGB values. */
|
/* Allocate a buffer for the RGB values. */
|
||||||
if (ppm_type == ppm_color && (gray || three_pass))
|
if (ppm_type == ppm_color && (gray || three_pass))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
:backend "pnm"
|
:backend "pnm"
|
||||||
:version "1.0.1"
|
:version "1.0.2"
|
||||||
:status :beta
|
:status :beta
|
||||||
:manpage "sane-pnm"
|
:manpage "sane-pnm"
|
||||||
:url "mailto:henning@meier-geinitz.de"
|
:url "mailto:henning@meier-geinitz.de"
|
||||||
|
|
Ładowanie…
Reference in New Issue