Check if sanei_config_get_string fails because of a single quotation mark

in the configuration file.
merge-requests/1/head
Henning Geinitz 2003-09-21 10:42:15 +00:00
rodzic 27c4ed03f5
commit 9a6faa5046
4 zmienionych plików z 70 dodań i 4 usunięć

Wyświetl plik

@ -48,7 +48,7 @@
/**************************************************************************/
/* ma1509 backend version */
#define BUILD 2
#define BUILD 3
/**************************************************************************/
#include "../include/sane/config.h"
@ -1165,6 +1165,12 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
word = 0;
cp = sanei_config_get_string (cp, &word);
if (!word)
{
DBG (1, "sane_init: config file line %d: missing quotation mark?\n",
linenumber);
continue;
}
if (strcmp (word, "warmup-time") == 0)
{
@ -1173,6 +1179,14 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
free (word);
word = 0;
cp = sanei_config_get_string (cp, &word);
if (!word)
{
DBG (1, "sane_init: config file line %d: missing quotation mark?\n",
linenumber);
continue;
}
errno = 0;
local_warmup_time = strtol (word, &end, 0);

Wyświetl plik

@ -46,7 +46,7 @@
/**************************************************************************/
/* Mustek backend version */
#define BUILD 132
#define BUILD 133
/**************************************************************************/
#include "../include/sane/config.h"
@ -5112,12 +5112,25 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
free (word);
word = 0;
cp = sanei_config_get_string (cp, &word);
if (!word)
{
DBG (1, "sane_init: config file line %d: missing quotation mark?\n",
linenumber);
continue;
}
if (strcmp (word, "strip-height") == 0)
{
free (word);
word = 0;
cp = sanei_config_get_string (cp, &word);
if (!word)
{
DBG (1, "sane_init: config file line %d: missing quotation mark?\n",
linenumber);
continue;
}
errno = 0;
strip_height = strtod (word, &end);
if (end == word)
@ -5264,6 +5277,13 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
free (word);
word = 0;
cp = sanei_config_get_string (cp, &word);
if (!word)
{
DBG (1, "sane_init: config file line %d: missing quotation mark?\n",
linenumber);
continue;
}
errno = 0;
buffer_size = strtol (word, &end, 0);
@ -5311,6 +5331,13 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
free (word);
word = 0;
cp = sanei_config_get_string (cp, &word);
if (!word)
{
DBG (1, "sane_init: config file line %d: missing quotation mark?\n",
linenumber);
continue;
}
errno = 0;
block_size = strtol (word, &end, 0);

Wyświetl plik

@ -46,7 +46,7 @@
This file implements a SANE backend for Mustek 1200UB and similar
USB flatbed scanners. */
#define BUILD 16
#define BUILD 17
#include "../include/sane/config.h"
@ -764,11 +764,25 @@ sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
word = 0;
cp = sanei_config_get_string (cp, &word);
if (!word)
{
DBG (1, "sane_init: config file line %d: missing quotation mark?\n",
linenumber);
continue;
}
if (strcmp (word, "max_block_size") == 0)
{
free (word);
word = 0;
cp = sanei_config_get_string (cp, &word);
if (!word)
{
DBG (1, "sane_init: config file line %d: missing quotation mark?\n",
linenumber);
continue;
}
errno = 0;
max_block_size = strtol (word, &end, 0);
if (end == word)

Wyświetl plik

@ -41,7 +41,7 @@
This backend is for testing frontends.
*/
#define BUILD 21
#define BUILD 22
#include "../include/sane/config.h"
@ -1088,6 +1088,9 @@ read_option (SANE_String line, SANE_String option_string,
cp = sanei_config_get_string (line, &word);
if (!word)
return SANE_STATUS_INVAL;
if (strcmp (word, option_string) != 0)
return SANE_STATUS_INVAL;
@ -1101,6 +1104,8 @@ read_option (SANE_String line, SANE_String option_string,
case param_bool:
{
cp = sanei_config_get_string (cp, &word);
if (!word)
return SANE_STATUS_INVAL;
if (strlen (word) == 0)
{
DBG (3, "read_option: option `%s' requires parameter\n",
@ -1126,6 +1131,8 @@ read_option (SANE_String line, SANE_String option_string,
SANE_Int int_value;
cp = sanei_config_get_string (cp, &word);
if (!word)
return SANE_STATUS_INVAL;
errno = 0;
int_value = (SANE_Int) strtol (word, &end, 0);
if (end == word)
@ -1154,6 +1161,8 @@ read_option (SANE_String line, SANE_String option_string,
SANE_Fixed fixed_value;
cp = sanei_config_get_string (cp, &word);
if (!word)
return SANE_STATUS_INVAL;
errno = 0;
double_value = strtod (word, &end);
if (end == word)
@ -1180,6 +1189,8 @@ read_option (SANE_String line, SANE_String option_string,
case param_string:
{
cp = sanei_config_get_string (cp, &word);
if (!word)
return SANE_STATUS_INVAL;
if (strlen (word) == 0)
{
DBG (3, "read_option: option `%s' requires parameter\n",