Synchronize with sane-backends/sanei/ to avoid linker problems.

Correct fix is probably to make libsanei available from sane-backends.
DEVEL_2_0_BRANCH-1
Petter Reinholdtsen 2001-05-27 19:43:14 +00:00
rodzic 634270d81a
commit 5a6208f61d
2 zmienionych plików z 36 dodań i 7 usunięć

Wyświetl plik

@ -75,14 +75,14 @@ bin_w_string (Wire *w, void *v)
SANE_Word len;
SANE_String *s = v;
if (w->direction == WIRE_ENCODE)
if (w->direction != WIRE_DECODE)
{
len = 0;
if (*s)
len = strlen (*s) + 1;
}
sanei_w_array (w, &len, v, w->codec.w_byte, 1);
if (!len && w->direction == WIRE_DECODE)
if (w->direction == WIRE_DECODE && !len)
*s = 0;
}

Wyświetl plik

@ -56,6 +56,9 @@ sanei_w_space (Wire *w, size_t howmuch)
int fd = w->io.fd;
ssize_t nread, nwritten;
if (w->status != 0)
return;
if (w->buffer.curr + howmuch > w->buffer.end)
{
switch (w->direction)
@ -80,6 +83,10 @@ sanei_w_space (Wire *w, size_t howmuch)
case WIRE_DECODE:
left_over = w->buffer.end - w->buffer.curr;
if ((signed)left_over < 0)
return;
if (left_over)
memcpy (w->buffer.start, w->buffer.curr, left_over);
w->buffer.curr = w->buffer.start;
@ -121,7 +128,16 @@ sanei_w_array (Wire *w, SANE_Word *len_ptr, void **v, WireCodecFunc w_element,
if (w->direction == WIRE_FREE)
{
free (*v);
if (*len_ptr && *v)
{
val = *v;
for (i = 0; i < *len_ptr; ++i)
{
(*w_element) (w, val);
val += element_size;
}
free (*v);
}
return;
}
@ -162,8 +178,11 @@ sanei_w_ptr (Wire *w, void **v, WireCodecFunc w_value, size_t value_size)
if (w->direction == WIRE_FREE)
{
if (*v)
free (*v);
if (*v && value_size)
{
(*w_value) (w, *v);
free (*v);
}
return;
}
if (w->direction == WIRE_ENCODE)
@ -320,6 +339,7 @@ sanei_w_option_descriptor (Wire *w, SANE_Option_Descriptor *v)
sanei_w_word (w, &v->size);
sanei_w_word (w, &v->cap);
sanei_w_constraint_type (w, &v->constraint_type);
switch (v->constraint_type)
{
case SANE_CONSTRAINT_NONE:
@ -331,14 +351,14 @@ sanei_w_option_descriptor (Wire *w, SANE_Option_Descriptor *v)
break;
case SANE_CONSTRAINT_WORD_LIST:
if (w->direction == WIRE_ENCODE)
if (w->direction != WIRE_DECODE)
len = v->constraint.word_list[0] + 1;
sanei_w_array (w, &len, (void **) &v->constraint.word_list,
w->codec.w_word, sizeof(SANE_Word));
break;
case SANE_CONSTRAINT_STRING_LIST:
if (w->direction == WIRE_ENCODE)
if (w->direction != WIRE_DECODE)
{
for (len = 0; v->constraint.string_list[len]; ++len);
++len; /* send NULL string, too */
@ -439,3 +459,12 @@ sanei_w_init (Wire *w, void (*codec_init_func)(Wire *))
if (codec_init_func != 0)
(*codec_init_func) (w);
}
void
sanei_w_exit (Wire *w)
{
if (w->buffer.start)
free(w->buffer.start);
w->buffer.start = 0;
w->buffer.size = 0;
}