Add workaround for Mac OS X 10.3, where the msghdr structure does not

follow the POSIX definition.
This commit is contained in:
chris_kohlhoff 2006-07-03 11:47:41 +00:00
parent 620d93da2a
commit b6bc1b49c0

View File

@ -24,6 +24,9 @@
#include <cerrno>
#include <boost/detail/workaround.hpp>
#include <new>
#if defined(__MACH__) && defined(__APPLE__)
# include <AvailabilityMacros.h>
#endif // defined(__MACH__) && defined(__APPLE__)
#include "asio/detail/pop_options.hpp"
#include "asio/error.hpp"
@ -189,7 +192,12 @@ inline int recvfrom(socket_type s, buf* bufs, size_t count, int flags,
return bytes_transferred;
#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
msghdr msg;
#if defined(__MACH__) && defined(__APPLE__) \
&& (MAC_OS_X_VERSION_MAX_ALLOWED < 1040)
msg.msg_name = reinterpret_cast<char*>(addr);
#else
msg.msg_name = addr;
#endif
msg.msg_namelen = *addrlen;
msg.msg_iov = bufs;
msg.msg_iovlen = count;
@ -246,7 +254,12 @@ inline int sendto(socket_type s, const buf* bufs, size_t count, int flags,
return bytes_transferred;
#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
msghdr msg;
#if defined(__MACH__) && defined(__APPLE__) \
&& (MAC_OS_X_VERSION_MAX_ALLOWED < 1040)
msg.msg_name = reinterpret_cast<char*>(const_cast<socket_addr_type*>(addr));
#else
msg.msg_name = const_cast<socket_addr_type*>(addr);
#endif
msg.msg_namelen = addrlen;
msg.msg_iov = const_cast<buf*>(bufs);
msg.msg_iovlen = count;