Fix sanei_tcp_read(). Revert some getopt logic.

* sanei/sanie_tcp.c, backend/epson2_net.c: Update
sanei_tcp_read() to better simulate old behavior of MSG_WAITALL.
recv() tends to return MTU sized chunks of data without that option.  And at
least cygwin doesn't support MSG_WAITALL.  Re-enable epson2 using that
function for big recieves.
* libgetopt.c, libgetopt1.c:
Revert some logic meant to be used only when we were always compiling
interal getopt() functions.  Fix header filename.
merge-requests/1/head
chris@cnpbagwell.com 2009-06-09 19:06:27 -05:00
rodzic bf57122892
commit 581b94fb88
5 zmienionych plików z 24 dodań i 15 usunięć

Wyświetl plik

@ -1,3 +1,14 @@
2009-06-09 Chris Bagwell <cbagwell-guest at users.alioth.debian.org>
* sanei/sanie_tcp.c, backend/epson2_net.c: Update
sanei_tcp_read() to better simulate old behavior of
MSG_WAITALL. recv() tends to return MTU sized chunks
of data without that option. And at least cygwin doesn't
support MSG_WAITALL. Re-enable epson2 using that function
for big recieves.
* libgetopt.c, libgetopt1.c: Revert some logic meant to be used
only when we were always compiling internal getopt() functions.
Fix header filename.
2009-06-09 Stéphane Voltz <stef.dev at free.fr>
* backend/lexmark.h backend/lexmark.c backend/lexmark_low.c:
cleanups, better 'fake usb' and possible fix for bug #311862

Wyświetl plik

@ -97,8 +97,7 @@ sanei_epson_net_read(Epson_Scanner *s, unsigned char *buf, size_t wanted,
if (size == wanted) {
DBG(15, "%s: full read\n", __func__);
/* read = sanei_tcp_read(s->fd, buf, size); */
read = recv(s->fd, buf, size, MSG_WAITALL); /* XXX temporary */
read = sanei_tcp_read(s->fd, buf, size);
if (s->netbuf) {
free(s->netbuf);

Wyświetl plik

@ -61,11 +61,6 @@
# endif
#endif
/* For Sane, always compile this */
#if defined ELIDE_CODE
#undef ELIDE_CODE
#endif
#ifndef ELIDE_CODE
@ -118,7 +113,7 @@
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
#include "../include/getopt.h"
#include "../include/lgetopt.h"
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,

Wyświetl plik

@ -27,7 +27,7 @@
#ifdef _LIBC
# include <getopt.h>
#else
# include "getopt.h"
# include "../include/lgetopt.h"
#endif
#if !defined __STDC__ || !__STDC__
@ -56,11 +56,6 @@
#endif
#endif
/* Always compile for Sane */
#if defined ELIDE_CODE
#undef ELIDE_CODE
#endif
#ifndef ELIDE_CODE

Wyświetl plik

@ -106,5 +106,14 @@ sanei_tcp_write(int fd, const u_char * buf, int count)
ssize_t
sanei_tcp_read(int fd, u_char * buf, int count)
{
return recv(fd, buf, count, 0);
ssize_t bytes_recv = 0, rc = 1;
while (bytes_recv < count && rc > 0)
{
rc = recv(fd, buf+bytes_recv, count-bytes_recv, 0);
if (rc > 0)
bytes_recv += rc;
}
return bytes_recv;
}