Get option descriptor for option 0 before getting the value for option 0.

merge-requests/2/head
Julien BLACHE 2008-08-05 09:04:51 +00:00
rodzic 25db05c0d3
commit fe7c5b707c
2 zmienionych plików z 24 dodań i 2 usunięć

Wyświetl plik

@ -1,3 +1,7 @@
2008-08-05 Julien Blache <jb@jblache.org>
* src/scanadf.c: fetch_options(): get option descriptor for option 0
before getting the value for option 0.
2008-07-03 Peter Kirchgeßner <peter@kirchgessner.net>
* doc/scanadf.man: Fix description of options for sane-hp-backend.
A patch for sane-hp to be used with scanadf is not necessary

Wyświetl plik

@ -552,15 +552,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;