From c05ddb6092ed784a52335d50c8de695393bd4df2 Mon Sep 17 00:00:00 2001 From: Henning Geinitz Date: Fri, 29 Mar 2002 12:21:02 +0000 Subject: [PATCH] Check if option is settable when automatically setting it. New version: 1.0.7. Henning Meier-Geinitz --- backend/pnm.c | 10 +++++++--- doc/descriptions/pnm.desc | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/pnm.c b/backend/pnm.c index 91ef53ae2..228e0e9c6 100644 --- a/backend/pnm.c +++ b/backend/pnm.c @@ -40,7 +40,7 @@ whether to permit this exception to apply to your modifications. If you do not wish that, delete this exception notice. */ -#define BUILD 6 +#define BUILD 7 #include "../include/sane/config.h" @@ -613,7 +613,11 @@ sane_control_option (SANE_Handle handle, SANE_Int option, switch (action) { case SANE_ACTION_SET_AUTO: - + if (!SANE_OPTION_IS_SETTABLE (sod[option].cap)) + { + DBG(4, "sane_control_option: option is not settable\n"); + return SANE_STATUS_INVAL; + } status = sanei_constrain_value (sod + option, (void*)&v, &myinfo); if (status != SANE_STATUS_GOOD) return status; @@ -630,7 +634,7 @@ sane_control_option (SANE_Handle handle, SANE_Int option, case SANE_ACTION_SET_VALUE: if (!SANE_OPTION_IS_SETTABLE (sod[option].cap)) { - DBG(4, "sane_control_option: option is not setable\n"); + DBG(4, "sane_control_option: option is not settable\n"); return SANE_STATUS_INVAL; } status = sanei_constrain_value (sod + option, value, &myinfo); diff --git a/doc/descriptions/pnm.desc b/doc/descriptions/pnm.desc index d652eec23..f40f966b4 100644 --- a/doc/descriptions/pnm.desc +++ b/doc/descriptions/pnm.desc @@ -1,5 +1,5 @@ :backend "pnm" -:version "1.0.6" +:version "1.0.7" :status :beta :manpage "sane-pnm" :url "mailto:henning@meier-geinitz.de"