[sane-devel] a backend test

Oliver Rauch oliver.rauch@rauch-domain.de
Wed, 20 Mar 2002 01:00:09 +0100


Henning Meier-Geinitz wrote:
> 
> 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.

Hello Henning,

if 0 is a positive integer number is a question that is often discussed.
I think it does not make sense to set this value to 1 because in this case
the backend has to allocate memory for the value what makes no sense.

I think we should explictly allow to set this value to 0

Bye
Oliver



-- 
Homepage:	http://www.rauch-domain.de
sane-umax:	http://www.rauch-domain.de/sane-umax
xsane:		http://www.xsane.org
E-Mail:		mailto:Oliver.Rauch@rauch-domain.de