[sane-devel] option size = 0 allowed ?

Henning Meier-Geinitz henning@meier-geinitz.de
Wed, 18 Dec 2002 11:55:06 +0100


On Wed, Dec 18, 2002 at 07:30:42AM +0100, Michael Herder wrote:
> from the standard:
> "Member size specifies the size of the option value (in bytes).
> ...
> SANE_TYPE_INT, SANE_TYPE_FIXED: The size must be a positive integer multiple 
> of the size of a SANE_Word. The option value is a vector of length
> size/sizeof(SANE_Word)."
> The umax backend defines an option "halftone pattern" with size 0. Is this 
> allowed? 

I don't think so. While one could argue if 0 is positive (or negative,
or both or neither positive nor negative) the intention here is clear
for me: size > 0. There was a similar discussion on sane-devel years
(?) ago, but I don't remember the conclusion.

> Furthermore, the umax backend changes the option size later. IMHO, that at 
> least isn't allowed, because only the availablity or value of an option may 
> change.

It's not allowed. But at least the mustek backend does it also. And I
don't know an easy work-around if you don't want to specify options
for every combination of halftone pattern dimensions.

Changing constraints is also not allowed in SANE1, but it's done by
quite some backends.