[svn] gcry - r1164 - trunk/src

svn author marcus cvs at cvs.gnupg.org
Tue Jul 4 15:06:05 CEST 2006


Author: marcus
Date: 2006-07-04 15:06:04 +0200 (Tue, 04 Jul 2006)
New Revision: 1164

Modified:
   trunk/src/ChangeLog
   trunk/src/ath.h
   trunk/src/gcrypt.h
   trunk/src/types.h
Log:
2006-07-04  Marcus Brinkmann  <marcus at g10code.de>

	* ath.c: Avoid warning about double defined type byte and other
	hacks to let it build for W32 (backported from LIBGCRYPT-1-2-BRANCH).
	* ath.h, gcrypt.h, tests/benchmark.c, src/types.h: Likewise.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2006-07-04 12:54:17 UTC (rev 1163)
+++ trunk/src/ChangeLog	2006-07-04 13:06:04 UTC (rev 1164)
@@ -2,6 +2,7 @@
 
 	* ath.c: Avoid warning about double defined type byte and other
 	hacks to let it build for W32 (backported from LIBGCRYPT-1-2-BRANCH).
+	* ath.h, gcrypt.h, tests/benchmark.c, src/types.h: Likewise.
 
 	* gcrypt.h: Revert last change, and instead:
 	[_WIN32 || __WIN32__]: Do not include <sys/socket.h>, but

Modified: trunk/src/ath.h
===================================================================
--- trunk/src/ath.h	2006-07-04 12:54:17 UTC (rev 1163)
+++ trunk/src/ath.h	2006-07-04 13:06:04 UTC (rev 1164)
@@ -22,9 +22,6 @@
 #define ATH_H
 
 #ifdef _WIN32
-#warning We need to replace these hacks by cleaner code.
-typedef int ssize_t;
-typedef int pid_t;
 #include <windows.h>
 #else
 #include <sys/types.h>
@@ -78,6 +75,15 @@
   int (*mutex_unlock) (void *priv);
   ssize_t (*read) (int fd, void *buf, size_t nbytes);
   ssize_t (*write) (int fd, const void *buf, size_t nbytes);
+#ifdef _WIN32
+  ssize_t (*select) (int nfd, void *rset, void *wset, void *eset,
+		     struct timeval *timeout);
+  ssize_t (*waitpid) (pid_t pid, int *status, int options);
+  int (*accept) (int s, void  *addr, int *length_ptr);
+  int (*connect) (int s, void *addr, socklen_t length);
+  int (*sendmsg) (int s, const void *msg, int flags);
+  int (*recvmsg) (int s, void *msg, int flags);
+#else
   ssize_t (*select) (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
 		     struct timeval *timeout);
   ssize_t (*waitpid) (pid_t pid, int *status, int options);
@@ -85,6 +91,7 @@
   int (*connect) (int s, struct sockaddr *addr, socklen_t length);
   int (*sendmsg) (int s, const struct msghdr *msg, int flags);
   int (*recvmsg) (int s, struct msghdr *msg, int flags);
+#endif
 };
 
 gpg_err_code_t ath_install (struct ath_ops *ath_ops, int check_only);
@@ -100,11 +107,19 @@
 int ath_mutex_lock (ath_mutex_t *mutex);
 int ath_mutex_unlock (ath_mutex_t *mutex);
 
-
 /* Replacement for the POSIX functions, which can be used to allow
    other (user-level) threads to run.  */
 ssize_t ath_read (int fd, void *buf, size_t nbytes);
 ssize_t ath_write (int fd, const void *buf, size_t nbytes);
+#ifdef _WIN32
+ssize_t ath_select (int nfd, void *rset, void *wset, void *eset,
+		    struct timeval *timeout);
+ssize_t ath_waitpid (pid_t pid, int *status, int options);
+int ath_accept (int s, void *addr, int *length_ptr);
+int ath_connect (int s, void *addr, int length);
+int ath_sendmsg (int s, const void *msg, int flags);
+int ath_recvmsg (int s, void *msg, int flags);
+#else
 ssize_t ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
 		    struct timeval *timeout);
 ssize_t ath_waitpid (pid_t pid, int *status, int options);
@@ -112,5 +127,6 @@
 int ath_connect (int s, struct sockaddr *addr, socklen_t length);
 int ath_sendmsg (int s, const struct msghdr *msg, int flags);
 int ath_recvmsg (int s, struct msghdr *msg, int flags);
+#endif 
 
 #endif	/* ATH_H */

Modified: trunk/src/gcrypt.h
===================================================================
--- trunk/src/gcrypt.h	2006-07-04 12:54:17 UTC (rev 1163)
+++ trunk/src/gcrypt.h	2006-07-04 13:06:04 UTC (rev 1164)
@@ -34,7 +34,7 @@
 # include <ws2tcpip.h>
 #else
 # include <sys/socket.h>
-#endif
+#endif /*!_WIN32*/
 
 #include <sys/time.h>
 
@@ -178,6 +178,15 @@
   int (*mutex_unlock) (void **priv);
   ssize_t (*read) (int fd, void *buf, size_t nbytes);
   ssize_t (*write) (int fd, const void *buf, size_t nbytes);
+#ifdef _WIN32
+  ssize_t (*select) (int nfd, void *rset, void *wset, void *eset,
+		     struct timeval *timeout);
+  ssize_t (*waitpid) (pid_t pid, int *status, int options);
+  int (*accept) (int s, void  *addr, int *length_ptr);
+  int (*connect) (int s, void *addr, socklen_t length);
+  int (*sendmsg) (int s, const void *msg, int flags);
+  int (*recvmsg) (int s, void *msg, int flags);
+#else
   ssize_t (*select) (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
 		     struct timeval *timeout);
   ssize_t (*waitpid) (pid_t pid, int *status, int options);
@@ -185,6 +194,7 @@
   int (*connect) (int s, struct sockaddr *addr, socklen_t length);
   int (*sendmsg) (int s, const struct msghdr *msg, int flags);
   int (*recvmsg) (int s, struct msghdr *msg, int flags);
+#endif
 };
 
 #define GCRY_THREAD_OPTION_PTH_IMPL					      \

Modified: trunk/src/types.h
===================================================================
--- trunk/src/types.h	2006-07-04 12:54:17 UTC (rev 1163)
+++ trunk/src/types.h	2006-07-04 13:06:04 UTC (rev 1164)
@@ -43,7 +43,11 @@
 
 #ifndef HAVE_BYTE_TYPEDEF
 #undef byte	    /* maybe there is a macro with this name */
+/* Windows typedefs byte in the rpc headers.  Avoid warning about
+   double definition.  */
+#if !(defined(_WIN32) && defined(cbNDRContext))
   typedef unsigned char byte;
+#endif
 #define HAVE_BYTE_TYPEDEF
 #endif
 




More information about the Gnupg-commits mailing list