diff --git a/libbitdht/src/util/bdnet.cc b/libbitdht/src/util/bdnet.cc index 495a35c56..b951f0ee2 100644 --- a/libbitdht/src/util/bdnet.cc +++ b/libbitdht/src/util/bdnet.cc @@ -276,13 +276,13 @@ int bdnet_inet_aton(const char *name, struct in_addr *addr) return (((*addr).s_addr = inet_addr(name)) != INADDR_NONE); } - - +#ifndef __MINGW64_VERSION_MAJOR int sleep(unsigned int sec) { Sleep(sec * 1000); return 0; } +#endif int usleep(unsigned int usec) { diff --git a/libbitdht/src/util/bdnet.h b/libbitdht/src/util/bdnet.h index fdc4c337f..9b9d36f48 100644 --- a/libbitdht/src/util/bdnet.h +++ b/libbitdht/src/util/bdnet.h @@ -131,9 +131,13 @@ std::string bdnet_inet_ntoa(struct in_addr in); */ #define EAGAIN 11 +#define EUSERS 87 + +#define EHOSTDOWN 112 + +#ifndef __MINGW64_VERSION_MAJOR #define EWOULDBLOCK EAGAIN -#define EUSERS 87 #define ENOTSOCK 88 #define EOPNOTSUPP 95 @@ -147,10 +151,10 @@ std::string bdnet_inet_ntoa(struct in_addr in); #define ETIMEDOUT 10060 // value from pthread.h #define ECONNREFUSED 111 -#define EHOSTDOWN 112 #define EHOSTUNREACH 113 #define EALREADY 114 #define EINPROGRESS 115 +#endif int bdnet_w2u_errno(int error); @@ -158,7 +162,9 @@ int bdnet_w2u_errno(int error); * ms uses millisecs. * void Sleep(int ms); */ +#ifndef __MINGW64_VERSION_MAJOR int sleep(unsigned int sec); +#endif int usleep(unsigned int usec); #endif // END of WINDOWS defines. diff --git a/libretroshare/src/pqi/pqinetwork.cc b/libretroshare/src/pqi/pqinetwork.cc index 72cf40e95..ba9a015ee 100644 --- a/libretroshare/src/pqi/pqinetwork.cc +++ b/libretroshare/src/pqi/pqinetwork.cc @@ -362,7 +362,7 @@ bool getLocalInterfaces(struct in_addr &routeAddr, std::list &ad addr.s_addr = ipaddr.dwAddr; rs_sprintf(out, "Iface(%ld) => %s\n", ipaddr.dwIndex, rs_inet_ntoa(addr).c_str()); -#if __MINGW_MAJOR_VERSION <= 3 +#if __MINGW_MAJOR_VERSION <= 3 && !defined(__MINGW64_VERSION_MAJOR) unsigned short wType = ipaddr.unused2; // should be wType #else unsigned short wType = ipaddr.wType; diff --git a/libretroshare/src/pqi/pqinetwork.h b/libretroshare/src/pqi/pqinetwork.h index 9c1be7473..911b42dce 100644 --- a/libretroshare/src/pqi/pqinetwork.h +++ b/libretroshare/src/pqi/pqinetwork.h @@ -64,9 +64,14 @@ extern int errno; /* Define extern errno, to duplicate unix behaviour */ * NB. we should make the same, but not necessary */ #define EAGAIN 11 -#define EWOULDBLOCK EAGAIN #define EUSERS 87 + +#define EHOSTDOWN 112 + +#ifndef __MINGW64_VERSION_MAJOR +#define EWOULDBLOCK EAGAIN + #define ENOTSOCK 88 #define EOPNOTSUPP 95 @@ -80,10 +85,10 @@ extern int errno; /* Define extern errno, to duplicate unix behaviour */ #define ETIMEDOUT 10060 // value from pthread.h #define ECONNREFUSED 111 -#define EHOSTDOWN 112 #define EHOSTUNREACH 113 #define EALREADY 114 #define EINPROGRESS 115 +#endif #endif /********************************** WINDOWS/UNIX SPECIFIC PART ******************/ diff --git a/libretroshare/src/util/rsthreads.cc b/libretroshare/src/util/rsthreads.cc index 4012ca26f..b64411b7d 100644 --- a/libretroshare/src/util/rsthreads.cc +++ b/libretroshare/src/util/rsthreads.cc @@ -35,6 +35,10 @@ #include #endif +#if defined(WINDOWS_SYS) && defined(__MINGW64_VERSION_MAJOR) +#include // for Sleep +#endif + /******* * #define DEBUG_THREADS 1 * #define RSMUTEX_ABORT 1 // Catch wrong pthreads mode.