[sane-devel] a backend test

Oliver Rauch oliver.rauch@rauch-domain.de
Tue, 19 Mar 2002 22:58:31 +0100


Frank Zago wrote:
> 
> >      for (*option_num = 0; *option_num <= num_dev_options; (*option_num)++) {
> >
> > Shouldn't this be "< num_dev_options"
> 
> Fixed. New release uploaded.
> 
> Your bug report looks smaller everytime. I take that as a good sign :)
> 
> In your pnm backend, in sane_get_parameters, you could return a slightly
> different number of line and line size when a backup is not occuring.
> 

Hello Frank,

when for Option 0 the name is not defined (opt->name == NULL) then this code
prints the warning about empty name. e.g. the additional "if (opt->name != NULL)"
solves the Problem, but then the opt->name != NULL of the check command also
can be removed:

if (opt->name != NULL)
{
                                check(WRN, (*opt->name ==0),
                                          "option %d must have an empty name (ie. \"\")",
option_num);
}  


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.

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