From 8341662d1b57edc90e7bbc020319b282ca7f3ab2 Mon Sep 17 00:00:00 2001 From: Nithin Raju Date: Fri, 24 Oct 2014 08:14:52 -0700 Subject: [PATCH] netlink-socket: Fix a couple of compilation warnings. Reported-by: Gurucharan Shetty Signed-off-by: Nithin Raju Acked-by: Alin Gabriel Serdean Tested-by: Alin Gabriel Serdean [blp@nicira.com replaced conventional cast by CONST_CAST] Signed-off-by: Ben Pfaff --- lib/netlink-socket.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c index 3b77b4356..d46c8313b 100644 --- a/lib/netlink-socket.c +++ b/lib/netlink-socket.c @@ -1180,7 +1180,7 @@ nl_dump_done(struct nl_dump *dump) * the overlapped structure event associated with the pending I/O will be set */ static int -pend_io_request(const struct nl_sock *sock) +pend_io_request(struct nl_sock *sock) { struct ofpbuf request; uint64_t request_stub[128]; @@ -1229,13 +1229,14 @@ done: #endif /* _WIN32 */ /* Causes poll_block() to wake up when any of the specified 'events' (which is - * a OR'd combination of POLLIN, POLLOUT, etc.) occur on 'sock'. */ + * a OR'd combination of POLLIN, POLLOUT, etc.) occur on 'sock'. + * On Windows, 'sock' is not treated as const, and may be modified. */ void nl_sock_wait(const struct nl_sock *sock, short int events) { #ifdef _WIN32 if (sock->overlapped.Internal != STATUS_PENDING) { - pend_io_request(sock); + pend_io_request(CONST_CAST(struct nl_sock *, sock)); /* XXX: poll_wevent_wait(sock->overlapped.hEvent); */ } poll_immediate_wake(); /* XXX: temporary. */ @@ -1255,7 +1256,8 @@ int nl_sock_fd(const struct nl_sock *sock) { #ifdef _WIN32 - return sock->handle; + BUILD_ASSERT_DECL(sizeof sock->handle == sizeof(int)); + return (int)sock->handle; #else return sock->fd; #endif -- 2.20.1