Skip to content

Commit c0c6610

Browse files
committed
make windows and older libzmq's happy
1 parent a74e951 commit c0c6610

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/zoscdump.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,20 @@ determine_socket( const char *bind)
4444
if (zrex_eq(rex, bind, "^(.+)://.*") )
4545
{
4646
const char *transport = zrex_hit(rex, 1);
47-
if ( streq(transport, "udp") )
48-
retsock = zsock_new_dgram(bind);
4947

48+
if ( streq(transport, "ipc") )
49+
retsock = zsock_new_pull( bind );
50+
#ifdef ZMQ_DGRAM
51+
else if ( streq(transport, "udp") )
52+
retsock = zsock_new_dgram(bind);
53+
#endif
54+
#ifdef ZMQ_STREAM
5055
else if ( streq(transport, "tcp") )
5156
{
5257
retsock = zsock_new(ZMQ_STREAM);
53-
zsock_bind(retsock, bind);
58+
zsock_bind(retsock, "%s", bind);
5459
}
55-
56-
else if ( streq(transport, "ipc") )
57-
retsock = zsock_new_pull( bind );
60+
#endif
5861

5962
else
6063
zsys_error("Not a valid transport in %s", transport);
@@ -70,6 +73,7 @@ determine_socket( const char *bind)
7073
return NULL;
7174
}
7275

76+
7377
void
7478
recv_dgram(zmsg_t *msg)
7579
{
@@ -173,12 +177,16 @@ main (int argc, char *argv [])
173177

174178
switch ( zsock_type(which) )
175179
{
180+
#ifdef ZMQ_DGRAM
176181
case ZMQ_DGRAM:
177182
recv_dgram(msg);
178183
break;
184+
#endif
185+
#ifdef ZMQ_STREAM
179186
case ZMQ_STREAM:
180187
recv_stream(msg);
181188
break;
189+
#endif
182190
default:
183191
zsys_error("Unsupported socket type");
184192
break;
@@ -188,11 +196,11 @@ main (int argc, char *argv [])
188196
}
189197

190198
zpoller_destroy(&poller);
191-
zsock_t *sock = zlist_first(sockets);
199+
zsock_t *sock = (zsock_t *)zlist_first(sockets);
192200
while (sock)
193201
{
194202
zsock_destroy(&sock);
195-
sock = zlist_next(sockets);
203+
sock = (zsock_t *)zlist_next(sockets);
196204
}
197205

198206
return ret;

0 commit comments

Comments
 (0)