From 1261139bcbbcfd9048682cc3116e529582d1f72c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 12 Jan 2018 17:13:35 +0100 Subject: [PATCH] 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. --- include/wx/msw/private/sockmsw.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/wx/msw/private/sockmsw.h b/include/wx/msw/private/sockmsw.h index bbcad77bca..91dbbede2a 100644 --- a/include/wx/msw/private/sockmsw.h +++ b/include/wx/msw/private/sockmsw.h @@ -23,6 +23,15 @@ #if defined(__CYGWIN__) #include + #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 // ---------------------------------------------------------------------------- @@ -61,7 +70,7 @@ private: // just useless) as they would be dispatched by the main thread // while this blocking socket can be used from a worker one, so it // would result in data races and other unpleasantness. - unsigned long trueArg = 1; + wxIoctlSocketArg_t trueArg = 1; ioctlsocket(m_fd, FIONBIO, &trueArg); } else