diff --git a/ChangeLog b/ChangeLog index 5fadd04a4..1cb918e7c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-11-05 Chris Bagwell + * lib/vsyslog.c, frontend/scanimage.c, include/sane/sanei_tcp.h + include/sane/sanei_udp.h, lib/inet_ntop.c, lib/inet_pton.c, + sanei/sanie_init_debug.c, sanei/sanei_scsi.c, sanei/sanei_tcp.c, + sanei_udp.c, sanei_usb.c: mingw32 compile fixes. Mostly its + not including header files that windows doesn't have and + add winsock.h as needed. Also, do not use signals windows + doesn't have as well. + 2011-11-02 Stéphane Voltz * backend/genesys_*.[ch] backend/Makefile.am backend/Makefile.in: genesys_gl841.h creation and genesys backend code cleanup diff --git a/frontend/scanimage.c b/frontend/scanimage.c index 1d4839215..540c5d4d1 100644 --- a/frontend/scanimage.c +++ b/frontend/scanimage.c @@ -2211,9 +2211,13 @@ List of available devices:", prog_name); if (output_format != OUTPUT_PNM) resolution_value = get_resolution (); +#ifdef SIGHUP signal (SIGHUP, sighandler); - signal (SIGINT, sighandler); +#endif +#ifdef SIGPIPE signal (SIGPIPE, sighandler); +#endif + signal (SIGINT, sighandler); signal (SIGTERM, sighandler); if (test == 0) diff --git a/include/sane/sanei_tcp.h b/include/sane/sanei_tcp.h index df20f7b01..b285f8f76 100644 --- a/include/sane/sanei_tcp.h +++ b/include/sane/sanei_tcp.h @@ -20,8 +20,10 @@ #include +#ifdef HAVE_SYS_SOCKET_H #include #include +#endif extern SANE_Status sanei_tcp_open(const char *host, int port, int *fdp); extern void sanei_tcp_close(int fd); diff --git a/include/sane/sanei_udp.h b/include/sane/sanei_udp.h index b84c678cd..a16d1bac4 100644 --- a/include/sane/sanei_udp.h +++ b/include/sane/sanei_udp.h @@ -20,8 +20,10 @@ #include +#ifdef HAVE_SYS_SOCKET_H #include #include +#endif extern SANE_Status sanei_udp_open(const char *host, int port, int *fdp); extern SANE_Status sanei_udp_open_broadcast(int *fdp); diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c index c7829489b..f5944672d 100644 --- a/lib/inet_ntop.c +++ b/lib/inet_ntop.c @@ -4,9 +4,14 @@ #include #include +#ifdef WIN32 +#include +#endif +#ifdef HAVE_SYS_SOCKET_H #include #include #include +#endif const char * diff --git a/lib/inet_pton.c b/lib/inet_pton.c index 66be2095f..8c1d21da5 100644 --- a/lib/inet_pton.c +++ b/lib/inet_pton.c @@ -4,9 +4,14 @@ #include #include +#ifdef WIN32 +#include +#endif +#ifdef HAVE_SYS_SOCKET_H #include #include #include +#endif int inet_pton (int af, const char *src, void *dst) diff --git a/lib/vsyslog.c b/lib/vsyslog.c index ce86301ec..5878cff20 100644 --- a/lib/vsyslog.c +++ b/lib/vsyslog.c @@ -1,13 +1,11 @@ #include "../include/sane/config.h" -#include "stdio.h" -#include -#include - #ifndef HAVE_VSYSLOG -void -vsyslog(int priority, const char *format, va_list args) +#include +#include + +void vsyslog(int priority, const char *format, va_list args) { char buf[1024]; vsnprintf(buf, sizeof(buf), format, args); diff --git a/sanei/sanei_init_debug.c b/sanei/sanei_init_debug.c index 87296882f..6b50f0364 100644 --- a/sanei/sanei_init_debug.c +++ b/sanei/sanei_init_debug.c @@ -48,7 +48,9 @@ #endif #include #include +#ifdef HAVE_VSYSLOG #include +#endif #ifdef HAVE_OS2_H #include #endif diff --git a/sanei/sanei_scsi.c b/sanei/sanei_scsi.c index 69d5859b7..09127c843 100644 --- a/sanei/sanei_scsi.c +++ b/sanei/sanei_scsi.c @@ -56,7 +56,9 @@ #include #include +#ifdef HAVE_SYS_IOCTL_H #include +#endif #include #include @@ -5046,7 +5048,7 @@ sanei_scsi_cmd2 (int fd, pkt.sptd.TimeOutValue = sane_scsicmd_timeout; - pkt.sptd.SenseInfoOffset = offsetof(struct pkt, sense); + pkt.sptd.SenseInfoOffset = (void *)pkt.sense - (void *)&pkt; pkt.sptd.SenseInfoLength = sizeof(pkt.sense); ret = DeviceIoControl(fd, diff --git a/sanei/sanei_tcp.c b/sanei/sanei_tcp.c index e60430b44..d61404de2 100644 --- a/sanei/sanei_tcp.c +++ b/sanei/sanei_tcp.c @@ -46,7 +46,12 @@ #include #include +#ifdef WIN32 +#include +#endif +#ifdef HAVE_SYS_SOCKET_H #include +#endif #define BACKEND_NAME sanei_tcp diff --git a/sanei/sanei_udp.c b/sanei/sanei_udp.c index 9379e4f25..82a8b0a4d 100644 --- a/sanei/sanei_udp.c +++ b/sanei/sanei_udp.c @@ -46,10 +46,15 @@ #include #include +#ifdef WIN32 +#include +#endif +#ifdef HAVE_SYS_SOCKET_H #include #include #include #include +#endif #define BACKEND_NAME sanei_udp diff --git a/sanei/sanei_usb.c b/sanei/sanei_usb.c index 3130a7153..e8a3d1a75 100644 --- a/sanei/sanei_usb.c +++ b/sanei/sanei_usb.c @@ -55,7 +55,9 @@ #include #include #include +#ifdef HAVE_SYS_IOCTL_H #include +#endif #include #include #include @@ -1807,6 +1809,7 @@ sanei_usb_open (SANE_String_Const devname, SANE_Int * dn) devname, strerror (errno)); return status; } +#ifdef FD_CLOEXEC flag = fcntl (devices[devcount].fd, F_GETFD); if (flag >= 0) { @@ -1814,6 +1817,7 @@ sanei_usb_open (SANE_String_Const devname, SANE_Int * dn) DBG (1, "sanei_usb_open: fcntl of `%s' failed: %s\n", devname, strerror (errno)); } +#endif } else if (devices[devcount].method == sanei_usb_method_usbcalls) {