Code maintenance for Qt 5:

- Fixed compile with MinGW-w64 under Windows


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6866 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-10-21 21:42:15 +00:00
parent 764a6b31ca
commit 31fd6f6261
5 changed files with 22 additions and 7 deletions

View File

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

View File

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

View File

@ -362,7 +362,7 @@ bool getLocalInterfaces(struct in_addr &routeAddr, std::list<struct in_addr> &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;

View File

@ -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 ******************/

View File

@ -35,6 +35,10 @@
#include <stdio.h>
#endif
#if defined(WINDOWS_SYS) && defined(__MINGW64_VERSION_MAJOR)
#include <windows.h> // for Sleep
#endif
/*******
* #define DEBUG_THREADS 1
* #define RSMUTEX_ABORT 1 // Catch wrong pthreads mode.