]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Make windows happier still
authorNick Mathewson <nickm@torproject.org>
Tue, 12 Aug 2003 08:18:13 +0000 (08:18 +0000)
committerNick Mathewson <nickm@torproject.org>
Tue, 12 Aug 2003 08:18:13 +0000 (08:18 +0000)
svn:r392

src/common/aes.c
src/common/fakepoll.c
src/common/util.c
src/common/util.h
src/or/routers.c

index 037d7b3061e3335ef3e3f76e5bc92bf5a72929ba..590d304837b2a8c460484d65a705517c5949bb06 100644 (file)
@@ -122,9 +122,9 @@ aes_get_counter(aes_cnt_cipher_t *cipher)
 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 d2928761cb1aadc1e3f87de80ad9f62ccb9a0c1a..ec1201a797df6cbabce1153c07defdf39d6c3422 100644 (file)
 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 c313fb5db86eb4bf6f96becce202442e754ddbe7..378612d10e6e88d3fd47778f634d0c58a58489fa 100644 (file)
@@ -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 @@ tor_socketpair(int family, int type, int protocol, int fd[2])
         || family != AF_UNIX
 #endif
         ) {
+#ifdef _MSC_VER
+               errno = WSAEAFNOSUPPORT;
+#else
         errno = EAFNOSUPPORT;
+#endif
         return -1;
     }
     if (!fd) {
@@ -202,7 +213,11 @@ tor_socketpair(int family, int type, int protocol, int fd[2])
     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 86003873277fa6a633c766d0fc4edcafb78c4b86..3569632e979fe34ef8516dd4b7a63fe08d1e9d40 100644 (file)
@@ -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
index f4d059d9ccaaff6f1efab87cd3a35eab95d7ae1c..e9cee1ef7cc685a88a57507c9f0170dd9cfdc750 100644 (file)
@@ -56,7 +56,7 @@ int learn_my_address(struct sockaddr_in *me) {
   memset(me,0,sizeof(struct sockaddr_in));
   me->sin_family = AF_INET;
   memcpy((void *)&me->sin_addr,(void *)localhost->h_addr,sizeof(struct in_addr));
-  me->sin_port = htons(options.ORPort);
+  me->sin_port = htons((uint16_t) options.ORPort);
   log_fn(LOG_DEBUG,"chose address as '%s'.",inet_ntoa(me->sin_addr));
   if (!strncmp("127.",inet_ntoa(me->sin_addr), 4) &&
       strcasecmp(localhostname, "localhost")) {