From 84357741a6a6e6430f199b2c3f7498e0e97da9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 12 Feb 2023 17:35:53 +0100 Subject: New upstream version 1.2.1 --- frontend/jpegtopdf.c | 4 ++++ frontend/saned.c | 10 +++++----- frontend/scanimage.c | 25 ++++++++++++++++++++++--- 3 files changed, 31 insertions(+), 8 deletions(-) (limited to 'frontend') diff --git a/frontend/jpegtopdf.c b/frontend/jpegtopdf.c index 8f144b5..5c5d712 100644 --- a/frontend/jpegtopdf.c +++ b/frontend/jpegtopdf.c @@ -201,7 +201,11 @@ static SANE_Int _get_current_time( struct tm *pt, SANE_Byte *sign_c, int *ptz_h, goto EXIT; } /* get time difference ( OHH'mm' ) */ +#ifdef __FreeBSD__ + tz = -pt->tm_gmtoff; +#else tz = timezone; +#endif if ( tz > 0 ) { *sign_c = '-'; } diff --git a/frontend/saned.c b/frontend/saned.c index 5b16980..e31758a 100644 --- a/frontend/saned.c +++ b/frontend/saned.c @@ -84,8 +84,8 @@ #include "lgetopt.h" -#if defined(HAVE_SYS_POLL_H) && defined(HAVE_POLL) -# include +#if defined(HAVE_POLL_H) && defined(HAVE_POLL) +# include #else /* * This replacement poll() using select() is only designed to cover @@ -2449,7 +2449,7 @@ void sig_int_term_handler (int signum) { /* unused */ - signum = signum; + (void) signum; signal (SIGINT, NULL); signal (SIGTERM, NULL); @@ -2543,7 +2543,7 @@ saned_avahi_group_callback (AvahiEntryGroup *g, AvahiEntryGroupState state, void char *n; /* unused */ - userdata = userdata; + (void) userdata; if ((!g) || (g != avahi_group)) return; @@ -2657,7 +2657,7 @@ saned_avahi_callback (AvahiClient *c, AvahiClientState state, void *userdata) int error; /* unused */ - userdata = userdata; + (void) userdata; if (!c) return; diff --git a/frontend/scanimage.c b/frontend/scanimage.c index b587b9d..d79d487 100644 --- a/frontend/scanimage.c +++ b/frontend/scanimage.c @@ -40,6 +40,14 @@ #include #include +#ifdef __FreeBSD__ +#include +#endif + +#if defined (__APPLE__) && defined (__MACH__) +#include // for basename() +#endif + #include #include @@ -917,9 +925,10 @@ fetch_options (SANE_Device * device) scanimage_exit (1); } - /* create command line option only for settable options */ - if (!SANE_OPTION_IS_SETTABLE (opt->cap) || opt->type == SANE_TYPE_GROUP) - continue; + /* create command line option only for non-group options */ + /* Also we sometimes see options with no name in rogue backends. */ + if ((opt->type == SANE_TYPE_GROUP) || (opt->name == NULL)) + continue; option_number[option_count] = i; @@ -1072,6 +1081,12 @@ process_backend_option (SANE_Handle device, int optnum, const char *optarg) opt = sane_get_option_descriptor (device, optnum); + if (!SANE_OPTION_IS_SETTABLE (opt->cap)) + { + fprintf (stderr, "%s: attempted to set readonly option %s\n", + prog_name, opt->name); + scanimage_exit (1); + } if (!SANE_OPTION_IS_ACTIVE (opt->cap)) { fprintf (stderr, "%s: attempted to set inactive option %s\n", @@ -2013,6 +2028,10 @@ static void print_options(SANE_Device * device, SANE_Int num_dev_options, SANE_B if (!opt) opt = sane_get_option_descriptor (device, i); + /* Some options from rogue backends are empty. */ + if (opt->name == NULL) + continue; + if (ro || SANE_OPTION_IS_SETTABLE (opt->cap) || opt->type == SANE_TYPE_GROUP) print_option (device, i, opt); -- cgit v1.2.3