[sane-devel] a backend test

Henning Meier-Geinitz henning@meier-geinitz.de
Tue, 19 Mar 2002 23:55:38 +0100


Hi,

On Tue, Mar 19, 2002 at 10:58:31PM +0100, Oliver Rauch wrote:
> The testbackend prints a warning:
> warning : invalid size for option halftone-pattern
> 
> for this option:
>   /* halftone pattern */
>   scanner->opt[OPT_HALFTONE_PATTERN].name  = SANE_NAME_HALFTONE_PATTERN;
>   scanner->opt[OPT_HALFTONE_PATTERN].title = SANE_TITLE_HALFTONE_PATTERN;
>   scanner->opt[OPT_HALFTONE_PATTERN].desc  = SANE_DESC_HALFTONE_PATTERN;
>   scanner->opt[OPT_HALFTONE_PATTERN].type  = SANE_TYPE_INT;
>   scanner->opt[OPT_HALFTONE_PATTERN].size  = 0;
>   scanner->opt[OPT_HALFTONE_PATTERN].constraint_type = SANE_CONSTRAINT_RANGE;
>   scanner->opt[OPT_HALFTONE_PATTERN].constraint.range = &u8_range;
>   scanner->val[OPT_HALFTONE_PATTERN].wa    = scanner->halftone_pattern; 
> 
> I think a constraint_range can have a size of 0 if there is nothing to set.
> In this case the option also is set inactive.

Same code is in mustek so I thought about it a bit yesterday:
<nitpick> The standard says: "The size must be a positive integer value
of SANE_Word". I don't think 0 is a positive integer...
And "inactive" is only for the setting/reading of the option value,
not the option descriptor.
</nitpick>
Probably in practice it doesn't matter but it won't hurt to e.g. use the
smallest possible size.

Bye,
  Henning