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
Henning Geinitz 2002-04-06 20:42:07 +00:00
rodzic 5bcc9e004b
commit 63bfda58be
1 zmienionych plików z 13 dodań i 1 usunięć

Wyświetl plik

@ -56,6 +56,7 @@ sanei_constrain_value (const SANE_Option_Descriptor * opt, void * value,
int i, num_matches, match;
const SANE_Range * range;
SANE_Word w, v;
SANE_Bool b;
size_t len;
switch (opt->constraint_type)
@ -139,7 +140,18 @@ sanei_constrain_value (const SANE_Option_Descriptor * opt, void * value,
return SANE_STATUS_GOOD;
}
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:
break;
}