Permalink
Browse files

Make setsockopt do (const char *) on arg 4

This used to be in compat.h for Windows only.  As it's defined as const void *,
there should be no adverse affects to always doing this.  However, the #define
in compat.h horribly borks nzmqt's usage of setsockopt() on Windows...
  • Loading branch information...
Beirdo committed Jun 13, 2012
1 parent 89106e6 commit 9639b04b152122bba7bc511782d07b2f0f837aab
@@ -31,7 +31,8 @@ BufferedSocketDevice::BufferedSocketDevice( int nSocket )
struct linger ling = {1, 1};
- if ( setsockopt(socket(), SOL_SOCKET, SO_LINGER, &ling, sizeof(ling)) < 0)
+ if ( setsockopt(socket(), SOL_SOCKET, SO_LINGER, (const char *)&ling,
+ sizeof(ling)) < 0)
LOG(VB_GENERAL, LOG_ERR,
"BufferedSocketDevice: setsockopt - SO_LINGER: " + ENO);
@@ -38,7 +38,7 @@ class MBroadcastSocketDevice : public MSocketDevice
int one = 1;
if (setsockopt(socket(), SOL_SOCKET, SO_BROADCAST,
- &one, sizeof(one)) < 0)
+ (const char *)&one, sizeof(one)) < 0)
{
LOG(VB_GENERAL, LOG_ERR, "setsockopt - SO_BROADCAST Error" + ENO);
}
@@ -51,7 +51,8 @@ class MBroadcastSocketDevice : public MSocketDevice
virtual ~MBroadcastSocketDevice()
{
int zero = 0;
- setsockopt(socket(), SOL_SOCKET, SO_BROADCAST, &zero, sizeof(zero));
+ setsockopt(socket(), SOL_SOCKET, SO_BROADCAST, (const char *)&zero,
+ sizeof(zero));
}
virtual QHostAddress address() const { return m_address; }
@@ -57,13 +57,13 @@ MMulticastSocketDevice::MMulticastSocketDevice(
m_imr.imr_interface.s_addr = htonl(INADDR_ANY);
if (setsockopt(socket(), IPPROTO_IP, IP_ADD_MEMBERSHIP,
- &m_imr, sizeof( m_imr )) < 0)
+ (const char *)&m_imr, sizeof( m_imr )) < 0)
{
LOG(VB_GENERAL, LOG_ERR, LOC + "setsockopt - IP_ADD_MEMBERSHIP " + ENO);
}
if (setsockopt(socket(), IPPROTO_IP, IP_MULTICAST_TTL,
- &ttl, sizeof(ttl)) < 0)
+ (const char *)&ttl, sizeof(ttl)) < 0)
{
LOG(VB_GENERAL, LOG_ERR, LOC + "setsockopt - IP_MULTICAST_TTL " + ENO);
}
@@ -107,7 +107,7 @@ qint64 MMulticastSocketDevice::writeBlock(
uint32_t interface_addr = (*it).toIPv4Address();
setsockopt(socket(), IPPROTO_IP, IP_MULTICAST_IF,
- &interface_addr, sizeof(interface_addr));
+ (const char *)&interface_addr, sizeof(interface_addr));
retx = MSocketDevice::writeBlock(data, len, host, port);
#if 0
LOG(VB_GENERAL, LOG_DEBUG, LOC + QString("writeBlock on %1 %2")

0 comments on commit 9639b04

Please sign in to comment.