Get option descriptor 0 before trying to read the value for option 0.

merge-requests/1/head
Julien BLACHE 2008-08-04 20:54:10 +00:00
rodzic 07b79c5feb
commit eefb1b1155
2 zmienionych plików z 24 dodań i 2 usunięć

Wyświetl plik

@ -1,3 +1,7 @@
2008-08-04 Julien Blache <jb@jblache.org>
* frontend/scanimage.c: fetch_options(), actually get option
descriptor 0 before attempting to get the value of option 0.
2008-08-04 Stéphane Voltz <stef.dev@free.fr>
* backend/umax_pp.c backend/umaxp_pp.h backend/umax_pp.conf.in:
use configuration framework

Wyświetl plik

@ -838,15 +838,33 @@ fetch_options (SANE_Device * device)
const SANE_Option_Descriptor *opt;
SANE_Int num_dev_options;
int i, option_count;
SANE_Status status;
/* and now build the full table of long options: */
sane_control_option (device, 0, SANE_ACTION_GET_VALUE, &num_dev_options, 0);
opt = sane_get_option_descriptor (device, 0);
if (opt == NULL)
{
fprintf (stderr, "Could not get option descriptor for option 0\n");
exit (1);
}
status = sane_control_option (device, 0, SANE_ACTION_GET_VALUE, &num_dev_options, 0);
if (status != SANE_STATUS_GOOD)
{
fprintf (stderr, "Could not get value for option 0: %s\n", sane_strstatus (status));
exit (1);
}
option_count = 0;
for (i = 0; i < num_dev_options; ++i)
for (i = 1; i < num_dev_options; ++i)
{
opt = sane_get_option_descriptor (device, i);
if (opt == NULL)
{
fprintf (stderr, "Could not get option descriptor for option %d\n", i);
exit (1);
}
if (!SANE_OPTION_IS_SETTABLE (opt->cap))
continue;