[sane-devel] Patch to scanimage.c for 16-bit PNM files (was: Epson 2450: scanimage produces invalid PNM files)

Henning Meier-Geinitz henning@meier-geinitz.de
Thu, 9 May 2002 15:46:23 +0200


Hi,

On Mon, Apr 15, 2002 at 05:22:55PM -0400, Roland Roberts wrote:
> >>>>> "Henning" == Henning Meier-Geinitz <henning@meier-geinitz.de> writes:
> 
>     Henning> Thanks for the patch. It fixes some cases. However, you
>     Henning> will get problems if the amount of data is odd or
>     Henning> must_buffer == SANE_TRUE.

I have fixed this in CVS now. Please test in every mode.

> I thought I had code in there for must_buffer,

Yes, but it was more complicated because the 16 bit modes didn't work
at all in must_buffer mode. See CVS. I removed support for the 16 bit
three-pass modes which didn't work anyway. And three-pass scanners
that support 16 bit won't be too common :-)

hand-scanner mode with 16 bit should work, however.

> but you are definitelya correct about the odd amount of data issue.
> I wouldn't think the latter case could happen with a local scanner,
> but with a network scanner I can see it happening.a 

A backend can define it's buffer size to e.g. 15 bytes. Or read can
return an odd nu,ber of bytes. It can happen any time.

I think I found a solution for this in CVS. Please test.

Bye,
  Henning