diff --git a/ChangeLog b/ChangeLog index 2c991ac1e..efeff8181 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-06-09 Chris Bagwell + * 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 * backend/lexmark.h backend/lexmark.c backend/lexmark_low.c: cleanups, better 'fake usb' and possible fix for bug #311862 diff --git a/backend/epson2_net.c b/backend/epson2_net.c index 63ac87ce5..14b8b1d5a 100644 --- a/backend/epson2_net.c +++ b/backend/epson2_net.c @@ -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); diff --git a/lib/getopt.c b/lib/getopt.c index 997fa69b8..9dabb82b0 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -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, diff --git a/lib/getopt1.c b/lib/getopt1.c index 8ae8a0579..5ace00a8c 100644 --- a/lib/getopt1.c +++ b/lib/getopt1.c @@ -27,7 +27,7 @@ #ifdef _LIBC # include #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 diff --git a/sanei/sanei_tcp.c b/sanei/sanei_tcp.c index 128ba7f26..e60430b44 100644 --- a/sanei/sanei_tcp.c +++ b/sanei/sanei_tcp.c @@ -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; }