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);
}
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);
/* $Id$ */
#include "../or/or.h"
+
+#ifdef _MSC_VER
+#include <io.h>
+#include <limits.h>
+#include <process.h>
+#endif
+
#include "util.h"
#include "log.h"
|| family != AF_UNIX
#endif
) {
+#ifdef _MSC_VER
+ errno = WSAEAFNOSUPPORT;
+#else
errno = EAFNOSUPPORT;
+#endif
return -1;
}
if (!fd) {
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;
#endif
#ifndef HAVE_GETTIMEOFDAY
#ifdef HAVE_FTIME
+#define USING_FAKE_TIMEVAL
#include <sys/timeb.h>
#define timeval timeb
#define tv_sec time
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")) {