* [Bug #311316] Allow sane_open() to be called with empty (zero-length)

device name to select first available one (see special case described in
  SANE API Documentation, s. 4.3.4).
merge-requests/1/head
Ilia Sotnikov 2008-12-22 07:52:43 +00:00
rodzic 1f6ae430d7
commit d9bfa31c40
1 zmienionych plików z 9 dodań i 4 usunięć

Wyświetl plik

@ -72,7 +72,7 @@
}
/* #define HAS_WORKING_COLOR_48 */
#define BUILD 3
#define BUILD 4
#define USB_TIMEOUT 30 * 1000
static SANE_Word
@ -424,9 +424,14 @@ sane_open (SANE_String_Const devicename, SANE_Handle * handle)
if (!handle)
return SANE_STATUS_INVAL;
for (ptr = scanners_list;
ptr && strcmp (ptr->sane.name, devicename) != 0;
ptr = ptr->next);
/* Allow to open the first available device by specifying zero-length name */
if (!devicename || !devicename[0]) {
ptr = scanners_list;
} else {
for (ptr = scanners_list;
ptr && strcmp (ptr->sane.name, devicename) != 0;
ptr = ptr->next);
}
if (!ptr)
return SANE_STATUS_INVAL;