aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog28
-rw-r--r--src/assuan-buffer.c6
-rw-r--r--src/assuan-defs.h18
-rw-r--r--src/assuan-io.c15
-rw-r--r--src/assuan-listen.c4
-rw-r--r--src/assuan-logging.c5
-rw-r--r--src/assuan-pipe-connect.c15
-rw-r--r--src/assuan-pipe-server.c19
-rw-r--r--src/assuan-socket-connect.c11
-rw-r--r--src/assuan-socket-server.c11
-rw-r--r--src/assuan-socket.c20
-rw-r--r--src/assuan-uds.c17
-rw-r--r--src/assuan.h.in4
-rw-r--r--src/debug.c10
-rw-r--r--src/debug.h4
-rw-r--r--src/mkheader.c18
-rw-r--r--src/posix-fd-t.inc.h2
-rw-r--r--src/system-w32ce.c3
-rw-r--r--src/system.c6
-rw-r--r--src/sysutils.c6
-rw-r--r--src/w32-fd-t.inc.h2
-rw-r--r--src/w32-types.inc.h6
-rw-r--r--src/w32ce-fd-t.inc.h2
23 files changed, 180 insertions, 52 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c84cc33..5a875a4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,31 @@
+2010-11-01 Werner Koch <[email protected]>
+
+ * assuan-socket.c (S_IRUSR) [W32]: Define if not defined.
+
+ * sysutils.c: Remove include of devload.h.
+
+ * assuan-defs.h [HAVE_WINSOCK2_H]: Include winsock2.h prior to
+ windows.h.
+ * assuan-pipe-server.c: Ditto.
+ * sysutils.c: Ditto.
+ * assuan-socket-server.c: Ditto.
+ * assuan-pipe-connect.c: Ditto.
+ * assuan-socket-connect.c: Ditto.
+ * assuan-uds.c: Ditto.
+ * assuan-logging.c: Ditto.
+ * system-w32ce.c: Ditto.
+ * assuan-io.c: Ditto.
+
+ * w32-types.inc.h [_MSC_VER]: Define ssize_t and pid_t.
+
+ * w32ce-fd-t.inc.h, w32-fd-t.inc.h, posix-fd-t.inc.h, debug.h:
+ s/inline/GPG_ERR_INLINE/.
+ * assuan.h.in: Let mkheader write the sys/types.h and unistd.h
+ include lines.
+ * mkheader.c: Change accordingly.
+
+ Guard include of sys/types.h, sys/stat.h, sys/time.h and unistd.h.
+
2010-09-17 Werner Koch <[email protected]>
* assuan-socket-connect.c (INADDR_NONE): New replacement. Fixes
diff --git a/src/assuan-buffer.c b/src/assuan-buffer.c
index 45dc08c..3c2e7be 100644
--- a/src/assuan-buffer.c
+++ b/src/assuan-buffer.c
@@ -22,10 +22,12 @@
#include <string.h>
#include <stdio.h>
#include <errno.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <assert.h>
#ifdef HAVE_W32_SYSTEM
-#include <process.h>
+# include <process.h>
#endif
#include "assuan-defs.h"
diff --git a/src/assuan-defs.h b/src/assuan-defs.h
index 9c1e64e..4a25568 100644
--- a/src/assuan-defs.h
+++ b/src/assuan-defs.h
@@ -21,14 +21,22 @@
#ifndef ASSUAN_DEFS_H
#define ASSUAN_DEFS_H
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
#ifndef HAVE_W32_SYSTEM
-#include <sys/socket.h>
-#include <sys/un.h>
+# include <sys/socket.h>
+# include <sys/un.h>
#else
-#include <windows.h>
+# ifdef HAVE_WINSOCK2_H
+# /* Avoid inclusion of winsock.h via windows.h. */
+# include <winsock2.h>
+# endif
+# include <windows.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
#endif
-#include <unistd.h>
#include "assuan.h"
diff --git a/src/assuan-io.c b/src/assuan-io.c
index c5bbc99..8bb8ed9 100644
--- a/src/assuan-io.c
+++ b/src/assuan-io.c
@@ -22,14 +22,23 @@
#endif
#include <time.h>
-#include <sys/time.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <errno.h>
#ifdef HAVE_W32_SYSTEM
+# ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+# endif
# include <windows.h>
#else
# include <sys/wait.h>
diff --git a/src/assuan-listen.c b/src/assuan-listen.c
index 55ddd0a..2c589ab 100644
--- a/src/assuan-listen.c
+++ b/src/assuan-listen.c
@@ -24,7 +24,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <errno.h>
#include "assuan-defs.h"
diff --git a/src/assuan-logging.c b/src/assuan-logging.c
index dc2427e..d74e5d2 100644
--- a/src/assuan-logging.c
+++ b/src/assuan-logging.c
@@ -26,7 +26,10 @@
#include <string.h>
#include <stdarg.h>
#ifdef HAVE_W32_SYSTEM
-#include <windows.h>
+# ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+# endif
+# include <windows.h>
#endif /*HAVE_W32_SYSTEM*/
#include <errno.h>
#include <ctype.h>
diff --git a/src/assuan-pipe-connect.c b/src/assuan-pipe-connect.c
index bdcedc1..ed23cb2 100644
--- a/src/assuan-pipe-connect.c
+++ b/src/assuan-pipe-connect.c
@@ -29,14 +29,21 @@
#ifndef HAVE_DOSISH_SYSTEM
# include <signal.h>
#endif
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <errno.h>
#include <fcntl.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
#ifndef HAVE_W32_SYSTEM
-#include <sys/wait.h>
+# include <sys/wait.h>
#else
-#include <windows.h>
+# ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+# endif
+# include <windows.h>
#endif
#include "assuan-defs.h"
diff --git a/src/assuan-pipe-server.c b/src/assuan-pipe-server.c
index f8c98d0..3304498 100644
--- a/src/assuan-pipe-server.c
+++ b/src/assuan-pipe-server.c
@@ -23,12 +23,21 @@
#include <stdlib.h>
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#ifdef HAVE_W32_SYSTEM
-#include <windows.h>
-#include <fcntl.h>
+# ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+# endif
+# include <windows.h>
+# include <fcntl.h>
#endif
#include "assuan-defs.h"
diff --git a/src/assuan-socket-connect.c b/src/assuan-socket-connect.c
index b54d5e4..4ccaf1a 100644
--- a/src/assuan-socket-connect.c
+++ b/src/assuan-socket-connect.c
@@ -26,9 +26,16 @@
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
-#include <unistd.h>
-#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
#ifdef HAVE_W32_SYSTEM
+# ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+# endif
# include <windows.h>
#else
# include <sys/socket.h>
diff --git a/src/assuan-socket-server.c b/src/assuan-socket-server.c
index 031ee88..27994a2 100644
--- a/src/assuan-socket-server.c
+++ b/src/assuan-socket-server.c
@@ -24,9 +24,16 @@
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
#ifdef HAVE_W32_SYSTEM
+# ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+# endif
# include <windows.h>
# if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
diff --git a/src/assuan-socket.c b/src/assuan-socket.c
index ca0609a..937ff56 100644
--- a/src/assuan-socket.c
+++ b/src/assuan-socket.c
@@ -24,16 +24,18 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_W32_SYSTEM
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <wincrypt.h>
-#include <io.h>
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+# include <wincrypt.h>
+# include <io.h>
#else
-#include <sys/types.h>
-#include <sys/socket.h>
+# include <sys/types.h>
+# include <sys/socket.h>
#endif
#include <errno.h>
-#include <sys/stat.h>
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
#include <fcntl.h>
#include <assert.h>
@@ -53,6 +55,10 @@
#endif
#ifdef HAVE_W32_SYSTEM
+#ifndef S_IRUSR
+# define S_IRUSR 0
+# define S_IWUSR 0
+#endif
#ifndef S_IRGRP
# define S_IRGRP 0
# define S_IWGRP 0
diff --git a/src/assuan-uds.c b/src/assuan-uds.c
index 96cf683..93fa957 100644
--- a/src/assuan-uds.c
+++ b/src/assuan-uds.c
@@ -25,17 +25,24 @@
#include <stddef.h>
#include <stdio.h>
#include <errno.h>
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
#ifndef HAVE_W32_SYSTEM
-#include <sys/socket.h>
-#include <sys/un.h>
+# include <sys/socket.h>
+# include <sys/un.h>
#else
-#include <windows.h>
+# ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+# endif
+# include <windows.h>
#endif
#if HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <fcntl.h>
#include <string.h>
#include <assert.h>
diff --git a/src/assuan.h.in b/src/assuan.h.in
index 456e184..ea91973 100644
--- a/src/assuan.h.in
+++ b/src/assuan.h.in
@@ -24,8 +24,8 @@
#define ASSUAN_H
#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
+@include:sys/types.h@
+@include:unistd.h@
#include <stdarg.h>
#ifndef _ASSUAN_NO_SOCKET_WRAPPER
diff --git a/src/debug.c b/src/debug.c
index 6ebc179..5ed4d4d 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -26,13 +26,15 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
#include <ctype.h>
#include <errno.h>
#ifndef HAVE_DOSISH_SYSTEM
-# include <sys/types.h>
-# include <sys/stat.h>
-# include <fcntl.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <fcntl.h>
#endif
#include <assert.h>
diff --git a/src/debug.h b/src/debug.h
index 8d2771e..bd586c3 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -39,10 +39,10 @@
/* Remove path components from filenames (i.e. __FILE__) for cleaner
logs. */
-static inline const char *_assuan_debug_srcname (const char *file)
+static GPG_ERR_INLINE const char *_assuan_debug_srcname (const char *file)
ASSUAN_GCC_A_PURE;
-static inline const char *
+static GPG_ERR_INLINE const char *
_assuan_debug_srcname (const char *file)
{
const char *s = strrchr (file, '/');
diff --git a/src/mkheader.c b/src/mkheader.c
index 1b2e165..d44f6b4 100644
--- a/src/mkheader.c
+++ b/src/mkheader.c
@@ -82,6 +82,24 @@ write_special (const char *fname, int lnr, const char *tag)
else
include_file (fname, lnr, "posix-includes.inc.h");
}
+ else if (!strcmp (tag, "include:sys/types.h"))
+ {
+ if (!strcmp (host_os, "mingw32ce"))
+ fputs ("#ifdef __MINGW32CE__\n"
+ "# include <sys/types.h>\n"
+ "#endif\n", stdout);
+ else
+ fputs ("#include <sys/types.h>\n", stdout);
+ }
+ else if (!strcmp (tag, "include:unistd.h"))
+ {
+ if (!strcmp (host_os, "mingw32ce"))
+ fputs ("#ifdef __MINGW32CE__\n"
+ "# include <unistd.h>\n"
+ "#endif\n", stdout);
+ else
+ fputs ("#include <unistd.h>\n", stdout);
+ }
else if (!strcmp (tag, "include:types"))
{
if (strstr (host_os, "mingw32"))
diff --git a/src/posix-fd-t.inc.h b/src/posix-fd-t.inc.h
index 35bf5ae..80aa5f0 100644
--- a/src/posix-fd-t.inc.h
+++ b/src/posix-fd-t.inc.h
@@ -23,7 +23,7 @@
typedef int assuan_fd_t;
#define ASSUAN_INVALID_FD (-1)
#define ASSUAN_INVALID_PID ((pid_t) -1)
-static inline assuan_fd_t
+static GPG_ERR_INLINE assuan_fd_t
assuan_fd_from_posix_fd (int fd)
{
return fd;
diff --git a/src/system-w32ce.c b/src/system-w32ce.c
index c201c47..3061f45 100644
--- a/src/system-w32ce.c
+++ b/src/system-w32ce.c
@@ -26,6 +26,9 @@
#include <errno.h>
#include <time.h>
#include <fcntl.h>
+# ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+# endif
#include <windows.h>
#include <winioctl.h>
#include <devload.h>
diff --git a/src/system.c b/src/system.c
index 779b567..1c7d617 100644
--- a/src/system.c
+++ b/src/system.c
@@ -24,8 +24,10 @@
#include <stdlib.h>
#include <errno.h>
-/* Solaris 8 needs sys/types.h before time.h. */
-#include <sys/types.h>
+#ifdef HAVE_SYS_TYPES_H
+ /* Solaris 8 needs sys/types.h before time.h. */
+# include <sys/types.h>
+#endif
#include <time.h>
#include <fcntl.h>
diff --git a/src/sysutils.c b/src/sysutils.c
index 1760f44..578e47d 100644
--- a/src/sysutils.c
+++ b/src/sysutils.c
@@ -25,10 +25,12 @@
#include <string.h>
#include <stdarg.h>
#ifdef HAVE_W32_SYSTEM
-#include <windows.h>
+# ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+# endif
+# include <windows.h>
# ifdef HAVE_W32CE_SYSTEM
# include <winioctl.h>
-# include <devload.h>
# endif /*HAVE_W32CE_SYSTEM*/
#endif /*HAVE_W32_SYSTEM*/
diff --git a/src/w32-fd-t.inc.h b/src/w32-fd-t.inc.h
index 11cd511..37f20f4 100644
--- a/src/w32-fd-t.inc.h
+++ b/src/w32-fd-t.inc.h
@@ -27,7 +27,7 @@
typedef void *assuan_fd_t;
#define ASSUAN_INVALID_FD ((void*)(-1))
#define ASSUAN_INVALID_PID ((pid_t) -1)
-static inline assuan_fd_t
+static GPG_ERR_INLINE assuan_fd_t
assuan_fd_from_posix_fd (int fd)
{
if (fd < 0)
diff --git a/src/w32-types.inc.h b/src/w32-types.inc.h
index 56bc7b2..35aaec9 100644
--- a/src/w32-types.inc.h
+++ b/src/w32-types.inc.h
@@ -20,4 +20,10 @@
## This file is included by the mkheader tool. Lines starting with
## a double hash mark are not copied to the destination file.
typedef void *assuan_msghdr_t;
+
+#ifdef _MSC_VER
+ typedef long ssize_t;
+ typedef int pid_t;
+#endif
+
##EOF##
diff --git a/src/w32ce-fd-t.inc.h b/src/w32ce-fd-t.inc.h
index df55f23..2de72e6 100644
--- a/src/w32ce-fd-t.inc.h
+++ b/src/w32ce-fd-t.inc.h
@@ -23,7 +23,7 @@
typedef void *assuan_fd_t;
#define ASSUAN_INVALID_FD ((void*)(-1))
#define ASSUAN_INVALID_PID ((pid_t) -1)
-static inline assuan_fd_t
+static GPG_ERR_INLINE assuan_fd_t
assuan_fd_from_posix_fd (int fd)
{
return (assuan_fd_t)(fd);