aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2003-08-12 08:18:13 +0000
committerNick Mathewson <nickm@torproject.org>2003-08-12 08:18:13 +0000
commitbbd4032fc14fb23edf7633382ed26788523ac728 (patch)
treeb750c6470d44414897d7a977ed14c7f6ba809d6f /src/common
parent25c9c837eb6fde0e7a6ef84b76602450e5672d53 (diff)
downloadtor-bbd4032fc14fb23edf7633382ed26788523ac728.tar
tor-bbd4032fc14fb23edf7633382ed26788523ac728.tar.gz
Make windows happier still
svn:r392
Diffstat (limited to 'src/common')
-rw-r--r--src/common/aes.c6
-rw-r--r--src/common/fakepoll.c9
-rw-r--r--src/common/util.c15
-rw-r--r--src/common/util.h1
4 files changed, 26 insertions, 5 deletions
diff --git a/src/common/aes.c b/src/common/aes.c
index 037d7b306..590d30483 100644
--- a/src/common/aes.c
+++ b/src/common/aes.c
@@ -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);
}
diff --git a/src/common/fakepoll.c b/src/common/fakepoll.c
index d2928761c..ec1201a79 100644
--- a/src/common/fakepoll.c
+++ b/src/common/fakepoll.c
@@ -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);
diff --git a/src/common/util.c b/src/common/util.c
index c313fb5db..378612d10 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -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;
diff --git a/src/common/util.h b/src/common/util.h
index 860038732..3569632e9 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -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