epson2, epsonds, kodakaio, magicolor: Don't set invalid value

If the value to be set is not valid, it should not change the sval
structure (even if doing so has no negative side effects).

This also makes the fallthrough less confusing by removing the first
cast of two for the br-x and br-y values.
merge-requests/128/head
Olaf Meeuwissen 2019-08-10 21:05:48 +09:00
rodzic fcd537e207
commit 797cd1fb37
4 zmienionych plików z 4 dodań i 8 usunięć

Wyświetl plik

@ -1889,8 +1889,7 @@ setvalue(SANE_Handle handle, SANE_Int option, void *value, SANE_Int *info)
case OPT_BR_X:
case OPT_BR_Y:
sval->w = *((SANE_Word *) value);
if (SANE_UNFIX(sval->w) == 0) {
if (SANE_UNFIX(*((SANE_Word *) value)) == 0) {
DBG(17, "invalid br-x or br-y\n");
return SANE_STATUS_INVAL;
}

Wyświetl plik

@ -1050,8 +1050,7 @@ setvalue(SANE_Handle handle, SANE_Int option, void *value, SANE_Int *info)
case OPT_BR_X:
case OPT_BR_Y:
sval->w = *((SANE_Word *) value);
if (SANE_UNFIX(sval->w) == 0) {
if (SANE_UNFIX(*((SANE_Word *) value)) == 0) {
DBG(17, " invalid br-x or br-y\n");
return SANE_STATUS_INVAL;
}

Wyświetl plik

@ -3276,8 +3276,7 @@ setvalue(SANE_Handle handle, SANE_Int option, void *value, SANE_Int *info)
case OPT_BR_X:
case OPT_BR_Y:
sval->w = *((SANE_Word *) value);
if (SANE_UNFIX(sval->w) == 0) {
if (SANE_UNFIX(*((SANE_Word *) value)) == 0) {
DBG(17, "invalid br-x or br-y\n");
return SANE_STATUS_INVAL;
}

Wyświetl plik

@ -2789,8 +2789,7 @@ setvalue(SANE_Handle handle, SANE_Int option, void *value, SANE_Int *info)
case OPT_BR_X:
case OPT_BR_Y:
sval->w = *((SANE_Word *) value);
if (SANE_UNFIX(sval->w) == 0) {
if (SANE_UNFIX(*((SANE_Word *) value)) == 0) {
DBG(17, "invalid br-x or br-y\n");
return SANE_STATUS_INVAL;
}