AsyncIO::cancel
[folly.git] / folly / portability / Sockets.cpp
index 84317bf72de19f64295ac48f8e599a910dd773b0..b5f0b7d517de83ef1e410f13362ecb2fb6111e79 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -134,7 +134,7 @@ int inet_aton(const char* cp, struct in_addr* inp) {
 }
 
 const char* inet_ntop(int af, const void* src, char* dst, socklen_t size) {
-  return ::inet_ntop(af, (char*)src, dst, size);
+  return ::inet_ntop(af, (char*)src, dst, size_t(size));
 }
 
 int listen(int s, int backlog) {
@@ -144,7 +144,7 @@ int listen(int s, int backlog) {
 int poll(struct pollfd fds[], nfds_t nfds, int timeout) {
   // TODO: Allow both file descriptors and SOCKETs in this.
   for (int i = 0; i < nfds; i++) {
-    fds[i].fd = fd_to_socket(fds[i].fd);
+    fds[i].fd = fd_to_socket((int)fds[i].fd);
   }
   return ::WSAPoll(fds, (ULONG)nfds, timeout);
 }
@@ -192,7 +192,7 @@ ssize_t recvfrom(
 
     WSABUF wBuf{};
     wBuf.buf = (CHAR*)buf;
-    wBuf.len = len;
+    wBuf.len = (ULONG)len;
     WSAMSG wMsg{};
     wMsg.dwBufferCount = 1;
     wMsg.lpBuffers = &wBuf;
@@ -256,7 +256,7 @@ ssize_t recvfrom(
   return recvfrom(s, (void*)buf, (size_t)len, flags, from, fromlen);
 }
 
-ssize_t recvmsg(int s, struct msghdr* message, int fl) {
+ssize_t recvmsg(int s, struct msghdr* message, int /* flags */) {
   SOCKET h = fd_to_socket(s);
 
   // Don't currently support the name translation.
@@ -313,7 +313,7 @@ ssize_t send(int s, const void* buf, int len, int flags) {
   return send(s, (const void*)buf, (size_t)len, flags);
 }
 
-ssize_t sendmsg(int s, const struct msghdr* message, int fl) {
+ssize_t sendmsg(int s, const struct msghdr* message, int /* flags */) {
   SOCKET h = fd_to_socket(s);
 
   // Unfortunately, WSASendMsg requires the socket to have been opened