Esme Povirk (@madewokherd) commented about dlls/sane.ds/ui.c:
else if (opt->type == TYPE_FIXED)
{
int pos, *sf;
option->opt_type = opt->type;
option->reg_type = REG_DWORD;
sf = calloc( opt->size, sizeof(int) );
sane_option_get_value(opt->optno, sf );
if (opt->constraint.range.quant)
pos = *sf / opt->constraint.range.quant;
else
pos = MulDiv( *sf, 100, 65536 );
memcpy(option->value, &pos, sizeof(INT));
option->size = sizeof(pos);
free(sf);
}
- }
I'm not sure if this covers all potential option type+constraint combinations. We should probably print a FIXME if we get something unexpected, and maybe initialize these fields to something invalid?