diff --git a/src/tun.c b/src/tun.c index 6b53c69..f563320 100644 --- a/src/tun.c +++ b/src/tun.c @@ -466,7 +466,7 @@ close_tun(int tun_fd) #ifdef WINDOWS32 int -write_tun(int tun_fd, char *data, size_t len) +write_tun(int tun_fd, uint8_t *data, size_t len) { DWORD written; DWORD res; @@ -490,12 +490,12 @@ write_tun(int tun_fd, char *data, size_t len) } ssize_t -read_tun(int tun_fd, char *buf, size_t len) +read_tun(int tun_fd, uint8_t *buf, size_t len) { int bytes; memset(buf, 0, 4); - bytes = recv(tun_fd, buf + 4, len - 4, 0); + bytes = recv(tun_fd, (char *)buf + 4, len - 4, 0); if (bytes < 0) { return bytes; } else { diff --git a/src/windows.h b/src/windows.h index e3295f1..2addd6e 100644 --- a/src/windows.h +++ b/src/windows.h @@ -102,11 +102,16 @@ struct ip /* Convenience macros for operations on timevals. NOTE: `timercmp' does not work for >= or <=. */ #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) + +#ifndef timerclear #define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) +#endif +#ifndef timercmp #define timercmp(a, b, CMP) \ (((a)->tv_sec == (b)->tv_sec) ? \ ((a)->tv_usec CMP (b)->tv_usec) : \ ((a)->tv_sec CMP (b)->tv_sec)) +#endif #define timeradd(a, b, result) \ do { \ (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ @@ -127,18 +132,13 @@ struct ip } \ } while (0) -struct timezone -{ - int tz_minuteswest; /* minutes W of Greenwich */ - int tz_dsttime; /* type of dst correction */ -}; - +#if 0 inline int gettimeofday(struct timeval *tv, struct timezone *tz) { FILETIME ft; unsigned __int64 tmpres = 0; - static int tzflag = 0; + int tzflag = 0; if (NULL != tv) { @@ -169,6 +169,7 @@ gettimeofday(struct timeval *tv, struct timezone *tz) return 0; } +#endif DWORD WINAPI tun_reader(LPVOID arg); struct tun_data {