[or-cvs] Make windows happier still

Nick Mathewson nickm at seul.org
Tue Aug 12 08:18:15 UTC 2003


Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv9512/src/common

Modified Files:
	aes.c fakepoll.c util.c util.h 
Log Message:
Make windows happier still

Index: aes.c
===================================================================
RCS file: /home/or/cvsroot/src/common/aes.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- aes.c	12 Aug 2003 06:45:03 -0000	1.3
+++ aes.c	12 Aug 2003 08:18:13 -0000	1.4
@@ -122,9 +122,9 @@
 void
 aes_set_counter(aes_cnt_cipher_t *cipher, u64 counter)
 {
-  cipher->pos = counter & 0x0f;
-  cipher->counter0 = (counter >> 4) & 0xffffffff;
-  cipher->counter1 = (counter >> 36);
+  cipher->pos = (u8)(counter & 0x0f);
+  cipher->counter0 = (u32) ((counter >> 4) & 0xffffffff);
+  cipher->counter1 = (u32) (counter >> 36);
   _aes_fill_buf(cipher);
 }
 

Index: fakepoll.c
===================================================================
RCS file: /home/or/cvsroot/src/common/fakepoll.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- fakepoll.c	12 Aug 2003 06:41:40 -0000	1.5
+++ fakepoll.c	12 Aug 2003 08:18:13 -0000	1.6
@@ -28,12 +28,17 @@
 int
 poll(struct pollfd *ufds, unsigned int nfds, int timeout)
 {
-	int idx, maxfd, fd, r;
+	unsigned int idx, maxfd, fd;
+	int r;
 	fd_set readfds, writefds, exceptfds;
+#ifdef USING_FAKE_TIMEVAL
+#undef timeval
+#undef tv_sec
+#undef tv_usec
+#endif
 	struct timeval _timeout;
 	_timeout.tv_sec = timeout/1000;
 	_timeout.tv_usec = (timeout%1000)*1000;
-	
 	FD_ZERO(&readfds);
 	FD_ZERO(&writefds);
 	FD_ZERO(&exceptfds);

Index: util.c
===================================================================
RCS file: /home/or/cvsroot/src/common/util.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- util.c	12 Aug 2003 07:49:29 -0000	1.12
+++ util.c	12 Aug 2003 08:18:13 -0000	1.13
@@ -3,6 +3,13 @@
 /* $Id$ */
 
 #include "../or/or.h"
+
+#ifdef _MSC_VER
+#include <io.h>
+#include <limits.h>
+#include <process.h>
+#endif
+
 #include "util.h"
 #include "log.h"
 
@@ -146,7 +153,11 @@
         || family != AF_UNIX
 #endif
         ) {
+#ifdef _MSC_VER
+		errno = WSAEAFNOSUPPORT;
+#else
         errno = EAFNOSUPPORT;
+#endif
         return -1;
     }
     if (!fd) {
@@ -202,7 +213,11 @@
     return 0;
 
   abort_tidy_up_and_fail:
+#ifdef _MSC_VER
+  errno = WSAECONNABORTED;
+#else
   errno = ECONNABORTED; /* I hope this is portable and appropriate.  */
+#endif
   tidy_up_and_fail:
     {
         int save_errno = errno;

Index: util.h
===================================================================
RCS file: /home/or/cvsroot/src/common/util.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- util.h	12 Aug 2003 07:43:15 -0000	1.6
+++ util.h	12 Aug 2003 08:18:13 -0000	1.7
@@ -15,6 +15,7 @@
 #endif
 #ifndef HAVE_GETTIMEOFDAY
 #ifdef HAVE_FTIME
+#define USING_FAKE_TIMEVAL
 #include <sys/timeb.h>
 #define timeval timeb
 #define tv_sec time



More information about the tor-commits mailing list