Should now compile with mingw cross (still need zlib + err.h)

This commit is contained in:
frekky 2015-11-15 20:57:45 +08:00
parent 35a0f8279d
commit 4c8732f0ca
2 changed files with 11 additions and 10 deletions

View File

@ -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 {

View File

@ -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 {