Fix wxSocket code compilation with Cygwin in 64 bits

Use __ms_u_long instead of just u_long with Cygwin to avoid mismatch
between (64 bit) Cygwin long and (still 32 bit, even in 64 bit build)
Windows API long.
This commit is contained in:
Vadim Zeitlin
2018-01-12 17:13:35 +01:00
parent a5ae0685a0
commit 1261139bcb

View File

@@ -23,6 +23,15 @@
#if defined(__CYGWIN__) #if defined(__CYGWIN__)
#include <winsock.h> #include <winsock.h>
#ifdef __LP64__
// We can't use long in this case because it is 64 bits with Cygwin, so
// use their special type used for working around this instead.
#define wxIoctlSocketArg_t __ms_u_long
#endif
#endif
#ifndef wxIoctlSocketArg_t
#define wxIoctlSocketArg_t u_long
#endif #endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -61,7 +70,7 @@ private:
// just useless) as they would be dispatched by the main thread // just useless) as they would be dispatched by the main thread
// while this blocking socket can be used from a worker one, so it // while this blocking socket can be used from a worker one, so it
// would result in data races and other unpleasantness. // would result in data races and other unpleasantness.
unsigned long trueArg = 1; wxIoctlSocketArg_t trueArg = 1;
ioctlsocket(m_fd, FIONBIO, &trueArg); ioctlsocket(m_fd, FIONBIO, &trueArg);
} }
else else