Make windows happier still

svn:r392
This commit is contained in:
Nick Mathewson 2003-08-12 08:18:13 +00:00
parent 25c9c837eb
commit bbd4032fc1
5 changed files with 27 additions and 6 deletions

View 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);
}

View File

@ -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);

View 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;

View 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

View 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")) {