kopia lustrzana https://gitlab.com/sane-project/backends
Check that a SANE_Bool variable can only be SANE_TRUE or SANE_FALSE.
Henning Meier-Geinitz <henning@meier-geinitz.de>DEVEL_2_0_BRANCH-1
rodzic
5bcc9e004b
commit
63bfda58be
|
@ -56,6 +56,7 @@ sanei_constrain_value (const SANE_Option_Descriptor * opt, void * value,
|
||||||
int i, num_matches, match;
|
int i, num_matches, match;
|
||||||
const SANE_Range * range;
|
const SANE_Range * range;
|
||||||
SANE_Word w, v;
|
SANE_Word w, v;
|
||||||
|
SANE_Bool b;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
switch (opt->constraint_type)
|
switch (opt->constraint_type)
|
||||||
|
@ -140,6 +141,17 @@ sanei_constrain_value (const SANE_Option_Descriptor * opt, void * value,
|
||||||
}
|
}
|
||||||
return SANE_STATUS_INVAL;
|
return SANE_STATUS_INVAL;
|
||||||
|
|
||||||
|
case SANE_CONSTRAINT_NONE:
|
||||||
|
switch (opt->type)
|
||||||
|
{
|
||||||
|
case SANE_TYPE_BOOL:
|
||||||
|
b = *(SANE_Bool *) value;
|
||||||
|
if (b != SANE_TRUE && b != SANE_FALSE)
|
||||||
|
return SANE_STATUS_INVAL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue